function navon(myid){
document.getElementById(myid).style.backgroundImage = "url(images/nav-on.gif)";
}


function navoff(myid){
document.getElementById(myid).style.backgroundImage = "url(images/nav-off.gif)";
}



////AJAX Lookups
var xmlHttp=null;

function sendform(theform) {

var theForm = document.getElementById(theform);
var PostText = "";
var amp = "&";

  for(i=0; i<theForm.elements.length; i++){
	if(theForm.elements[i].type == "text" || theForm.elements[i].type == "textarea" || theForm.elements[i].type == "hidden")
	{
		if(i > 0){PostText += amp;}
		PostText += theForm.elements[i].name+"="+encodeURIComponent(theForm.elements[i].value);
	} 
	else if (theForm.elements[i].type == "checkbox") 
	{
		PostText += amp+theForm.elements[i].name+"="+theForm.elements[i].checked;
	} 
	else if (theForm.elements[i].type == "select-one") 
	{
		PostText += amp+theForm.elements[i].name+"="+theForm.elements[i].options[theForm.elements[i].selectedIndex].text;
	}
  }

sendmail(PostText);
}





function sendmail(querystring){

  if(xmlHttp!=null)
	{
		if(xmlHttp.readyState<4)
		{
			setTimeout('sendmail("'+querystring+'")',50);
			return;
		}
	}
  xmlHttp=GetXmlHttpObject();
  if (xmlHttp==null)
    {
    alert ("Your browser does not support AJAX!");
    return;
    } 
  var url="http://www.easymovingcompany.com/cgi-bin/web.pl?" + querystring;
  xmlHttp.onreadystatechange=stateChanged;
  xmlHttp.open("GET",url,true);
  xmlHttp.send(null);
}

function stateChanged(){ 
  if (xmlHttp.readyState==4)
  { 
    var responsediv = document.getElementById("formresponse");
    responsediv.innerHTML=xmlHttp.responseText;
    responsediv.style.visibility = "visible";
    var t = setTimeout("document.getElementById(\"formresponse\").style.visibility = 'hidden';", 10000);
  }
}

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;
}