function Start()
{
    var a = new Image()
    a.src = "http://www.keylessentryonline.com/Images/Home2.jpg"
    a.src = "http://www.keylessentryonline.com/Images/About2.jpg"
    a.src = "http://www.keylessentryonline.com/Images/Factory2.jpg"
    a.src = "http://www.keylessentryonline.com/Images/Aftermarket2.jpg"
    a.src = "http://www.keylessentryonline.com/Images/Search2.jpg"
    a.src = "http://www.keylessentryonline.com/Images/Contact2.jpg"
    a.src = "http://www.keylessentryonline.com/Images/Cart2.jpg"
}

function CheckForm()
{
    var CC = document.getElementById("CC").value
    var exm = document.getElementById("exm").options[document.getElementById("exm").selectedIndex].value
    var exy = document.getElementById("exy").options[document.getElementById("exy").selectedIndex].value
    var CCV = document.getElementById("CCV").value
    
    var billFirst = document.getElementById("billFirst").value
    var billLast = document.getElementById("billLast").value
    var billAddress = document.getElementById("billAddress").value
    var billCity = document.getElementById("billCity").value
    var x=document.getElementById("billState")
    var billState = x.options[x.selectedIndex].value
    var billZip = document.getElementById("billZip").value
    
    var shipFirst = document.getElementById("shipFirst").value
    var shipLast = document.getElementById("shipLast").value
    var shipAddress = document.getElementById("shipAddress").value
    var shipCity = document.getElementById("shipCity").value
    var y=document.getElementById("shipState")
    var shipState = y.options[y.selectedIndex].value
    var shipZip = document.getElementById("shipZip").value
    
    var Email = document.getElementById("Email").value
    
    if (CC && exm && exy && CCV && billFirst && billLast && billAddress && billCity && billState && billZip && shipFirst && shipLast && shipAddress && shipCity && shipState && shipZip && Email)
    {
        document.getElementById("Submit").innerHTML = '<input type="Submit" value="Submit" />'
    }
    else
    {
        document.getElementById("Submit").innerHTML = '<font color="red">*</font>Field is required.  Please fill out all required fields to activate the submit button.<br /><input type="submit" value="Submit (Disabled)" disabled />'
    }
}

function UseAbove()
{
    var billFirst = document.getElementById("billFirst").value
    var billLast = document.getElementById("billLast").value
    var billAddress = document.getElementById("billAddress").value
    var billCity = document.getElementById("billCity").value
    var x=document.getElementById("billState")
    var billState = x.options[x.selectedIndex].value
    var billZip = document.getElementById("billZip").value

    document.getElementById("shipFirst").value = billFirst
    document.getElementById("shipLast").value = billLast
    document.getElementById("shipAddress").value = billAddress
    document.getElementById("shipCity").value = billCity
    var y=document.getElementById("shipState")
    y.options[y.selectedIndex].value = billState
    y.options[y.selectedIndex].text = billState
    document.getElementById("shipZip").value = billZip

    CheckForm()
}

function FillMake()
{
    var x=document.getElementById("Year")
    var choice=x.options[x.selectedIndex].value
  xmlHttp=GetXmlHttpObject()
  if (xmlHttp==null)
  {
    alert ("Browser does not support HTTP Request")
    return
  } 
  var url="FillMake.php?choice=" + choice + "&sid="+Math.random()
  xmlHttp.onreadystatechange=DoFill2
  xmlHttp.open("GET",url,true)
  xmlHttp.send(null)
}

function DoFill2() 
{ 
  if ((xmlHttp.readyState==4 || xmlHttp.readyState=="complete"))
  { 
    document.getElementById("Make").innerHTML=xmlHttp.responseText
  }
}

function FillModel()
{
    var x=document.getElementById("MakeList")
    var choice=x.options[x.selectedIndex].value
    var x=document.getElementById("Year")
    var choice2=x.options[x.selectedIndex].value
  xmlHttp=GetXmlHttpObject()
  if (xmlHttp==null)
  {
    alert ("Browser does not support HTTP Request")
    return
  } 
  var url="FillModel.php?choice=" + choice + "&choice2=" + choice2 + "&sid="+Math.random()
  xmlHttp.onreadystatechange=DoFill
  xmlHttp.open("GET",url,true)
  xmlHttp.send(null)
}

function DoFill() 
{ 
  if ((xmlHttp.readyState==4 || xmlHttp.readyState=="complete"))
  { 
    document.getElementById("Model").innerHTML=xmlHttp.responseText
  }
}

function Go(choice)
{
    document.location = choice;
}

function Over(choice)
{
    document.getElementById(choice).src = "http://www.keylessentryonline.com/Images/" + choice + "2.jpg"
}

function Out(choice)
{
    document.getElementById(choice).src = "http://www.keylessentryonline.com/Images/" + choice + ".jpg"
}

function AJAX_FUNCTION(DOVAR)
{
  xmlHttp=GetXmlHttpObject()
  if (xmlHttp==null)
  {
    alert ("Browser does not support HTTP Request")
    return
  } 
  var url="PHP_PAGE.php?VAR=" + DOVAR + "&sid="+Math.random()
  xmlHttp.onreadystatechange=AJAXCALL
  xmlHttp.open("GET",url,true)
  xmlHttp.send(null)
}

function AJAXCALL() 
{ 
  if ((xmlHttp.readyState==4 || xmlHttp.readyState=="complete"))
  { 
    document.getElementById("AJAXDIV").innerHTML=xmlHttp.responseText
  }
}

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;
}