function apriModale(){
		//$('html').addClass('noScroll'); //blocco scroll verticale
		$('select').hide(); // nascondo select per problema ie6
		$('#modalBoxOverlay').show();	//apro finestra	
		$('#spinner').show();
	};
function chiudiModale(){
	//$('html').removeClass('noScroll');
	$('select').show(); 
	$('#modalBoxOverlay, #finestraModale ').hide();
	$('#spinner').hide();
};
function mostraContenuto(data){
	var offset =$('#finestraModale').outerHeight()/2;
	if(typeof document.body.style.maxHeight == "undefined") {
		// IE6
		var viewportheight = document.documentElement.clientHeight //altezza area visibile
		var scrOfY = document.documentElement.scrollTop; //scroll verticale
		var topIe6 =scrOfY+(viewportheight/2)-offset;	//margin-top	
		$('#finestraModale').css({'top':topIe6+'px'}).fadeIn();
	}else{
		// tutti gli altri
		$('#finestraModale').css({'top':'50%', 'margin-top':'-'+offset+'px'}).fadeIn();
	};		
	$('div#finestraModale .messaggio').html(data).css({'visibility':'visible'});
	$('#spinner').hide();
}

function initLightBox(){
	$('#product_gallery a[rel=lightbox]').lightBox();
}

$(function(){
	initLightBox();
});
//	
//$(function(){
//	$('a').click(
//		function(event){ //intercetto il click
//			if($(this).attr('rel')=='ajax'){
//				apriModale();	
//				var target = $(this).attr('href');
//				alert(target);
//				$('div#finestraModale .messaggio').load(target, null, mostraContenuto);	
//				event.preventDefault();
//			}
//		}
//	);
//});


function apriScheda(quale){
	apriModale();
	$('div#finestraModale .messaggio').load(quale, null, mostraContenuto);	
}
