function Isempty(s){var regexpWhitespace=/^\s+$/;return((s==null)||(s.length==0)||regexpWhitespace.test(s))}function IsAlphaNum(s){var validChars=/^[\w\s]+$/;return validChars.test(s)}function IsAlpha(s){var regexpAlphabetic=/^[a-zA-Z\s]+$/;return regexpAlphabetic.test(s)}function IsDate(s){var testDate=new Date(s);return !isNaN(testDate)}function IsEmail(s){var regexpEmail=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;return regexpEmail.test(s)}function IsInteger(s){var regexp=/^[+]?\d+$/;return regexp.test(s)}function IsNumeric(s){var regexp=/^\d+$/;return regexp.test(s)}function IsFloat(s){return !isNaN(parseFloat(s))}function validateform(arr){for(i=0;i<arr.length;i++){var control=window.document.getElementById(arr[i][0]);switch(arr[i][1]){case"Required":if(Isempty(control.value)){alert(arr[i][3]+" is required.");control.focus();return false}break}if(!Isempty(control.value)){switch(arr[i][2]){case"Alpha":if(!IsAlpha(control.value)){alert(arr[i][3]+" should be alphabatic.");control.focus();return false}break;case"AlphaNum":if(!IsAlphaNum(control.value)){alert(arr[i][3]+" should be alphanumeric.");control.focus();return false}break;case"Numeric":if(!IsNumeric(control.value)){alert(arr[i][3]+" should be numeric.");control.focus();return false}break;case"Email":if(!IsEmail(control.value)){alert(arr[i][3]+" is not valid.");control.focus();return false}break;case"Integer":if(!IsInteger(control.value)){alert(arr[i][3]+" is not valid amount.");control.focus();return false}break;case"Float":if(!IsFloat(control.value)){alert(arr[i][3]+" is not valid amount.");control.focus();return false}break}}}}function CheckImg(control){var i=0;imgpath=window.document.getElementById(control).value;imgpathstr=new String(imgpath);splitString=imgpathstr.split("\\");imgpathstr1=new String(splitString[splitString.length-1]);dotindex=imgpathstr1.lastIndexOf(".");imagename=new String(imgpathstr1.substring(0,dotindex));imageext=new String(imgpathstr1.substring(dotindex+1,imgpathstr1.length));imageext=imageext.toUpperCase();if(imageext=="JPG"||imageext=="GIF"||imageext=="JPEG"){return true}else{alert("Upload (Jpeg or Gif) image only");return false}};
