// JavaScript Document

function chk_string( str, req, min, max )// Checking the lent of the text box
{
	if( str.length == 0 && !req )
		return 0;
	if( str.length < min || str.length > max )
		return 1;
	return 0;
}


function chk_email( str, req )
{
	var email_RegEx = /^\w+([-.]\w+)*\@\w+([-.]\w+)*\.\w+$/;
	if( str.length == 0 && !req )
	    return 0;
	var found = email_RegEx.test( str );
	if( found == false )
	    return 1;
	return 0;
}
function proenquiry()
{	
	
	// JavaScript Document


if( chk_string( document.form.customername.value, 1, 2, 200 ) )
	{
		alert("Customer Name is not specified");
		document.form.customername.focus();
		return false;
	}	
	
	if( chk_string( document.form.address.value, 1, 2, 500 ) )
	{
		alert("Customer Address  is not specified");
		document.form.address.focus();
		return false;
	}	
	
	
	if( chk_string( document.form.zipcode.value, 1, 2, 15 ) )
	{
		alert("Zip Code is not specified");
		document.form.zipcode.focus();
		return false;
	}	
	
	if( chk_string( document.form.ccodephoneno.value, 1, 2, 15 ) )
	{
		alert("Country code is not specified");
		document.form.ccodephoneno.focus();
		return false;
	}	
		if( chk_string( document.form.acodephoneno.value, 1, 2, 15 ) )
	{
		alert("Area code is not specified");
		document.form.acodephoneno.focus();
		return false;
	}	
	

	if( chk_string( document.form.phoneno.value, 1, 2, 15 ) )
	{
		alert("Phone No. is not specified");
		document.form.phoneno.focus();
		return false;
	}	
	
	
	
	
	if( chk_string( document.form.ccodecontactno.value, 1, 2, 15 ) )
	{
		alert("Country code is not specified");
		document.form.ccodecontactno.focus();
		return false;
	}	
	
	if( chk_string( document.form.acodecontactno.value, 1, 2, 15 ) )
	{
		alert("Area code is not specified");
		document.form.acodecontactno.focus();
		return false;
	}	
	
	
	
	
	
	if( chk_string( document.form.contactno.value, 1, 2, 15 ) )
	{
		alert("Contact No. is not specified");
		document.form.contactno.focus();
		return false;
	}	
	
	
	

	 if( chk_email( document.form.email.value, 1, 2, 100 ) )
	{
		alert("Email Id invalid or not specified");
		document.form.email.focus();
		return false;
	} 
	
	
}	













