/* popin
------------------------------------------------------------------------------*/
/*
$(document).ready(function()
{
	if($("#popin").length) { afficher_popin(); }
});
*/
function denied_popin(url)
{
	//window.open(url,'barometre');
	//$("#popin").load(url,function(){  });
	$("body").append('<iframe src="'+url+'" name="IFDeniedBarometre" style="display:none;">');

}
function masquer_popin()
{
	$("#ecran,#popin").hide();
	if(document.all) document.body.style.overflow = 'auto';
	else document.body.style.overflow = 'visible';
}
function afficher_popin()
{
	/*
	$("#popin").load(page,function(){
	});
	*/
	$("#popin .bhaut a").click(function(){
		masquer_popin();
		return false;
	});	
	$("#popin .aLater a").click(function(){
		masquer_popin();
		return false;
	});	
	$("#popin .aClose a").click(function(){
		masquer_popin();
		return false;
	});	
	$("#popin .aWindow a").click(function(){
		masquer_popin();
	});
	$(function()
	{
		$("#ecran,#popin").show();
		initPopin();
	});
}
var popupBarometre = null;
function openBarometre(url,largeur,hauteur)
{
	var dessus=(screen.height/2)-(hauteur/2);
	var gauche=(screen.width/2)-(largeur/2);
	var features='';
	features+='  height='+hauteur+''
	features+=', width='+largeur+''
	features+=', top='+dessus+''
	features+=', left='+gauche+''
	features+=', scrollbars=yes';
	if(popupBarometre) popupBarometre.close();
	popupBarometre  = window.open(url,'barometre',features);
	if(popupBarometre) masquer_popin();
}
/************************** Traitement de la PopIn */
function initPopin()
{
	if($("#popin").length && $("#ecran").length )
	{
		if($("#popin").css('display') == 'block')
			$("#ecran").show();
		
		if($("#ecran").css('display') == 'block')
			$("#popin").show();
		
		if($("#popin").css('display') == 'block')
		{
			// Traitement de la largeur
			docWidth = document.all?document.body.offsetWidth:window.innerWidth;
			$("#popin").css('left',returnResize(docWidth,700,40,1000));
			// Traitement de la hauteur
			docHeight = document.all?document.body.offsetHeight:window.innerHeight;
			$("#popin").css('top',returnResize(docHeight,400,18,40));
			// Efface le scroll
		//	document.getElementsByTagName('html')[0].style.overflow = "hidden";
		//	document.getElementsByTagName('body')[0].style.overflow = "hidden";
			//changeAttribut(document.body,'style','overflow:hidden;');
		}
	}
}
document.onmouseover = initPopin

function returnResize(docl,l,min,max)
{
	if(docl < min) docl = min;
	if(docl > max) docl = max;
	returnL = (docl - l)/2;
	if(returnL < min) returnL = min;
	return returnL + 'px';
}
/*
------------------------------------------------------------------------------*/