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

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

NAME: order_payment.js

AUTHOR: Rustom Rawat , Access Web Solutions
DATE  : 9/27/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 orderpayment()
{
var form = window.document.frmPayment
	if (form.AccountID.value == "" || form.AccountID.value.length < 8)
	{
	alert("Please enter your email in the \"AccountID\" field.");
	form.AccountID.focus();
	return false;
	}
	if (form.FName.value == "" || form.FName.value.length < 3)
	{
	alert("Please enter your first name in the \"First Name\" field.");
	form.FName.focus();
	return false;
	}
	if (form.LName.value == "" || form.LName.value.length < 3)
	{
	alert("Please enter your last name in the \"Last Name\" field.");
	form.LName.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.Domain.value == "")
	{
	alert("Please enter the website address for which \nyou are availing services in the \"Your Domain Name\" field.");
	form.Domain.focus();
	return false;
	}
	if (form.MOP.value == "")
	{
	alert("Please select mode of payment from \"Payment Method\" field.");
	form.MOP.focus();
	return false;
	}
	if (form.Amount.value == "")
	{
	alert("Please enter total amount in the \"Amount to be Paid\" field.");
	form.Amount.focus();
	return false;
	}
	if (form.Amount.value)
	{
  	if (!isNum(form.Amount.value))
	  {
	  alert("Please enter only valid numbers.");
	  form.Amount.focus();
	  return false;
	  }
	}
	if (form.Contract.value == "No")
	{
	alert("You must accept the contract terms for opening account with us.");
	form.Contract.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;
}