/* ------------------------------------------- INICIO AJAX MODELOS -------------------------------------- */
    var req;

    function loadAjaxModelos(url)
    {
		req = null;

        if (window.XMLHttpRequest)
        {
            req = new XMLHttpRequest();
            req.onreadystatechange = processAjaxModelos;
            req.open("GET", url, true);
            req.send(null);

        } else if (window.ActiveXObject) {

            try {
                req = new ActiveXObject("Msxml2.XMLHTTP.4.0");
            } catch(e) {

                try {
                    req = new ActiveXObject("Msxml2.XMLHTTP.3.0");
                } catch(e) {

                    try {
                        req = new ActiveXObject("Msxml2.XMLHTTP");
                    } catch(e) {

                        try {
                            req = new ActiveXObject("Microsoft.XMLHTTP");
                        } catch(e) {
                            req = false;
                        }
                    }
                }
            }

            if (req)
            {
                req.onreadystatechange = processAjaxModelos;
                req.open("GET", url, true);
                req.send();
            }
        }
    }

    /* ----------------------- carregar niveis ----------------------- */
    function processAjaxModelos()
    {
		var respTxt;
   		var selectModelos = document.getElementById("buscaModelos");

		if (req.readyState == 4)
        {
			if (req.status == 200)
			{
                respTxt = req.responseText;
                selectModelos.innerHTML = respTxt;
			}
        }
	}

	function buscaModelos(marcaID)
	{
		var marcaID;

		document.getElementById("LastMarcaID").value = marcaID;

		random_num = (Math.round((Math.random()*100000000)+1));
		loadAjaxModelos("../ajax/buscaModelos.php?marca="+marcaID+"&"+random_num);
	}

/* ----------------------- FIM AJAX MODELOS ----------------------- */


/* ------------------------------------------- INICIO AJAX ANOS -------------------------------------- */
    var req;

    function loadAjaxAnos(url)
    {
		req = null;

        if (window.XMLHttpRequest)
        {
            req = new XMLHttpRequest();
            req.onreadystatechange = processAjaxAnos;
            req.open("GET", url, true);
            req.send(null);

        } else if (window.ActiveXObject) {

            try {
                req = new ActiveXObject("Msxml2.XMLHTTP.4.0");
            } catch(e) {

                try {
                    req = new ActiveXObject("Msxml2.XMLHTTP.3.0");
                } catch(e) {

                    try {
                        req = new ActiveXObject("Msxml2.XMLHTTP");
                    } catch(e) {

                        try {
                            req = new ActiveXObject("Microsoft.XMLHTTP");
                        } catch(e) {
                            req = false;
                        }
                    }
                }
            }

            if (req)
            {
                req.onreadystatechange = processAjaxAnos;
                req.open("GET", url, true);
                req.send();
            }
        }
    }

    /* ----------------------- carregar niveis ----------------------- */
    function processAjaxAnos()
    {
		var respTxt;
   		var selectAnos = document.getElementById("buscaAno");

		if (req.readyState == 4)
        {
			if (req.status == 200)
			{
                respTxt = req.responseText;
                selectAnos.innerHTML = respTxt;
			}
        }
	}

	function buscaAnos(Modelo)
	{
		var marcaID = document.getElementById("LastMarcaID").value;
		var Modelo;

		random_num = (Math.round((Math.random()*100000000)+1));
		loadAjaxAnos("../ajax/buscaAnos.php?marca="+marcaID+"&modelo="+Modelo+"&"+random_num);
	}

/* ----------------------- FIM AJAX ANOS ----------------------- */

