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("Please enter your email address in the correct format i.e. someone@something.co.uk")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Please enter your email address in the correct format i.e. someone@something.co.uk")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Please enter your email address in the correct format i.e. someone@something.co.uk")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Please enter your email address in the correct format i.e. someone@something.co.uk")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Please enter your email address in the correct format i.e. someone@something.co.uk")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Please enter your email address in the correct format i.e. someone@something.co.uk")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Please enter your email address in the correct format i.e. someone@something.co.uk")
		    return false
		 }

 		 return true				
	}

function ValidateForm(){
	var name=document.form1.name
	var email=document.form1.email
			
if ((email.value==null)||(email.value=="")){
		alert("Please Enter a valid Email address")
		email.focus()
		return false
	}
	else if (echeck(email.value)==false){
		email.value=""
		email.focus()
		return false
	}
	return true
 }
 
 function ValidateContactForm(){
	var name=document.contact_form.name
	var email=document.contact_form.email
			
 if ((email.value==null)||(email.value=="")){
		alert("Please Enter a valid Email address")
		email.focus()
		return false
	}
	else if (echeck(email.value)==false){
		email.value=""
		email.focus()
		return false
	}
	return true
 }


function ValidateOrderForm(){
var cfirstname=document.order_form.cfirstname
	var csurname=document.order_form.csurname
	var cphone=document.order_form.cphone
	var caddress=document.order_form.caddress
	var ctown=document.order_form.ctown
	var ccounty=document.order_form.ccounty
	var cpostcode=document.order_form.cpostcode
	var cemail=document.order_form.email
	var agree=document.order_form.agree
    
   if ((cfirstname.value==null)||(cfirstname.value=="")){
        alert ("Please enter your First Name")
		cfirstname.focus()
		return false
    }
    
   else if ((csurname.value==null)||(csurname.value=="")){
        alert ("Please enter your Last Name")
		csurname.focus()
		return false
    }
    
     else if ((cphone.value==null)||(cphone.value=="")){
        alert ("Please enter your Telephone Number")
		cphone.focus()
		return false
    }
    
    else  if ((cemail.value==null)||(cemail.value=="")){
		alert("Please Enter a valid Email address")
		cemail.focus()
		return false
	}
	else if (echeck(cemail.value)==false){
		cemail.value=""
		cemail.focus()
		return false
	}
        
    else if ((caddress.value==null)||(caddress.value=="")){
        alert ("Please enter your Address")
		caddress.focus()
		return false
    }
    
    else if ((ctown.value==null)||(ctown.value=="")){
        alert ("Please enter your Town")
		ctown.focus()
		return false
    }
    
    else if ((ccounty.value==null)||(ccounty.value=="")){
        alert ("Please enter your County")
		ccounty.focus()
		return false
    }
    
    else if ((cpostcode.value==null)||(cpostcode.value=="")){
        alert ("Please enter your Postcode")
		cpostcode.focus()
		return false
    }
   else if (document.order_form.agree.checked==false){
        alert ("To process the order you must tick the box and agree to our terms and conditions.")
		agree.focus()
		return false
    }
	
return true
 }