
function checkemail(email)
{
  var result = false;
  var theStr = new String(email);
  var index = theStr.indexOf("@");
  if (index > 0)
  {
  	var pindex = theStr.indexOf(".",index);
    if ((pindex > index+1) && (theStr.length > pindex+1)) result = true;
  }
  
  return result;
}

function checkpay()
{
var result1 = false;
var pay = -1;
for (i = 0; i <= 2; i++)
{
  if (document.info.payment[i].checked){
  pay=i
  }
}  
  if (pay > -1 )
  {
    result1=true;
  }   
  
 return result1;
}



function validate()
{
x=document.info
billing_cust_email=x.billing_cust_email.value
billing_cust_name=x.billing_cust_name.value
billing_middle_name=x.billing_middle_name.value
billing_last_name=x.billing_last_name.value
com=x.com.value
pos=x.pos.value
billing_cust_address=x.billing_cust_address.value
billing_cust_city=x.billing_cust_city.value
billing_cust_state=x.billing_cust_state.value
billing_cust_zip=x.billing_cust_zip.value
billing_cust_country=x.billing_cust_country.value
billing_cust_tel_Ctry=x.billing_cust_tel_Ctry.value
billing_cust_tel_Area=x.billing_cust_tel_Area.value
billing_cust_tel_No=x.billing_cust_tel_No.value
billing_cust_fax_Ctry=x.billing_cust_fax_Ctry.value
billing_cust_fax_Area=x.billing_cust_fax_Area.value
billing_cust_fax_No=x.billing_cust_fax_No.value

bdaym=x.bdaym.value
bdayd=x.bdayd.value
bdayy=x.bdayy.value


submitOK="True"

if (checkemail(billing_cust_email)==false) 
 {
 alert("Invalid email")
 document.info.billing_cust_email.focus()
 return false
 }

if (billing_cust_name=="")
 {
 alert("Please enter your first name")
 document.info.billing_cust_name.focus()
 return false
 }

if (billing_middle_name=="")
 {
 alert("Please enter your middle name")
 document.info.billing_middle_name.focus()
 return false
 }

if (billing_last_name=="")
 {
 alert("Please enter your last name")
 document.info.billing_last_name.focus()
 return false
 }
 
if (com=="")
 {
 alert("Please enter your company")
 document.info.com.focus()
 return false
 } 
 
if (pos=="")
 {
 alert("Please enter your position")
 document.info.pos.focus()
 return false
 } 

if (billing_cust_address=="")
 {
 alert("Please enter your address")
 document.info.billing_cust_address.focus()
 return false
 } 

if (billing_cust_city=="")
 {
 alert("Please enter your city")
 document.info.billing_cust_city.focus()
 return false
 }

if (billing_cust_state=="")
 {
 alert("Please enter your state/region")
 document.info.billing_cust_state.focus()
 return false
 }

if (billing_cust_zip=="")
 {
 alert("Please enter your zip")
 document.info.billing_cust_zip.focus()
 return false
 }

if (billing_cust_country=="--")
 {
 alert("Please choose a country")
 document.info.billing_cust_country.focus()
 return false
 }

if (bdaym=="--")
 {
 alert("Please select your birth month")
 document.info.bdaym.focus()
 return false
 }
 
if (bdayd=="--")
 {
 alert("Please select your birth day")
 document.info.bdayd.focus()
 return false
 } 

if (bdayy=="--")
 {
 alert("Please select your birth year")
 document.info.bdayy.focus()
 return false
 }
 
if (billing_cust_tel_Ctry=="")
 {
 alert("Please enter your country code")
 document.info.billing_cust_tel_Ctry.focus()
 return false
 }

if (billing_cust_tel_Area=="")
 {
 alert("Please enter your area code")
 document.info.billing_cust_tel_Area.focus()
 return false
 }

if (billing_cust_tel_No=="")
 {
 alert("Please enter your phone number")
 document.info.billing_cust_tel_No.focus()
 return false
 }

if (billing_cust_fax_Ctry=="")
 {
 alert("Please enter your fax country code")
 document.info.billing_cust_fax_Ctry.focus()
 return false
 }
 
if (billing_cust_fax_Area=="")
 {
 alert("Please enter your fax area code")
 document.info.billing_cust_fax_Area.focus()
 return false
 }

if (billing_cust_fax_No=="")
 {
 alert("Please enter your fax number")
 document.info.billing_cust_fax_No.focus()
 return false
 }

if (checkpay()==false) 
 {
 alert("Please choose payment")
 document.info.payment[0].focus()
 return false
 
 }

}
