<!--	
/*
	function isNumber(txtfld, ndigits, msg)
		txtfld:		ID of the input field
		ndigits:		No of digits it can have
		msg:			Alertive Name of the field
*/
function isNumber(txtfld, mdigits, msg)
{
	var str=txtfld.value;
	for (var i = 0; i < str.length; i++) {
		var ch = str.substring(i, i + 1);
		if (ch < "0" || "9" < ch){
			alert("\nThe " + msg + " field only accepts digits.\n\r Please re-enter " + msg + ".");
			txtfld.select();
			txtfld.focus();
			return(false);
      }
   }
   if(str.length>mdigits){
		alert("\nThe " + msg + " field shall have " + mdigits + " digits only.\n\n Please re-enter " + msg + ".");
		txtfld.select();
		txtfld.focus();
		return(false);
   }
	return(true);
}

function isYesNo(optFld,msg)
{
	if (optFld == null) {
		if (msg != "") {		
			alert("\nPlease select YES or NO for " + msg + ".\n\nIt is required.")	
		}
		return(false);
	}

	if (( !optFld[0].checked) && ( !optFld[1].checked)) {
		if (msg != "") {		
			alert("\nPlease select YES or NO for " + msg + ".\n\nIt is required.")
		}			
		return(false);
	}
	return(true);	
}

function isEmpty(txtFld,msg)
{
	var str = txtFld.value;

	// Return false if name field is blank.
	if (str == "") {
		if (msg != "") {	
			alert("\nPlease fill in " + msg + ".\n\nIt is required.")
			txtFld.focus();
		}
		return(true);
	}
	return(false);	
}	

function isName(txtFld,msg)
{
	var str = txtFld.value;
	var wasnonspace;
	// Return false if name field is blank.
	if (str == "") {
		alert("\nPlease fill in " + msg + ".\n\nIt is required.")
		txtFld.focus();
		return(false);
	}
      
	wasnonspace = false;      
	// Return false if characters are not a-z, A-Z, or a space, period(.), or dash(-).
	for (var i = 0; i < str.length; i++) 
		{
		var ch = str.substring(i, i + 1);
		if (((ch < "a" || "z" < ch) && (ch < "A" || "Z" < ch)) && ch != ' ' && ch !='.' && ch!='-') 
		{
			alert("\nThe " + msg + " field only accepts letters, spaces, periods and dashes.\n\nPlease re-enter " + msg + ".");
			txtFld.select();
			txtFld.focus();
			return(false);
         }
		if (ch != " ") {
			wasnonspace = true;
		}
      }
    if (!wasnonspace) {
		alert("\nThe " + msg + " is blank.\n\nPlease enter " + msg + ".")
		txtFld.select();
		txtFld.focus();		
		return(false);
    }
	return(true);
}

function isAddress(txtFld,msg)
{
	var str = txtFld.value;
	var wasnonspace;
	// Return false if name field is blank.
	if (str == "") {
		alert("\nPlease fill in " + msg + ".\n\nIt is required.")
		txtFld.focus();
		return(false);
	}
      
	wasnonspace = false;      
	// Return false if characters are not a-z, A-Z, 0-9 or a space, period(.), or dash(-).
	for (var i = 0; i < str.length; i++) 
		{
		var ch = str.substring(i, i + 1);
		if (((ch < "a" || "z" < ch) && (ch < "A" || "Z" < ch) && (ch < "0" || "9" < ch)) && ch != ' ' && ch !='.' && ch!='-') 
		{
			alert("\nThe " + msg + " field only accepts letters, numbers, spaces, periods and dashes.\n\nPlease re-enter " + msg + ".");
			txtFld.select();
			txtFld.focus();
			return(false);
         }
		if (ch != " ") {
			wasnonspace = true;
		}
      }
    if (!wasnonspace) {
		alert("\nThe " + msg + " is blank.\n\nPlease enter " + msg + ".")
		txtFld.select();
		txtFld.focus();		
		return(false);
    }
	return(true);
}

