function spostaLogin(){
	var p = $("#wrapper_in");
	var posizione = $("#wrapper_in").position();
	//$("#debugger").html("posizione WRAPPER_IN: " + posizione.left);
	$("#login_up").css("left",posizione.left+32);
}

function openLogin(){
	$('#dashboard').animate({
		height: ['toggle', 'swing']
	  }, 200, 'linear');
}

function addCSS(oggetto, classe, testo){
	$("#"+oggetto).addClass(classe);
	if(testo){
		if($("#"+oggetto).val() == testo)
			$("#"+oggetto).val('');
	}
}

function removeCSS(oggetto, classe, testo){
	$("#"+oggetto).removeClass(classe);
	if(testo){
		if($("#"+oggetto).val() == "")
			$("#"+oggetto).val(testo);
	}
}

$(document).ready(function() {
	// MOUSEOVER	
	$("li.menu").mouseover(function(){
		$(this).removeClass().addClass("menu_up");
	}).mouseout(function(){
		$(this).removeClass().addClass("menu");		
	});
	
	$("p.albo").mouseover(function(){
		$(this).removeClass().addClass("albo_up");
	}).mouseout(function(){
		$(this).removeClass().addClass("albo");		
	});
	
	$("div.roma").mouseover(function(){
		$(this).removeClass().addClass("roma_up");
	}).mouseout(function(){
		$(this).removeClass().addClass("roma");		
	});
	
	$("div.frosinone").mouseover(function(){
		$(this).removeClass().addClass("frosinone_up");
	}).mouseout(function(){
		$(this).removeClass().addClass("frosinone");		
	});
	
	$("div.latina").mouseover(function(){
		$(this).removeClass().addClass("latina_up");
	}).mouseout(function(){
		$(this).removeClass().addClass("latina");		
	});
	
	$("div.rieti").mouseover(function(){
		$(this).removeClass().addClass("rieti_up");
	}).mouseout(function(){
		$(this).removeClass().addClass("rieti");		
	});
	
	$("div.viterbo").mouseover(function(){
		$(this).removeClass().addClass("viterbo_up");
	}).mouseout(function(){
		$(this).removeClass().addClass("viterbo");		
	});
	
	$("input.bottone").mouseover(function(){
		$(this).removeClass().addClass("bottone_up");
	}).mouseout(function(){
		$(this).removeClass().addClass("bottone");
	});
	
	$("div.blocco_news_al").mouseover(function(){
		$(this).css({"background":"#fbfbfb","cursor":"pointer"});
	}).mouseout(function(){
		$(this).css({"background":"#f2f2f2","cursor":"default"});
	});
	
	$("div.blocco_news_an").mouseover(function(){
		$(this).css({"background":"#fbfbfb","cursor":"pointer"});
	}).mouseout(function(){
		$(this).css({"background":"#f2f2f2","cursor":"default"});
	});
	
	$("div.blocco_news_blocchetto").mouseover(function(){
		$(this).css({"background":"#f8f8f8","cursor":"pointer"});
	}).mouseout(function(){
		$(this).css({"background":"#fff","cursor":"default"});
	});
	
	$("span.login_button").mouseover(function(){
		$(this).removeClass().addClass("login_button_up");
	}).mouseout(function(){
		$(this).removeClass().addClass("login_button");
	});
	
	$("span.login_button_M").mouseover(function(){
		$(this).removeClass().addClass("login_button_M_up");
	}).mouseout(function(){
		$(this).removeClass().addClass("login_button_M");
	});
	
	$("span.login_button_F").mouseover(function(){
		$(this).removeClass().addClass("login_button_F_up");
	}).mouseout(function(){
		$(this).removeClass().addClass("login_button_F");
	});
	
	$("input.login_button").mouseover(function(){
		$(this).removeClass().addClass("login_button_up");
	}).mouseout(function(){
		$(this).removeClass().addClass("login_button");
	});
	
	$("div.YTthumbs").mouseover(function(){
		$(this).css({"border":"#b78211 solid 1px","cursor":"pointer"});
	}).mouseout(function(){
		$(this).css({"border":"#ccc solid 1px","cursor":"pointer"});
	});
	
	$("div.YTtitle").mouseover(function(){
		$(this).removeClass().addClass("YTtitle_up");
	}).mouseout(function(){
		$(this).removeClass().addClass("YTtitle");
	});
	
	$("div.YTtitle_page").mouseover(function(){
		$(this).removeClass().addClass("YTtitle_page_up");
	}).mouseout(function(){
		$(this).removeClass().addClass("YTtitle_page");
	});
	
	$("div.allegati_lista").mouseover(function(){
		$(this).css({"color":"#b78211","cursor":"pointer"});
	}).mouseout(function(){
		$(this).css({"color":"#666","cursor":"default"});
	});
	
	$("div.capitoli_lista").mouseover(function(){
		$(this).css({"color":"#555","cursor":"pointer"});
	}).mouseout(function(){
		$(this).css({"color":"#999","cursor":"default"});
	});
	
	$("div.capitoli_lista_view").mouseover(function(){
		$(this).css({"cursor":"pointer"});
	}).mouseout(function(){
		$(this).css({"cursor":"default"});
	});
	
	$("div.banner_mask").mouseover(function(){
		$(this).css({"border":"#b78211 solid 1px","cursor":"pointer"});
	}).mouseout(function(){
		$(this).css({"border":"#ccc solid 1px","cursor":"pointer"});
	});
	
	$("tr.riga_liste").mouseover(function(){
		$(this).css({"background":"#f8f8f8","cursor":"pointer"});
	}).mouseout(function(){
		$(this).css({"background":"#fff","cursor":"default"});
	});
	
	/*$("select.liste").mouseover(function(){
		$(this).removeClass().addClass("liste_up");
	}).mouseout(function(){
		$(this).removeClass().addClass("liste");
	});*/
	
	/*$("div.paginazione").mouseover(function(){
		$(this).removeClass().addClass("paginazione_up");
	}).mouseout(function(){
		$(this).removeClass().addClass("paginazione");
	});*/
	
	// IMPOSTAZIONI
	$("li.menu:last").css({"border-right":"none"});
	$("#visual").height($("td.blocco_cex").height()-5);
	$('.tool_tip_action').tipsy({gravity: 'se', html: true});
	$("div.search div:first a").css({"margin":"0 3px"});
	$("table.blocco_home_4 td:last").css({"padding":"0"});
	$("table.blocco_home_3 td div.banner_mask:last").css({"margin":"0"});
	
	// FANCY
	$("a#fancy_img").fancybox({
		/*'opacity'		: true,
		'overlayShow'	: false,
		'transitionIn'	: 'elastic'*/
	});
	
	$('a#facebook').popupWindow({ 
		centerBrowser:1,
		width:800, 
		height:400,
		windowURL:"http://www.facebook.com/sharer.php?u=http://www.ancilazio.it/&t=ancilazio.it"
	});
	
	$('a#twitter').popupWindow({ 
		centerBrowser:1,
		width:800,
		height:400,
		windowURL:"http://twitter.com/home?status=http://www.ancilazio.it/title=ancilazio.it"
	});
	
	// NEWS SCROLLER
	$("div.newsticker").jCarouselLite({
		vertical: true,
		hoverPause:true,
		visible: 3,
		auto:1500,
		speed:1000
	});
	
});
