function apriPrivacy(){
var larghezza= 370;
var altezza= 400;
var windowLeft = (screen.width - larghezza) / 2;
var windowTop = (screen.height - altezza) / 2;
 window.open('http://www.perfiducia.com/it/normativa-privacy/', 'popupPrivacy', 'height='+ altezza +', width='+larghezza+', top=' + windowTop + ',left=' + windowLeft + ',scrollbars=yes, resizable=0, menubar=0, toolbar=0, location=0, statusbar=0, fullscreen=0');
}; 

function apriModale(){
		//$('html').addClass('noScroll'); //blocco scroll verticale
		//$('select').hide(); // nascondo select per problema ie6			
		$('#modalBoxOverlay').show();	//apro finestra	
	};
	function chiudiModale(){
		//$('html').removeClass('noScroll');
		//$('select').show(); 
		$('#modalBoxOverlay, #finestraModale ').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'}).animate({height:'100px'});
		};		
		$('div#finestraModale .messaggio').html(data).css({'visibility':'visible'});
	}
	
	
// ----------------------------------------------------------	

$(function(){
	// apri privacy
	$('a#priv, a.priv').live('click', function(){
		apriPrivacy();
		return false;
	});
	
	// apri modale per parla l'oca
	$('a').click(function(event){ //intercetto il click
		if($(this).attr('rel')=='ajax'){
		apriModale();	
		var target = $(this).attr('href');			
		$('div#finestraModale .messaggio').load(target, null, mostraContenuto);	
		event.preventDefault();		
		}
	});
	// apri modale per parla l'oca
	$('a.btnChiudiModale, p.feedback a').live('click', function(){ 
		chiudiModale();	
		return false();	
	});
});