/*	 
	 #############################################################################
     # Function Name: ValidateLogin()
     # Created By: Siddharth Thakar
     # Created on: 18  Sep 2007
     # Purpose: Function to validate the login funciton.    
     # ON SUCCESS: Returns TRUE if validated.     
     # ON FAILURE: Returns FLASE  if not validated.
	 # USED BY : includes/right_nav.php
     #############################################################################
*/	 

	 function ValidateLogin()
	 {
		 var frm =document.frmLogin;	
		 if (isBlank(frm.txtEmail.value))
		 {
			alert("Please enter your Email ID");
			frm.txtEmail.focus();
			return false;
		 }
		 if (!(isValidEmail(frm.txtEmail.value)))
		{
			alert("Please enter valid Email Address");
			frm.txtEmail.focus();
			return false;	
		}
		 if (isBlank(frm.txtPassword.value))
		 {
			alert("Please enter your Password");
			frm.txtPassword.focus();
			return false;
		 }
	 }
	
	function clearPwdForm(){
		document.getElementsByName("txtEmailId")[0].value="";
		document.getElementsByName("pd_dob_day")[0].selectedIndex = -1;
		document.getElementsByName("pd_dob_month")[0].selectedIndex = -1;
		document.getElementsByName("pd_dob_year")[0].selectedIndex = -1;
	}

	function clearLoginForm(){
		document.getElementsByName("txtEmail")[0].value="";
		document.getElementsByName("txtPassword")[0].value="";
	}

	 function validatePwd()
	 {
		 var frm =document.frmForgotPwd;	
		 if (isBlank(frm.txtEmailId.value))
		 {
			alert("Please enter your Email ID");
			frm.txtEmailId.focus();
			return false;
		 }
		 if (!(isValidEmail(frm.txtEmailId.value)))
		{
			alert("Please enter valid Email Address");
			frm.txtEmailId.focus();
			return false;	
		}
		 if(isBlank(frm.pd_dob_day.value))
		{
			alert('Please enter yout Date of Birth');
			frm.pd_dob_day.focus();
			return false;
		}

		if(isBlank(frm.pd_dob_year.value))
		{
			alert('Please enter yout Date of Birth');
			frm.pd_dob_year.focus();
			return false;
		}

		if(isBlank(frm.pd_dob_month.value))
		{
			alert('Please enter yout Date of Birth');
			frm.pd_dob_month.focus();
			return false;
		}
		var DtStr = frm.pd_dob_day.value + "-" + frm.pd_dob_month.selectedIndex + "-" + frm.pd_dob_year.value;
		if(!isValidDate(DtStr))
		{
			alert("Please enter a valid date");
			frm.pd_dob_month.focus();
			return false;
		}
		 document.frmForgotPwd.submit();
	 }




	/*	 
	 #############################################################################
     # Function Name: ValidateRegistration()
     # Created By: Pushpendra Kumar
     # Created on: 8  Sep 2009
     # Purpose: Function to validate the registration page.    
     # ON SUCCESS: Returns TRUE if validated.     
     # ON FAILURE: Returns FLASE  if not validated.     
	 # USED BY : register.php
     #############################################################################
*/	 

  function ValidateRegistration()
	 {
		 var frm =document.frmRegister;	
		
		 if (isBlank(frm.txtFirstName.value))
		 {
			alert("Please enter First Name");
			frm.txtFirstName.focus();
			return false;
		 }
		 if (!(IsAlpha(frm.txtFirstName.value)))
		 {
			alert("Please enter Valid First Name");
			frm.txtFirstName.focus();
			return false;
		 }
		 if (isBlank(frm.txtLastName.value))
		 {
			alert("Please enter Last Name");
			frm.txtLastName.focus();
			return false;
		 }
		 if (!(IsAlpha(frm.txtLastName.value)))
		 {
			alert("Please enter valid Last Name");
			frm.txtLastName.focus();
			return false;
		 }
		 if (isBlank(frm.txtEmailId.value))
		 {
			alert("Please enter Email Address");
			frm.txtEmailId.focus();
			return false;
		 }
		if (!(isValidEmail(frm.txtEmailId.value)))
		{
			alert("Please enter valid Email Address");
			frm.txtEmailId.focus();
			return false;	
		}
		if (isBlank(frm.txtConfirmEmailId.value))
		 {
			alert("Please enter the confirmation Email Address");
			frm.txtConfirmEmailId.focus();
			return false;
		 }
		if (!(frm.txtConfirmEmailId.value == frm.txtEmailId.value))
		{
			alert("Please enter the same Email Address as entered above.");
			frm.txtConfirmEmailId.focus();
			return false;	
		}
		if (isBlank(frm.txtPassword.value))
		 {
			alert("Please enter the Password");
			frm.txtPassword.focus();
			return false;
		}
		if ((frm.txtPassword.value).length <6 )
		 {
			alert("Password should be atleast 6 characters long.");
			frm.txtPassword.focus();
			return false;
		 }
		 
		if (isBlank(frm.txtConfirmPassword.value))
		 {
			alert("Please enter the confirmation Password");
			frm.txtConfirmPassword.focus();
			return false;
		 }
		if (!(frm.txtConfirmPassword.value == frm.txtPassword.value))
		{
			alert("Please enter the same Password as entered above.");
			frm.txtConfirmPassword.focus();
			return false;	
		}
		 if (isBlank(frm.txtAddr1.value))
		 {
			alert("Please enter Address 1");
			frm.txtAddr1.focus();
			return false;
		 }	
		 if (isBlank(frm.txtCity.value))
		 {
			alert("Please enter a City");
			frm.txtCity.focus();
			return false;
		 }	
		if (!(IsAlpha(frm.txtCity.value)))
		 {
			alert("Please enter Valid City Name");
			frm.txtCity.focus();
			return false;
		 }
		 if (isBlank(frm.txtZip.value))
		 {
			alert("Please enter Zip Code");
			frm.txtZip.focus();
			return false;
		 }
		 if (!isValidNumber(frm.txtZip.value))
		 {
			alert("Please enter a valid zip code");
			frm.txtZip.focus();
			return false;
		 }
		if ((frm.txtZip.value).length != 5)
		 {
			alert("Zip Code should be of 5 digit");
			frm.txtZip.focus();
			return false;
		 }
		 if (isBlank(frm.lsCountry.value))
		 {
			alert("Please select country");
			frm.lsCountry.focus();
			return false;
		 }

		 if (isBlank(frm.stateName.value))
		 {
			  var countryName = frm.lsCountry.value;
			  if (countryName == "US")
			  {
				alert("Please select State");
				frm.stateName.focus();
				return false;
			  }
		 }
		if(isBlank(frm.pd_dob_month.value))
		{
			alert('Please enter yout Date of Birth');
			document.forms[0].pd_dob_month.focus();
			return false;
		}
		 if(isBlank(frm.pd_dob_day.value))
		{
			alert('Please enter yout Date of Birth');
			document.forms[0].pd_dob_day.focus();
			return false;
		}

		if(isBlank(frm.pd_dob_year.value))
		{
			alert('Please enter yout Date of Birth');
			document.forms[0].pd_dob_year.focus();
			return false;
		}

		
		var DtStr = frm.pd_dob_day.value + "-" + frm.pd_dob_month.selectedIndex + "-" + frm.pd_dob_year.value;
		if(!isValidDate(DtStr))
		{
			alert("Please enter a valid date");
			document.forms[0].pd_dob_month.focus();
			return false;
		}
		
		if((frm.pd_dob_day.value != '') && (frm.pd_dob_month.value != '') && (frm.pd_dob_year.value != ''))
		{
			var currentTime = new Date();
			var date = currentTime.getDate();
			var month = currentTime.getMonth()+1;
			var fullyear = currentTime.getFullYear();
			var datediff = date - frm.pd_dob_day.value;
			var monthdiff = month - frm.pd_dob_month.value;
			var yeardiff = fullyear - frm.pd_dob_year.value;

			if (datediff < 0 || monthdiff < 0)
				yeardiff--;
			if(frm.stateName.value == 'ME')
			{
				if (yeardiff < 18)
				{
					setCookie("age18Cookie","1",2);
					alert("We're sorry but we can't accept your messages or personal information because you do not meet our eligibility requirements.\n But that doesn't mean you can't explore the rest of our site and learn more about us!");
					return false;
				}
			}	
			else
			{
				if (yeardiff < 13)
				{
						alert("We're sorry but we can't accept your messages or personal information because you do not meet our eligibility requirements.\n But that doesn't mean you can't explore the rest of our site and learn more about us!");
						return false;
				}
					
			}
		}
		var day = getCookie('age18Cookie');
	  if(frm.stateName.value == 'ME'){
	    if(day!='')
		{			
			alert("We're sorry but we can't accept your messages or personal information because you do not meet our eligibility requirements.\n But that doesn't mean you can't explore the rest of our site and learn more about us!");
						return false;
		}
	  }
	 }
	



	
	/*	 
	 #############################################################################
     # Function Name: ValidateUpdateProfile()
     # Created By: Siddharth Thakar
     # Created on: 18  Sep 2007
     # Purpose: Function to validate the update profile page.    
     # ON SUCCESS: Returns TRUE if validated.     
     # ON FAILURE: Returns FLASE  if not validated.     
	 # USED BY : register_update.php
     #############################################################################
*/ 
	 function ValidateUpdateProfile()
	  {
		 var frm =document.frmRegister;	
		 
		 if (isBlank(frm.txtFirstName.value))
		 {
			alert("Please enter First Name");
			frm.txtFirstName.focus();
			return false;
		 }
		 if (!(IsAlpha(frm.txtFirstName.value)))
		 {
			alert("Please enter Valid First Name");
			frm.txtFirstName.focus();
			return false;
		 }
		 if (isBlank(frm.txtLastName.value))
		 {
			alert("Please enter Last Name");
			frm.txtLastName.focus();
			return false;
		 }
		 if (!(IsAlpha(frm.txtLastName.value)))
		 {
			alert("Please enter valid Last Name");
			frm.txtLastName.focus();
			return false;
		 }
		 if (isBlank(frm.txtAddress1.value))
		 {
			alert("Please enter Address 1");
			frm.txtAddress1.focus();
			return false;
		 }	
		 if (isBlank(frm.lsCountry.value))
		 {
			alert("Please select country");
			frm.lsCountry.focus();
			return false;
		 }
	 }
	 
	 /*	 
	 #############################################################################
     # Function Name: ValidateFeedback()
     # Created By: Siddharth Thakar
     # Created on: 21 Sep 2007
     # Purpose: Function to validate the Feedback and Enquiry page.    
     # ON SUCCESS: Returns TRUE if validated.     
     # ON FAILURE: Returns FLASE  if not validated. 
	 # USED BY : feedback_enquiries.php
     #############################################################################
*/ 
	 function ValidateFeedback()
	  {
		var frm =document.frmFeedback;	
		if (isBlank(frm.txtFirstName.value))
		{
			alert("Please enter First Name");
			frm.txtFirstName.focus();
			return false;
		}
		if (!(IsAlpha(frm.txtFirstName.value)))
		{
			alert("Please enter valid First Name");
			frm.txtFirstName.focus();
			return false;
		}
		if (isBlank(frm.txtLastName.value))
		{
			alert("Please enter Last Name");
			frm.txtLastName.focus();
			return false;
		}
		if (!(IsAlpha(frm.txtLastName.value)))
		{
			alert("Please enter valid Last Name");
			frm.txtLastName.focus();
			return false;
		}
		if (isBlank(frm.txtEmailId.value))
		{
			alert("Please enter Email Id");
			frm.txtEmailId.focus();
			return false;
		}
		if (!(isValidEmail(frm.txtEmailId.value)))
		{
			alert("Please enter valid your Email");
			frm.txtEmailId.focus();
			return false;	
		}
		if (isBlank(frm.lsCountry.value))
		{
			alert("Please select Country");
			frm.lsCountry.focus();
			return false;
		}
		if (isBlank(frm.lsTopics.value))
		{
			alert("Please select Subject");
			frm.lsTopics.focus();
			return false;
		}	
		if (isBlank(frm.taEnquiry.value))
		{
			alert("Please enter your Enquiry");
			frm.taEnquiry.focus();
			return false;
		}
		 
}

