function addfav(url,title) {
	if (window.sidebar) { // Mozilla Firefox Bookmark
	window.sidebar.addPanel(title, url,"");
	} else if( window.external ) { // IE Favorite
	window.external.AddFavorite( url, title); }
	else if(window.opera && window.print) { // Opera Hotlist
	return true; }
}

var popupStatus = 0;
 
function loadPopup(){  
	if(popupStatus==0){  
	$jq("#backgroundPopup").css({  
	"opacity": "0.7"  
	});  
	$jq("#backgroundPopup").fadeIn("slow");  
	$jq("#kg_friendconnect").fadeIn("slow");  
	popupStatus = 1;  
	}  
} 

function disablePopup(){  
	if(popupStatus==1){  
	$jq("#backgroundPopup").fadeOut("slow");  
	$jq("#kg_friendconnect").fadeOut("slow");  
	popupStatus = 0;  
	}  
}  

function centerPopup(){    
	var windowWidth = document.documentElement.clientWidth;  
	var windowHeight = document.documentElement.clientHeight;  
	var popupHeight = $jq("#kg_friendconnect").height();  
	var popupWidth = $jq("#kg_friendconnect").width();  
	$jq("#kg_friendconnect").css({  
	"position": "absolute",  
	"top": windowHeight/2-popupHeight/2,  
	"left": windowWidth/2-popupWidth/2  
	});  
	$jq("#backgroundPopup").css({  
	"height": windowHeight  
	});     
}  

var $jq = jQuery.noConflict();

$jq(document).ready(function(){

$jq('a.email').nospam({ replaceText: true });
$jq('.removed_link').append(' (link non disponibile)');
$jq("a.email_img").nospam();
$jq("#fctrigger").click(function(){   
	centerPopup();  
	loadPopup();
});  
$jq("#popupClose").click(function(){  
	disablePopup();  
});  
$jq("#backgroundPopup").click(function(){  
	disablePopup();  
});    
$jq(document).keypress(function(e){  
	if(e.keyCode==27 && popupStatus==1){  
	disablePopup();  
	}  
});  
$jq("ol.trackbacklist").hide();
	$jq("span.trackback_show").click(function () {
		$jq("ol.trackbacklist").slideToggle("fast");
			if($jq(this).text()=="Mostra") {
			$jq(this).text("Nascondi");
			}
			else {
			$jq(this).text("Mostra");
			}
		return false;
	});
$jq("ul.categorie").find('li.cat-item').click(function(){
	var url = $jq(this).find('a').attr('href');
    window.location = url;
    return false;
	});
$jq("ul.categorie").find('li.cat-item').hover(function(){
		$jq(this).css({'background-color' : '#FAABB0', 'cursor' : 'pointer'}); 
		},function(){
		$jq(this).css({'background-color' : '#F4E9E5'});
	});

////$jq("ul.mensile").find('li.titolo_mesi').click(function(){
////	var url = $(this).find('a').attr('href');
////    window.location = url;
////    return false;
////	});
////$jq("ul.mensile").find('li.titolo_mesi').hover(function(){
////		$(this).css({'background-color' : '#C6DFDF', 'cursor' : 'pointer'}); 
////		},function(){
////		$(this).css({'background-color' : '#DBEBEA'});
////	});
$jq("#posts").find('hr').wrap("<div class='hr'></div>");
$jq(".sticky").wrap("<div class='sticky_outer'></div>");
$jq("#slider").easySlider({
				auto: false, 
				continuous: false,
				numeric: false
			});
////$jq("ul.mensile li").click(function() { //When trigger is clicked...  
////	//Following events are applied to the subnav itself (moving subnav up and down)  
////	$(this).parent().find("ul.elenco_mesi").slideDown('fast').show(); //Drop down the subnav on click  
////	$(this).parent().hover(function() { 
////	}, function(){  
////	$(this).parent().find("ul.elenco_mesi").slideUp('fast'); //When the mouse hovers out of the subnav, move it back up  
////	});  
////	//Following events are applied to the trigger (Hover events for the trigger)  
////	$(this).parent().find("ul.elenco_mesi li").hover(function(){
////		$(this).css({'background-color' : '#e8f5f4'}); 
////		},function(){
////		$(this).css({'background-color' : '#DBEBEA'});
////		});
////	$(this).parent().find("ul.elenco_mesi li").click(function(){
////	var url = $(this).find('a').attr('href');
////    window.location = url;
////    return false;
////	});
////	});  
}); 
