 function email(str) {
	    var error = "";
  var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){  
		document.getElementById("email").style.backgroundColor = '#FFDFE3';	
		
		   error = "Invalid E-mail\n";
		   return error;
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){  
		document.getElementById("email").style.backgroundColor = '#FFDFE3';	
	
		   error = "Invalid E-mail\n";
		   return error;
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		document.getElementById("email").style.backgroundColor = '#FFDFE3';	
	
		       error = "Invalid E-mail\n";
		   return error;
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		document.getElementById("email").style.backgroundColor = '#FFDFE3';	

		     error = "Invalid E-mail\n";
		   return error;
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){	 
		document.getElementById("email").style.backgroundColor = '#FFDFE3';	

		      error = "Invalid E-mail\n";
		   return error;
		 }

		 if (str.indexOf(dot,(lat+2))==-1){	
		document.getElementById("email").style.backgroundColor = '#FFDFE3';	

		   error = "Invalid E-mail\n";
		   return error;
		 }
		
		 if (str.indexOf(" ")!=-1){
		     error = "Invalid E-mail\n";
		document.getElementById("email").style.backgroundColor = '#FFDFE3';	

		   return error;
		 }

		   return error; 
}

function validate_form() {
var reason = "";


	reason += email(document.ASP_Enquiry.email.value);
  	reason += validateaddress();
  	reason += validatecasino();		
  	reason += validatehuman();
	
  if (reason != "") {
    alert("Some fields need correction:\n" + reason);
    return false;
  }
else
{
   document.ASP_Enquiry.submit();
   }
}
function validateaddress() {
    var error = "";
 
    if (document.ASP_Enquiry.address.value == "") 
	{	
		document.getElementById("address").style.backgroundColor = '#FFDFE3';
        error = "Please specify the venue address.\n";
    } 
    return error;  
	
}

function validatecasino() {
    var error = "";
 
    if (document.ASP_Enquiry.casino.checked == false) 
	{	
		document.getElementById("casino").style.backgroundColor = '#FFDFE3';
        error = "Please specify type of entertainment required.\n";
    } 
    return error;  
	
}

function validatehuman() {
    var error = "";
 
    if (document.ASP_Enquiry.human.value !== "5") 
	{	
		document.getElementById("human").style.backgroundColor = '#FFDFE3';
        error = "Please answer the question - what is 2+3?.\n";
    } 
    return error;  
	
}

