
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){
	   return false
	}

	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
	   return false
	}

	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
	    return false
	}

	 if (str.indexOf(at,(lat+1))!=-1){
	    return false
	 }

	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
	    return false
	 }

	 if (str.indexOf(dot,(lat+2))==-1){
	    return false
	 }
	
	 if (str.indexOf(" ")!=-1){
	    return false
	 }

	 return true					
}



function checkForm() {
	
	//check Company Name
	if (!document.enquiryForm.company.value) {
		document.enquiryForm.company.focus();
		alert ('Please enter "Company Name"');
		return false;
	}

	//check Country
	if (document.enquiryForm.country.value == -1) {
		document.enquiryForm.country.focus();
		alert ('Please select "Country"');
		return false;
	}
	
	//check Contact Person
	if (!document.enquiryForm.contact.value) {
		document.enquiryForm.contact.focus();
		alert ('Please enter "Contact Person"');
		return false;
	}
	
	//check Email Address
	if (!document.enquiryForm.email.value) {
		document.enquiryForm.email.focus();
		alert ('Please enter "Email Address"');
		return false;
	}
	if (echeck(document.enquiryForm.email.value) == false){
		document.enquiryForm.email.focus();
		alert ('Invalid "Email Address"');
		return false
	}
	

	//check Enquiry / Comment
	if (!document.enquiryForm.comment.value) {
		document.enquiryForm.comment.focus();
		alert ('Please enter "Enquiry / Comment"');
		return false;
	}
	
	document.enquiryForm.submit();

}


