function vaiProvincia(user_type) {
    document.forms['sceltaprovincia'].action = "localizzazione-" + user_type + ".html";
    document.forms['sceltaprovincia'].submit();
}

function resetComune() {
    if (document.forms['sceltaprovincia'].elements['zone_profile_comuni']!=null) {
        document.forms['sceltaprovincia'].elements['zone_profile_comuni'].selectedIndex=0;
        document.forms['sceltaprovincia'].elements['zone_profile_comuni'].options.length = 1;
    }
    if (document.forms['sceltaprovincia'].elements['zone_pdv']!=null) {
        document.forms['sceltaprovincia'].elements['zone_pdv'].selectedIndex=0;
        document.forms['sceltaprovincia'].elements['zone_pdv'].options.length = 1;
    }                
}

function resetPdv() {
    if (document.forms['sceltaprovincia'].elements['zone_pdv']!=null) {
        document.forms['sceltaprovincia'].elements['zone_pdv'].selectedIndex=0;
        document.forms['sceltaprovincia'].elements['zone_pdv'].options.length = 1;
    }
}

function annullaLoc(user_type) {
    document.forms['sceltaprovincia'].action = "home-" + user_type + ".html";
    document.forms['sceltaprovincia'].elements['annullaLoc'].value = "ora";
    document.forms['sceltaprovincia'].submit();
}

function annullaAcc(user_type) {
    document.forms['autenticato'].action = "home-" + user_type + ".html";
    document.forms['autenticato'].elements['annullaAcc'].value = "ora";
    document.forms['autenticato'].submit();
}

function saltopagina(iniziada) {
    document.forms["DATALIST"].elements["iniziada"].value= ""+ iniziada;
    document.forms["DATALIST"].submit();
}

function wichKey(event) {
    if (event.keyCode == "13"){
        document.forms['sceltaprovincia'].submit();
    }
}

function searchNews() {
    if (document.forms['SEARCH'].elements['news_testo'].value != "") {
        document.forms['SEARCH'].submit();
    }else{
        window.alert('ATTENZIONE!!\nE\' necessario inserire almeno una parola nel campo testo per procedere alla ricerca!!');
    }
}

function addbookmark(){
	bookmarkurl="http://www.conad.it"
	bookmarktitle="Conad"
	if (document.all)
		window.external.AddFavorite(bookmarkurl,bookmarktitle)
}

function cerca_nel_sito() {
        if (document.getElementById("search").value!="" && document.getElementById("search").value!="Cerca") {
                document.forms['frmSearch'].submit();
        }
        return false;
}

function cerca_nel_sito2() {
        if (document.getElementById("search2").value!="" && document.getElementById("search2").value!="Cerca") {
                document.forms['frmSearch2'].submit();
        }
        return false;
}

function vai(dove,user_type){
    if (document.getElementById("recipes_what").value == ""){
            return false;	
    } else { 
        if (document.getElementById("select_search").style.display == "none"){
                if (document.getElementById("recipes_search").value == ""){
                        return false;	
                } else { 
                        document.getElementById("newsearch").value = "nuova";
                        document.getElementById("mainForm").action="./cercaricette_risultati" + dove + "-" + user_type + ".html";
                        document.getElementById("mainForm").submit();
                }			
        } else {			
                if (document.getElementById("select_search").value == ""){
                        return false;	
                } else { 
                        document.getElementById("newsearch").value = "nuova";
                        document.getElementById("mainForm").action="./cercaricette_risultati" + dove + "-" + user_type + ".html";
                        document.getElementById("mainForm").submit();
                }
        }
    }
}

function loadCombo(sObj) {
        if (sObj.value == "" || sObj.value == "9" || sObj.value == "10" || sObj.value == "4" || sObj.value == "16") {
                document.getElementById("select_search").length =1
                document.getElementById("select_search").style.display = "none";
                document.getElementById("recipes_search").style.display = "";
                //document.getElementById("recipes_search").value="Ricerca";
                document.getElementById("newsearch").value = "nuova";
                return;
        } else {
                document.getElementById("select_search").length =1
                document.getElementById("select_search").style.display = "";
                document.getElementById("recipes_search").style.display = "none";
                //document.getElementById("recipes_search").value="Ricerca";			
                document.getElementById("newsearch").value = "nuova";
                loadAjaxCombo("select_search",sObj.value,true);
        }
}

function cerca_pietanza(id_pietanza,user_type){
        document.getElementById("recipes_what").options[document.getElementById("recipes_what").selectedIndex].value = '14'; 
        document.getElementById("recipes_pietanza").value = id_pietanza;
        document.getElementById("newsearch").value = "nuova";
        document.getElementById("mainForm").action="./cercaricette_risultati-" + user_type + ".html";
        document.getElementById("mainForm").submit();
}

function cerca_vino(id_vino,user_type){
        document.getElementById("recipes_what").options[document.getElementById("recipes_what").selectedIndex].value = '16'; 
        document.getElementById("recipes_tipo").value = id_vino;
        document.getElementById("newsearch").value = "nuova";
        document.getElementById("mainForm").action="./cercaricette_risultati_vini-" + user_type + ".html";
        document.getElementById("mainForm").submit();
}

function cerca_frigo(user_type){
        if (document.getElementById("recipes_searchFrigo").value == ""){
                return false;	
        } else { 
                document.getElementById("newsearchFrigo").value = "nuova";
                document.getElementById("mainFormFrigo").action="./cercaricette_risultati-" + user_type + ".html";
                document.getElementById("mainFormFrigo").submit();
        }			
}

function cerca_trucchi(user_type) {
        if (document.getElementById("recipes_search").value == ""){
                return false;	
        } else { 
                document.getElementById("recipes_what").value = "5";
                document.getElementById("newsearch").value = "nuova";
                document.getElementById("mainForm").action="./trucchi_risultati-" + user_type + ".html";
                document.getElementById("mainForm").submit();
        }			
}

function archivio_trucchi(user_type) {
        document.getElementById("recipes_search").value = "\" \"";
        document.getElementById("recipes_what").value = "5";
        document.getElementById("newsearch").value = "nuova";
        document.getElementById("mainForm").action="./trucchi_risultati-" + user_type + ".html";
        document.getElementById("mainForm").submit();
}