/*	 
	 #############################################################################
     # Function Name: ValidateForgotPassword()
     # Created By: Siddharth Thakar
     # Created on: 21 Sep 2007
     # Purpose: Function to validate the forgot password/ id.    
     # ON SUCCESS: Returns TRUE if validated.     
     # ON FAILURE: Returns FLASE  if not validated.     
	 # USED BY : forgot_password.php
     #############################################################################
*/	 

	 function ValidateForgotPassword()
	 {
		 var frm =document.frmForgotPassword;	
		
		 if (isBlank(frm.txtEmailId.value))
		 {
			alert("Please enter Email Id");
			frm.txtEmailId.focus();
			return false;
		 }
		if (!(isValidEmail(frm.txtEmailId.value)))
		{
			alert("Please enter valid Email Id");
			frm.txtEmailId.focus();
			return false;	
		}
		
		 
}

/*	 
 #############################################################################
 # Function Name: ValidateTestimonial()
 # Created By: Siddharth Thakar
 # Created on: 21 Sep 2007
 # Purpose: Function to validate the Feedback and Enquiry page.    
 # ON SUCCESS: Returns TRUE if validated.     
 # ON FAILURE: Returns FLASE  if not validated.     
 # USED BY : testimonial.php
 #############################################################################
*/ 
 function ValidateTestimonial()
  {
	var frm =document.frmTestimonial;	
	if (isBlank(frm.txtFirstName.value))
	{
		alert("Please enter First Name");
		frm.txtFirstName.focus();
		return false;
	}
	if (!(IsAlpha(frm.txtFirstName.value)))
	{
		alert("Please enter valid First Name");
		frm.txtFirstName.focus();
		return false;
	}
	if (isBlank(frm.txtLastName.value))
	{
		alert("Please enter Last Name");
		frm.txtLastName.focus();
		return false;
	}
	if (!(IsAlpha(frm.txtLastName.value)))
	{
		alert("Please enter valid Last Name");
		frm.txtLastName.focus();
		return false;
	}
	if (isBlank(frm.txtEmailId.value))
	{
		alert("Please enter Email Id");
		frm.txtEmailId.focus();
		return false;
	}
	if (!(isValidEmail(frm.txtEmailId.value)))
	{
		alert("Please enter valid Email Address");
		frm.txtEmailId.focus();
		return false;	
	}
	if (isBlank(frm.lsCountry.value))
	{
		alert("Please select Country");
		frm.lsCountry.focus();
		return false;
	}
	if (isBlank(frm.lsProduct.value))
	{
		alert("Please select Product");
		frm.lsProduct.focus();
		return false;
	}	
	if (isBlank(frm.taComment.value))
	{
		alert("Please enter your Comment");
		frm.taComment.focus();
		return false;
	}
	 
}


