var Interval;
var popUp;
var div;
function showPopupCenter(divName) {
	div = divName;	
	popUp = document.getElementById(divName);
	if(popUp){
		Interval = window.setInterval("checkScroll()",2);
		popUp.style.display='block';
	}
	
}

function hidePopup() {
	clearInterval(Interval);
	popUp.style.display='none';
}

function checkScroll() {
	var top;
	var popinHeight = 0;
	var popinWidth = 0;
	var child;
	var obj;
	
	obj = $(div).select( 'div.layer');
	if (obj!="") {popinHeight = obj[0].getHeight(); popinWidth = obj[0].getWidth();}
	
	obj = $(div).select( 'div.layerDyn');
	if (obj!="") {popinHeight = obj[0].getHeight(); popinWidth = obj[0].getWidth();}
	
	obj = $(div).select( 'div#conf-news');
	if (obj!="") {popinHeight = obj[0].getHeight(); popinWidth = obj[0].getWidth();}
	
	obj = $(div).select( 'div.conf-ajout');
	if (obj!="") {popinHeight = obj[0].getHeight(); popinWidth = obj[0].getWidth();}
	
	obj = $(div).select( 'div#Panier-confirm');
	if (obj!="") {popinHeight = obj[0].getHeight(); popinWidth = obj[0].getWidth();}
	
	obj = $(div).select( 'div#envoi-ami');
	if (obj!="") {popinHeight = obj[0].getHeight(); popinWidth = obj[0].getWidth();}
	
	obj = $(div).select( 'div#Wishlist-confirm');
	if (obj!="") {popinHeight = obj[0].getHeight(); popinWidth = obj[0].getWidth();}
	
	obj = $(div).select( 'div#Mdp-lost');
	if (obj!="") {popinHeight = obj[0].getHeight(); popinWidth = obj[0].getWidth();}
	
	obj = $(div).select( 'div#CloseConfirmRel');
	if (obj!="") {popinHeight = obj[0].getHeight(); popinWidth = obj[0].getWidth();}
	
	obj = $(div).select( 'div#CloseConfirmRel1');
	if (obj!="") {popinHeight = obj[0].getHeight(); popinWidth = obj[0].getWidth();}
	
	
	if(popinHeight ==0)
		popinHeight =250;
		
	obj="";
	// Safari
	if(navigator.userAgent.toLowerCase().indexOf("safari") != -1){
	top = document.body.scrollTop
	} else {
	top = document.documentElement.scrollTop;
	}
	
	//popUpStyleLeft = popUp.style.width.substring(0, popUp.style.width.length-2);
	halfHeight = ((getWindowHeight() - popinHeight) / 2) + top;
	halfWidth = ((getWindowWidth() - popinWidth) / 2)
	popUp.style.top = Math.round(halfHeight)+'px';
	popUp.style.left = Math.round(halfWidth)+'px';
	
}