<!--
/*********************************************
	© 2006 Interactif.com - Olivier Cozette
*********************************************/
// Dimensions des boutons
buttonClosewidth=10;
buttonMaxiwidth=10;
heightFooter=25;
// Définir les variables
mousePosX=0;
mousePosY=0;
layer='';
origX=0;
origY=0;
origLayerX=0;
origLayerY=0;
origwidth=0;
origheight=0;
minwidth=30;
minheight=30;
layerResize=0;
layerDrag=0;
popupLayerOpen=0;
maxiMiniLayer=0;
resize=false;
// Images à préloader
var tabImg=new Array('bt_popupl_resize','bt_popupl_close','bt_popupl_minmax','bt_popupl_newwin');
// Chemin
var leChemin="img/";
// Preloader les images
for (var x=0;x<tabImg.length;x++) {
	eval(tabImg[x]+"_a=new Image();");
	eval(tabImg[x]+"_a.src=\""+leChemin+""+tabImg[x]+"_a.gif\";");
	eval(tabImg[x]+"_b=new Image();");
	eval(tabImg[x]+"_b.src=\""+leChemin+""+tabImg[x]+"_b.gif\";");	
}
// Définir les coordonnées X et Y
function getMouseXY(e) {
	if (document.all) {
		mousePosX=event.clientX;+document.body.scrollleft;
		mousePosY=event.clientY;+document.body.scrolltop
	} else {
		mousePosX=e.pageX;
		mousePosY=e.pageY
	}
}
// Déplacer le popup
function startLayerDrag(layerID) {
	layer=document.getElementById(layerID);
	origX=mousePosX;
	origY=mousePosY;
	origLayerX=Math.abs(layer.style.left.substring(0,layer.style.left.length-2));
	origLayerY=Math.abs(layer.style.top.substring(0,layer.style.top.length-2));
	document.onmousemove=(resize==true?onResize:onLayerDrag)
	if (document.all) {
		document.all["popupLayerContent"].style.visibility='hidden'
	} else {
		document.getElementById('popupLayerContent').style.visibility='hidden'
	}
}
// Actions drag et fin de drag
function endLayerDrag() {
	if (layerResize==1) {
		endResize()
	}
	if (document.all) {
		document.all["popupLayerContent"].style.visibility='visible';
		document.all["popupLayerFooter"].style.visibility='visible'
	} else {
		document.getElementById('popupLayerContent').style.visibility='visible';
		document.getElementById('popupLayerFooter').style.visibility='visible'
	}
	layerDrag=0;
	layer='';
	origX=0;
	origY=0;
	document.onmousemove=getMouseXY
}
function onLayerDrag(e) {
	layerDrag=1;
	getMouseXY(e);
	diffX=mousePosX-origX;
	diffY=mousePosY-origY;
	layer.style.left=origLayerX+diffX+'px';
	layer.style.top=origLayerY+diffY+'px'
}
// Actions resize et fin resize
function startResize(layerID) {
	if (document.all) {
		document.all["popupLayerContent"].style.visibility='hidden';
		document.all["popupLayerFooter"].style.visibility='hidden'
	} else {
		document.getElementById('popupLayerContent').style.visibility='hidden';
		document.getElementById('popupLayerFooter').style.visibility='hidden'
	}
	if (layerDrag==1) {
		endLayerDrag()
	}
	layerResize=1;
	layer=document.getElementById(layerID);
	origX=mousePosX;
	origY=mousePosY;
	origwidth=Math.abs(layer.style.width.substring(0,layer.style.width.length-2));
	origheight=Math.abs(layer.style.height.substring(0,layer.style.height.length-2));
	resize=true
}
function endResize() {
	layerResize=0;
	layer='';
	origX=0;
	origY=0;
	resize=false;
	document.onmousemove=getMouseXY;
	if (document.all) {
		document.all["popupLayerTitle"].style.width=iframewidth+'px';
		document.all["iframeLayerContent"].style.width='100%';
		document.all["iframeLayerContent"].style.height=iframeheight;
		document.all["popupLayerContent"].style.visibility='visible'
	} else {
		document.getElementById('popupLayerTitle').style.width=iframewidth-7+'px';
		document.getElementById('iframeLayerContent').style.width='100%';
		document.getElementById('iframeLayerContent').style.height=iframeheight;
		document.getElementById('popupLayerContent').style.visibility='visible'
	}
}
function onResize(e) {
	getMouseXY(e);
	diffX=mousePosX-origX;
	diffY=mousePosY-origY;
	if (origwidth+diffX<=minwidth) {
		layer.style.width=minwidth+'px';
		iframewidth=minwidth
	} else {
		layer.style.width=origwidth+diffX+'px';
		iframewidth=origwidth+diffX
	}
	if (origheight+diffY<=minheight) {
		layer.style.height=minheight+'px';
		iframeheight=minheight-layerTitleHeight-heightFooter-2
	} else {
		layer.style.height=origheight+diffY+'px';
		iframeheight=origheight+diffY-layerTitleHeight-heightFooter-2
	}
	if (document.all) {
		document.all["popupLayerContent"].style.visibility='hidden'
	} else {
		document.getElementById('popupLayerContent').style.visibility='hidden'
	}
}
// Calculer les dimensions, définir les variables et positionner
// layerPopup('nom_de_la_page.cfm',30,'Titre du popup',300,150,-1,-1,0,1,1)
function layerPopup(layerPage,LayerHautTitle,layerTitleContent,layerLarg,layerHaut,layerPosx,layerPosy,newWindow,scrolling,ico) {
	if (scrolling==1) {
		layerScrolling="auto";
	} else {
		layerScrolling=0;
	}
	if (ico==1) {
		layerIcoContent='<img src="img/bt_popupl_icoie.gif" width="21" height="21">';
	} else {
		layerIcoContent='';
	}
	layerTitleHeight=LayerHautTitle;
	layerContentTitle=layerTitleContent;
	layerUrlToView=layerPage;
	layerPopupLarg=layerLarg;
	layerPopupHaut=layerHaut;
	layerNewWindow=newWindow;
	if (layerPosx!=-1 && layerPosy!=-1) {
		popupLayerPosX=layerPosx;
		popupLayerPosY=layerPosy;		
	}
	hideObjects();
	if (layerNewWindow==0) {
		if (document.all) {
			document.all["popupLayerNewWindow"].style.visibility='hidden'
		} else {
			document.getElementById('popupLayerNewWindow').style.visibility='hidden'
		}
	}
	if (document.all) {
		document.all["popupLayer"].style.width=layerLarg+'px';
		document.all["popupLayer"].style.height=layerHaut+'px';
		document.all["popupLayerTitle"].style.height=layerTitleHeight+'px';
		document.all["popupLayerTitle"].style.width=layerLarg+'px';
		document.all["popupLayerTitle"].innerHTML='<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td width="1%">'+layerIcoContent+'</td><td class="spopupTitle">'+layerContentTitle+'</td></tr></table>';
		var leScrollX=document.body.scrollLeft;
		var leScrollY=document.body.scrollTop;
		// Centrer X et Y
		if (layerPosx==-1 && layerPosy==-1) {
			var fWinLarg=document.body.offsetWidth;
			var fWinHaut=document.body.offsetHeight;
			popupLayerPosX=(fWinLarg/2)-(layerLarg/2);
			popupLayerPosY=(fWinHaut/2)-(parseInt(layerHaut-layerTitleHeight-heightFooter-2)/2);
			document.all["popupLayer"].style.left=popupLayerPosX+leScrollX;
			document.all["popupLayer"].style.top=popupLayerPosY+leScrollY
		} else if (layerPosx!=-1 && layerPosy!=-1) {
			document.all["popupLayer"].style.left=layerPosx+leScrollX;
			document.all["popupLayer"].style.top=layerPosy+leScrollY
		}
		// Centrer  X
		if (layerPosx==-1 && layerPosy!=-1) {
			var fWinLarg=document.body.offsetWidth;
			popupLayerPosX=(fWinLarg/2)-(layerLarg/2);
			document.all["popupLayer"].style.left=popupLayerPosX+leScrollX;
			document.all["popupLayer"].style.top=layerPosy+leScrollY
		// Center Y
		} else if (layerPosx!=-1 && layerPosy==-1) {
			var fWinHaut=document.body.offsetHeight;
			popupLayerPosY=(fWinHaut/2)-(parseInt(layerHaut-layerTitleHeight-heightFooter-2)/2);
			document.all["popupLayer"].style.left=layerPosx+leScrollX;
			document.all["popupLayer"].style.top=popupLayerPosY+leScrollY
		}
		document.all["popupLayerContent"].innerHTML='<iframe id="iframeLayerContent" name="iframeLayerContent" src="'+layerUrlToView+'" height="'+parseInt(layerHaut-layerTitleHeight-heightFooter-2)+'" width="'+layerLarg+'" frameborder="0" scrolling="'+layerScrolling+'">';
	} else {
		document.getElementById('popupLayer').style.width=layerLarg+'px';
		document.getElementById('popupLayer').style.height=layerHaut+'px';
		document.getElementById('popupLayerTitle').style.height=layerTitleHeight+'px';
		document.getElementById('popupLayerTitle').style.width=layerLarg-7+'px';
		document.getElementById('popupLayerTitle').innerHTML='<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td width="1%">'+layerIcoContent+'</td><td class="spopupTitle">'+layerContentTitle+'</td></tr></table>';
		var leScrollX=self.pageXOffset;
		var leScrollY=self.pageYOffset;
		// Centrer X et Y
		if (layerPosx==-1 && layerPosy==-1) {
			var fWinLarg=window.innerWidth;
			var fWinHaut=window.innerHeight;
			popupLayerPosX=(fWinLarg/2)-(layerLarg/2);
			popupLayerPosY=(fWinHaut/2)-(parseInt(layerHaut-layerTitleHeight-heightFooter-2)/2);
			document.getElementById('popupLayer').style.left=popupLayerPosX+leScrollX;
			document.getElementById('popupLayer').style.top=popupLayerPosY+leScrollY
		} else if (layerPosx!=-1 && layerPosy!=-1) {
			document.getElementById('popupLayer').style.left=layerPosx+leScrollX;
			document.getElementById('popupLayer').style.top=layerPosy+leScrollY
		}
		// Centrer X
		if (layerPosx==-1 && layerPosy!=-1) {
			var fWinLarg=window.innerWidth;
			popupLayerPosX=(fWinLarg/2)-(layerLarg/2);
			document.getElementById('popupLayer').style.left=popupLayerPosX+leScrollX;
			document.getElementById('popupLayer').style.top=layerPosy+leScrollY
		// Centrer Y
		} else if (layerPosx!=-1 && layerPosy==-1) {
			var fWinHaut=window.innerHeight;
			popupLayerPosY=(fWinHaut/2)-(parseInt(layerHaut-layerTitleHeight-heightFooter-2)/2);
			document.getElementById('popupLayer').style.left=layerPosx+leScrollX;
			document.getElementById('popupLayer').style.top=popupLayerPosY+leScrollY
		}
		document.getElementById('popupLayerContent').innerHTML='<iframe id="iframeLayerContent" name="iframeLayerContent" src="'+layerUrlToView+'" height="'+parseInt(layerHaut-layerTitleHeight-heightFooter-2)+'" width="'+layerLarg+'" frameborder="0" scrolling="'+layerScrolling+'">';
	}
	if (popupLayerOpen==0) {
		openLayerPopup()
	}
}