/*	 
	 #############################################################################
     # Function Name: ValidateContactUs()
     # Created By: Siddharth Thakar
     # Created on: 21 Sep 2007
     # Purpose: Function to validate the Contact us page.    
     # ON SUCCESS: Returns TRUE if validated.     
     # ON FAILURE: Returns FLASE  if not validated.     
	 # USED BY : contact_us.php
     #############################################################################
*/ 
 function ValidateContactUs()
  {
	var frm =document.frmCoantactUs;	
	if (isBlank(frm.txtFirstName.value))
	{
		alert("Please enter First Name");
		frm.txtFirstName.focus();
		return false;
	 }
	 if (!(IsAlpha(frm.txtFirstName.value)))
	 {
		alert("Please enter Valid First Name");
		frm.txtFirstName.focus();
		return false;
	 }
	 if (isBlank(frm.txtLastName.value))
	 {
		alert("Please enter Last Name");
		frm.txtLastName.focus();
		return false;
	 }
	 if (!(IsAlpha(frm.txtLastName.value)))
	 {
		alert("Please enter valid Last Name");
		frm.txtLastName.focus();
		return false;
	 }

	if (isBlank(frm.txtEmailId.value))
	{
		alert("Please enter Email Address");
		frm.txtEmailId.focus();
		return false;
	}
	if (!(isValidEmail(frm.txtEmailId.value)))
	{
		alert("Please enter valid Email Address");
		frm.txtEmailId.focus();
		return false;	
	}
	
	if (isBlank(frm.taComment.value))
	{
		alert("Please enter your Comment");
		frm.taComment.focus();
		return false;
	}
	 
}