// Checks the txtZip field.
function isZip(txtZip,msg)
   {
   var str   = txtZip.value;

	// Return false if zip code field is blank.
	if (str == "") {
		alert("\nPlease fill in " + msg + ".\n\nIt is required.")
		txtZip.focus();
		return(false);
	}
	if (str.length != 5 && str.length != 10) {
		alert("\nPlease enter " + msg + " of 5 digits or in zip+4 format.\n\nFor example: 12345 or 12345-6789");
		txtZip.select();
		txtZip.focus();
		return(false);
	}
	// Return false if characters are not digits '0-9'.
	for (var i = 0; i < str.length; i++) 
	{
		var ch = str.substring(i, i + 1);
		if ((ch < "0" || "9" < ch) && !(ch == "-" && i == 5)) {
			alert("\nPlease enter 5 digit or zip+4 format " + msg + ".\n\nFor example: 12345 or 12345-6789");
			txtZip.select();
			txtZip.focus();
			return(false);
		}
		if ((i == 5) && (ch != "-")) {
			alert("\nPlease enter 5 digit or zip+4 format " + msg + ".\n\nFor example: 12345 or 12345-6789");
			txtZip.select();
			txtZip.focus();
			return(false);
		}		
	}
	return(true);
}	
      
// Checks for a valid 5 digit char string.
function isZip5(txtZip,msg)
   {
   var str   = txtZip.value;

	// Return false if zip code field is blank.
	if (str == "") {
		alert("\nPlease fill in " + msg + ".\n\nIt is required.")
		txtZip.focus();
		return(false);
	}
	if (str.length != 5) {
		alert("\nPlease enter " + msg + " of 5 digits.\n\nFor example: 12345");
		txtZip.select();
		txtZip.focus();
		return(false);
	}
	// Return false if characters are not digits '0-9'.
	for (var i = 0; i < str.length; i++) 
	{
		var ch = str.substring(i, i + 1);
		if ((ch < "0" || "9" < ch) && !(ch == "-" && i == 5)) {
			alert("\nPlease enter 5 digit format " + msg + ".\n\nFor example: 12345");
			txtZip.select();
			txtZip.focus();
			return(false);
		}
		if ((i == 5) && (ch != "-")) {
			alert("\nPlease enter 5 digit format " + msg + ".\n\nFor example: 12345");
			txtZip.select();
			txtZip.focus();
			return(false);
		}		
	}
	return(true);
}
      
// Checks the E-MAIL field.
function isEmail(txtFld,msg)
{

   var str   = txtFld.value;
   
	if (txtFld.value == "") {
		return(true);
	}
	// Return false if e-mail field does not contain a '@' and '.' .
   if (txtFld.value.indexOf ('@',0) == -1 || 
       txtFld.value.indexOf ('.',0) == -1)
      {
      alert("\nThe " + msg + " address entered is not in a proper format. Please re-enter or leave blank." )
      txtFld.select();
      txtFld.focus();
      return(false);
      }
   else
      {
		// Return false if characters are not a-z, A-Z, 0-9 or an @, period(.), dash(-), or underscore(_).
		for (var i = 0; i < str.length; i++) 
		{
			var ch = str.substring(i, i + 1);
			if (((ch < "a" || "z" < ch) && (ch < "A" || "Z" < ch) && (ch < "0" || "9" < ch)) && ch != '@' && ch !='.' && ch !='-' && ch!='_') 
				{
				alert("\nPlease use only letters, numbers and @.-_ for " + msg + ".");
				txtFld.select();
				txtFld.focus();
				return(false);
				}
		}	    
		return(true);
      }
}

// Checks the NUMBER field.
function isDecimalNum(txtFld,msg) 
   {
   var str = txtFld.value;
   // Return false if number field is blank.
   if (str == "")
         {
         alert("\nThe " + msg + " field is blank.\n\nPlease enter a decimal number.");
         txtFld.focus();
         return false;
         }
   // Return false if characters are not '0-9' or '.' . 
   for (var i = 0; i < str.length; i++) 
      {
      var ch = str.substring(i, i + 1);
      if ((ch < "0" || "9" < ch) && ch != '.') 
         {
         alert("\nThe " + msg + " field accepts only numbers and a decimal point. \n\nPlease re-enter a decimal number.");
         txtFld.select();
         txtFld.focus();
         return false;
         }
      }
   return true;
   }
   
