var xmlHttp;

	function createXMLHttpRequest()
	{
	 if (window.ActiveXObject) {
		    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		 } else if (window.XMLHttpRequest) {
			 xmlHttp = new XMLHttpRequest();
		 }
	}


/// ค้นหารุ่น
	function search_gen(element) {            
            createXMLHttpRequest();
            var url = "other_data/search_gen.php?data="  + new Date().getTime() + Math.random() + ":||:" + element;            
            xmlHttp.open("GET", url, true);
            xmlHttp.onreadystatechange = searchgen;
            xmlHttp.send(null);
        }

  function searchgen() {
	  	  document.getElementById("sxgen").innerHTML='<div id="wait1">&nbsp;<img src=images/progress.gif></div>';
	  	   if (xmlHttp.readyState == 4) {
                if (xmlHttp.status == 200) {
                    document.getElementById("sxgen").innerHTML = xmlHttp.responseText;
					search_fac();
              }
            }
        }

	function search_fac(element) {            
            createXMLHttpRequest();
            var url = "other_data/search_fac.php?data="  + new Date().getTime() + Math.random() + ":||:" + element;            
            xmlHttp.open("GET", url, true);
            xmlHttp.onreadystatechange = searchfac;
            xmlHttp.send(null);
        }

  function searchfac() {
	  	  document.getElementById("sxfac").innerHTML='<div id="wait1">&nbsp;<img src=images/progress.gif></div>';
	  	   if (xmlHttp.readyState == 4) {
                if (xmlHttp.status == 200) {
                    document.getElementById("sxfac").innerHTML = xmlHttp.responseText;
              }
            }
        }


/// รายละเอียดรถ
	function carsdetail(element) {            
            createXMLHttpRequest();
            var url = "other_data/carsdetail.php?data="  + new Date().getTime() + Math.random() + ":||:" + element;            
            xmlHttp.open("GET", url, true);
            xmlHttp.onreadystatechange = cars_detail;
            xmlHttp.send(null);
        }

  function cars_detail() {
	  	  document.getElementById("showcarsdetail").innerHTML="&nbsp;<img src=images/ms_progcircle.gif>";
	  	   if (xmlHttp.readyState == 4) {
                if (xmlHttp.status == 200) {
                   document.getElementById("showcarsdetail").style.width = "470px";
                   document.getElementById("showcarsdetail").style.border = "1px solid #c0c0c0";
                   document.getElementById("showcarsdetail").innerHTML = xmlHttp.responseText;
              }
            }
        }


/// เพิ่มรายละเอียดการซ่อม
	function listcarsrepair(element) {            
            createXMLHttpRequest();
            var url = "repair/listcarsrepair.php?data="  + new Date().getTime() + Math.random() + ":||:" + element;            
            xmlHttp.open("GET", url, true);
            xmlHttp.onreadystatechange = listcars_repair;
            xmlHttp.send(null);
        }

  function listcars_repair() {
	  	  document.getElementById("showcarsdetail").innerHTML='&nbsp;<img src=images/ms_progcircle.gif>';
	  	   if (xmlHttp.readyState == 4) {
                if (xmlHttp.status == 200) {
                   document.getElementById("showcarsdetail").style.width = "470px";
                   document.getElementById("showcarsdetail").style.border = "1px solid #c0c0c0";
                   document.getElementById("showcarsdetail").innerHTML = xmlHttp.responseText;
              }
            }
        }




/// รายละเอียดรถ
	function listusecars(element) {            
            createXMLHttpRequest();
            var url = "usecars/listusecars.php?data="  + new Date().getTime() + Math.random() + ":||:" + element;            
            xmlHttp.open("GET", url, true);
            xmlHttp.onreadystatechange = reserv_detail;
            xmlHttp.send(null);
        }

  function reserv_detail() {
	  	  document.getElementById("showcarsdetail").innerHTML='&nbsp;<img src=images/ms_progcircle.gif>';
	  	   if (xmlHttp.readyState == 4) {
                if (xmlHttp.status == 200) {
                   document.getElementById("showcarsdetail").style.width = "470px";
                   document.getElementById("showcarsdetail").style.border = "1px solid #c0c0c0";
                   document.getElementById("showcarsdetail").innerHTML = xmlHttp.responseText;
              }
            }
        }

