
var opciones = location.href;
        var sIdCat = "";

        if (opciones.indexOf("idCat=") != -1) {
                opciones = opciones.substring(opciones.indexOf("idCat="), opciones.length);
                sIdCat = opciones.split("=");
                sIdCat = sIdCat[1];
        }

var arrModelos = new Array();

                arrModelos[0] = new Array ('-1@-Selecciona un modelo-','130-1@C701','33-1@S853');

                arrModelos[1] = new Array ('-1@-Selecciona un modelo-','126-1@8100');

                arrModelos[2] = new Array ('-1@-Selecciona un modelo-','122-1@U1205');

                arrModelos[3] = new Array ('-1@-Selecciona un modelo-','119-1@ME550','123-1@ME770','129-1@ME970','116-1@MG280','21-1@MG300','65-1@MG320','26-1@MG810','125-1@MU550');

                arrModelos[4] = new Array ('-1@-Selecciona un modelo-','132-1@V235','38-1@557','96-1@A1200i','46-1@E1','39-1@K1','9-1@L6','32-1@L7','88-1@ROKR E2','18-1@U6','7-1@V3 Razr','69-1@V365','106-1@W510','95-1@Z3','118-1@Z6');

                arrModelos[5] = new Array ('-1@-Selecciona un modelo-','132-1@V235','38-1@557','96-1@A1200i','46-1@E1','39-1@K1','9-1@L6','32-1@L7','88-1@ROKR E2','18-1@U6','7-1@V3 Razr','69-1@V365','106-1@W510','95-1@Z3','118-1@Z6');

                arrModelos[6] = new Array ('-1@-Selecciona un modelo-','50-1@2610','127-1@2760','1-1@3220','110-1@5070','72-1@5200','53-1@5300','6-1@6020','99-1@6061','71-1@6085','14-1@6101','98-1@6103','134-1@6120','100-1@6131','68-1@6300','107-1@6600','97-1@6670','35-1@8801','80-1@E50','112-1@E65','79-1@N73','83-1@N80');

                arrModelos[7] = new Array ('-1@-Selecciona un modelo-','133-1@V7');

                arrModelos[8] = new Array ('-1@-Selecciona un modelo-','19-1@Treo');

                arrModelos[9] = new Array ('-1@-Selecciona un modelo-','103-1@A100','75-1@S100');

                arrModelos[10] = new Array ('-1@-Selecciona un modelo-','54-4@SGH-C406','67-1@SGH-D836','78-1@SGH-D900','109-1@SGH-E236','76-1@SGH-E256','57-4@SGH-E356','81-1@SGH-E496','70-1@SGH-E786','77-1@SGH-E906','131-1@SGH-I326','62-1@SGH-T519','15-1@SGH-T809','117-1@SGH-U600','61-4@SGH-X656','108-1@SGH-X836');

                arrModelos[11] = new Array ('-1@-Selecciona un modelo-','55-1@my401L','60-1@my700x');

                arrModelos[12] = new Array ('-1@-Selecciona un modelo-','113-1@K310','31-2@K510a','92-1@K550i','40-1@K790','89-1@W200a','34-1@W300i','114-1@W580','124-1@W580','10-1@W600i','91-1@W610i','42-1@W710','2-1@W810i','90-1@Z310a','52-1@Z520','48-1@Z550','41-1@Z710');

                arrModelos[13] = new Array ('-1@-Selecciona un modelo-','111-1@i230');

function getModelos(brand){
        if (parseInt(brand) == -1 ) {
                return;
        }
        object = document.selModelo.idTel;
        borraSelect(object);

        //Asigna las ciudades del estado seleccionado
        var arrModXMarca = arrModelos[parseInt(brand)];
        for(var i=0; i<arrModXMarca.length; i++) {
                defSelected = false;
                selected = false;
                if (i==0) {
                        defSelected = true;
                        selected = true;
                }
                var sText= arrModXMarca[i];
                for (var j=0; j<sText.length; j++){
                        if (sText.substring(j,j+1)=='@')
                                break;
                }
                //El valor del combo se forma por: contador-clave_municipio
                addOption(object, sText.substring(0,j), sText.substring(j+1,sText.length), defSelected, selected);

                //addOption(object, 'i', arrModXMarca[i], defSelected, selected);
                object.selectedIndex = 0;
        }
        object.focus();
}
function addOption(object, value, texto, defSelected, selected) {
        optionName = new Option(texto, value, defSelected, selected);
        elements = object.length;
        object.options[elements] = optionName;
}
function borraSelect(object) {
        elements = object.length;
        for (i = elements; i>=0; i--) {
                object.options[i] = null;
        }
}

function validaFiltro(){
        if (document.selModelo.brand.options[document.selModelo.brand.selectedIndex].value != "-1" && document.selModelo.idTel.options[document.selModelo.idTel.selectedIndex].value != "-1"){
                document.selModelo.tel.value = document.selModelo.brand.options[document.selModelo.brand.selectedIndex].text + " " + document.selModelo.idTel.options[document.selModelo.idTel.selectedIndex].text;
                if (sIdCat != "") {
                        document.selModelo.idCat.value = sIdCat;
                }
            return true;
        } else {
        	return false;
        }
}
function init(){
        document.selModelo.brand.selectedIndex = 0;
        document.selModelo.idTel.selectedIndex = 0;
}

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

