//------- Valid Email Check --------------
function isValidEmail(emailval)
	{
	//var emailPat =  /^(([a-z]|[A-Z]|[\d]|\_|\.)+)(@)(([a-z]|[A-Z]|[\d])+)(.)(([a-z]|[A-Z]|[\d])+)$/
	//var matchArray = emailval.match(emailPat); // is the format ok?
		//if(matchArray == null) 
		//{alert("Email is not in a valid format.");
		//return false;
		//}
		return true;
	}
//------- Valid  Check --------------

function isNumeric(val){
var numPat = /(\d{1,8})+/;
var matchArray = val.match(numPat);
	if (matchArray == null) {
			alert("Please Enter a numeric value only .");
			return false;
		}
}
//--- Numeric check over 

//function isPassword(val1,val2){
//var lenStat
//	val1 = val1.toString() ; val1 = val1.toLowerCase();
//	val2 = val2.toString() ; val2 = val2.toLowerCase();
//	
//	if (val1 == "") {alert("Please enter your password");chkStatus = 0;return false;}
//	if (passwordLen(val1) == false) {alert("Length Of Password should be between 6-20.");chkStatus=0;return false;};
//	if (val2 == "") {alert("Please Re-Enter your password");chkStatus = 1;return false;}
//	if (val1 == val2) {chkStatus = 5;} else {alert(" Please confirm your password. Re-enter your password.");chkStatus = 2;return false;} // end if
//	return true;
//}
//--- Password Check Over

function passwordLen(val){
	var pwdLenPat = /^(\w{6,20})$/;
var matchArray = val.match(pwdLenPat);
	if (matchArray == null) 
	{return false;}
	return true;
}
//--- Password length should be between 6-20 chars.

//----------Clearing Form Fields ------->
function clearFields() 
{for (var j =0;j<document.forms.length;j++){document.forms(j).reset();}}//-- end of function

//------------------>
function isValidDate(dateStr) {
	var datePat = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{4})$/;
	var matchArray = dateStr.match(datePat); // is the format ok?
		if (matchArray == null) {
			alert("Date is not in a valid format.<USAGE>: mm/dd/yyyy")
			return false;
		}
		 // parse date into variables
		month = matchArray[1];	day = matchArray[3];	year = matchArray[4];
		
		if (month < 1 || month > 12) 
		{alert("Month must be between 1 and 12.");return false;	}
		
		if (day < 1 || day > 31) 
		{alert("Day must be between 1 and 31.");	return false;}
		
		if ((month==4 || month==6 || month==9 || month==11) && day==31) 
		{alert("Month "+month+" doesn't have 31 days!");return false;}
		
		if (month == 2) { // check for february 29th
			var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
				if (day>29 || (day==29 && !isleap)) {
					alert("February " + year + " doesn't have " + day + " days!");
					return false;
				}
			}
	return true;
}      
//------------------>
