/* =========================================================================

JavaScript Source File -- Created with SAPIEN Technologies PrimalSCRIPT (TM)

NAME: ask_for_quote.js

AUTHOR: Rustom Rawat , Access Web Solutions
DATE  : 9/28/03
COPYRIGHT: (c) 2003 Access Web Solutions.
COMMENT: AWS grants you a royalty free license to use or modify this 
		 software provided that this copyright notice appears on all copies.
 		 This software is provided "AS IS," without a warranty of any kind.
 		 
============================================================================ */

function askquote()
{
var form = window.document.frmQuote
	if (form.Name.value == "" || form.Name.value.length < 3)
	{
	alert("Please enter your name in the \"Name\" field.");
	form.Name.focus();
	return false;
	}
	if (form.Email.value == "" || form.Email.value.length < 12)
	{
	alert("Please enter your email address in the \"Email\" field.");
	form.Email.focus();
	return false;
	}
	if (form.City.value == "" || form.City.length < 5)
	{
	alert("Please enter your city in the \"City\" field.");
	form.City.focus();
	return false;
	}
	if (form.Country.value == "" || form.Country.value.length < 2)
	{
	alert("Please enter your country in the \"Country\" field.");
	form.Country.focus();
	return false;
	}
	if (form.phone_area.value == "" || form.phone_area.value.length < 3)
	{
	alert("Please enter your city code in the \"Phone\" field.");
	form.phone_area.focus();
	return false;
	}
	if (form.phone_area.value)
	{
  	if (!isNum(form.phone_area.value))
	  {
	  alert("Please enter only valid numbers.");
	  form.phone_area.focus();
	  return false;
	  }
	}
	if (form.phone_exch.value == "" || form.phone_exch.value.length < 3)
	{
	alert("Please enter your area code in the \"Phone\" field.");
	form.phone_exch.focus();
	return false;
	}
	if (form.phone_exch.value)
	{
  	if (!isNum(form.phone_exch.value))
	  {
	  alert("Please enter only valid numbers.");
	  form.phone_exch.focus();
	  return false;
	  }
	}
	if (form.phone_num.value == "" || form.phone_num.value.length < 4)
	{
	alert("Please enter your phone number in the \"Phone\" field.");
	form.phone_num.focus();
	return false;
	}
	if (form.phone_num.value)
	{
  	if (!isNum(form.phone_num.value))
	  {
	  alert("Please enter only valid numbers.");
	  form.phone_num.focus();
	  return false;
	  }
	}
	if (form.descBiz.value == "")
	{
	alert("Please describe your business in the \"Description of Your Business\" field.");
	form.descBiz.focus();
	return false;
	}
return true;
}


// Check for numerical data only
function isNum(passedVal) 
{
	if (passedVal == "") 
	{
	   return false;
	}
	for (i=0; i<passedVal.length; i++) {
	    if (passedVal.charAt(i) <"0") {
			if (passedVal.charAt(i)!=".")
			{
				return false;
			} 
//			return false;
	    }
	    if (passedVal.charAt(i) > "9") {
			if (passedVal.charAt(i)!=".")
			{
				return false;
			} 
//		return false;
	    }
	}
	return true;
}