// sets the Phone field with formatted phone number
function setPhone(txtFld,msg){
	var str=txtFld.value;
	var newstr="";
	var i;
	var ch;
	for(i=0;i<str.length;i++){
		ch=str.substring(i,i+1);
		if(! (ch < "0" || ch > "9")) newstr=newstr + ch;
		}
	if(newstr.length!=10){
         alert("\nThe " + msg + " field is not in proper format(" + newstr.length + ").\n\nPlease enter the phone number again.");
         txtFld.focus();
         return false;
		}
	str = newstr.substring(0,3)+"-"+newstr.substring(3,6)+"-"+newstr.substring(6,10)
	txtFld.value = str;
	return true;
}

// Checks the Phone field.
function isPhone(txtFld,msg,Required) 
   {
   var str = txtFld.value;
   // Return false if number field is blank.
   if (Required==true && str == "")
         {
         alert("\nThe " + msg + " field is blank.\n\nPlease enter a phone number.");
         txtFld.focus();
         return false;
         }
   // Return false if characters are not '0-9' or '-' or '(' or ')'. 
   for (var i = 0; i < str.length; i++) 
      {
      var ch = str.substring(i, i + 1);
      if ((ch < "0" || "9" < ch) && ch != '-' && ch != '(' && ch != ')' && ch != ' ') 
         {
         alert("\nThe " + msg + " field accepts only numbers and the characters () or -. \n\nPlease re-enter a valid phone number.");
         txtFld.select();
         txtFld.focus();
         return false;
         }
      }
   return true;
   }
   
// Checks the PHONE NUMBER field.
function isPhoneNumber(txtArea,txtExch,txtLine)
   {
   var str = txtArea.value;
   var str1 = txtExch.value;
   var str2 = txtLine.value;
   // Return false if area code field is blank.
   if (str == "")
      {
      alert("\nThe AREA CODE field of your phone number is blank.\n\nPlease enter your area code.")
      txtArea.focus();
      return false;
      }
   if (str.length != 3)
      {
      alert("\nThe AREA CODE requires three digits.\n\nPlease re-enter your area code.")
      txtArea.select();
      txtArea.focus();
      return false;
      }
   // Return false if characters are not digits '0-9'.
   for (var i = 0; i < str.length; i++) 
      {
      var ch = str.substring(i, i + 1);
      if (ch < "0" || "9" < ch)
         {
         alert("\nThe AREA CODE field only accepts digits '0-9'.\n\nPlease re-enter your area code.");
         txtArea.select();
         txtArea.focus();
         return false;
         }
      }
   // Return false if phone prefix field is blank.
   if (str1 == "")
      {
      alert("\nThe PREFIX field of your phone number is blank.\n\nPlease enter your phone prefix.")
      txtExch.focus();
      return false;
      }
   if (str1.length != 3)
      {
      alert("\nThe PREFIX field of your phone number requires three digits.\n\nPlease re-enter your phone prefix.")
      txtExch.select();
      txtExch.focus();
      return false;
      }
   // Return false if characters are digits '0-9'.
   for (var i = 0; i < str1.length; i++) 
      {
      var ch = str1.substring(i, i + 1);
      if (ch < "0" || "9" < ch)
         {
         alert("\nThe PREFIX field only accepts digits '0-9'.\n\nPlease re-enter your phone prefix.");
         txtExch.select();
         txtExch.focus();
         return false;
         }
      }
   // Return false if phone number field is blank.
   if (str2 == "")
      {
      alert("\nThe PHONE NUMBER field of your phone number is blank.\n\nPlease enter your phone number.")
      txtLine.focus();
      return false;
      }
   if (str2.length != 4)
      {
      alert("\nThe PHONE NUMBER field requires four digits.\n\nPlease re-enter your phone number.")
      txtLine.select();
      txtLine.focus();
      return false;
      }
   // Return false if characters are not digits '0-9'.
   for (var i = 0; i < str2.length; i++) 
      {
      var ch = str2.substring(i, i + 1);
      if (ch < "0" || "9" < ch)
         {
         alert("\nThe phone number field only accepts digits '0-9'.\n\nPlease re-enter your phone number.");
         txtLine.select();
         txtLine.focus();
         return false;
         }
      }
   return true;   
   }

