Was looking for javascript extension detection
Never mind. While posting for help, I narrowed down my thoughts and did a search on the web and found a solution.. I am posting just in case someone else needs it.
if( !imagename.match(/.(jpg)|(gif)|(png)|(bmp)|(jpeg)$/) ){
alert("wrong extension! Only jpg, gif, png, bmp or jpeg can be set as main image.");
return;
}
Thanks anyway.