Well never mind, I got the solution from here
http://www.aspsnippets.com/Articles/Issue-JavaScript-in-WebUserControl-not-working-when-used-multiple-times-on-same-page.aspx
I just needed to register the script with some unique ID.
solved CSS not applying on multiple instances of a custom control