// JavaScript Document
function validatesampleform()
{
	if(document.getElementById('enqname').value=="")
	{
		alert("Please specify your name.");	
		document.getElementById('enqname').focus();
		return false;
	}
	if(document.getElementById('enqcontactphone').value=="")
	{
		alert("Please specify Contact Telephone number.");	
		document.getElementById('enqcontactphone').focus();
		return false;
	}else if(!isPhone(document.getElementById('enqcontactphone').value)) {
		alert("Please specify valid Phone Number.");		
		document.getElementById('enqcontactphone').focus();
		return false;
	}
	if(document.getElementById('enqemail').value=="")
	{
		alert("Please specify Your E - Mail Address.");	
		document.getElementById('enqemail').focus();
		return false;
	}else if(!isEmailValid(document.getElementById('enqemail').value)) {
		alert("Please specify valid E-mail.");		
		document.getElementById('enqemail').focus();
		return false;
	}
	if(document.getElementById('enqcompany').value=="")
	{
		alert("Please specify Your Company Name.");	
		document.getElementById('enqcompany').focus();
		return false;
	}
	if(document.getElementById('enqaddress').value=="")
	{
		alert("Please specify Your Address.");	
		document.getElementById('enqaddress').focus();
		return false;
	}
	if(document.getElementById('enqpostcode').value=="")
	{
		alert("Please specify Your Postal Code.");	
		document.getElementById('enqpostcode').focus();
		return false;
	}
	if(document.getElementById('hearusfrom').value=="")
	{
		alert("Please specify from where did you hear about us?");	
		document.getElementById('hearusfrom').focus();
		return false;
	}
	
	    document.frmsampleorder.submit();
	 
}
function isEmailValid(sEmail) {
		if (sEmail.value == '' || sEmail.indexOf('.') == 0 || 
sEmail.indexOf('.') == -1 || sEmail.indexOf('@') == 0 || sEmail.indexOf('@') == -1 || 
sEmail.indexOf('.') == sEmail.length - 1 || sEmail.indexOf(',') >= 0) {
	    	return false;
		} else {
				return true;
		}
		}

function isPhone(phone)
{
	var temp="";
	for(var i=0;i<phone.length;i++)
	{
			temp=phone.charAt(i);
			if(temp==" ")
				continue;
			if(!(temp>="0" && temp<="9"))
				return false;
	}
	return true;
}	


