$(function() {
	var nosubmit = false;
	$("#ricerca").keypress(function (e) {
	
		var k = e.which
		nosubmit = true;
		if (k == 13) {	
			$("#btncerca").trigger('click');
		}
	});
	$("form").submit(function(){
		if (nosubmit) return false;
	});

	$("#btncerca").click(function() {
		//#edc 30lug08 - ricerca per aree	
		var t = "" //template
		if  (($("#t").length>0) && ($("#t").val().length>0)){
		    t = "t=" + $("#t").val()  + "&"
		} 
		var a = "" //id area
		if  (($("#a").length>0) && ($("#a").val().length>0)){
		    a= "a=" + $("#a").val() + "&"
		}	
		var g = "" // id gruppo di lavoro
		if  (($("#g").length>0) && ($("#g").val().length>0)){
		    g = "g=" + $("#g").val()  + "&"
		} 
		//#edc 30lug08 - ricerca per aree	
		nosubmit = true;
		newlocation = "/servizi/ricerca.aspx?ft=1&" + a + t + g + "str=" + $("#ricerca").val();
		window.location.href = newlocation;
		return false;
	});
});