// Fermer le popup layer
function closeLayerPopup() {
	popupLayerOpen=0;
	showObjects();
    
	if (document.all) {
		document.all["popupLayerContent"].style.visibility='hidden';
		document.all["popupLayer"].style.visibility='hidden';
		document.all["popupLayerFooter"].style.visibility='hidden';
		document.all["popupLayerContent"].innerHTML=''
		
	} else {
		document.getElementById('popupLayerContent').style.visibility='hidden';
		document.getElementById('popupLayer').style.visibility='hidden';
		document.getElementById('popupLayerFooter').style.visibility='hidden';
		document.getElementById('popupLayerContent').innerHTML=''
	}
    
}
// Afficher le popup layer
function openLayerPopup() {
	popupLayerOpen=1;
	if (document.all) {
		document.all["popupLayer"].style.visibility='visible';
		document.all["popupLayerContent"].style.visibility='visible';
		document.all["popupLayerFooter"].style.visibility='visible'
	} else {
		document.getElementById('popupLayer').style.visibility='visible';
		document.getElementById('popupLayerContent').style.visibility='visible';
		document.getElementById('popupLayerFooter').style.visibility='visible'
	}
}
// Ouvrir dans une nouvelle fenêtre
function newWindow() {
	closeLayerPopup();
	window.open(layerUrlToView)
}
// Maximizer Minimizer le poupup layer
function maxMinPopupLayer() {
	var passHere=0;
	if (maxiMiniLayer==0) {
		maxiMiniLayer=1;
		var decalPopupLayer=0;
		passHere=1;
		if (document.all) {
			var leScrollX=document.body.scrollLeft;
			var leScrollY=document.body.scrollTop;
			var fWinLarg=document.body.offsetWidth;
			var fWinHaut=document.body.offsetHeight;
			document.all["popupLayer"].style.width=fWinLarg-decalPopupLayer-25+'px';
			document.all["popupLayer"].style.height=fWinHaut-decalPopupLayer-5+'px';
			document.all["popupLayerTitle"].style.width=fWinLarg-decalPopupLayer+'px';
			document.all["iframeLayerContent"].style.width=fWinLarg-decalPopupLayer-25;
			document.all["iframeLayerContent"].style.height=fWinHaut-layerTitleHeight-heightFooter-decalPopupLayer-2-5;
			document.all["popupLayer"].style.left=leScrollX;
			document.all["popupLayer"].style.top=leScrollY
		} else {
			var leScrollX=self.pageXOffset;
			var leScrollY=self.pageYOffset;
			var fWinLarg=window.innerWidth;
			var fWinHaut=window.innerHeight;
			document.getElementById('popupLayer').style.width=fWinLarg-decalPopupLayer-25+'px';
			document.getElementById('popupLayer').style.height=fWinHaut-decalPopupLayer-5+'px';
			document.getElementById('popupLayerTitle').style.width=fWinLarg-decalPopupLayer-7+'px';
			document.getElementById('iframeLayerContent').style.width=fWinLarg-decalPopupLayer-25;
			document.getElementById('iframeLayerContent').style.height=fWinHaut-layerTitleHeight-heightFooter-decalPopupLayer-2-5;
			document.getElementById('popupLayer').style.left=leScrollX;
			document.getElementById('popupLayer').style.top=leScrollY
		}
	} else {
		if (passHere==0) {
			maxiMiniLayer=0;
			if (document.all) {
				document.all["popupLayer"].style.width=layerPopupLarg+'px';
				document.all["popupLayer"].style.height=layerPopupHaut+'px';
				document.all["popupLayerTitle"].style.width=layerPopupLarg+'px';
				document.all["iframeLayerContent"].style.width='100%';
				document.all["iframeLayerContent"].style.height=layerPopupHaut-layerTitleHeight-heightFooter-2;
				document.all["popupLayer"].style.left=popupLayerPosX;
				document.all["popupLayer"].style.top=popupLayerPosY
			} else {
				document.getElementById('popupLayer').style.width=layerPopupLarg+'px';
				document.getElementById('popupLayer').style.height=layerPopupHaut+'px';
				document.getElementById('popupLayerTitle').style.width=layerPopupLarg-7+'px';
				document.getElementById('iframeLayerContent').style.width='100%';
				document.getElementById('iframeLayerContent').style.height=layerPopupHaut-layerTitleHeight-heightFooter-2;
				document.getElementById('popupLayer').style.left=popupLayerPosX;
				document.getElementById('popupLayer').style.top=popupLayerPosY
			}
		}
	}
}
// Rollovers des boutons
function rolloPopupLayer(imgName,etat,type) {
	if (type==0) { // boutons
		if (etat==1) {
			eval("document."+imgName+".src="+imgName+"_b.src;")
		}
		if (etat==0) {
			eval("document."+imgName+".src="+imgName+"_a.src;")
		}
	}
}
// Cacher les objets
function hideObjects() {
	var tabObjets=new Array('iframe','select');
	for (x=0;x<=tabObjets.length;x++) {
		eval("var oSelects=document.getElementsByTagName('"+tabObjets[x]+"');")
		if (oSelects.length>0) { 
			for (i=0;i<oSelects.length;i++) {
				oSelects[i].style.visibility='hidden'
			} 
		}
	}

}
// Afficher les objets
function showObjects() {
	var tabObjets=new Array('iframe','select');
	for (x=0;x<=tabObjets.length;x++) {
		eval("var oSelects=document.getElementsByTagName('"+tabObjets[x]+"');")
		if (oSelects.length>0) { 
			for (i=0;i<oSelects.length;i++) {
				oSelects[i].style.visibility='visible'
			} 
		}
	}
    
    if (lesprovincesok==1) { 
    showProvinces();
    }
}
document.onmousemove=getMouseXY
//-->