
﻿function emailValidator(elem, helperMsg)
 {
    var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	if(elem.value.length != 0)
	{
	   if(! elem.value.match(emailExp))
	   {
	        alert(helperMsg);
	        elem.focus();
	        return false;
	   }
	}
	return true;
 }
 
extArray = new Array(".gif", ".jpg", ".png");

function LimitAttach(form, file) {
	allowSubmit = false;
	if (!file) return true;
	while (file.indexOf("\\") != -1)
	file = file.slice(file.indexOf("\\") + 1);
	ext = file.slice(file.indexOf(".")).toLowerCase();
	for (var i = 0; i < extArray.length; i++) {
	if (extArray[i] == ext) { allowSubmit = true; break; }
	}
	if (allowSubmit) form.submit();
	else
	{
	alert("Please only upload files that end in types:  " 
	+ (extArray.join("  ")) + "\nPlease select a new "
	+ "file to upload and submit again.");
	return false;
    }
    return true
}
	
function msg(message)
    {
		if(confirm(message))
		{
		   return true;
		}
		else
		{
		   return false;
		}
     }
