function GetReturn(e) {
var keynum;
var keychar;
var numcheck;
    if(window.event) // IE
      {
      keynum = e.keyCode;
      }
    else if(e.which) // Netscape/Firefox/Opera
      {
      keynum = e.which;
      }
     
    if(keynum == 13) {
        CheckSearch (); 
        return false;
    } else  {
        return true;
    }
}

	function CheckSearch () {
	    var frm = window.document.forms[0];
	    if (frm.psearch.value.length <= 2) {
	        alert("Ricercare almeno 3 caratteri");
    	    return false;
	    };
	    window.location.href = "/viaggi.aspx?search=" + frm.psearch.value;
	    return false;
	}

	function OnReturnSearch(event) { 
		var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
		if (keyCode == 13) {
			return CheckSearch ();
		} 
		else
		return true;
	}	

function CheckItem(simage, sitem){ 
    ctrlimage = document.getElementById(simage);
    ctrlitem = document.getElementById(sitem);

  if (ctrlitem.checked) {
    ctrlimage.src = "immagini/no_check.gif";
    ctrlitem.checked = false;
  }else {
    ctrlimage.src = "immagini/check_on.gif";
    ctrlitem.checked = true;
  }  
  return true; 
}

	function CheckDestSearch () {
	    var frm = window.document.forms[0];
	    
	    var txt = frm.search_txt.value;
	    var citta = "";
	    if (frm.search_citta) {
	        if (frm.search_citta.selectedIndex != 0) {
	            var iIndex = frm.search_citta.selectedIndex ;
	            citta = frm.search_citta.options[iIndex].value;
	        };
	    };
	    var custom = "";
	    if (frm.search_custom) {
	        if (frm.search_custom.selectedIndex != 0) {
	            var iIndex = frm.search_custom.selectedIndex ;
	            custom = frm.search_custom.options[iIndex].value;
	        };
	    };
	    var stato = "";
	    if (frm.search_stato) {
	        if (frm.search_stato.selectedIndex != 0) {
	            var iIndex = frm.search_stato.selectedIndex ;
	            stato = frm.search_stato.options[iIndex].value;
	        };
	    };
	    
	    lnk = baselink;
	    if (txt.length > 0) lnk = lnk + "&search=" + txt;
	    if (citta.length > 0) lnk = lnk + "&city=" + citta;
	    if (frm.search_custom) lnk = lnk + "&custom=" + custom;
	    if (frm.search_stato) lnk = lnk + "&stato=" + stato;
	    if (frm.search_num) {
    	    var numrow = frm.search_num.value;
    	    if (numrow.length > 0) lnk = lnk + "&num=" + numrow;
	    }
	    if (frm.chk_img) {
	        var showimg = 0;
	        if (frm.chk_img.checked) showimg = 1;
	        lnk = lnk + "&img=" + showimg;
	    }
	    window.location.href = lnk;
	    return false;
	}

	function ClearDestSearch () {
	    var frm = window.document.forms[0];
	    frm.search_txt.value = "";
	    if (frm.search_citta) frm.search_citta.selectedIndex = 0;
	    if (frm.search_custom) frm.search_custom.selectedIndex = 0;
	    if (frm.search_stato) frm.search_stato.selectedIndex = 0;

	    window.location.href = clearlink;
	    return false;
	}
	
	function CheckAgSearch () {
	    var frm = window.document.forms[0];
	    
	    var txt = frm.search_ag_nome.value;
	    var citta = "";
	    if (frm.search_ag_citta.selectedIndex != 0) {
	        var iIndex = frm.search_ag_citta.selectedIndex ;
	        citta = frm.search_ag_citta.options[iIndex].value;
	    };
	    var cap = frm.search_ag_cap.value;
	    lnk = baselink;
	    if (txt.length > 0) lnk = lnk + "&s_nome=" + txt;
	    if (citta.length > 0) lnk = lnk + "&s_city=" + citta;
	    if (cap.length > 0) lnk = lnk + "&s_cap=" + cap;
	    window.location.href = lnk;
	    return false;
	}

// JScript File
function OpenSfogliatore (idcat) {
    //alert ("I cataloghi sfogliabili saranno disponibili tra pochissimo.\nCi scusiamo per il disagio.\nULISSE VIAGGI");
    //return false;
    var sName = "/sfogliatore.aspx?idcat=" + idcat;
    var sRef = "wndSfogliatore";
    var sCfg = "menubar=no,toolbars=yes,resizable=no,status=no,location=no,width=996,height=600,";
    var wref = window.open(sName, sRef, sCfg);
    if (wref) wref.focus();
    return false;
}
