

// EL mapa comarcal té definides totes les zones i crida aquesta funcio
var nohit = new Array();

// La funcio busca el valor dins el combo que li passem i el selecciona
function hitcomarca(combo,com)
{
    // control comarques inactives
    var i 
    for(i=0;i<nohit.length;i++) {
        if(com==nohit[i]) { return; }
    } 
    
    // assigna un camp del formulari i fer un submit
    // opcio 1: document.location.href = "llista.asp?comarca="+com;
    //combo.value = com;
    
    
    // per assignar el valor en NS hem de fer el bucle...
    var val = com+'';
    combo.selectedIndex = 0;
    for(i=1;i<combo.options.length;i++) {
        if( combo.options[i].value.toLowerCase() == val.toLowerCase() || combo.options[i].value.toLowerCase() == "0"+val.toLowerCase()) {
            combo.selectedIndex = i; 
            break;
        }
    }
    // if(combo.selectedIndex > 0) { document.form1.submit(); }

    if(combo.selectedIndex > 0) { 
		document.form1.submit(); 
    }else{
	    alert ('No s\'han trobat registres per a aquesta comarca')
    }
}

