

/////validate trade enquiry
function validateIcast(theForm) {
	
	if (theForm.comNameIcast.value.length < 1) {

    alert("A company name is required!");

    theForm.comNameIcast.focus();

    return (false);

  }
	
	
	if (theForm.conNameIcast.value.length < 1) {

    alert("A contact name is required!");

    theForm.conNameIcast.focus();

    return (false);

  }
  
  
  
  /* Email check */

 

 {

	var emailID=document.icast.conEmailIcast

	

	if ((emailID.value==null)||(emailID.value=="")){

		alert("Please Enter your Email Address")

		emailID.focus()

		return false

	}

	if (echeck(emailID.value)==false){

		//emailID.value=""

		emailID.focus()

		return false

	}

 }
 
  /* Check delivery Tel is a number */

	if ( (parseFloat(theForm.phoneIcast.value) != theForm.phoneIcast.value) ||

             theForm.phoneIcast.value.length < 0 ||

             theForm.phoneIcast.value.length > 255) {

		alert("The phone number must be a number with no spaces");

		theForm.phoneIcast.focus();

		theForm.phoneIcast.select();

		return (false);

	}
 
  
  /* date time */
  
  if (theForm.date1.value == "Wed 13-07-2011" && theForm.date2.value == "Thur 14-07-2011" && theForm.date3.value == "Fri 15-07-2011")

  {

    alert("Please select a preferred date and time!");

    theForm.date1.focus();

    return (false);

  }




}



/////validate trade enquiry
function validateTrade(theForm) {
	
	if (theForm.conName.value.length < 1) {

    alert("A contact name is required!");

    theForm.conName.focus();

    return (false);

  }
  
  if (theForm.comName.value.length < 1) {

    alert("A company name is required!");

    theForm.comName.focus();

    return (false);

  }
  
  /* Email check */

 

 {

	var emailID=document.trade.conEmail

	

	if ((emailID.value==null)||(emailID.value=="")){

		alert("Please Enter your Email Address")

		emailID.focus()

		return false

	}

	if (echeck(emailID.value)==false){

		//emailID.value=""

		emailID.focus()

		return false

	}

 }
 
  /* Check delivery Tel is a number */

	if ( (parseFloat(theForm.phone.value) != theForm.phone.value) ||

             theForm.phone.value.length < 0 ||

             theForm.phone.value.length > 255) {

		alert("The phone number must be a number with no spaces");

		theForm.phone.focus();

		theForm.phone.select();

		return (false);

	}
 
  
  /* country */
  
  if (theForm.country.value == "** Select Country **")

  {

    alert("Please select your Country");

    theForm.country.focus();

    return (false);

  }
	
}

function Validator(theForm)

{

 

   

   /* Check First Name */

  if (theForm.firstname.value.length < 1)

  {

    alert("You cannot leave your First Name Blank!");

    theForm.firstname.focus();

    return (false);

  }

 

  

   /* Check Last Name */

  if (theForm.lastname.value.length < 1)

  {

    alert("You cannot leave your Last Name Blank!");

    theForm.lastname.focus();

    return (false);

  }

  

   /* Address 1 */

  if (theForm.addressa.value.length < 1)

  {

    alert("You cannot leave the address Field blank");

    theForm.addressa.focus();

    return (false);

  }  

  

    

    /* Address 2 */

  if (theForm.addressb.value.length < 1)

  {

    alert("You cannot leave the address Field blank");

    theForm.addressb.focus();

    return (false);

  }  

  

 

    /* PostCode */

  if (theForm.postcode.value.length < 1)

  {

    alert("You cannot leave the postcode Field blank");

    theForm.postcode.focus();

    return (false);

  }  

  

  

     /* Tel */

  if (theForm.phone.value.length < 1)

  {

    alert("You cannot leave the Telephone Field blank");

    theForm.phone.focus();

    return (false);

  }  

 

 

 

 /* Email check */

 

 {

	var emailID=document.Subscribe.email

	

	if ((emailID.value==null)||(emailID.value=="")){

		alert("Please Enter your Email ID")

		emailID.focus()

		return false

	}

	if (echeck(emailID.value)==false){

		//emailID.value=""

		emailID.focus()

		return false

	}

 }



 

  

 /* Check Tel is a number */

	if ( (parseFloat(theForm.phone.value) != theForm.phone.value) ||

             theForm.phone.value.length < 0 ||

             theForm.phone.value.length > 255) {

		alert("The phone number must be a number");

		theForm.phone.focus();

		theForm.phone.select();

		return (false);

	}

 



   /* Check Country */

  if (theForm.country.value == "** Select **")

  {

    alert("You must select a Country");

    theForm.country.focus();

    return (false);

  }



  

   /* Product */

  if (theForm.prod_code.value.length < 1)

  {

    alert("You cannot leave the Product Field blank");

    theForm.prod_code.focus();

    return (false);

  }  

  

  /* Date */

  if (theForm.date_purchase.value.length < 1)

 {

    alert("You cannot leave the Purchase Date Field blank");

    theForm.date_purchase.focus();

    return (false);

  }  



/* Place */

  if (theForm.place_purchase.value.length < 1)

 {

    alert("You cannot leave the Place of Purchase Field blank");

    theForm.place_purchase.focus();

    return (false);

  }  



 }