// Checks the MemberID field.
function isMemberID(txtFld,msg) 
   {
   var str = txtFld.value;
   
   if (str.length < 12)
         {
         alert("\nThe " + msg + " field is not complete.\n\nPlease enter your full Member ID as it appears on your membership card including club code and excluding space, dashes or letters.");
         txtFld.focus();
         return false;
         }

   // Return false if characters are not '0-9'. 
   for (var i = 0; i < str.length; i++) 
      {
      var ch = str.substring(i, i + 1);
      if (ch < "0" || "9" < ch)
         {
         alert("\nThe " + msg + " field accepts only digits. \n\nPlease re-enter the Member ID consisting only of digits.");
         txtFld.select();
         txtFld.focus();
         return false;
         }
      }
   return true;
   }

function isAlphaNumeric(txtFld,msg)  {
	var valid = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
	var ln=txtFld.value.length; 
	if (ln>0) {
		var temp;
		for (var x=0; x<ln; x++) { 
			temp = txtFld.value.substring(x, x+1); 
			if (valid.indexOf(temp)== "-1") { 
				alert("\nThe " + msg + " field accepts only digits or alphabet characters. \n\nPlease re-enter the " + msg + " consisting only of digits and/or alphabet characters.");
				txtFld.select();
				txtFld.focus();
				return false; 
			};
		}; 
		return true; 
	};  
};

//checks that at least one check box is selected
function isChecked(myentry) {
 	var isValid=false;
 	var boxes=myentry.length;
	for (var i=0; i<boxes; i++) {
		if (myentry[i].checked) {
			isValid=true;
		};
	};
 	if (isValid==false) { 
  		return false; 
 	} else { 
   		return true; 		
 	}; 
}; 

//returns the number of checkboxes checked
function numChecked(myentry) {
 	var checked = 0;
 	var boxes=myentry.length;
	for (var i=0; i<boxes; i++) {
		if (myentry[i].checked) {
			checked=checked + 1;
		};
	};
	return checked; 		
}; 

//checks that at least one radio is selected
function isRadioSelected(myentry) {
 	var isValid=false;
 	var boxes=myentry.length;
	for (var i=0; i<boxes; i++) {
		if (myentry[i].selected) {
			isValid=true;
		};
	};
 	if (isValid==false) { 
  		return false; 
 	} else { 
   		return true; 		
 	}; 
}; 

/*  ================================================================
    FUNCTION:  isCreditCard(st)
 
    INPUT:     st - a string representing a credit card number

    RETURNS:  true, if the credit card number passes the Luhn Mod-10
		    test.
	      false, otherwise
    ================================================================ */

function isCreditCard(st) {

  // Encoding only works on cards with less than 19 digits
  if ((st.length > 19) || (st.length < 13))
    return (false);

  sum = 0; mul = 1; l = st.length;
  for (i = 0; i < l; i++) {
    digit = st.substring(l-i-1,l-i);
    tproduct = parseInt(digit ,10)*mul;
    if (tproduct >= 10)
      sum += (tproduct % 10) + 1;
    else
      sum += tproduct;
    if (mul == 1)
      mul++;
    else
      mul--;
  }

  if ((sum % 10) == 0) {  
    return (true);
  }
  else
    return (false);

} // END FUNCTION isCreditCard()
   
