
var xmlHttp

//switch state

function showTerms(st)
 { 
 xmlHttp=GetXmlHttpObject()
 if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request")
  return
  } 
 var url="terms.php"
 url=url+"?q="+st
 url=url+"&sid="+Math.random()
 xmlHttp.onreadystatechange=stateswitched 
 xmlHttp.open("GET",url,true)
 xmlHttp.send(null)
 } 

function stateswitched() 
{ 
if (xmlHttp.readyState==4)
 { 
 document.getElementById("txTerms").innerHTML=xmlHttp.responseText 
 } 
}


//map us out

function showMap(str)
 { 
 xmlHttp=GetXmlHttpObject()
 if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request")
  return
  } 
 var url="mapus.php"
 url=url+"?m="+str
 url=url+"&sid="+Math.random()
 xmlHttp.onreadystatechange=mapped 
 xmlHttp.open("GET",url,true)
 xmlHttp.send(null)
 } 

function mapped() 
{ 
if (xmlHttp.readyState==4)
 { 
 document.getElementById("txtMap").innerHTML=xmlHttp.responseText 
 } 
}


// for ALL

function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}

// end of AJAX


//to check required fields in quote form
function validate()
{

if (document.form.Name.value == "")
{document.form.Name.focus();
alert ("Please enter your Name")
return false;
}

if (document.form1.Telephone.value == "")
{document.form1.Telephone.focus();
alert ("Please enter your Telephone number")
return false;
}

if (document.form1.Email.value.length < 7 || document.form1.Email.value.indexOf("@")==-1 || document.form1.Email.value.indexOf(".")==-1 || document.form1.Email.value.indexOf("!")!=-1){
  document.form1.Email.focus();
  alert("You did not provide a valid Email address. A valid\nEmail address would look something like this:\n\nusername@yourdomain.com\n");
  return false;
 }

if (document.form1.Shipping_from_City.value == "")
{document.form1.Shipping_from_City.focus();
alert ("Please enter the City you are shipping from")
return false;
 }

if (document.form1.Shipping_from_State.value == "")
{document.form1.Shipping_from_State.focus();
alert ("Please enter the State you are shipping from")
return false;
 }

if (document.form1.Shipping_from_Zip.value == "")
{document.form1.Shipping_from_Zip.focus();
alert ("Please enter the Zip code you are shipping from")
return false;
 }

if (document.form1.Shipping_from_Country.value == "")
{document.form1.Shipping_from_Country.focus();
alert ("Please enter the Country you are shipping from")
return false;
 }

if (document.form1.Shipping_to_City.value == "")
{document.form1.Shipping_to_City.focus();
alert ("Please enter the City you are shipping to")
return false;
 }

if (document.form1.Shipping_to_Country.value == "")
{document.form1.Shipping_to_Country.focus();
alert ("Please enter the Country you are shipping to")
return false;
 }

if (document.form1.Shipping_Date.value == "")
{document.form1.Shipping_Date.focus();
alert ("Please enter your Shipping Date")
return false;
}

if (document.form1.Commodity.value == "")
{document.form1.Commodity.focus();
alert ("Please give a brief description of what are shipping")
return false;
}

 return true;
}
//end 

// check fields on booking form
function checkForm()
{

if (document.form2.termsconditions.checked != true)
{document.form2.termsconditions.focus();
alert ("You must accept our Terms and Conditions")
return false;
}

if (document.form2.Shipper_Contact_Name.value == "")
{document.form2.Shipper_Contact_Name.focus();
alert ("Please enter the Shipper Name")
return false;
}

if (document.form2.Shipper_Address.value == "")
{document.form2.Shipper_Address.focus();
alert ("Please enter the Shipper Address")
return false;
}

if (document.form2.Shipper_City.value == "")
{document.form2.Shipper_City.focus();
alert ("Please enter the Shipper City")
return false;
 }

if (document.form2.Shipper_Country.value == "")
{document.form2.Shipper_Country.focus();
alert ("Please enter the Shipper Country")
return false;
 }

if (document.form2.Shipper_Telephone.value == "")
{document.form2.Shipper_Telephone.focus();
alert ("Please enter the Shipper Telephone")
return false;
}


if (document.form2.Shipper_Email.value.length < 7 || document.form2.Shipper_Email.value.indexOf("@")==-1 || document.form2.Shipper_Email.value.indexOf(".")==-1 || document.form2.Shipper_Email.value.indexOf("!")!=-1){
  document.form2.Shipper_Email.focus();
  alert("You did not provide a valid Email address. A valid\nEmail address would look something like this:\n\nusername@yourdomain.com\n");
  return false;
 }

if (document.form2.Consignee_Contact_Name.value == "")
{document.form2.Consignee_Contact_Name.focus();
alert ("Please enter the Consignee Name")
return false;
}

if (document.form2.Consignee_Address.value == "")
{document.form2.Consignee_Address.focus();
alert ("Please enter the Consignee Address")
return false;
}

if (document.form2.Consignee_City.value == "")
{document.form2.Consignee_City.focus();
alert ("Please enter the Consignee City")
return false;
 }

if (document.form2.Consignee_Country.value == "")
{document.form2.Consignee_Country.focus();
alert ("Please enter the Consignee Country")
return false;
 }

if (document.form2.Consignee_Telephone.value == "")
{document.form2.Consignee_Telephone.focus();
alert ("Please enter the Consignee Telephone")
return false;
}

 return true;
}
//end 


