function refreshDropdowns() {
	
	$(".dropdown img.flag").addClass("flagvisibility");

	$(".dropdown dt a").click(function() {
		var dl = $(this).parent('dt').parent('.dropdown');
		dl.children('dd').children("ul").toggle();
	});

	$(".dropdown dd ul li a").click(function() {
		var dl = $(this).parent("li").parent("ul").parent("dd").parent(".dropdown");
		var text = $(this).html();
		dl.children("dt").children("a").children("span").html(text);
		dl.children("dd").children("ul").hide();
	});

	function getSelectedValue(id) {
		return $("#" + id).find("dt a span.value").html();
	}

	$("#flagSwitcher").click(function() {
		$(".dropdown img.flag").toggleClass("flagvisibility");
	});
	
}

$(document).ready(function() {
	//jQuery.noConflict();
	refreshDropdowns();
});

function return_value_where(){
	if (document.search_form.where.value == "")
		document.search_form.where.value = "via Roma, quadrilatero...";
}

function setCookie(c_name,value,expiredays){
	var exdate = new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=c_name+ "=" +escape(value)+
	((expiredays==null) ? "" : ";expires="+exdate.toUTCString());
}

function select_all(){
	var text_val=eval("document.search_form.whereStr");
	text_val.focus();
	text_val.select();
}