// Checks the Credit Card Number
function isCreditCardNumber(txtFld,msg)
	{
	var str = txtFld.value;
	// Return false if Credit Card Number is blank.
	if (str == "")
		{
         alert("\nThe " + msg + " field is blank.\n\nPlease enter the Credit Card Number.");
         txtFld.focus();
         return false;
         }
   for (var i = 0; i < str.length; i++) 
      {
      var ch = str.substring(i, i + 1);
      if (ch < "0" || "9" < ch) 
         {
         alert("\nThe " + msg + " field accepts only digits. \n\nPlease re-enter the Credit Card Number.");
         txtFld.select();
         txtFld.focus();
         return false;
         }
      }
	if( str.length < 13 || str.length > 19){
			alert("Credit card number must be a string of digits between 13 and 19 characters.  \n\nPlease re-enter the Credit Card Number.")
			txtFld.select();
			txtFld.focus();
			return false;
			}
	return true;
}

// Checks the Credit Card Exp Date
function isExpMonth(monthFld,yearFld,msg)
	{
	if(monthFld.options[monthFld.selectedIndex].value=="" || yearFld.options[yearFld.selectedIndex].value==""){
		alert("\nThe " + msg + " fields need to be entered");
		monthFld.focus();
		return (false);
		}
	var intMM = parseInt(monthFld.options[monthFld.selectedIndex].value);
	var intYYYY = parseInt(yearFld.options[yearFld.selectedIndex].value);
	var dtToday = new Date();
	if(intMM<1 || intMM > 12 || intYYYY < dtToday.getFullYear()){
		alert("\nThe " + msg + " contains invalid date values.\n\nPlease re-enter the values.");
		monthFld.focus();
		return (false);
		}
	if(intYYYY==dtToday.getFullYear() && (intMM - 1) < dtToday.getMonth()){
		alert("\nThe " + msg + " contains expired date values.\n\nPlease re-enter the values.");
		monthFld.focus();
		return (false);
		}
	return (true);
}
// Checks the Date whether it is valid or not
function isValidDate(txtFld, msg){
	var str=txtFld.value
// Checks for the following valid date formats:
// MM/DD/YY   MM/DD/YYYY   MM-DD-YY   MM-DD-YYYY
// Also separates date into month, day, and year variables
	var datePat = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{4})$/;

	var matchArray = str.match(datePat); // is the format ok?
	if (matchArray == null) {
		alert("The Date value in " + msg + " is not in a valid format.\nPlease use the format mm/dd/yyyy.")
		txtFld.select();
		txtFld.focus();
		return false;
	}
	var month = matchArray[1]; // parse date into variables
	var day = matchArray[3];
	var year = matchArray[4];
	if (month < 1 || month > 12) { // check month range
		alert("The Month in " + msg + " must be between 1 and 12.");
		txtFld.select();
		txtFld.focus();
		return false;
	}
	if (day < 1 || day > 31) {
		alert("The Day in " + msg + " must be between 1 and 31.");
		txtFld.select();
		txtFld.focus();
		return false;
	}
	if ((month==4 || month==6 || month==9 || month==11) && day==31) {
		alert("Month "+month+" doesn't have 31 days!")
		txtFld.select();
		txtFld.focus();
		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!");
			txtFld.select();
			txtFld.focus();
			return false;
		}
	}
	return true;
}