function isValidDate(d) 
	 {
		 var strDatestyle = "EU";  //European date style 
		 var strDate; 
		 var strDateArray; 
		 var strDay; 
		 var strMonth; 
		 var strYear; 
		 var intDay; 
		 var intMonth; 
		 var intYear; 
		 var booFound = false; 
		 var strSeparatorArray = new Array("-"," ","/","."); 
		 var intElementNr; 
		 var err = 0; 
		 var strMonthArray = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"); 
		 strDate = d; 
		 if (strDate.length < 1) 
		 {
			 return false; 
		 }
		 
		 if (strDate.toLowerCase()=="today" || strDate.toLowerCase()=="now")
		 {
			 return true;
		 }
		 
		 for (intElementNr = 0; intElementNr < strSeparatorArray.length; intElementNr++) 
		 {
			 if (strDate.indexOf(strSeparatorArray[intElementNr]) != -1) 
			 {
				 strDateArray = strDate.split(strSeparatorArray[intElementNr]); 
				 if (strDateArray.length != 3) 
				 {
					 err = 1; 
					 return false; 
				 }
				 else 
				 {
					 strDay = strDateArray[0]; 
					 strMonth = strDateArray[1]; 
					 strYear = strDateArray[2]; 
				 }
				 booFound = true; 
			 }
		 }

		 if (booFound == false) 
		 {
			 if (strDate.length>5) 
			 {
				 strDay = strDate.substr(0, 2); 
				 strMonth = strDate.substr(2, 2); 
				 strYear = strDate.substr(4); 
			 }
			 else 
			 {
				 return false; 
			 }
		 }

		 // verify year part   2 or 4 digits 
		 if (strYear.length != 2 && strYear.length != 4) 
		 {
			 return false;
		 }

		 if (isNaN(strYear))
		 {
			 return false;
		 }
		 
		 // US style (swap month and day) 
		 if (strDatestyle == "US") 
		 {
			 strTemp = strDay; 
			 strDay = strMonth; 
			 strMonth = strTemp; 
		 }

		 // verify 1 or 2 digit integer day 
		 if (strDay.length<1 || strDay.length>2) 
		 {
			 return false;
		 }
		 
		 if (isNaN(strDay))
		 {
			 return false;
		 }
		 
		 // month may be digits of characters, hence following check 
		 intMonth = parseInt(strMonth, 10); 
		 if (isNaN(intMonth)) 
		 {
			 for (i = 0;i<12;i++) 
			 {
				 if (strMonth.toUpperCase() == strMonthArray[i].toUpperCase()) 
				 {
					 intMonth = i+1; 
					 strMonth = strMonthArray[i]; 
					 i = 12; 
				 }
			 }
			 if (isNaN(intMonth)) 
			 {
				 err = 3; 
				 return false; 
			 }
		 }

		 intDay=parseInt(strDay,10); 
		 intYear = parseInt(strYear, 10); 

		 if (intMonth>12 || intMonth<1) 
		 {
			 err = 5; 
			 return false; 
		 }

		 // day in month check 
		 if (intDay < 1 || intDay > 31)
		 {
			 return false;
		 }
		 
		 if ((intMonth == 4 || intMonth == 6 || intMonth == 9 || intMonth == 11) && (intDay > 30)) 
		 {
			 return false; 
		 }

		 if (intMonth == 2) 
		 {
			 if (LeapYear(intYear)) 
			 {
				 if (intDay > 29) 
				 {
					 return false;
				 }
			 }
			 else 
			 {
				 if (intDay > 28) 
				 {
					 return false;
				 }
			 }
		 }

		 if (intYear<=99)
		 {
		      intYear=intYear+2000;
	     }
		 return intDay+"/"+intMonth+"/"+intYear; 
	 }
	 

	 /*
     #############################################################################
     # Function Name: LeapYear()
     # Created By: PHP Team   
     # Created on: 12  Sep 2005
     # Purpose: check year wether it is a leap year or not.
     # Parameters: string intYear : Year
     # ON SUCCESS: Returns TRUE given year is leap year.
     # ON FAILURE: Returns FLASE  given year is not a leap year.
     #############################################################################
	 */

	 function LeapYear(intYear) 
	 {
		 if (intYear % 100 == 0) 
		 {
			 if (intYear % 400 == 0) 
			 {
				 return true; 
			 }
		 }
		 else 
		 {
			 if ((intYear % 4) == 0) 
			 { 
				 return true; 
			 }
		 }
		 return false; 
	 }

	function submitThisForm(){
		var isValid = 'true';
		var strMessage = 'Please supply a valid response for the following fields:\n\n';
		if(document.askolayform.c_fname.value == '')
		{
			strMessage = strMessage + '  &#8211; First Name\n';
			document.getElementById('firstNameMsg').style.display = 'inline';
			document.getElementById('validationError').style.display = 'inline';
			document.getElementById('age18Error').style.display = 'none';
			isValid = 'false';
		}
		else
		{
			document.getElementById('firstNameMsg').style.display = 'none';
		}
		
		
		if(document.askolayform.c_lname.value == '')
		{
			strMessage = strMessage + '  &#8211; Last Name\n';
			document.getElementById('lastNameMsg').style.display = 'inline';
			document.getElementById('validationError').style.display = 'inline';
			document.getElementById('age18Error').style.display = 'none';
			isValid = 'false';
		}
		else
		{
			document.getElementById('lastNameMsg').style.display = 'none';
		}
		
		var re = new RegExp("^[a-zA-Z0-9_%\\.-]+@([a-zA-Z0-9_\\-]+\\.)+[a-zA-Z]+(,[a-zA-Z0-9_\%\\.-]+@([a-zA-Z0-9_-]+\\.)+[a-zA-Z]+)*$");
		var email_match = re.exec(document.askolayform.c_email.value);
		
		if((document.askolayform.c_email.value == '') || (email_match == null))
		{
			strMessage = strMessage + '  &#8211; Email Address\n';
			document.getElementById('emailMsg').style.display = 'inline';
			document.getElementById('validationError').style.display = 'inline';
			document.getElementById('age18Error').style.display = 'none';
			isValid = 'false';
		}
		else
		{
			document.getElementById('emailMsg').style.display = 'none';
		}

		if(document.askolayform._icf_15.value == '')
		{
			strMessage = strMessage + '  &#8211; Country\n';
			document.getElementById('countryMsg').style.display = 'inline';
			document.getElementById('validationError').style.display = 'inline';
			document.getElementById('age18Error').style.display = 'none';
			isValid = 'false';
		}
		else
		{
			document.getElementById('countryMsg').style.display = 'none';
		}

		if(document.askolayform._icf_11.value == '' || document.askolayform._icf_13.value == '' || document.askolayform._icf_14.value == '')
		{
			strMessage = strMessage + '  &#8211; Date of Birth\n';
			document.getElementById('dobMsg').style.display = 'inline';
			document.getElementById('validationError').style.display = 'inline';
			document.getElementById('age18Error').style.display = 'none';
			isValid = 'false';			

		}
		else
		{
			document.getElementById('dobMsg').style.display = 'none';
		}

		if(document.askolayform._icf_9.value == '')
		{
			strMessage = strMessage + '  &#8211; Zip Code\n';
			document.getElementById('zipMsg').style.display = 'inline';
			document.getElementById('validationError').style.display = 'inline';
			document.getElementById('age18Error').style.display = 'none';
			isValid = 'false';
		}
		else if (!isValidNumber(document.askolayform._icf_9.value))
		 {
			strMessage = strMessage + '  &#8211; Zip Code\n';
			document.getElementById('zipMsg').style.display = 'inline';
			document.getElementById('validationError').style.display = 'inline';
			document.getElementById('age18Error').style.display = 'none';
			isValid = 'false';
		 }
		else if ((document.askolayform._icf_9.value).length != 5)
		 {
			strMessage = strMessage + '  &#8211; Zip Code\n';
			document.getElementById('zipMsg').style.display = 'inline';
			document.getElementById('validationError').style.display = 'inline';
			document.getElementById('age18Error').style.display = 'none';
			isValid = 'false';
		 }
		else
		{
			document.getElementById('zipMsg').style.display = 'none';
		}


		if(document.askolayform._icf_10.value == '')
		{
			strMessage = strMessage + '  &#8211; State\n';
			document.getElementById('stateMsg').style.display = 'inline';
			document.getElementById('validationError').style.display = 'inline';
			document.getElementById('age18Error').style.display = 'none';
			isValid = 'false';			

		}
		else
		{
			document.getElementById('stateMsg').style.display = 'none';
		}
		var DtStr = document.askolayform._icf_11.value + "-" + document.askolayform._icf_13.value + "-" + document.askolayform._icf_14.value;
		if(!isValidDate(DtStr))
		{
			strMessage = strMessage + '  &#8211; Date of Birth\n';
			document.getElementById('invaliddob').style.display = 'inline';
			document.getElementById('validationError').style.display = 'inline';
			document.getElementById('age18Error').style.display = 'none';
			isValid = 'false';
		}
		else
		{
			document.getElementById('invaliddob').style.display = 'none';
		}
		if(document.askolayform._icf_11.value != '' && document.askolayform._icf_13.value != '' && document.askolayform._icf_14.value != '')
		{
			var currentTime = new Date();
			var date = currentTime.getDate();
			var month = currentTime.getMonth()+1;
			var fullyear = currentTime.getFullYear();

			var datediff = date - document.askolayform._icf_11.value;
			var monthdiff = month - document.askolayform._icf_13.value;
			var yeardiff = fullyear - document.askolayform._icf_14.value;

			if (datediff < 0 || monthdiff < 0)
				yeardiff--;
			if(document.askolayform._icf_10.value == 'ME')
			{
				if (yeardiff < 18)
				{
					var expdate = new Date ();
					expdate.setTime(expdate.getTime() + 1000 * 60 * 60 * 24 * 365);
					if(isValid == 'true')
					{				
					setCookie("age18CookieChat","1",2);				
					document.getElementById('age18Error').style.display = 'inline';
					document.getElementById('validationError').style.display = 'none';
					}
					isValid = 'false';
				}	
				else
				{
					document.getElementById('age18Error').style.display = 'none';
				}
			}
			else
			{
				if (yeardiff < 13)
				{
					var expdate = new Date ();
					expdate.setTime(expdate.getTime() + 1000 * 60 * 60 * 24 * 365);
					if(isValid == 'true')
					{				
						document.getElementById('age18Error').style.display = 'inline';
						document.getElementById('validationError').style.display = 'none';
					}
					isValid = 'false';
				}
			}

		}
		
	  if(document.askolayform._icf_10.value == 'ME')
		{
	  	  var day = getCookie('age18CookieChat');
		  if(day!='' && isValid=='true')
			{			
				document.getElementById('age18Error').style.display = 'inline';
				document.getElementById('validationError').style.display = 'none';
				isValid = 'false';
			}
		}

		if(isValid == 'true')
		{
			document.askolayform.submit();
			document.getElementById('validationError').style.display = 'none';
			document.getElementById('age18Error').style.display = 'none';
			pageTracker = _gat._getTracker("UA-2984237-1");
			pageTracker._setVar('livechat');
		}
	}


	function dispState(frm) 
	{
		if(document.askolayform.p_country.value == 'United States')
		{
			document.getElementById('showstate').style.display = '';
			document.getElementById('disphight').style.display = '';
			document.askolayform._icf_10.selectedIndex  = 0;
		}
		else
		{
			document.getElementById('showstate').style.display = 'none';
			document.getElementById('disphight').style.display = 'none';
		}
	}

	function setCookie(c_name,value,expiredays)
	{
	  var exdate=new Date();
	  exdate.setDate(exdate.getDate()+expiredays);
	  document.cookie=c_name+ "=" +escape(value)+ ((expiredays==null) ? "" : "; expires="+exdate.toGMTString());
	}

	function getCookie(c_name)
	{
	  if (document.cookie.length>0)
	  { 
		c_start=document.cookie.indexOf(c_name + "=")
		if (c_start!=-1)
		{ 
		c_start=c_start + c_name.length+1 
		c_end=document.cookie.indexOf(";",c_start)
		  if (c_end==-1) c_end=document.cookie.length
		   return unescape(document.cookie.substring(c_start,c_end))
		} 
	  }
	  return "";
	}


	 function displayState() 
		{
			if(document.frmRegister.lsCountry.value == 'US'){
					document.getElementById('displayState1').style.display = '';
					document.getElementById('displayHight').style.display='';
					document.frmRegister.stateName.selectedIndex  = 0;
			}
			else	{
					document.getElementById('displayState1').style.display = 'none';
					document.getElementById('displayHight').style.display='none';
			}
		}

 function ValidateUpdation(thisform)
	 {
		 var frm =document.frmRegister;	
		
		 if (isBlank(frm.txtFirstName.value))
		 {
			alert("Please enter First Name");
			frm.txtFirstName.focus();
			return false;
		 }
		 if (!(IsAlpha(frm.txtFirstName.value)))
		 {
			alert("Please enter Valid First Name");
			frm.txtFirstName.focus();
			return false;
		 }
		 if (isBlank(frm.txtLastName.value))
		 {
			alert("Please enter Last Name");
			frm.txtLastName.focus();
			return false;
		 }
		 if (!(IsAlpha(frm.txtLastName.value)))
		 {
			alert("Please enter valid Last Name");
			frm.txtLastName.focus();
			return false;
		 }
		 if (isBlank(frm.txtAddr1.value))
		 {
			alert("Please enter Address 1");
			frm.txtAddr1.focus();
			return false;
		 }	
		 if (isBlank(frm.txtCity.value))
		 {
			alert("Please enter a City");
			frm.txtCity.focus();
			return false;
		 }	
		if (!(IsAlpha(frm.txtCity.value)))
		 {
			alert("Please enter Valid City Name");
			frm.txtCity.focus();
			return false;
		 }
		 if (isBlank(frm.txtZip.value))
		 {
			alert("Please enter Zip Code");
			frm.txtZip.focus();
			return false;
		 }
		 if (!isValidNumber(frm.txtZip.value))
		 {
			alert("Please enter a valid zip code");
			frm.txtZip.focus();
			return false;
		 }
		if ((frm.txtZip.value).length != 5)
		 {
			alert("Zip Code should be of 5 digit");
			frm.txtZip.focus();
			return false;
		 }
		 if (isBlank(frm.lsCountry.value))
		 {
			alert("Please select country");
			frm.lsCountry.focus();
			return false;
		 }
		 if (isBlank(frm.stateName.value))
		 {
			  var countryName = frm.lsCountry.value;
			  if (countryName == "US")
			  {
				alert("Please select State");
				frm.stateName.focus();
				return false;
			  }
		 }
	 }