hey Rifz, just taking a look at your script... you've made a couple of conceptual errors and you do repeat the same pieces of code multiple times but considering you are obviously new to MEL it's a really good start (and a useful idea for a script tool too which is sometimes more important!)
here's a couple of tips/pointers.
distribution/setup: always save your scripts as .MEL files, and instruct your users to simply place the script file in one of their scripts\ folders. If you call your main global procedure the SAME name as the .mel file maya will automatically find it and run it when the user types the proc name.
Execution: Never paste procs code into a shelf button or hotkey, in fact even entering procs into the script editor is not a good idea unless you are completely familiar with local/global scope and how it works.
local/global proc scope: ALWAYS put your main global proc at the END of your script file and all the local procs it calls ABOVE it.
UI controls: if you want a button, slider or other control to call a function it MUST be a global proc.
use procs wisely: If you have a proc that only has 1 line or 1 command it's probably not worth having as a proc, just put the command in whatever calls it.
use procs wisely pII: If, in your script, you find yourself writing more than 3-4 lines of code that you have already written before, even if some variable value within them is different, you should consider making that code into a procedure and call that instead.
Think before uploading If you upload a script that is partially broken or works only within a very small area of operation, even if you plan to update it later, most people will get annoyed with it not working and stop using or delete it. They are then very unlikely to go back to the same script if there's a newer version. delaying release until something is stable/fully working may be hard but you'll have far happier users (and cop less flak!)
credit where credit's due: it's great (and very flattering) that you thank me, Joojaa and Daniel in your script header, but NOWHERE in your script do you credit YOURSELF!!! and it's your own work!
I have simplified these somewhat (I don't want to confuse you with too many complications) so while some of the above tips are slightly more complex and detailed that I've let on, in general you'd do best to just follow them as is until you're more familiar with MEL.
most importantly, keep at it though and if in doubt - ask!
:nathaN