// Checks the Date of Birth given in the format of mm/dd/yyyy
function isValidDateOfBirth(txtFld,msg){
	var str=txtFld.value
// Checks for the following valid date formats:
// MM/DD/YY   MM/DD/YYYY   MM-DD-YY   MM-DD-YYYY
// Also separates date into month, day, and year variables
	var datePat = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{4})$/;

	var matchArray = str.match(datePat); // is the format ok?
	if (matchArray == null) {
		alert("The Date value in " + msg + " is not in a valid format.")
		txtFld.select();
		txtFld.focus();
		return false;
	}
	var month = matchArray[1]; // parse date into variables
	var day = matchArray[3];
	var year = matchArray[4];
	if (month < 1 || month > 12) { // check month range
		alert("The Month in " + msg + " must be between 1 and 12.");
		txtFld.select();
		txtFld.focus();
		return false;
	}
	if (day < 1 || day > 31) {
		alert("The Day in " + msg + " must be between 1 and 31.");
		txtFld.select();
		txtFld.focus();
		return false;
	}
	if ((month==4 || month==6 || month==9 || month==11) && day==31) {
		alert("Month "+month+" doesn't have 31 days!")
		txtFld.select();
		txtFld.focus();
		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!");
			txtFld.select();
			txtFld.focus();
			return false;
		}
	}
	var dtToday = new Date();
	var dtToday = new Date(dtToday.getFullYear(),dtToday.getMonth(),dtToday.getDate())
	var dtGiven = new Date(year,month-1,day);
	
	var strMoToday = "0" + dtToday.getMonth().toString();
	var strDyToday = "0" + dtToday.getDate().toString();

	var strMoGiven = "0" + dtGiven.getMonth().toString();
	var strDyGiven = "0" + dtGiven.getDate().toString();

	var strdtGiven = dtGiven.getFullYear() + strMoGiven.substring(strMoGiven.length-2) + strDyGiven.substring(strDyGiven.length-2);
	var strdtToday = dtToday.getFullYear() + strMoToday.substring(strMoToday.length-2) + strDyToday.substring(strDyToday.length-2);

	// compare date strings to get around Nav 4.0 y2k problems
	if (strdtGiven > strdtToday){
		alert(msg + " cannot be a future date");
		txtFld.select();
		txtFld.focus();
		return false;
	}
	if (year < 1880){
		alert(msg + " invalid date of birth");
		txtFld.select();
		txtFld.focus();
		return false;
	}	
	return true;  // date is valid
}

//Checks whether the select box item is selected of other than the first
function isSelected(selectFld,msg){
	if(selectFld.selectedIndex<=0){
		alert("Select value for " + msg);
		selectFld.focus();
		return (false);
	}
	return true;
}

//Checks whether the two dates given are in chronological order i.e fdate<sdate
function areDatesInOrder(fdate,sdate,fmsg,smsg){
	var fd = new Date(fdate.value);
	var sd = new Date(sdate.value);
	var d,m,y;
	var strf;
	var strs;
	d = fd.getDate();
	m = fd.getMonth();
	y = fd.getFullYear();
	strf = "" + y;
	if(m<10)strf=strf + "0" + m; else strf = strf + m;
	if(d<10)strf=strf + "0" + d; else strf = strf + d;

	d = sd.getDate();
	m = sd.getMonth();
	y = sd.getFullYear();
	strs = "" + y;
	if(m<10)strs=strs + "0" + m; else strs = strs + m;
	if(d<10)strs=strs + "0" + d; else strs = strs + d;
	if(strf > strs){
		alert(fmsg + " is later than " + smsg);
		fdate.select();
		fdate.focus();
		return(false);
	}
	return(true);
}

//Checks whether the number given is currency with two or less number of decimal places
function isCurrency(txtfld,msg){
	var strfld = txtfld.value;
	var strlcl = "";
	var ch;
	var bdec = false;
   for (var i = 0; i < strfld.length; i++){
		ch = strfld.substring(i,i+1);
		if(ch>="0" && ch<="9"){ strlcl = strlcl + ch;}
		else if(ch=="." && bdec==false){
				strlcl=strlcl + ch;
				bdec==true;
			}
		else{
			alert(msg + " has invalid characters.  Rectify and Try again.");
			txtfld.select();
			txtfld.focus();
			return(false);
		}
	}
	if(strlcl.indexOf(".")>=0 && strlcl.indexOf(".")<(strlcl.length-1)){
		var strdec = strlcl.substring(strlcl.indexOf(".")+1,strlcl.length);
		if(strdec.length>2){
			alert(msg + " Currency can be upto two decimals only.");
			txtfld.select();
			txtfld.focus();
			return(false);
		}
	}
	return(true);	
}

function checkedBoxes(myentry) {
 	var isValid=false;
 	var boxes=myentry.length;
	var count=0;
	for (var i=0; i<boxes; i++) {
		if (myentry[i].checked) {
			count=count+1;
		};
	};
	return count;
}; 

function numSelected(myentry) {
 	var isValid=false;
 	var boxes=myentry.length;
	var count=0;
	for (var i=0; i<boxes; i++) {
		if (myentry[i].selected) {
			count=count+1;
		};
	};
	return count;
}; 

//-->
	