function busca_modelo(){
	var concesionario =    document.getElementById('concesionario').value;
	var modelo =    document.getElementById('modelo').value;
	document.getElementById('modelo_respuesta').innerHTML = '<img src="/imagenes/_loading.gif">';
		
	var myConn = new XHConn();
	var peticion = function (oXML) {  
		document.getElementById('modelo_respuesta').innerHTML = oXML.responseText;
		};
	myConn.connect("/ajax/busca_modelo.php" , "GET", 'modelo='+modelo+"&concesionario="+concesionario, peticion);
			
	
	
}

function busca_concesionario(){
	var concesionario =    document.getElementById('concesionario').value;
	var modelo =  document.getElementById('modelo').value;
	var version =  document.getElementById('version').value;
	document.getElementById('concesionario_respuesta').innerHTML = '<img src="/imagenes/_loading.gif">';
	
	var myConn = new XHConn();
	var peticion = function (oXML) {  
		document.getElementById('concesionario_respuesta').innerHTML = oXML.responseText;
		busca_modelo();
		};
	myConn.connect("/ajax/busca_concesionario.php" , "GET", 'modelo='+modelo+"&concesionario="+concesionario+"&version="+version, peticion);
	
	//busca_modelo_version();
	
}

function busca_modelo_version(){
	var modelo =    document.getElementById('modelo').value;
	var concesionario =   document.getElementById('concesionario').value;
	document.getElementById('version_respuesta').innerHTML = '<img src="/imagenes/_loading.gif">';
	
	var myConn = new XHConn();
	var peticion = function (oXML) { 
		document.getElementById('version_respuesta').innerHTML = oXML.responseText;
		busca_concesionario();
		};
	myConn.connect("/ajax/busca_version.php" , "GET", 'modelo='+modelo+"&concesionario="+concesionario, peticion);
			
	
}


function movepic(img_name,img_src) {
document[img_name].src=img_src;
}


function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


/** XHConn - Simple XMLHTTP Interface - bfults@gmail.com - 2005-04-08        **
 ** Code licensed under Creative Commons Attribution-ShareAlike License      **
 ** http://creativecommons.org/licenses/by-sa/2.0/                           **/
function XHConn()
{
  var xmlhttp, bComplete = false;
  try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); }
  catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); }
  catch (e) { try { xmlhttp = new XMLHttpRequest(); }
  catch (e) { xmlhttp = false; }}}
  if (!xmlhttp) return null;
  this.connect = function(sURL, sMethod, sVars, fnDone)
  {
    if (!xmlhttp) return false;
    bComplete = false;
    sMethod = sMethod.toUpperCase();

    try {
      if (sMethod == "GET")
      {
        xmlhttp.open(sMethod, sURL+"?"+sVars, true);
        sVars = "";
      }
      else
      {
        xmlhttp.open(sMethod, sURL, true);
        xmlhttp.setRequestHeader("Method", "POST "+sURL+" HTTP/1.1");
        xmlhttp.setRequestHeader("Content-Type",
          "application/x-www-form-urlencoded");
      }
      xmlhttp.onreadystatechange = function(){
        if (xmlhttp.readyState == 4 && !bComplete)
        {
          bComplete = true;
          fnDone(xmlhttp);
        }};
      xmlhttp.send(sVars);
    }
    catch(z) { return false; }
    return true;
  };
  return this;
}




    



