// JavaScript Document

function validate_fields()
 {
	 var regex = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
    	var check=regex.test(document.frm.email.value);
	
  if(document.frm.email.value=="")
    {
       alert(msgEnterEmail + msgNot);
       document.frm.email.focus();
       return false;
    }
	
	 if(check==false)
	  {
	alert("Invalid email !");
	document.frm.email.select();
	return false;
	  }
		
	 if(document.frm.comments.value=="")
    {
       alert(msgcomments + msgNot);
       document.frm.comments.focus();
       return false;
    }
	
	
	 
}	 
	 
/*------------ validation for applyforloan---------------	 */


function validate_loanfield()
 {  
     var regexpName=/^[a-zA-Z]+[a-zA-Z.'_\- ]+$/;
	   
	  if(document.frm2.title.selectedIndex==0) 
	  {
	 alert(msgPlease + " " +  msgSelect + " " + msgoption + " " + msgNot );
	 document.frm2.title.focus();
	 return false;
	  } 
	   
	   
	
	  
	 if(document.frm2.fname.value=="")
      {
	    alert( msgFirstname +" "+ msgBlank + msgNot);
	    document.frm2.fname.focus();
	    return false;
	  }
		  
		  else if(!document.frm2.fname.value.match(regexpName))
	        {
		        alert(msgInvalidfChar + msgNot );
		        document.frm2.fname.value = "";
		        document.frm2.fname.focus();
		        return false;
	         }
	      
		  
		  
	if(document.frm2.sname.value=="")
      {
	    alert( msgLastName  +" "+ msgBlank + msgNot);
	    document.frm2.sname.focus();
	    return false;
	  }
		  
		  else if(!document.frm2.sname.value.match(regexpName))
	        {
		        alert(msgInvalidSurname  + msgNot );
		        document.frm2.sname.value = "";
		        document.frm2.sname.focus();
		        return false;
	         }
	      
		  
		   
		   
	   var reg1 =/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,15})+$/;
            var elm = document.frm2.email;
            var check=reg1.test(elm.value);
            if(elm.value=='')
               {
                   alert(msgEnterEmail + " " + msgNot);
                   elm.focus();
                    return false;
               }
             if(elm.value!='')
              {
  
                 if(!check)
  
                     {
                       alert(msgInvalidEmail + " " + msgNot);
                        elm.select();
                         return false;
                       }

                 } 
				 
				 var phonecode1=/^[0-9]+$/;
				  if(document.frm2.hphone.value == "")
				  {
					 alert(msgHomePh + " " + msgBlank + msgNot);
		                   document.frm2.hphone.focus();
		                    return false;  
					 }  
					  				 
				 
	             if(document.frm2.hphone.value != "")
	               {
		              if(!document.frm2.hphone.value.match(phonecode1))
	                    {
		                   alert(msginvalidHomePH + msgNot);
		                   document.frm2.hphone.select();
		                    return false;
	                    }
		           } 
		  
		           if(document.frm2.reference.value=="")
                     {
	                    alert( msgreferencename +" "+ msgBlank + msgNot);
	                    document.frm2.reference.focus();
						
	                    return false;
	                 }
		
				  var phonecode2=/^[0-9]+$/;
				  if(document.frm2.Mobileno.value == "")
				  {
					 alert(msgMobileNo + " " + msgBlank + msgNot);
		                  
						   document.frm2.Mobileno.focus();
		                    return false;  
					 }  		  				 
				 
	             if(document.frm2.Mobileno.value != "")
	               {
		              if(!document.frm2.Mobileno.value.match(phonecode2))
	                    {
		                   alert(msginvalidMobileNo + msgNot);
		                   document.frm2.Mobileno.select();
		                    return false;
	                    }
		           } 
	 
	             var price_reg = /\$?[1-9]{1}[0-9]{0,3}(\.[0-9]{2})?/g;
				  if(document.frm2.amt.value == "")
				  {
					 alert(msgAmt + " " + msgBlank + msgNot);
		                   document.frm2.amt.focus();
		                    return false;  
				  }
				  
				 
				  
				   else if(!document.frm2.amt.value.match(price_reg))
				   {
					    alert(msgInValidAmt + msgNot);
		                   document.frm2.amt.focus();
		                    return false;  
					}  
					   
					   
				
	 
	            if(document.frm2.repaymenterm.selectedIndex==0) 
	              {
	               alert(msgPlease + " " +  msgSelect + " " + msgRepaymentTerm  + " " + msgNot );
	               document.frm2.repaymenterm.focus();
	               return false;
	              }
				  
  					
	 
	 
	 }
  
	 
	 
 /*-------------------------- function for repayment calculator------------------------------*/
   
   function validate_repaymentcal()
    { 
	       var Num2=/^[0-9]+$/;
              // var Num6=/\$?[1-9]{1}[0-9]{0,3}(\.[0-9]{2})?/g;
               // var Num6=/^[0-9]+([\.])+([0-9]{0,2})+$/;
			    var Num6=/^[0-9]+\.[0-9]{2}$/;
		if(document.form1.mortreq.value =="")
		 {
			 alert(msgMrequired +" "+ msgBlank + msgNot);
		      document.form1.mortreq.focus();
		       return false;
			 }  
			 
			if(!document.form1.mortreq.value.match(Num6))
	           {
		         alert(msginvalidMrequired + msgNot);
		          document.form1.mortreq.select();
		           return false;
	            }
			 
		   if(document.form1.T.value =="")
		 {
			 alert(msgRepaymentperiod  +" "+ msgBlank + msgNot);
		      document.form1.T.focus();
		       return false;
			 }  
			
			 if(!document.form1.T.value.match(Num2))
	           {
		         alert(msgINVRepaymentperiod  + msgNot);
		          document.form1.T.select();
		           return false;
	            }
			 
			  if(document.form1.R.value =="")
		       {
			    alert(msgInterestrate  +" "+ msgBlank + msgNot);
		        document.form1.R.focus();
		         return false;
			   }  
			 
			 if(!document.form1.R.value.match(Num2))
	           {
		         alert(msgInVALIDInterestrate  + msgNot);
		          document.form1.R.select();
		           return false;
	            }
				return false;
			/* computeForm();
			*/
			 
			 
		}
		
		
		
	
 
 
 
 
 
 
 
 
 
 function checkNumber(input, min, max, msg) 
 {

		msg = "The " + msg + " field is invalid. ";

		//this makes sure that the number is a number
		var str = input.value;
		for (var i = 0; i < str.length; i++) 
		{
			var ch = str.substring( i, i + 1)
			if ((ch < "0" || "9" < ch) && ch != '.') 
			{
				alert("invalid field");
				return false;
			}
		}
   //this makes sure that the number lies between the min and max values allowed
		var num = 0 + str
		if (num < min || max < num) {
			alert(msg + "The figure should be between " + min + " and " + max + ".");
			return false;
		}
		input.value = str;
		return true;
	}

   function computeField(input) {
		if (input.value != null && input.value.length != 0)
		
		
		{
			input.value = "" + eval(input.value);
		}
		computeForm(input.form);
		//clearForm(input.form);
		return false;
	}
	
	
	function computeForm(form) {
		var A=form.A.value; // Principal amount
		var T=form.T.value; // Term - number of years
		var R=form.R.value; // Rate of interest

		//making sure that an entry has been made in each field.
		if ((A == null || A.length == 0) ||
			(R == null || R.length == 0)) 
		{
			//alert('not all fields filled in');
			return;
		}

		// making sure that entries are valid by using check number
		if (!checkNumber(form.A, 1, 99999999, "'Mortgage required'") ||
			!checkNumber(form.R, .001, 1000, "Interest rate") ||
			!checkNumber(form.T, 5, 40, "Repayment period")) 
		{
			form.Cm.value = "Invalid";
			return;
		}

		// maths et al to be computed
		R = R / 100;
		var P = ((A*R)/12) * (1/(1-(Math.pow(1/(1+R),T))));
		form.Cm.value = poundsPence( P );
		P = ((A*0.12)/12) * (1 / (1-(Math.pow((1/1.12),T))));
		form.CCm.value = poundsPence( P );
		P = (A*R)/12;
		form.CI.value = poundsPence( P );
		P = ((A*0.12)/12);
		form.CCI.value = poundsPence( P );
		return false;
	}

	function poundsPence( N ) {
		// won't work as intended in ie3
		if ((navigator.appName.indexOf('Microsoft')>-1)
			&& (navigator.appVersion.indexOf('3.0')>-1) )
		{
			return N;
		}
		S = new String( N );
		var i = S.indexOf('.');
		if (i != -1) {
			S = S.substr( 0, i+3 );
			if (S.length-i < 3)
				S = S + '0';
		}
		return S;
	}

	//clears form
	function clearForm(form) {
		
		form.A.value = "";
		form.T.value = "";
		form.R.value = "";
		
		form.Cm.value = "";
		form.CI.value = "";
		form.CCm.value = "";
		form.CCI.value = "";
		return false;
	}
		