function echeck(str) {



		var at="@"

		var dot="."

		var lat=str.indexOf(at)

		var lstr=str.length

		var ldot=str.indexOf(dot)

		if (str.indexOf(at)==-1){

		   alert("Invalid E-mail ID")

		   return false

		}



		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){

		   alert("Invalid E-mail ID")

		   return false

		}



		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){

		    alert("Invalid E-mail ID")

		    return false

		}



		 if (str.indexOf(at,(lat+1))!=-1){

		    alert("Invalid E-mail ID")

		    return false

		 }



		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){

		    alert("Invalid E-mail ID")

		    return false

		 }



		 if (str.indexOf(dot,(lat+2))==-1){

		    alert("Invalid E-mail ID")

		    return false

		 }

		

		 if (str.indexOf(" ")!=-1){

		    alert("Invalid E-mail ID")

		    return false

		 }



 		 return true					

	}

	

	

function Validator1(theForm)

{



   

   /* Check First Name */

  if (theForm.firstname.value.length < 1)

  {

    alert("You cannot leave your First Name Blank!");

    theForm.firstname.focus();

    return (false);

    

  }

 

  

   /* Check Last Name */

  if (theForm.lastname.value.length < 1)

  {

    alert("You cannot leave your Last Name Blank!");

    theForm.lastname.focus();

    return (false);

  }	

	

	

/* Email check */

 

 {

	var emailID=document.regDetails.email

	

	if ((emailID.value==null)||(emailID.value=="")){

		alert("Please Enter your Email ID")

		emailID.focus()

		return false

	}

	if (echeck(emailID.value)==false){

		//emailID.value=""

		emailID.focus()

		return false

	}

 }	



/* Check Customer Reference */

  if (theForm.custRef.value.length < 1)

  {

    alert("You cannot leave your Customer Reference Blank!");

    theForm.custRef.focus();

    return (false);

  }



/* Check Warranty Reference 

  if (theForm.warrRef.value.length < 1)

  {

    alert("You cannot leave your Warranty Reference Blank!");

    theForm.warrRef.focus();

    return (false);

  }	*/

	

/* Check CR is a number */

	if ( (parseFloat(theForm.custRef.value) != theForm.custRef.value) ||

             theForm.custRef.value.length < 0 ||

             theForm.custRef.value.length > 255) {

		alert("The Customer Reference number must be a number");

		theForm.custRef.focus();

		theForm.custRef.select();

		return (false);

	}	

	else 

	{

	document.getElementById('message').style.visibility="visible";

	return (true);

	

}

	 /*Check WR is a number 

	if ( (parseFloat(theForm.warrRef.value) != theForm.warrRef.value) ||

             theForm.warrRef.value.length < 0 ||

             theForm.warrRef.value.length > 255) {

		alert("The Warranty Reference number must be a number");

		theForm.warrRef.focus();

		theForm.warrRef.select();

		return (false);

	}*/

	

}





/*

function showmessage (elmnt) {

document.getElementById(elmnt).style.visibility="visible"

}

 onclick="showmessage ('message')"

*/


