// JavaScript Document


function validate() {
	var form_name = document.frmcontact;	
//	alert(form_name.ExistingBT[0].checked);
	if(form_name.Btline[0].checked==false && form_name.Btline[1].checked==false){
		alert("Please select the BT line");
		form_name.Btline[0].focus();
		return false;
	}

  	
	if(form_name.Btlinetype[0].checked==false && form_name.Btlinetype[1].checked==false && form_name.Btline[0].checked==true ){
		alert("Please select the BT line type");
		form_name.Btlinetype[0].focus();
		return false;
	}
	
	if(form_name.ExistingBT[0].checked==false && form_name.ExistingBT[1].checked==false && form_name.Btline[0].checked==true){
		alert("Please select whether you are existing BT cusotmer");
		form_name.ExistingBT[0].focus();
		return false;
	}
	
	
	if(form_name.ExistingBT[0].checked==true && form_name.Btline[0].checked==true){
		if(form_name.txtemail1.value!=""){
			if(EmailValidate(form_name.txtemail1," email")==false){ return false;}
		}	
		if(form_name.txtemail2.value!=""){
			if(EmailValidate(form_name.txtemail2," email")==false){ return false;}
		}	
		if(form_name.txtemail3.value!=""){
			if(EmailValidate(form_name.txtemail3," email")==false){ return false;}
		}	
		if(TextValidate(form_name.BTpassword,"the password")==false){return false;}
	}
	
			
	if(TextValidate(form_name.ADSLphone,"the ADSL phone number")==false){return false;}		
	if(TextValidate(form_name.Highwayphone,"the Highway Conversion Number")==false){return false;}
	if(DateValidate1(form_name.InstallDate,form_name.InstallDate.value)==false){ return false;}
	if(form_name.InstallTime[0].checked==false && form_name.InstallTime[1].checked==false){
		alert("Please select preferred installation time");
		form_name.InstallTime[0].focus();
		return false;
	}
	
	if(TextValidate(form_name.txtFirstname," the First Name")==false){return false;}
	if(TextValidate(form_name.txtLastname,"the Last Name")==false){return false;}	
	if(TextValidate(form_name.txtCompany,"the Company Name")==false){return false;}	
	if(TextValidate(form_name.txtAddress1,"the Address1")==false){return false;}	
	if(TextValidate(form_name.txtAddress2,"the Address2")==false){return false;}	
	if(TextValidate(form_name.txtTown,"the Town")==false){return false;}	
	if(TextValidate(form_name.txtCountry,"the Country")==false){return false;}	
	if(TextValidate(form_name.txtPostcode,"the Post Code")==false){return false;}	
	if(TextValidate(form_name.maincontact,"Contact number")==false){return false;}	
	
	
	
	
	
	if(form_name.BtTerms[0].checked==false && form_name.BtTerms[1].checked==false){
		alert("Please confirm that the customer has accepted the BT Openworld Terms and conditions and Privacy Policy for the service");
		form_name.BtTerms[0].focus();
		return false;
	}
	if(form_name.BTinformation[0].checked==false && form_name.BTinformation[1].checked==false){
		alert("Please confirm that the customer wish to receive BT information regarding new products/ special offers?");
		form_name.BTinformation[0].focus();
		return false;
	}
	
	if(form_name.Informother[0].checked==false && form_name.Informother[1].checked==false){
		alert("Please confirm that the customer wish to receive information from other companies ?");
		form_name.Informother[0].focus();
		return false;
	}
	
	if(TextValidate(form_name.txtCustomername,"the Customer Name")==false){return false;}	
	if(TextValidate(form_name.txtCustomerpwd,"the Customer Password")==false){return false;}	
	
	if(form_name.txtCustomerpwd.value!=""){
		
		if(LengthValidate(form_name.txtCustomerpwd,8)==false){
			return false;
		}
		if(isAlphanum(form_name.txtCustomerpwd.value)==false){
			return false;
		}
	
	}
	if(DateValidate(form_name.txtDob,form_name.txtDob.value)==false){ return false;}
	if(TextValidate(form_name.txtMothername,"the Mother's maiden name")==false){return false;}	
	
	
	form_name.action="broadband-voip.php?action=submit";
	form_name.submit();
	
}

function showcontent(stat) {

   if(stat=="Yes"){
     document.getElementById("existinguser1").style.display='';
	 document.getElementById("existinguser2").style.display='';
	 document.getElementById("existinguser3").style.display='';
	 document.getElementById("existinguser4").style.display='';
	 document.getElementById("existinguser5").style.display='';
   }else{
     document.getElementById("existinguser1").style.display='none';
	 document.getElementById("existinguser2").style.display='none';
	 document.getElementById("existinguser3").style.display='none';
	 document.getElementById("existinguser4").style.display='none';
	 document.getElementById("existinguser5").style.display='none';
   }


}


function showcontent1(stat) {

   if(stat=="Yes"){
     document.getElementById("existingbtlines1").style.display='';
	 document.getElementById("existingbtlines2").style.display='';
	 document.getElementById("existingbtlines3").style.display='';
	 document.getElementById("existingbtlines4").style.display='';
	
   }else{
     document.getElementById("existingbtlines1").style.display='none';
	 document.getElementById("existingbtlines2").style.display='none';
	 document.getElementById("existingbtlines3").style.display='none';
	 document.getElementById("existingbtlines4").style.display='none';
	 document.getElementById("existinguser1").style.display='none';
	 document.getElementById("existinguser2").style.display='none';
	 document.getElementById("existinguser3").style.display='none';
	 document.getElementById("existinguser4").style.display='none';
	 document.getElementById("existinguser5").style.display='none';
   }


}