/*-------------------------------- validation for mortage quatation-----------------------*/


function numbersonly(e, decimal) 
{
var key;
var keychar;

if (window.event)
{
   key = window.event.keyCode;
}
else if (e) 
{
   key = e.which;
}
else 
{
   return true;
}
 keychar = String.fromCharCode(key);

if ((key==null) || (key==0) || (key==8) ||  (key==9) || (key==13) || (key==27) ) {
   return true;
}
else if ((("0123456789").indexOf(keychar) > -1)) {
   return true;
}
else if (decimal && (keychar == ".")) { 
  return true;
}
else
   return false;
}

function NumcheckNew(e)
{  
     var keynum;
	
	if(window.event) // IE
	 {
	  keynum = e.keyCode;
	 }
	 else if(e.which)// Firefox 
	 {
	  keynum = e.which;
	 }
//alert(e.keyCode);
if((keynum>=48 && keynum<58) || keynum==8 || keynum==13 || keynum==46 || keynum==47)
	{
		return true;
	 }
	else
	{
		return false;
	}
}


function Numcheck_earn(e)
{  
     var keynum;
	
	if(window.event) // IE
	 {
	  keynum = e.keyCode;
	 }
	 else if(e.which)// Firefox 
	 {
	  keynum = e.which;
	 }
//alert(e.keyCode);
if((keynum>=48 && keynum<58) || keynum==8 || keynum==13 || keynum==46 )
	{
		return true;
	 }
	else
	{
		return false;
	}
}

function validate_mrtg_quote()
{
	 if(document.form1.BorrowAmount.value=="")
      {
	    alert(msgBorrowAmount  +" "+ msgBlank + msgNot);
	    document.form1.BorrowAmount.focus();
	    return false;
	  }
	
	if(document.form1.PropertyValue.value=="")
      {
	    alert(msgPropertyValue  +" "+ msgBlank + msgNot);
	    document.form1.PropertyValue.focus();
	    return false;
	  }
	
}

/*-------------------- validation for mortage-quotation2.html----------------------*/


function CopyAddress1()
{
var a;
a = document.form1.address.value;
document.form2.Cust_Address1.value = a;
}

function CopyTown() 
{
var a;
a = document.form1.town.value;
document.form2.Cust_Town.value = a;
}

function CopyAddress2() 
{
var a;
a = document.form1.address2.value;
document.form2.Cust_Address2.value = a;
}

function CopyCounty() 
{
var a;
a = document.form1.county.value;
document.form2.Cust_County.value = a;
}

