var xmlHttpReq = new Array();

function xmlhttpPost(strURL, loc) {
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq[loc] = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq[loc] = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq[loc].open('POST', strURL, true);
    self.xmlHttpReq[loc].setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq[loc].onreadystatechange = function() {
        if (self.xmlHttpReq[loc].readyState == 4) {
            updatepage(self.xmlHttpReq[loc].responseText, loc);
        }
    }
    var q = getquerystring();
    // alert(q);
    self.xmlHttpReq[loc].send(q);
}

function getquerystring() {
    var submission_string="";

    // loop through all the forms in the doc
    for (var form_loop=0; form_loop<document.forms.length; form_loop++) 
    {
      // loop through all the elements of the form
      for (var elems=0; elems<document.forms[form_loop].length;elems++)
      {
        if (document.forms[form_loop].elements[elems].name != "")
        {
          if (submission_string.length > 0) {
              submission_string += "&"
          }
          submission_string += document.forms[form_loop].elements[elems].name + "=" + document.forms[form_loop].elements[elems].value;
        }
      }
    }
    return submission_string;
}

function updatepage(str, loc){
    document.getElementById(loc).innerHTML = str;
    if (loc == "motiongallery") { setTimeout("fillup()",4000); }
}

function img_scroll() {
    xmlhttpPost("/cgi-bin/get_img.cgi","motiongallery");
}

function do_veh() {
    var v = document.vehform.veh.value;
    window.location = 'http://www.vinbee.com/cgi-bin/pv.cgi?veh='+v;
}

function do_veh2() {
    do_veh();
}
