// aprire pop-up
function apriPop(url, name, w, h) {
	var l = Math.floor((screen.width-w)/3);
	var t = Math.floor((screen.height-h)/3);
	window.open(url,name,"width=" + w + ",height=" + h + ",top=" + t + ",left=" + l);
}

// automazione per show/hide
function setSH() {

	var myElements = ".btSh";

	$(myElements).each(function(i) {

		$(this).click(function() {

			if($(this).next('div').css('display') == 'none')
				$(this).next('div').show('slow');
			else
				$(this).next('div').hide('slow');
		});

	});

}


// -------------------------------------------------------------------------

function blink(pId) {

	$('#'+pId).animate({opacity:'0.5'}, 500);

	$('#'+pId).animate({opacity:'1.0'}, 500);

}

// -------------------------------------------------------------------------

function addFavorite() {

	$(".jQueryBookmark").click(function(e){

		e.preventDefault(); // this will prevent the anchor tag from going the user off to the link
		var bookmarkUrl = this.href;
		var bookmarkTitle = this.title;

		if (window.sidebar) { // For Mozilla Firefox Bookmark
			window.sidebar.addPanel(bookmarkTitle, bookmarkUrl,"");
		} else if( window.external || document.all) { // For IE Favorite
			window.external.AddFavorite( bookmarkUrl, bookmarkTitle);
		} else if(window.opera) { // For Opera Browsers
			$("a.jQueryBookmark").attr("href",bookmarkUrl);
			$("a.jQueryBookmark").attr("title",bookmarkTitle);
			$("a.jQueryBookmark").attr("rel","sidebar");
		} else { // for other browsers which does not support
			 alert('Your browser does not support this bookmark action');
			 return false;
		}
	});

}


// -------------------------------------------------------------------------


$(document).ready(function() {

	setSH();

	addFavorite();

});