function CopyPostcode() 
{
var a;
a = document.form1.postcode.value;
document.form2.Cust_PostCode.value = a;
}
             /**********************/
			 
			 
			 
  function validate_quotationfield()
 {
	 var regexpName=/^[a-zA-Z]+[a-zA-Z.'_\- ]+$/;
	if(document.form2.title.selectedIndex==0) 
	  {
	 alert(msgPlease + " " +  msgSelect + " " + msgoption + " " + msgNot );
	 document.form2.title.focus();
	 return false;
	  }
	  
	  // var regexpName1=/^[a-z,A-Z]+[a-z,A-Z,.,_,\-, ]+$/;
	 if(document.form2.fname.value=="")
      {
	    alert( msgFirstname +" "+ msgBlank + msgNot);
	    document.form2.fname.focus();
	    return false;
	  }
		  
		else if(!document.form2.fname.value.match(regexpName))
	        {
		        alert(msgInvalidfChar + msgNot );
		        document.form2.fname.value = "";
		        document.form2.fname.focus();
		        return false;
	         }
	      		   
		   
		   
		    if(document.form2.sname.value=="")
               {
	             alert( msgLastName  +" "+ msgBlank + msgNot);
	             document.form2.sname.focus();
	              return false;
	            }
		  
		else if(!document.form2.sname.value.match(regexpName))
	        {
		        alert(msgInvalidSurname   + msgNot );
		        document.form2.sname.value = "";
		        document.form2.sname.focus();
		        return false;
	         }
	      		 
		   
		   
	   var reg2 = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
            var elm = document.form2.email;
            var check=reg2.test(elm.value);
            if(elm.value=='')
               {
                   alert(msgEnterEmail + " " + msgNot);
                   elm.focus();
                    return false;
               }
             if(elm.value!='')
              {
  
                 if(!check)
  
                     {
                       alert(msgInvalidEmail + " " + msgNot);
                        elm.select();
                         return false;
                       }

                 } 
				 
				 
				  if(document.form2.hphone.value == "")
				  {
					 alert(msgHomePh + " " + msgBlank + msgNot);
		                   document.form2.hphone.focus();
		                    return false;  
					 }  
					  				 
				 
	           
		         
				 
				  if(document.form2.Mobileno.value == "")
				  {
					 alert(msgMobileNo + " " + msgBlank + msgNot);
		                   document.form2.Mobileno.focus();
		                    return false;  
					 }  
					  				 
		 }		 
 /*--------------------------- validation for paymentprotection---------------*/
	      
function payment()
 {
	 var regexpName=/^[a-zA-Z]+[a-zA-Z.'_\- ]+$/;
	 if(document.frm.fname.value=="")
      {
	    alert( msgName +" "+ msgBlank + msgNot);
	    document.frm.fname.focus();
	    return false;
	  }
		  
		 else if(!document.frm.fname.value.match(regexpName))
	        {
		        alert(msgInvalidNAME+ msgNot);
		        document.frm.fname.value = "";
		        document.frm.fname.focus();
		        return false;
	         }
	      
		  
		  var reg4 = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
           var elm = document.frm.email;
           var check=reg4.test(elm.value);

            if(document.frm.email.value=='')
               {
                   alert(msgEnterEmail + " " + msgNot);
                   elm.focus();
                    return false;
               }
             if(elm.value!='')
              {
  
                 if(!check)
  
                     {
                       alert(msgInvalidEmail + " " + msgNot);
                        elm.select();
                         return false;
                       }

                 } 
				 
				 var phoneno=/^[0-9]+$/;
				  if(document.frm.phoneno.value == "")
				  {
					 alert(msgPh + " " + msgBlank + msgNot);
		                   document.frm.phoneno.focus();
		                    return false;  
					 }  
					  				 
				 
	             if(document.frm.phoneno.value != "")
	               {
		              if(!document.frm.phoneno.value.match(phoneno))
	                    {
		                   alert(msginvalidPH + msgNot);
		                   document.frm.phoneno.select();
		                    return false;
	                    }
		           }
		if(document.frm.msg.value=="")
		  {
			alert( msgMes +" "+ msgBlank + msgNot);
			document.frm.msg.focus();
			return false;
		  }
		    
			
			 if(document.frm.terms.checked==false)
					    {
							alert(msgmissoldPPI + msgNot);
							return false;
							
							
						}
			
			
			
}	  	  
				
 
  /*--------------------------------------------*/
  
  /*--------- validation for debtmanagement-------------------*/
  
  

	function validate_debt_manage()
    {
	 var regexpName=/^[a-zA-Z]+[a-zA-Z.'_\- ]+$/;
	 
	 if(document.frm.fname.value=="")
      {
	    alert( msgFirstname +" "+ msgBlank + msgNot);
	    document.frm.fname.focus();
	    return false;
	  }
		 
		    
		     else if(!document.frm.fname.value.match(regexpName))
		
	        {
				
		        alert(msgInvalidfChar + msgNot );
		        document.frm.fname.value = "";
		      document.frm.fname.focus();
		        return false;
	         }
	       
		   
		   if(document.frm.sname.value=="")
            {
	         alert(msgLastName  +" "+ msgBlank + msgNot);
	         document.frm.sname.focus();
	          return false;
	         }
	
	      else if(!document.frm.sname.value.match(regexpName))
		
	        {
				
		        alert(msgInvalidSurname  + msgNot );
		        document.frm.sname.value = "";
		      document.frm.sname.focus();
		        return false;
	         }
	
	              var telphone=/^[0-9,(, ), +, -]+$/;
				  if(document.frm.telphone.value == "")
				  {
					 alert(msgHomePh + " " + msgBlank + msgNot);
		                   document.frm.telphone.focus();
		                    return false;  
					 }  
					  				 
				 
	             if(document.frm.telphone.value != "")
	               {
		              if(!document.frm.telphone.value.match(telphone))
	                    {
		                   alert(msginvalidHomePH + msgNot);
		                   document.frm.telphone.select();
		                    return false;
	                    }
		           } 
		  
		          
				  var mobile=/^[0-9,(, ), +, -]+$/;
				  if(document.frm.mobile.value == "")
				  {
					 alert(msgMobileNo + " " + msgBlank + msgNot);
		                   document.frm.mobile.focus();
		                    return false;  
					 }  
					  				 
				 
	             if(document.frm.mobile.value != "")
	               {
		              if(!document.frm.mobile.value.match(mobile))
	                    {
		                   alert(msginvalidMobileNo + msgNot);
		                   document.frm.mobile.select();
		                    return false;
	                    }
		           } 
	
	               var reg5 = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
                    var elm = document.frm.email;
                    var check=reg5.test(elm.value);
                    if(elm.value=='')
                     {
                      alert(msgEnterEmail + " " + msgNot);
                      elm.focus();
                      return false;
                     }
                     if(elm.value!='')
                     {
  
                       if(!check)
  
                        {
                          alert(msgInvalidEmail + " " + msgNot);
                          elm.select();
                          return false;
                        }

                    }
	
	                 if(document.frm.terms.checked==false)
					    {
							alert(msgPrivacyPolicy+ msgNot);
							return false;
							
							
						}
	
	
        }
	
	

		
				

	
	/*--------------------- validation for agent page------------------*/
	
	function validate_agentfrm()
	{
		 var regexpName=/^[a-zA-Z]+[a-zA-Z.'_\- ]+$/;
		 if(document.frm2.uname.value=="")
          {
	       alert( msgUsername  +" "+ msgBlank + msgNot);
	       document.frm2.uname.focus();
	       return false;
	      }
		         
		 else if(!document.frm2.uname.value.match(regexpName))
	        {
		        alert( msgUsernameCharacter   + msgNot );
		        document.frm2.uname.value = "";
		        document.frm2.uname.focus();
		        return false;
	         }
	      
		
		   		   
			 if(document.frm2.password.value=="")
               {
	              alert( msgPassword   +" "+ msgBlank + msgNot);
				  document.frm2.password.value = "";
	              document.frm2.password.focus();
	               return false;
	           }
		
		
		
		}
	
	
/*---------------------------- validation for applyloan2.html----------	 */


function validate_applyloan2()
 {
	 var num1=/^[0-9]+$/;
	 
		  
		  if(document.frm3.Ap1_MaritalStatus.selectedIndex==0) 
	       {
	        alert(msgPlease + " " +  msgSelect + " " + msgMarital  + " " + msgNot );
	        document.frm3.Ap1_MaritalStatus.focus();
	        return false;
	       }
	
	
	    if(document.frm3.dependents.value=="")
           {
	         alert(msgDependents  + " " + msgBlank + msgNot);
	         document.frm3.dependents.focus();
	         return false;
	       }
		         
		  else if(!document.frm3.dependents.value.match(num1))
	      {
		    alert( msgINVALIDDependentnum + msgNot );
		    document.frm3.dependents.value = "";
		    document.frm3.dependents.focus();
		    return false;
	         }
	
	       
		    if(document.frm3.Ap1_DOB_Day.selectedIndex==0) 
	         {
	          alert(msgPlease + " " +  msgSelect + " " + msgDate  + " " + msgNot );
	          document.frm3.Ap1_DOB_Day.focus();
	          return false;
	         }
	            			
	       if(document.frm3.Ap1_DOB_Mth.selectedIndex==0) 
	         {
	          alert(msgPlease + " " +  msgSelect + " " + msgMonth  + " " + msgNot );
	          document.frm3.Ap1_DOB_Mth.focus();
	          return false;
	         }
			
			
			  if(document.frm3.years2.value=="")
           {
	         alert(msgYear   + " " + msgBlank + msgNot);
	         document.frm3.years2.focus();
	         return false;
	       }
		         
		  else if(!document.frm3.years2.value.match(num1))
	      {
		    alert( msgINVALIDYear  + msgNot );
		    document.frm3.years2.value = "";
		    document.frm3.years2.focus();
		    return false;
	         }
		
		

	 if(document.frm3.LoanStatus.selectedIndex==0) 
	       {
	        alert(msgPlease + " " +  msgSelect + " " + msgLoanpurpose  + " " + msgNot );
	        document.frm3.LoanStatus.focus();
	        return false;
	       }
	
	
	
 }
	 


	
	 
	 
/*-----------------validation for joint applicant-----------------	*/


function validate_applyloan3()
 {
	
	 var num1=/^[0-9]+$/;
	  var regexpName2=/^[a-zA-Z]+[a-zA-Z.'_\- ]+$/;
	  
		  
		  if(document.frm4.Ap2_MaritalStatus.selectedIndex==0) 
	       {
	        alert(msgPlease + " " +  msgSelect + " " + msgMarital  + " " + msgNot );
	        document.frm4.Ap2_MaritalStatus.focus();
	        return false;
	       }
	
	
	    if(document.frm4.dependents.value=="")
           {
	         alert(msgDependents  + " " + msgBlank + msgNot);
	         document.frm4.dependents.focus();
	         return false;
	       }
		   
		   
		    else if(!document.frm4.dependents.value.match(num1))
	          {
		       alert( msgINVALIDDependentnum + msgNot );
		       document.frm4.dependents.value = "";
		       document.frm4.dependents.focus();
		       return false;
	         }
	
		 
	       
		   if(document.frm4.loanpurpose.selectedIndex==0) 
	       {
	        alert(msgPlease + " " +  msgSelect + " " + msgLoanpurpose  + " " + msgNot );
	        document.frm4.loanpurpose.focus();
	        return false;
	       }
		   
		   
		    if(document.frm4.Ap2_Title.selectedIndex==0) 
	       {
	        alert(msgPlease + " " +  msgSelect + " " + msgJointApplicantTitle  + " " + msgNot );
	        document.frm4.Ap2_Title.focus();
	        return false;
	       }
		   
		   // var regexpName2=/^[a-zA-Z]+[a-zA-Z.'_\- ]+$/;
		    if(document.frm4.Ap2_FirstName.value=="")
             {
	           alert(msgApplicant + " " + msgFirstname +" "+ msgBlank + msgNot);
	           document.frm4.Ap2_FirstName.focus();
	           return false;
	         }
		  
		  else if(!document.frm4.Ap2_FirstName.value.match(regexpName2))
	        {
		        alert(msgInvalidfChar + msgNot );
		        document.frm4.Ap2_FirstName.value = "";
		        document.frm4.Ap2_FirstName.focus();
		        return false;
	         }
	      
		  
		  
	if(document.frm4.Ap2_Surname.value=="")
      {
	    alert(msgApplicant + " " +  msgLastName  +" "+ msgBlank + msgNot);
	    document.frm4.Ap2_Surname.focus();
	    return false;
	  }
	  
	  
	  
	   else if(!document.frm4.Ap2_Surname.value.match(regexpName2))
	        {
		        alert(msgInvalidSurname + msgNot );
		        document.frm4.Ap2_Surname.value = "";
		        document.frm4.Ap2_Surname.focus();
		        return false;
	         }
		  
		  
		   if(document.frm4.Ap2_Relationship.selectedIndex==0) 
	       {
	        alert(msgPlease + " " +  msgSelect + " " + msgRelationshiptoyou   + " " + msgNot );
	        document.frm4.Ap2_Relationship.focus();
	        return false;
	       }
		   
		    if(document.frm4.Ap2_DOB_Day.selectedIndex==0) 
	         {
	          alert(msgPlease + " " +  msgSelect + " " + msgDate  + " " + msgNot );
	          document.frm4.Ap2_DOB_Day.focus();
	          return false;
	         }
	
	       if(document.frm4.Ap2_DOB_Mth.selectedIndex==0) 
	         {
	          alert(msgPlease + " " +  msgSelect + " " + msgMonth  + " " + msgNot );
	          document.frm4.Ap2_DOB_Mth.focus();
	          return false;
	         }
	
	        if(document.frm4.Ap2_DOB_Yrs.value=="")
           {
	         alert(msgYear   + " " + msgBlank + msgNot);
	         document.frm4.Ap2_DOB_Yrs.focus();
	         return false;
	       }
		         
		  else if(!document.frm4.Ap2_DOB_Yrs.value.match(num1))
	      {
		    alert( msgINVALIDYear  + msgNot );
		    document.frm4.Ap2_DOB_Yrs.value = "";
		    document.frm4.Ap2_DOB_Yrs.focus();
		    return false;
	         }
	
	
	 }	   
	

	
	
	
	
	
	
	
 /* ---------------- validation for number check-----------------------*/
 
 
 function Numcheck(e)
{  
     var keynum;
	 var keychar;
	 var numcheck;
	 //alert(e);
	 if(window.event) // IE
	 {
	  keynum = e.keyCode
	 }
	 else if(e.which)// Firefox 
	 {
	  keynum = e.which;
	 }
	keychar =String.fromCharCode(keynum);
	numcheck = /[0-9]/;
	if((keynum>=48 && keynum<58) || keynum==8 || keynum==13 || keynum==46 || keynum==9)
	{
		return true;
	 }
	else
	{
		return false;
	}
}

////Business Energy

function validate_business()
 {	//alert("Hello");
	var regexpName=/^[a-zA-Z]+[a-zA-Z.'_\- ]+$/;
	var regex = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
    	var check=regex.test(document.frm1.email.value);
	
	if(document.frm1.name1.value=="")
	{
	alert("Name should not be blank!");
	document.frm1.name1.focus();
	return false;
	}
	else if(!document.frm1.name1.value.match(regexpName))
	{
	alert("Invalid name !");
	document.frm1.name1.value = "";
	document.frm1.name1.focus();
	return false;
	}
	else if(document.frm1.email.value!="")
	{
		if(check==false)
		{
		alert("Invalid email !");
		document.frm1.email.select();
		return false;
		}
	}
	var telphone=/^[0-9]+$/;
 	if(document.frm1.telephone.value == "")
	{
		alert("Telephone should not be blank !");
		document.frm1.telephone.focus();
		return false;  
	}  
 	if(document.frm1.telephone.value != "")
	{
		if(!document.frm1.telephone.value.match(telphone))
		{
			alert("Invalid telephone");
			document.frm1.telephone.select();
			return false;
		}
	} 

}	


/*---------------------------validation for contactus.php-----------------------*/


function valid_contactusfield()
 {  
     var regexpName=/^[a-zA-Z]+[a-zA-Z.'_\- ]+$/;
	   
	 if(document.form2.name.value=="")
      {
	    alert( msgName +" "+ msgBlank + msgNot);
		document.form2.name.focus();
	    return false;
	    
	  }
		  
	 else if(!document.form2.name.value.match(regexpName))
	          {
		        alert(msgInvalidNAME  + msgNot );
		        document.form2.name.value = "";
		        document.form2.name.select();
		        return false;
	         }
	      
	  var reg5 = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
                    var elm = document.form2.email;
                    var check=reg5.test(elm.value);
                    if(elm.value=='')
                     {
                      alert(msgEnterEmail + " " + msgNot);
                      elm.focus();
                      return false;
                     }
                     if(elm.value!='')
                     {
  
                       if(!check)
  
                        {
                          alert(msgInvalidEmail + " " + msgNot);
                          elm.select();
                          return false;
                        }

                    }
		  	  
		  
		  /* if(document.form2.comments.value=="")
              {
	            alert( msgComments  +" "+ msgBlank + msgNot);
		        document.form2.comments.focus();
	            return false;
	    
	          }*/
		  }
 
 
 /*---------------- validation for life insurance------------------------*/
 
 
 function Render()
{
	var SubTyp;
	var BenLbl;
	var IncBen;
	var LoanRate;
	var PremDriven;
	var PremTD;
	var BenTD;

	SubTyp = document.getElementById('T_ProductSubtype').value;
	BenLbl = document.getElementById('T_BenLabel');
	IncBen = document.getElementById('T_IncBenTR');
	LoanRate = document.getElementById('T_LoanRateTR');
	PremDriven = document.getElementById('PremBen1').checked;
	PremTD = document.getElementById('T_PremTD');
	BenTD = document.getElementById('T_BenTD');

	BenLbl.innerHTML = SubTyp=='04'?'Annual Benefit (&#163;)':'Benefit Amount (&#163;)';
	IncBen.style.visibility = SubTyp=='03'?'hidden':'visible';
	LoanRate.style.visibility = SubTyp=='03'?'visible':'hidden';
	PremTD.style.visibility = PremDriven?'visible':'hidden';
	BenTD.style.visibility = PremDriven?'hidden':'visible';

var PTAWarn;
	PTAWarn = document.getElementById('T_NoPTALabel');
	if(PTAWarn != null)
	{
		if(SubTyp=='02') PTAWarn.innerHTML='Cannot quote PTA for Convertible Term';
		else if(SubTyp=='04') PTAWarn.innerHTML='Cannot quote PTA for Family Income Benefit';
		else PTAWarn.innerHTML='';
	}

	return true;
}


///////////////////////////////////////

function income_pro(){ 
		
		 var regexpName=/^[a-zA-Z]+[a-zA-Z.'_\- ]+$/;
	 
	 if(document.getElementById('genderLB1').checked==false && document.getElementById('genderLB2').checked==false)
      {
	    alert(  msgPlease + " " + msgSelect + " " + msgGender + msgNot );
	    //document.getElementById('gen1').focus();
	    return false;
	  }
	  
	 if(document.frm1.DOB.value=="")
      {
	    alert( msgDOB + " " + msgBlank +  msgNot );
	    document.frm1.DOB.focus();
	    return false;
	  }
		
		if(document.frm1.DOB.value!=""){
		var txt=document.getElementById('DOB');                    
var filter=/^(0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.](19|20)\d\d+$/;               
var test_bool = filter.test(txt.value);        
if (test_bool==false){ 
alert('Please enter the date of birth In MM/DD/YYYY format');            
txt.focus();            
return false;                   
 }  
		}
	  
	  
	  if(document.getElementById('smoke1').checked==false && document.getElementById('smoke2').checked==false)
      {
	    alert( msgPlease + " " + msgSelect + " " + msgSmoke  + msgNot );
	    document.getElementById('smoke1').focus();
	    return false;
	  }
	  
 if(document.frm1.Serchbx.value=="")
      {
	    alert( msgEnterOccupation +  msgNot);
	    document.frm1.Serchbx.focus();
	    return false;
	  }
		 
		  if(document.frm1.Annual.value=="")
      {
	    alert( msgEnterAnnuualEarning +  msgNot );
	    document.frm1.Annual.focus();
	    return false;
	  }    
		   
	     
	
		 
	                   var reg5 = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
                    var elm = document.frm1.email;
                    var check=reg5.test(elm.value);
                    if(elm.value=='')
                     {
                      alert(msgEnterEmail + " " + msgNot);
                      elm.focus();
                      return false;
                     }
                     if(elm.value!='')
                     {
  
                       if(!check)
  
                        {
                          alert(msgInvalidEmail + " " + msgNot);
                          elm.select();
                          return false;
                        }

                    }

	          
        }
		

/*-----------------------validation for life Insurance----------------------	*/



function validate_lifeins()
 {   
    
	  var terms=/^[0-9]+$/; 
	  
	 /*if(document.frm4.gender.value !="")
      {
	    alert( msgPlease + " " + msgSelect + " " + msgGender + msgNot );
	   
	    return false;
	  } */
	 	
	  if(document.frm4.DOB.value !="")
	  {
		var txt=document.getElementById('DOB');                    
        var filter=/^(0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.](19|20)\d\d+$/;               
        var test_bool = filter.test(txt.value);        
        if (test_bool==false)
		{ 
          alert('Please enter the date of birth In MM/DD/YYYY format');            
          txt.focus();            
          return false;                   
         }  
		}
	  
	  /* if(document.frm4.Smoker.value !="")	 
        {
	       alert( msgPlease + " " + msgSelect + " " + msgSmoke  + msgNot );
	       return false;
	     } */
	  
	if( document.frm4.TermYears.value =="") 
	    { 
		 alert(msgTerms + " " + msgBlank + msgNot);	
		  document.frm4.TermYears.focus();
		  return false;
			
		}	
		   
	  
	  
	if( document.frm4.TermYears.value !="")
	 {
	  if(!document.frm4.TermYears.value.match(terms))
	   {
		alert(msgInValidTerms + msgNot);
		document.frm4.TermYears.focus();
		return false;
	   }
	 }
	 
/*	  if(document.frm4.genderB.value !="")	 
      {
	    alert( msgPlease + " " + msgSelect + " " + msgGender + msgNot );
	    return false;
	  } 
*/	 
	  
	 
	 
	   if(document.frm4.DOB2.value !="")
	  {
		var txt=document.getElementById('DOB2');                    
        var filter=/^(0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.](19|20)\d\d+$/;               
        var test_bool = filter.test(txt.value);        
        if (test_bool==false)
		{ 
          alert('Please enter the date of birth In MM/DD/YYYY format');            
          txt.focus();            
          return false;                   
         }  
		}
	
	  
	 
 }
				

/*-------------------------------------------------------------------------------	*/


function ShowHideHelp()
	{
		if (document.getElementById("lnkShowHelp").innerText == "Hide Help Hints")
		{	
			//Change the link from hide to show
			//Test to make sure the help control is available
			//Hide the help control
			document.getElementById("lnkShowHelp").innerText = "Show Help Hints";
			

			/*if (CheckHelpItem(document.getElementById("IncomeProtectionForm1_DualClientControl1_HelpItem3_HelpButton")) == true)
				document.getElementById("IncomeProtectionForm1_DualClientControl1_HelpItem3_HelpButton").style.visibility = "hidden";*/
			
			if (CheckHelpItem(document.getElementById("IncomeProtectionForm1_DualClientControl1_Occupation_1_HelpItemControl_HelpButton")) == true)
				document.getElementById("IncomeProtectionForm1_DualClientControl1_Occupation_1_HelpItemControl_HelpButton").style.visibility = "hidden";
			
			if (CheckHelpItem(document.getElementById("IncomeProtectionForm1_HelpDrivenControl_HelpButton")) == true)
				document.getElementById("IncomeProtectionForm1_HelpDrivenControl_HelpButton").style.visibility = "hidden";
			
			if (CheckHelpItem(document.getElementById("IncomeProtectionForm1_HelpDeferControl_HelpButton")) == true)
				document.getElementById("IncomeProtectionForm1_HelpDeferControl_HelpButton").style.visibility = "hidden";
			
			if (CheckHelpItem(document.getElementById("IncomeProtectionForm1_HelpMonthlyControl_HelpButton")) == true)
				document.getElementById("IncomeProtectionForm1_HelpMonthlyControl_HelpButton").style.visibility = "hidden";
			
			if (CheckHelpItem(document.getElementById("IncomeProtectionForm1_HelpIncBenControl_HelpButton")) == true)
				document.getElementById("IncomeProtectionForm1_HelpIncBenControl_HelpButton").style.visibility = "hidden";
			
			if (CheckHelpItem(document.getElementById("IncomeProtectionForm1_HelpResetControl_HelpButton")) == true)
				document.getElementById("IncomeProtectionForm1_HelpResetControl_HelpButton").style.visibility = "hidden";
			
			if (CheckHelpItem(document.getElementById("IncomeProtectionForm1_HelpGuaranteeControl_HelpButton")) == true)
				document.getElementById("IncomeProtectionForm1_HelpGuaranteeControl_HelpButton").style.visibility = "hidden";
		}
		else
		{
			//Change the link from show to hide
			//Test to make sure the help control is available
			//Show the help control
			document.getElementById("lnkShowHelp").innerText = "Hide Help Hints";
			
			/*if (CheckHelpItem(document.getElementById("IncomeProtectionForm1_DualClientControl1_HelpItem3_HelpButton")) == true)
				document.getElementById("IncomeProtectionForm1_DualClientControl1_HelpItem3_HelpButton").style.visibility = "visible";*/
				
			if (CheckHelpItem(document.getElementById("IncomeProtectionForm1_DualClientControl1_Occupation_1_HelpItemControl_HelpButton")) == true)
				document.getElementById("IncomeProtectionForm1_DualClientControl1_Occupation_1_HelpItemControl_HelpButton").style.visibility = "visible";
				
			if (CheckHelpItem(document.getElementById("IncomeProtectionForm1_HelpDrivenControl_HelpButton")) == true)
				document.getElementById("IncomeProtectionForm1_HelpDrivenControl_HelpButton").style.visibility = "visible";
			
			if (CheckHelpItem(document.getElementById("IncomeProtectionForm1_HelpDeferControl_HelpButton")) == true)
				document.getElementById("IncomeProtectionForm1_HelpDeferControl_HelpButton").style.visibility = "visible";
			
			if (CheckHelpItem(document.getElementById("IncomeProtectionForm1_HelpMonthlyControl_HelpButton")) == true)
				document.getElementById("IncomeProtectionForm1_HelpMonthlyControl_HelpButton").style.visibility = "visible";
			
			if (CheckHelpItem(document.getElementById("IncomeProtectionForm1_HelpIncBenControl_HelpButton")) == true)
				document.getElementById("IncomeProtectionForm1_HelpIncBenControl_HelpButton").style.visibility = "visible";
			
			if (CheckHelpItem(document.getElementById("IncomeProtectionForm1_HelpResetControl_HelpButton")) == true)
				document.getElementById("IncomeProtectionForm1_HelpResetControl_HelpButton").style.visibility = "visible";
			
			if (CheckHelpItem(document.getElementById("IncomeProtectionForm1_HelpGuaranteeControl_HelpButton")) == true)
				document.getElementById("IncomeProtectionForm1_HelpGuaranteeControl_HelpButton").style.visibility = "visible";
		}
	}
			
	function CheckHelpItem(helpControl)
	{
		if (helpControl ? true : false)
			return true ;
		else
			return false;
	}

/*------------------validation for request pension advice---------------*/

  function validate_RPadvice()
  
  {
	  var regexpName=/^[a-zA-Z]+[a-zA-Z.'_\- ]+$/;
	  
	 if(document.form2.empstatus.selectedIndex==0) 
	  {
	 alert(msgPlease + " " +  msgSelect + " " + msgEmpstatus  + " " + msgNot );
	 document.form2.empstatus.focus();
	 return false;
	  } 
	  
	  if(document.getElementById("pentiontotransfer1").checked==false && document.getElementById("pentiontotransfer2").checked==false)
      {
	    alert(  msgPlease + " " + msgSelect + " " + msgPensiontotransfer  + msgNot );
	    
	    return false;
	  }
	     
		 if(document.getElementById("makecontribution1").checked==false && document.getElementById("makecontribution2").checked==false)
      {
	    alert(  msgPlease + " " + msgSelect + " " + msgMakelumpsumcontribution + msgNot );
	    return false;
	  }
	  
	   if(document.form2.title.selectedIndex==0) 
	  {
	 alert(msgPlease + " " +  msgSelect + " " + msgTitle  + " " + msgNot );
	 document.form2.title.focus();
	 return false;
	  } 
	  
	  
	   if(document.form2.forename.value=="")
      {
	    alert( msgForename  +" "+ msgBlank + msgNot);
	    document.form2.forename.focus();
	    return false;
	  }
		   if(document.form2.forename.value !="")
		   {
		  if(!document.form2.forename.value.match(regexpName))
	        {
		        alert(msgInvalidForename  + msgNot );
		        document.form2.forename.value = "";
		        document.form2.forename.focus();
		        return false;
	         }
		   }
		  
	   if(document.form2.sname.value=="")
        {
	      alert( msgLastName +" "+ msgBlank + msgNot);
	      document.form2.sname.focus();
	      return false;
	    }
		   if(document.form2.sname.value!="")
		    { 
		      if(!document.form2.sname.value.match(regexpName))
	           {
		          alert(msgInvalidSurname  + msgNot );
		          document.form2.sname.value = "";
		          document.form2.sname.focus();
		          return false;
	            }
			}
	
	
	    if(document.form2.Day.selectedIndex==0) 
	     {
	       alert(msgPlease + " " +  msgSelect + " " + msgDate  + " " + msgNot );
	       document.form2.Day.focus();
	       return false;
	     } 
	
	
	     if(document.form2.month.selectedIndex==0) 
	     {
	       alert(msgPlease + " " +  msgSelect + " " + msgMonth  + " " + msgNot );
	       document.form2.month.focus();
	       return false;
	     } 
	
	
	    if(document.form2.year.selectedIndex==0) 
	     {
	       alert(msgPlease + " " +  msgSelect + " " + msgYear  + " " + msgNot );
	       document.form2.year.focus();
	       return false;
	     } 
	 
	         
      
	
	
		 /* var postcode1=/^[0-9]+$/;
				  if(document.form2.postcode.value == "")
				  {
					 alert(msgPostCODE  + " " + msgBlank + msgNot);
		                   document.form2.postcode.focus();
		                    return false;  
					 }  
					  				 
				 
	             if(document.form2.postcode.value != "")
	               {
		              if(!document.form2.postcode.value.match(postcode1))
	                    {
		                   alert(msginvalidpostcode  + msgNot);
		                   document.form2.postcode.select();
		                    return false;
	                    }
		           } */
		   
		   
		   var reg1 =/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,15})+$/;
            var elm = document.form2.email;
            var check=reg1.test(elm.value);
            if(elm.value=='')
               {
                   alert(msgEnterEmail + " " + msgNot);
                   elm.focus();
                    return false;
               }
             if(elm.value!='')
              {
  
                 if(!check)
  
                     {
                       alert(msgInvalidEmail + " " + msgNot);
                        elm.select();
                         return false;
                       }

                 } 
				 
				 var phonecode1=/^[0-9,(, ), +, -]+$/;
				
				  if(document.form2.contno.value == "")
				  {
					 alert(msgcontactnumber  + " " + msgBlank + msgNot);
		                   document.form2.contno.focus();
		                    return false;  
					 }  
					  				 
				 
	             if(document.form2.contno.value != "")
	               {
		              if(!document.form2.contno.value.match(phonecode1))
	                    {
		                  alert(msginvalidcontactnumber + msgNot);
		                  document.form2.contno.select();
		                  return false;
	                    }
					
					  if(document.form2.contno.value.length<10)
	                    {
	                      alert(msginvalidcontactnumber + msgNot);
		                  document.form2.contno.select();
		                  return false;	
	                    }
					
		           } 
	  }
	  

	
	
	
	 
	 
/*------------------validation for leap year--------------------------*/


function checkleapyear(datea)
{
	datea = parseInt(datea);

	if(datea%4 == 0)
	{
		if(datea%100 != 0)
		{
			return true;
		}
		else
		{
			if(datea%400 == 0)
				return true;
			else
				return false;
		}
	  }
           return false;
}


	
	
/*----------------------------validation for affiliate---------------------------	*/
 function validate_affiliate()
  {
    var regexpName=/^[a-zA-Z]+[a-zA-Z.'_\- ]+$/;
   
    if(document.form2.name.value=="")
      {
	    alert( msgName +" "+ msgBlank + msgNot);
	    document.form2.name.focus();
	    return false;
	  }
		   if(document.form2.name.value !="")
		   {
		  if(!document.form2.name.value.match(regexpName))
	        {
		        alert(msgInvalidNAME + msgNot );
		        document.form2.name.value = "";
		        document.form2.name.focus();
		        return false;
	         }
		   }
 
 
  var reg1 =/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,15})+$/;
            var elm = document.form2.email;
            var check=reg1.test(elm.value);
            if(elm.value=='')
               {
                   alert(msgEnterEmail + " " + msgNot);
                   elm.focus();
                    return false;
               }
             if(elm.value!='')
              {
  
                 if(!check)
  
                     {
                       alert(msgInvalidEmail + " " + msgNot);
                        elm.select();
                         return false;
                       }

                 } 
 
  var phonecode1=/^[0-9,(, ), +, -]+$/;
				
				  if(document.form2.phoneno.value == "")
				  {
					 alert(msgPh  + " " + msgBlank + msgNot);
		                   document.form2.phoneno.focus();
		                    return false;  
					 }  
					  				 
				 
	             if(document.form2.phoneno.value != "")
	               {
		              if(!document.form2.phoneno.value.match(phonecode1))
	                    {
		                  alert(msginvalidPHONE  + msgNot);
		                  document.form2.phoneno.select();
		                  return false;
	                    }
					
					  if(document.form2.phoneno.value.length<10)
	                    {
	                      alert(msginvalidPHONE  + msgNot);
		                  document.form2.phoneno.select();
		                  return false;	
	                    }
					
		           } 
	
  }
	
	
/*------------------------------validation for investment Advice----------------	*/




  function validate_investmentdvice()
  
  {
	  var regexpName=/^[a-zA-Z]+[a-zA-Z.'_\- ]+$/;
	  
		  
	  if(document.getElementById("investmentlength").checked==false && document.getElementById("investmentlength2").checked==false)
      {
	    alert(  msgPlease + " " + msgSelect + " " + msgLengthofinvestment + msgNot );
	    return false;
	  }
	  
	   if(document.form2.contributiontype.selectedIndex==0) 
	    {
	      alert(msgPlease + " " +  msgSelect + " " + msgContributiontype   + " " + msgNot );
	    document.form2.contributiontype.focus();
	 return false;
	  } 
	  
	  
	   if(document.form2.title.selectedIndex==0) 
	  {
	 alert(msgPlease + " " +  msgSelect + " " + msgTitle  + " " + msgNot );
	 document.form2.title.focus();
	 return false;
	  } 
	  
	  
	   if(document.form2.forename.value=="")
      {
	    alert( msgForename  +" "+ msgBlank + msgNot);
	    document.form2.forename.focus();
	    return false;
	  }
		   if(document.form2.forename.value !="")
		   {
		  if(!document.form2.forename.value.match(regexpName))
	        {
		        alert(msgInvalidForename  + msgNot );
		        document.form2.forename.value = "";
		        document.form2.forename.focus();
		        return false;
	         }
		   }
		  
	   if(document.form2.sname.value=="")
        {
	      alert( msgLastName +" "+ msgBlank + msgNot);
	      document.form2.sname.focus();
	      return false;
	    }
		   if(document.form2.sname.value!="")
		    { 
		      if(!document.form2.sname.value.match(regexpName))
	           {
		          alert(msgInvalidSurname  + msgNot );
		          document.form2.sname.value = "";
		          document.form2.sname.focus();
		          return false;
	            }
			}
	
	
	    if(document.form2.Day.selectedIndex==0) 
	     {
	       alert(msgPlease + " " +  msgSelect + " " + msgDate  + " " + msgNot );
	       document.form2.Day.focus();
	       return false;
	     } 
	
	
	     if(document.form2.month.selectedIndex==0) 
	     {
	       alert(msgPlease + " " +  msgSelect + " " + msgMonth  + " " + msgNot );
	       document.form2.month.focus();
	       return false;
	     } 
	
	
	    if(document.form2.year.selectedIndex==0) 
	     {
	       alert(msgPlease + " " +  msgSelect + " " + msgYear  + " " + msgNot );
	       document.form2.year.focus();
	       return false;
	     } 
	 
	         
      
	
	
		  var postcode1=/^[0-9]+$/;
				  if(document.form2.postcode.value == "")
				  {
					 alert(msgPostCODE  + " " + msgBlank + msgNot);
		                   document.form2.postcode.focus();
		                    return false;  
					 }  
					  				 
				 
	             if(document.form2.postcode.value != "")
	               {
		              if(!document.form2.postcode.value.match(postcode1))
	                    {
		                   alert(msginvalidpostcode  + msgNot);
		                   document.form2.postcode.select();
		                    return false;
	                    }
		           } 
		   
		   
		   var reg1 =/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,15})+$/;
            var elm = document.form2.email;
            var check=reg1.test(elm.value);
            if(elm.value=='')
               {
                   alert(msgEnterEmail + " " + msgNot);
                   elm.focus();
                    return false;
               }
             if(elm.value!='')
              {
  
                 if(!check)
  
                     {
                       alert(msgInvalidEmail + " " + msgNot);
                        elm.select();
                         return false;
                       }

                 } 
				 
				 var phonecode1=/^[0-9,(, ), +, -]+$/;
				
				  if(document.form2.contno.value == "")
				  {
					 alert(msgcontactnumber  + " " + msgBlank + msgNot);
		                   document.form2.contno.focus();
		                    return false;  
					 }  
					  				 
				 
	             if(document.form2.contno.value != "")
	               {
		              if(!document.form2.contno.value.match(phonecode1))
	                    {
		                  alert(msginvalidcontactnumber + msgNot);
		                  document.form2.contno.select();
		                  return false;
	                    }
					
					  if(document.form2.contno.value.length<10)
	                    {
	                      alert(msginvalidcontactnumber + msgNot);
		                  document.form2.contno.select();
		                  return false;	
	                    }
					
		           } 
	  }
	  





/*-----------validation for feedback--------------------------------------*/


  function validate_feedback()
  {
	  
	  if(document.getElementById("sitehelp1").checked==false && document.getElementById("sitehelp2").checked==false)
      {
	    alert(  msgPlease + " " + msgSelect + " " + msgoption + msgNot );
	    return false;
	  }
	 
	 var reg1 =/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,15})+$/;
            var elm = document.feedbackform.email;
            var check=reg1.test(elm.value);
            if(elm.value=='')
               {
                   alert(msgEnterEmail + " " + msgNot);
                   elm.focus();
                    return false;
               }
             if(elm.value!='')
              {
  
                 if(!check)
  
                     {
                       alert(msgInvalidEmail + " " + msgNot);
                        elm.select();
                         return false;
                       }

                 } 
				 
	           
			    if(document.feedbackform.comments.value == "")
				  {
					 alert(msgComments  + " " + msgBlank + msgNot);
		             document.feedbackform.comments.focus();
		              return false;  
					 }  
	  
	 } 
	  
 /* ------------------------------------------------------------------------------- */
 
 
 
		function checkDate() {
 
  var myDayStr = document.form2.Day.value;;
var myMonthStr =  document.form2.month.value;;
var myYearStr = document.form2.year.value;
var myMonth = new Array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'); var myDateStr = myDayStr + ' ' + myMonth[myMonthStr] + ' ' + myYearStr;

/* Using form values, create a new date object
using the setFullYear function */
var myDate = new Date();
myDate.setFullYear( myYearStr, myMonthStr, myDayStr );

if ( myDate.getMonth() != myMonthStr ) {
  alert( 'I\'m sorry, but "' + myDateStr + '" is NOT a valid date.' );
} /*else {
  alert( 'Congratulations! "' + myDateStr + '" IS a valid date.' );
}*/
 
}
 
