Javascript Image Validation

Image Validation using JavaScript.


function isValidImage(imagename)
{
imagefile_value = imagename;
var checking = imagefile_value.toLowerCase();
if (!checking.match(/(\.jpg|\.gif|\.png|\.JPG|\.GIF|\.PNG|\.jpeg|\.JPEG)$/))
{
return false;
}
else
{
return true;
}
}