// 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);

}

// -------------------------------------------------------------------------
// SCROLL ORIZZONTALE

function setBtScrollH() {

	var interv = 500;

	var myScrLft = 0;

	$('#btScrollH_sx').click(function() {

		myScrLft = $('#riqScrollH_int').attr('scrollLeft')-interv;

		//alert('sx '+myScrLft);

		$('#riqScrollH_int').animate({ scrollLeft: myScrLft }, 2000);

	});

	$('#btScrollH_dx').click(function() {

		myScrLft = $('#riqScrollH_int').attr('scrollLeft')+interv;

		//alert('dx '+myScrLft);

		$('#riqScrollH_int').animate({ scrollLeft: myScrLft }, 2000);

	});

}

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

$(document).ready(function() {

	setSH();

	//~ if($.browser.msie) {
		//~ if(jQuery.browser.version == '6.0') {
//~
		//~ }
	//~ }

	$("a.gallery").fancybox();

	setBtScrollH();

});

