// JavaScript Document

var timer;
var isDataSending=false;
addLoadEvent(init);

function getElem(sID){
	if(document.getElementById(sID)){
		return $(sID); 
	}
}

var sVideoAideEnCours='';
function  loadVideoAide(id,sTitre,video){
	sVideoAideEnCours=video;
	$('btAideGENERALE').src='img/aide/bt-GENERALE-off.png';
	$('btAideCOMMANDER').src='img/aide/bt-COMMANDER-off.png';
	/*$('btAideSUIVRE').src='img/aide/bt-SUIVRE-off.png';
	$('btAideTELECHARGER').src='img/aide/bt-TELECHARGER-off.png';	
	$('btAideDECOUVRIR').src='img/aide/bt-DECOUVRIR-off.png';*/
	$('btAide'+video).src='img/aide/bt-'+video+'-on.png';
	
	swfobject.embedSWF("img/aide/playerAide.swf?tmp="+(Math.random()*1000), id, "642", "449", "10.0.0","", {titre:sTitre,fileVideo:'http://www.msafrance.com/sitemsa/img/aide/'+video+'.f4v',filePreview:'img/aide/'+video+'.png'}, {wmode:'transparent',allowFullScreen:'true'});
	trace({evnt:'chargement',param1:'video_aide',param4:'msa',param5:video,version_site:'2'});
}
function init(){
	//$('loading').fade({ duration: 0.5 });
	//hack css IE6
	var strChUserAgent = navigator.userAgent;
	var intSplitStart = strChUserAgent.indexOf("(",0);
	var intSplitEnd = strChUserAgent.indexOf(")",0);
	var strChMid = strChUserAgent.substring(intSplitStart, intSplitEnd);	
	if(strChMid.indexOf("MSIE 6")>0){		
		$('bloc-gauche').style.marginLeft='3px';
	}
}
var GLOBAL_nNbLayer=0;
var GLOBAL_aLayer=new Array();
var GLOBAL_nBordureLayer=5;
function layer(aParam){	
 	
	//rentre automatiquement le panneau de changement de brochure :
	if(document.getElementById('btn-panel-brochure')){
			setPanelUp()
     
	}
	
	//BUG FIRE FOX POPUP / FOND GRIS
	var bOpen = true;
	var sUserAgent = navigator.userAgent;
	if(GLOBAL_nNbLayer==0){
		var eID = 'bglayer';
	}else{
		var eID = GLOBAL_aLayer[(GLOBAL_nNbLayer-2)]+"-grise";
	}
	
	if(sUserAgent.indexOf("Firefox") != -1){
		if(document.getElementById(eID)){
			var eStyle = document.getElementById(eID).style;
			var nOpacity = eStyle.opacity;
			if(nOpacity<0.6 && nOpacity){
				bOpen = false;
			}
		}
			
	}else{
		if(document.getElementById(eID)){
			
			if(document.getElementById(eID).style.display!='none' && document.getElementById(eID).style.display!=''){
				bOpen = false;
			}
			
		}
			
	}
	//kTrace(eID+' -> D:'+ document.getElementById(eID).style.display);
	
	
	if(bOpen){
			
		hideFlash();
		GLOBAL_nNbLayer++;
		var sId=new String();
		if(aParam['id']){
			sId=aParam['id'];
		}else{
			sId="layer";
		}
		var nHeight=new Number();
		if(aParam['height']){
			nHeight=aParam['height'];
		}else{
			nHeight=800;
		}
	
		var nWidth=new Number();
		if(aParam['width']){
			nWidth=aParam['width'];
		}else{
			nWidth=800;
		}
		var sUrl=new Number();
		if(aParam['url']){
			sUrl=aParam['url'];
		}else{
			sUrl="";
		}
		var autosize='non';
		if(aParam['autosize']=='oui'){
			autosize='oui';
		}
	
		var sParam=new Number();
		if(aParam['param']){
			sParam=aParam['param'];
		}else{
			sParam="";
		}
	
		nWidth=nWidth+(GLOBAL_nBordureLayer*2);
		nHeight=nHeight+(GLOBAL_nBordureLayer*2);
		grise();
		
		var div=document.createElement('div');
		div.setAttribute("id",sId);
		GLOBAL_aLayer.push(sId);
		
		document.body.appendChild(div);
			
		$(sId).style.display='block';
		$(sId).style.position='absolute';
		$(sId).style.zIndex=10000;
		$(sId).style.backgroundColor='#ffffff';
		$(sId).style.width='2px';
		//$(sId).style.height='2px';	
		$(sId).style.left='50%';
		if(autosize=='oui'){
			$(sId).style.top=getPositionHPopup()+'px';//'200px';
		}else{
			$(sId).style.top=getPositionHPopup(nHeight)+'px';//'50%';
			$(sId).style.marginTop='-1px';
		}
		if(aParam['top']){
			$(sId).style.top=aParam['top']+'px';//'50%';
			$(sId).style.marginTop='-1px';
		}
		$(sId).style.marginLeft='-1px';
		
		//$(sId).style.marginBottom='50px';
		
		morphLayer(sId,2,nHeight,0.8);	
		setTimeout("morphLayer('"+sId+"','"+nWidth+"','"+nHeight+"',0.5,'"+autosize+"')",1000);
		setTimeout("openUrlLayer('"+sId+"','"+sUrl+"','"+sParam+"','"+autosize+"')",2000);
		
	}
	//$(sId).grow();
	//Effect.SlideDown(sId);	
	/*	
	$(sId).onclick=function(){
		$(this.id).fade();	
		setTimeout("removeLayer('"+this.id+"')",1200);
		degrise();
	}
	*/

}
function layerLocation(aParam){
	
	var sId=aParam['id'];
	var sUrl=aParam['url'];
	var sParam=aParam['param'];	
	
	var divLoading=document.createElement('div');	
	divLoading.setAttribute("id",sId+'ContentLoading');	
	$(sId).appendChild(divLoading);
	$(sId+'ContentHtml').style.display='none';
	$(sId+'ContentLoading').style.backgroundColor='#dddddd';
	$(sId+'ContentLoading').style.margin=GLOBAL_nBordureLayer+'px';
	$(sId+'ContentLoading').style.height=(parseInt($(sId).style.height)-(GLOBAL_nBordureLayer*2))+"px";
	$(sId+'ContentLoading').style.width=(parseInt($(sId).style.width)-(GLOBAL_nBordureLayer*2))+"px";
	$(sId+'ContentLoading').style.display='none';
	$(sId+'ContentLoading').style.position='absolute';
	$(sId+'ContentLoading').style.textAlign='center';
	$(sId+'ContentLoading').align = 'center';
	$(sId+'ContentLoading').innerHTML='<img src="img/loadingLayer.gif" style="margin-top:-16px;top:50%;position:absolute;" />';
	$(sId+'ContentLoading').style.zIndex='999';
	$(sId+'ContentLoading').appear();
	
	new Ajax.Request(sUrl,{
		asynchronous:true,
		method:'post',
		parameters:'idLayer='+sId+'&'+sParam,
		onSuccess:function(t){	
			var sChaine=t.responseText;
			$(sId).removeChild($(sId+'ContentLoading'))
			
			$(sId+'ContentHtml').innerHTML=sChaine+"";
			autoLoad({id:sId+'ContentHtml'});
			$(sId+'ContentHtml').appear();
			if(typeof onLoad == 'function'){
				var func=onLoad;												
				func();
			}
		}
	});	
	
}
function reOpenLayer(aParam){
	var sId=aParam['id'];
	var sUrl=aParam['url'];
	var nWidth=aParam['width']+10;
	var nHeight=aParam['height']+10;
	var autosize=aParam['autosize'];
	var sParam=aParam['param'];
	$(sId+'ContentHtml').fade();

	setTimeout("morphLayer('"+sId+"','"+nWidth+"','"+nHeight+"',0.5,'"+autosize+"')",1000);		
	setTimeout("openUrlLayer('"+sId+"','"+sUrl+"','"+sParam+"','"+autosize+"')",2000);	
		
}
function removeLayer(sId){
	GLOBAL_nNbLayer--;
	GLOBAL_aLayer.pop();
	document.body.removeChild($(sId));
	if(document.getElementById('tooltip')){$('tooltip').style.top=0+'px';}
}
function openUrlLayer(sId,sUrl,sParam,sAutoSize){
	
	$(sId).innerHTML='';
	
	//trace google analytics
	var aParam=sParam.split("&");	
	var aPageParam=new Array();
	var aIdParam=new Array('','','','','','','','','','');
	var sIdParam='';
	var bParamFound=0;
	for(var k=0;k<aParam.length;k++){		
		if(aParam[k].indexOf("page=")>-1){
			aPageParam=aParam[k].split("=");
			bParamFound=1;
			//trace du param page			
		}
		if(aParam[k].indexOf("id=")>-1){
			aIdParam=aParam[k].split("=");
			sIdParam="_"+aIdParam[1];
			//trace du param id	
			
		}
	}
	
	if(!bParamFound){
		//si pas de param page, on trace URL
		try {
		pageTracker._trackPageview("/script/"+sUrl ); 
		} catch(err) {}
		
	}else{
		if(aPageParam[1]=="suivre-popup"){
			sIdParam='';
		}
		if(aPageParam[1]=="telecharge-popup"){
			sIdParam='';
		}
		if(aPageParam[1]=="add_panier"){
			aPageParam[1]="ajout_panier";
		}
		if(aPageParam[1]=="clindoeil"){
			switch(sIdParam){
				case "_1":sIdParam="_profile_inox_repose_casserole";break;
				case "_2":sIdParam="_bloc_prise_retractable";break;
				case "_3":sIdParam="_showroom_interactif_led";break;
				case "_4":sIdParam="_kit_credence_lumineuse";break;
				case "_6":sIdParam="_barrette_lumineuse_et_spot_led";break;
				case "_7":sIdParam="_bloc_spot_carre";break;
				case "_8":sIdParam="_etagere_lumineuse";break;
				case "_9":sIdParam="_bloc_prise_angle";break;
				case "_10":sIdParam="_bloc_prise_multiposition";break;
				case "_11":sIdParam="_pieds_table_carre_acier";break;
			}
		}
		try {
			pageTracker._trackPageview("/popup/"+aPageParam[1]+sIdParam); 	
		} catch(err) {}
		
	}
	//fin de trace google analytics
	
	var divGriseTmp=document.createElement('div');	
	divGriseTmp.setAttribute("id",sId+'-griseTmp');	
	$(sId).appendChild(divGriseTmp);
	$(sId+'-griseTmp').style.display='none';
	
	var divGrise=document.createElement('div');	
	divGrise.setAttribute("id",sId+'-grise');	
	$(sId).appendChild(divGrise);
	$(sId+'-grise').style.display='none';
	
	$(sId+'-grise').style.backgroundColor='#000000';
	$(sId+'-grise').style.position='absolute';
	$(sId+'-grise').style.width=$(sId).style.width;
	$(sId+'-grise').style.zIndex=$(sId).style.zIndex+1;
	
	
	//BUG IE7 - Bordure top de la popup ki disparait
	var sUserAgent = navigator.userAgent;
	if(sUserAgent.indexOf("MSIE") != -1){
		var divBordure=document.createElement('div');	
		divBordure.setAttribute("id",sId+'ContentBordure');	
		$(sId).appendChild(divBordure);
		divBordure.style.height='0px';
		divBordure.innerHTML='';
	}
	/*
	var divBG = document.createElement('div');
	divBG.setAttribute("id",sId+'ContentBG');	
	divBG.style.backgroundColor='#ffffff';
	$(sId).appendChild(divBG);
	$(sId+'ContentBG').style.position='absolute';
	*/
	var div=document.createElement('div');	
	div.setAttribute("id",sId+'ContentHtml');	
	$(sId).appendChild(div);//$(sId+'ContentBG').appendChild(div);
	
	/*
	var br = document.createElement('br');$(sId).appendChild(br);
	var sp = document.createElement('div'); sp.style.height='20px'; sp.style.position='absolute'; $(sId).appendChild(sp); 
	var br2 = document.createElement('br');$(sId).appendChild(br2);
	//$(sId).style.innerHTML = $(sId).innerHTML+'<div style="height:20px;"></div>';
	*/
	
	var divLoading=document.createElement('div');	
	divLoading.setAttribute("id",sId+'ContentLoading');	
	$(sId).appendChild(divLoading);
	
	$(sId+'ContentLoading').style.backgroundColor = '#dddddd';
	$(sId+'ContentLoading').style.margin=GLOBAL_nBordureLayer+'px';
	$(sId+'ContentLoading').style.height=(parseInt($(sId).style.height)-(GLOBAL_nBordureLayer*2))+"px";
	$(sId+'ContentLoading').style.width=(parseInt($(sId).style.width)-(GLOBAL_nBordureLayer*2))+"px";
	$(sId+'ContentLoading').style.display='none';
	$(sId+'ContentLoading').style.position='absolute';
	$(sId+'ContentLoading').style.textAlign='center';	
	$(sId+'ContentLoading').innerHTML='<img src="img/loadingLayer.gif" style="margin-top:-16px;top:50%; left:50%;position:absolute;" alt="chargement ..."/>';
	$(sId+'ContentLoading').style.zIndex='999';
	$(sId+'ContentLoading').appear();
	$(sId+'ContentHtml').style.overflow='hidden';
	$(sId+'ContentHtml').style.margin=GLOBAL_nBordureLayer+'px';
	$(sId+'ContentHtml').style.height=(parseInt($(sId).style.height)-(GLOBAL_nBordureLayer*2))+"px";
//	$(sId).style.height='auto';

	//$(sId+'ContentHtml').style.height='auto';
	
	$(sId+'ContentLoading').style.width=(parseInt($(sId).style.width)-(GLOBAL_nBordureLayer*2))+"px";
	$(sId+'ContentHtml').style.display='none';
	//$(sId+'ContentHtml').style.position='absolute';

	if($(sId).offsetLeft<35){
		$(sId).style.marginLeft="0px";
		$(sId).style.left="35px";
		$('bglayer').style.width=(parseInt($(sId).style.width)+70)+"px";
	}
	if($(sId).offsetTop<35){
		$(sId).style.marginTop="0px";
		$(sId).style.top="35px";
		$('bglayer').style.height=(parseInt($(sId).style.height)+70)+"px";
		
	}

	$(sId+'ContentHtml').style.zIndex='1000';
			
	setTimeout(function(){
			if(!document.getElementById(sId+'btnClose') && document.getElementById(sId)){
				var div=document.createElement('div');	
				div.setAttribute("id",sId+'btnClose');	
				$(sId).appendChild(div);
				$(sId+'btnClose').style.position='absolute';
				$(sId+'btnClose').style.marginLeft=(parseInt($(sId).style.width)/2-75)+"px";
				$(sId+'btnClose').style.top="-25px";
				$(sId+'btnClose').style.width="150px";
				$(sId+'btnClose').style.color="#ffffff";
				$(sId+'btnClose').style.textAlign="center";
				$(sId+'btnClose').innerHTML='<!--<img src="img/closeLayer.png" width="31" height="17" style="cursor:pointer;" alt="Fermer" class="png" onclick="$(\''+sId+'\').style.display=\'none\';removeLayer(\''+sId+'\');degrise();" />--><span style=\"cursor:pointer;text-decoration:underline;\" onclick="$(\''+sId+'\').style.display=\'none\';removeLayer(\''+sId+'\');degrise();">Fermer cette fen&ecirc;tre</span>';				
			}
			},2000);
		
			
	new Ajax.Request(sUrl,{
		asynchronous:true,
		method:'post',
		parameters:'idLayer='+sId+'&'+sParam,
		onSuccess:function(t){
			if(document.getElementById(sId+'btnClose')){
				$(sId).removeChild($(sId+'btnClose'));
			}
			var sChaine=t.responseText;
			$(sId).removeChild($(sId+'ContentLoading'))
					
			$(sId+'ContentHtml').innerHTML=sChaine+"";
			
			autoLoad({id:sId+'ContentHtml'});
				btSlideShowisVisible=false;
			//bouton close
			if(!document.getElementById(sId+'btnClose')){
				var div=document.createElement('div');	
				div.setAttribute("id",sId+'btnClose');	
				$(sId).appendChild(div);
				$(sId+'btnClose').style.position='absolute';
				$(sId+'btnClose').style.marginLeft=(parseInt($(sId).style.width)-35)+"px";
				$(sId+'btnClose').style.top="-17px";	
				$(sId+'btnClose').innerHTML='<img src="img/closeLayer.png" width="31" height="17" style="cursor:pointer;" alt="Fermer" class="png" onclick="$(\''+sId+'\').style.display=\'none\';removeLayer(\''+sId+'\');degrise();" />';
				
			}
			
			//$(sId+'ContentHtml').appear();
			$(sId+'ContentHtml').style.display='block';
			//set_time_out('opacity',function(){setOpacity(sId+"ContentHtml",100)},2000);
			//resizeFondGris();
			
			if(sAutoSize=="oui"){
				set_time_out('height',function(){if(document.getElementById(sId)){$(sId).style.height='auto';}},500);
				set_time_out('replace',"replaceLayer('"+sId+"')",1000);
			}
			
			set_time_out(
				'grise',
				function(){
					if(document.getElementById(sId+'-grise')){
					
						$(sId+'-grise').style.height=parseInt($(sId).offsetHeight)+"px";
						$(sId+"-grise").style.top=0+'px';//$(sId).style.top;
						$(sId+"-grise").style.marginTop=0+'px';//$(sId).style.marginTop;
						$(sId+"-grise").style.left=0+'px';//$(sId).style.left;
						$(sId+"-grise").style.marginLeft=0+'px';//$(sId).style.marginLeft;
					}
				},
				1000
			);
			
			set_time_out('grise-fond-gris',resizeFondGris,1000);
			
			//window.setTimeout('resizeFondGris()',1000);
			if(typeof onLoad == 'function'){
				var func=onLoad;												
				func();
			}
		}
	});	
}

function replaceLayer(sId){
	if(document.getElementById(sId)){
		$(sId+'ContentHtml').style.height='auto';
	
		var heightPopup=parseInt($(sId).offsetHeight);
	
		var heightPage=parseInt($('bglayer').style.height);
		
		$(sId).style.top=getPositionHPopup()+'px';//200 + "px";
		/*
		if(heightPopup>heightPage-25){
			$(sId).style.top="50px";
		}else{
			$(sId).style.top="50%";		
			$(sId).style.marginTop="-"+((Math.round((heightPopup)/2)))+"px";	
		}
		*/
	}
}

function morphLayer(sId,nWidth,nHeight,nTime,sAutoSize){
	if(nWidth=="*"){
		nWidth=parseInt($('sId').style.width);
	}
	if(nHeight=="*"){
		nHeight=parseInt($('sId').style.height);
	}

	if(sAutoSize=='oui'){
		//$(sId).appear();
		$(sId).morph("width:"+nWidth+"px;margin-left:-"+Math.round(nWidth/2)+"px;height:"+nHeight+"px;margin-top:-"+Math.round(nHeight/2)+"px;",{duration:nTime});
	}else{
		$(sId).morph("width:"+nWidth+"px;margin-left:-"+Math.round(nWidth/2)+"px;height:"+nHeight+"px;margin-top:-"+Math.round(nHeight/2)+"px;",{duration:nTime});
	}
}

function grise(){
	if(GLOBAL_nNbLayer==1){
		var nHauteurNavigateur=$('page').scrollHeight;
//		var nHauteurNavigateur=$('page').offsetHeight;
//alert($('page').scrollHeight+"v"+$('page').pixelHeight);
		if(parseInt(nHauteurNavigateur)<parseInt($('page').offsetHeight)){
			nHauteurNavigateur=parseInt($('page').offsetHeight);
		}
		$('bglayer').style.width="100%";
		$('bglayer').style.height=nHauteurNavigateur+"px";
		$('bglayer').appear({ from:0, to:0.6,duration:1 });	
	}else{
		//console.log(GLOBAL_aLayer[(GLOBAL_nNbLayer-2)]+"-grise");
	
		$(GLOBAL_aLayer[(GLOBAL_nNbLayer-2)]+"-grise").appear({ from:0, to:0.6,duration:1 });	
	}
	resizeFondGris();

}

function resizeFondGris(){
	var sUserAgent = navigator.userAgent;
	//BUG SAFARI
	if(sUserAgent.indexOf("Safari") != -1 ){
		var oBody = document.getElementsByTagName('body')[0];
	}else{
		var oBody = document.documentElement;//$('page');//document.body;//
	}
	
	var nHauteurNavigateur=oBody.scrollHeight;
	var nLargeurNavigateur=oBody.scrollWidth;
	
	if(parseInt(nHauteurNavigateur)<parseInt(oBody.offsetHeight)){
		nHauteurNavigateur=parseInt(oBody.offsetHeight);
	}
	if(parseInt(nLargeurNavigateur)<parseInt(oBody.offsetWidth)){
		nLargeurNavigateur=parseInt(oBody.offsetWidth);
	}
	//BUG IE8
	if(sUserAgent.indexOf("MSIE 8") != -1 ){
		var oBody2 = document.getElementsByTagName('body')[0];
		nLargeurNavigateur=parseInt(oBody2.offsetWidth);
	}
	
	if(document.documentElement.clientHeight<oBody.scrollHeight){nHauteurNavigateur = nHauteurNavigateur + 30;}
	
	if(document.getElementById('bglayer')){
		$('bglayer').style.width=nLargeurNavigateur+"px";
		$('bglayer').style.height=nHauteurNavigateur+"px";
	}
	
}
window.onresize = resizeFondGris;
 
function showBodyDimensions(sComment){
	var oBody = document.documentElement;
	var oBody2 = document.getElementsByTagName('body')[0];
	
	var nHauteurNavigateur=oBody.scrollHeight;
	var nLargeurNavigateur=oBody.scrollWidth;
	
	if(parseInt(nHauteurNavigateur)<parseInt(oBody.offsetHeight)){
		nHauteurNavigateur=parseInt(oBody.offsetHeight);
	}
	if(parseInt(nLargeurNavigateur)<parseInt(oBody.offsetWidth)){
		nLargeurNavigateur=parseInt(oBody.offsetWidth);
	}
	//kTrace(sComment + " - H/L : " + nHauteurNavigateur + "/" + nLargeurNavigateur + " <br/> bglayer H/L: "+$('bglayer').style.height+"/"+$('bglayer').style.width);
	/*kTrace(sComment + "<br/>" 
		    + "<br/>oBody2.scrollWidth : " + oBody2.scrollWidth
			+ "<br/>oBody2.offsetWidth : " + oBody2.offsetWidth
			+ "<br/>oBody2.clientWidth : " + oBody2.clientWidth
			+ "<br/>----"
			+ "<br/>oBody2.scrollHeight : " + oBody2.scrollHeight
			+ "<br/>oBody2.offsetHeight : " + oBody2.offsetHeight
			+ "<br/>oBody2.clientHeight : " + oBody2.clientHeight
			+ "<br/>oBody2.height : " + oBody2.height
			+ "<br/>----"
			+ "<br/>$('bglayer').style.height : " + $('bglayer').style.height
			+ "<br/>-----------------------------------------");
	*/
	kTrace(sComment + "<br/>" 
			+ "<br/>1.oBody.clientHeight : " + oBody.clientHeight
			+ "<br/>2.oBody2.clientHeight : " + oBody2.clientHeight
			+ "<br/>oBody.scrollHeight : " + oBody.scrollHeight
			+ "<br/>oBody2.scrollHeight : " + oBody2.scrollHeight
			+ "<br/>-----------------------------------------");
}
 
function degrise(){	
	if(GLOBAL_nNbLayer==0){
		$('bglayer').fade({ from:0.6, to:0,duration:1 });
		$('bglayer').style.width=0+"px";
		$('bglayer').style.height=0+"px";
		setTimeout("showFlash()",1000);
	}else{
		$(GLOBAL_aLayer[(GLOBAL_nNbLayer-1)]+"-grise").fade({ from:0.6, to:0,duration:1 });	
	}
}

function openLink(sLink){
	window.open(sLink);
}
var TimerPage='';
var pageEnCours='-';


function goTo(page){
	var oldPage=pageEnCours;
	pageEnCours=page;	
	rollOut($("menu-"+oldPage));
	
	rollOver($("menu-"+page));
	
	clearTimeout(TimerPage);
	
	if(page=="accueil"){
		if(document.getElementById('over-log')){
			$('over-log').style.display='none';
			getSWF('espaceLog')._flReloadEspaceLog();
		}else{
			document.location.href='index.php';
		}
	}
	if(page=="sofive"){
		document.location.href="http://www.msafrance.com";
	}
	if(page=="contact"){
		var largeur = 0, hauteur = 0;
if( typeof( window.innerWidth ) == 'number' ) {
  largeur = window.innerWidth;
  hauteur = window.innerHeight;
  } 
else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
  largeur = document.documentElement.clientWidth;
  hauteur = document.documentElement.clientHeight;
  } 
else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
  largeur = document.body.clientWidth;
  hauteur = document.body.clientHeight;
  }
else {
  largeur = -1;
  hauteur = -1;
  } 
	
		//affichage de la popup contact
		$('grise-contact').appear({ from:0, to:0.5,duration:0.5 });	
		$('popup-contact').style.left=(largeur/2);		
		$('popup-contact').appear({duration:0.5 });	

	}
}

function closePopupContact(){
		$('grise-contact').fade({duration:0.5 });
	
		$('popup-contact').fade({duration:0.5 });	
}
function loadPage(){
		clearTimeout(TimerPage);
		/*var req= new Ajax.Updater( 
		  	$('page'), 
  			'aja/index.php', { 
    		method: 'get', 
    		parameters: 'page='+pageEnCours,
			onComplete: function(e){$('page').appear({ duration: 0.5 });}
			} 
		); */
		$('contenu-page').appear({ duration: 0.5 });
	
}
function loadZone(){
	clearTimeout(TimerPage);
	var req= new Ajax.Updater( 
		  	$('col1'), 
  			'aja/index.php', { 
    		method: 'get', 
    		parameters: 'page='+pageEnCours+'-col1',
			onComplete: function(e){$('col1').appear({ duration: 0.5 });}
			} 
		); 
	var req= new Ajax.Updater( 
		  	$('col2'), 
  			'aja/index.php', { 
    		method: 'get', 
    		parameters: 'page='+pageEnCours+'-col2',
			onComplete: function(e){$('col2').appear({ duration: 0.5 });}
			} 
		); 
		var req= new Ajax.Updater( 
		  	$('col3'), 
  			'aja/index.php', { 
    		method: 'get', 
    		parameters: 'page='+pageEnCours+'-col3',
			onComplete: function(e){$('col3').appear({ duration: 0.5});}
			} 
		);
}


function getSWF(movieName)
{
    if (navigator.appName.indexOf("Microsoft") != -1)
    {
        return window[movieName];
    }
    else
    {	
		
		return document[movieName];
    }
}

function onLoadComplete(){	
	//chargement de la page en AJAX
	clearInterval(timer);
		$('loading').fade({ duration: 0.5 });

		
}



function showMenu(id){
	document.getElementById(id).style.display='inline';
	var sChaine=document.getElementById("menu_"+id).src;
	document.getElementById("menu_"+id).src=sChaine.replace(/off/,'on');
}
function hideMenu(id){
	document.getElementById(id).style.display='none';
	var sChaine=document.getElementById("menu_"+id).src;
	if(sPageEnCours!="a-propos"){
		document.getElementById("menu_"+id).src=sChaine.replace(/on/,'off');
	}
}

function addLoadEvent(func){   
	
 	var oldonload = window.onload; 
    if (typeof window.onload != 'function') { 
        window.onload = func; 
    } else { 
	
        window.onload = function() 
    	{
			
            oldonload(); 
            func(); 	
        } 
    } 
} 


function rollOver(obj){
	if(obj){	
		var s=obj.className;
		var source=obj.src;
		if(s && s!='png'){
			var newstr = s.replace("_off", "_on", "gi");
			obj.className=newstr;
		}else{
			var newstr = source.replace("_off", "_on", "gi");
		 	newstr = newstr.replace("-off", "-on", "gi");
			obj.src=newstr;
		}
	}

}

function rollOut(obj){
	if(obj){
		if("menu-"+pageEnCours!=obj.id){	
			var s=obj.className;
			var source=obj.src;
			if(s && s!='png'){
				var newstr = s.replace("_on", "_off", "gi");	
				obj.className=newstr;
			}else{
				var newstr = source.replace("_on", "_off", "gi");
				newstr = newstr.replace("-on", "-off", "gi");
				obj.src = newstr;
			}
		}
	}
}

//fonctions de connexion
function connexion(){
	if(bLibAlertisLoaded){
	autoSubmit({'id':'formConnexion','url':'ajax/index.php?page=connexion','onSuccess':readConnexion});
	}

}

function connexionSADECC(){
	if(bLibAlertisLoaded){
	
		$('login').value=$('loginSADECC').value;
		$('pass').value=$('passSADECC').value;
		autoSubmit({'id':'formConnexion','url':'ajax/index.php?page=connexion&action=invitation-SADECC','onSuccess':readConnexionSADECC});
		
	}

}

function readConnexionSADECC(reponse){
	
	var resXML=reponse.responseXML;		
	var page_node = resXML.getElementsByTagName('page').item(0);
	if(page_node.getAttribute("nom")=="connexion"){
		var type_node = page_node.getElementsByTagName('connexion').item(0);		
		if(type_node.getAttribute('blacklist')=="false"){			
			if(type_node.getAttribute("erreur")=="true"){
				
				if(document.getElementById('login') &&  document.getElementById('pass')){
					$("pass").value="";			
					$("passSADECC").value="";			
					alertdiv('img/null.gif',"Nom d'utilisateur ou mot de passe incorrectes.<br/> Merci de v&eacute;rifier votre saisie.","");
				}
			} else {
				document.location.href='index.php';
			}
		} else {
			document.location.href='index.php';
		}
	}
}

var bIsSendSadecc=false;
function inscriptionSADECC(){		
	var msg='';
	nVerif=0;
	

	if(nVerif==0){		
		if(!$('datestand1').checked && !$('datestand2').checked && !$('datestand3').checked && !$('datestand4').checked){
			if(msg!=''){msg = msg + '<br/>'; }
				msg += "Vous devez pr&eacute;ciser la date de votre visite sur le stand.";
			nVerif++;
		}
	}
	
	if(nVerif==0){
		if(!validationMail($('mail').value)){
			if(msg!=''){msg = msg + '<br/>'; }
			msg += "L'adresse e-mail saisie ne para&icirc;t pas valide !";
			nVerif++;
		}
	}
	if(nVerif==0){
		if(!$('nom').value){
			if(msg!=''){msg = msg + '<br/>'; }
			msg += "Le nom du visiteur est obligatoire !";
			nVerif++;
		}
	}
	if(nVerif==0){
		if(!$('prenom').value){
			if(msg!=''){msg = msg + '<br/>'; }
				msg += "Le pr&eacute;nom du visiteur est obligatoire !";
			nVerif++;
		}
	}
	
	if(nVerif){
			alertdiv('img/erreur.gif','<div style=\'color:#990000;\'>'+msg+'</div>','');
	}else{
		if(!bIsSendSadecc){
			bIsSendSadecc=true;		
			autoSubmit({'id':'formInscriptionSADECC','url':'aja/index.php?page=send-inscription-SADECC','onSuccess':readInscriptionSADECC});
		}
	}

	
}


   
function _flOpenSADECC(){
	layer({id:'popSADECC',url:'aja/index.php',param:'page=invitation-SADECC',width:528,height:200,autosize:'oui'});
}
function readInscriptionSADECC(reponse){
	$('popSADECCContentHtml').innerHTML=reponse.responseText;
	autoLoad({id:'popSADECCContentHtml'});
	Effect.ScrollTo('hautPopupSADECC');
			
}

function readConnexion(reponse){
	
	var resXML=reponse.responseXML;		
	var page_node = resXML.getElementsByTagName('page').item(0);
	if(page_node.getAttribute("nom")=="connexion"){
		var type_node = page_node.getElementsByTagName('connexion').item(0);		
		if(type_node.getAttribute('blacklist')=="false"){			
			if(type_node.getAttribute("erreur")=="true"){
				
				if(document.getElementById('login') &&  document.getElementById('pass')){
					$("pass").value="";					
					alertdiv('img/null.gif',"Nom d'utilisateur ou mot de passe incorrectes.<br/> Merci de v&eacute;rifier votre saisie.","");
				}
			} else {
				document.location.href='index.php';
			}
		} else {
			document.location.href='index.php';
		}
	}
}

function deconnexion(){
	 //confirmdiv('img/question.gif',"Souhaitez-vous vraiment vous déconnecter ?","sendData('POST','ajax/index.php','page=connexion&action=deco',false,'',cbConnexion)","");
	 if(bLibAlertisLoaded){
    confirmdiv('img/null.gif',"Souhaitez-vous vraiment vous d&eacute;connecter ?","autoSubmit({'id':'page','url':'ajax/index.php?page=deconnexion','onSuccess':readConnexion})","");
	 }
	//document.location.href='index.php';		
}
addLoadEvent(majDureeSession);
function majDureeSession(){
	if(document.getElementById('dureeSession')){
		var nbMinute=parseInt($('dureeSession').value);
		
		
		
		var nHeure=parseInt(nbMinute/60);
		var nMinute=nbMinute-(nHeure*60);		
		var sMinute=nMinute;
		var sHeure=nHeure;
		if(nMinute<10){
			sMinute="0"+nMinute;
		}
		if(nHeure<10){
			sHeure="0"+nHeure;
		}
		$('dureeSessionHTML').innerHTML=sHeure+'h'+sMinute;
		nbMinute++;
		$('dureeSession').value=nbMinute;
		setTimeout("majDureeSession()",60000);
	}

}


function _flOpenMoyensEtServices(){
	layer({id:'popMoyensEtServices',url:'aja/index.php',param:'page=moyens-et-services',width:911,height:635});
}

function _flEspaceLogCommander(){
	$('over-log').style.display='none';
	$('over-log-loading').style.display='block';
	setTimeout("showOverLog('commander')",1000);	
}
function _flEspaceLogSuivre(){
		$('over-log').style.display='none';
		$('over-log-loading').style.display='block';
	setTimeout("showOverLog('suivre')",1000);	
	
}
function _flEspaceLogDecouvrir(){
	$('over-log').style.display='none';
	$('over-log-loading').style.display='block';
	setTimeout("showOverLog('decouvrir')",1000);	
}


function _flEspaceLogTelecharger(){	
	$('over-log').style.display='none';
	$('over-log-loading').style.display='block';
		setTimeout("showOverLog('decouvrir')",1000);	
}

function showOverLog(page){
	new Ajax.Updater('over-log','aja/index.php',
		{
			method:'post',
			parameters:'page='+page,
			onComplete:function(t){
				$('over-log-loading').style.display='none';
				$('over-log').innerHTML=t.responseText;
				$('over-log').appear();
			}
		}
	);	
}

//fonction du bon de commande
function _flEspaceLogNouveauBonCmd(){

	layer({id:'popBonCmd',url:'aja/index.php',param:'page=bon-cmd',width:700,height:642});
	$('over-log').style.display='none';
	$('over-log-loading').style.display='block';
	setTimeout("showOverLog('commander')",2000);	
}
function openCatalogueFromHome(){
	//alertdiv('img/null.gif',"Cette partie du site est actuellement en cours de mise &agrave; jour.","");
	document.location.href='index.php?page=commander&action=open-cat';
}
function openCatalogue(id){
	var sIdBon='&action=new';
	if(id){
		sIdBon=id;
	}
	if(sTypeUser=="client"){
		layer({id:'popCmdCat',url:'aja/index.php',param:'page=catalogue-interactif&open='+sIdBon,width:1165,height:940});
	}else{
		layer({id:'popCmdCat',url:'aja/index.php',param:'page=catalogue-interactif',width:1165,height:940});
		
	}
	//alertdiv('img/null.gif',"Cette partie du site est actuellement en cours de mise &agrave; jour.","");
}

function openBrochure(id_brochure){	
	
		layer({id:'popCmdCat',url:'aja/index.php',param:'page=catalogue-interactif&id_brochure='+id_brochure,width:1165,height:940});		
	
}

function openBrochureFromHome(id_brochure,type){	

		if(type=='client'){
			document.location.href='index.php?page=commander&action=open-cat&id_brochure='+id_brochure;			
		}else{
			layer({id:'popCmdCat',url:'aja/index.php',param:'page=catalogue-interactif&id_brochure='+id_brochure,width:1165,height:940});		
		}
	
}


var nTimeWakeSession = 60*1000;

function wakeSession(){
	
	var nTime=nTimeWakeSession;
	new Ajax.Request('ajax/index.php',
		{
			method:'post',
			parameters:'page=wake-session&tmp='+nTime,
			onComplete:function(t){	}
		}
	);
}

function setIntervall(fFunc, nTime){setTimeout(fFunc(),nTime);}

function initWake(){
	
	setInterval('wakeSession()',nTimeWakeSession );
}
addLoadEvent(initWake);


function setOpacity(eID, opacityLevel) {
	if(document.getElementById(eID)){
		var eStyle = document.getElementById(eID).style;
		eStyle.opacity = opacityLevel / 100;
		eStyle.filter = 'alpha(opacity='+opacityLevel+')';
	}
}
var btnDmdCatIsCliked=false;
function sendDmdCatalogue(aParam){
	/*
	idPop : id de la popup
	liste_champs : array avec les champs a valide
	nocolor : false par defaut, avec true , le changement de couleur n'est pas applique.
	init : false par defaut, remet les couleurs de bases quelque soit le resultat
	*/
	var msg = '';
	if(aParam['bIsClt']){
		var aLst = new Array('num_client');
		var nVerif = verifieChampsObligatoire({idPop:aParam['idPop'], liste_champs:aLst});
		if(nVerif==0 && parseInt($(aParam['idPop']+'nb_cata').value)+parseInt($(aParam['idPop']+'nb_pochette').value)==0){
			msg = "Vous devez commander au moins un catalogue ou un lot de pochettes &agrave; rabats !";
			nVerif++;
		}
	}else{
		var aLst = new Array('societe', 'num_siret', 'nom', 'fonction', 'adresse', 'cp', 'ville', 'tel', 'email', 'activite');
		var nVerif = verifieChampsObligatoire({idPop:aParam['idPop'], liste_champs:aLst});
		
		if(nVerif==0){
			if(!validationMail($(aParam['idPop']+'email').value)){
				msg += "L'adresse e-mail saisie ne para&icirc;t pas valide !";
				nVerif++;
			}
			if(!validationSIRET($(aParam['idPop']+'num_siret').value)){
				if(msg!=''){msg = msg + '<br/>'; }
				msg += "Le num&eacute;ro de siret saisi ne para&icirc;t pas valide !";
				nVerif++;
			}
		}
	}
	if(nVerif==0){
		/*if(document.getElementById('btnSendCat')){
			$('btnSendCat').onclick=function(){};
		}
		if(document.getElementById('btnSendCatLog')){
			$('btnSendCatLog').onclick=function(){};
		}*/
		if(btnDmdCatIsCliked==false){
			btnDmdCatIsCliked=true;
			autoSubmit(
			{	
				id:aParam['idPop']+"ContentHtml",
				url:'ajax/index.php?page=dmd_catalogue',
				onSuccess : function(t){
					var msg=getMsgFromAjax(t);
					btnDmdCatIsCliked=false;
					if(msg.indexOf('[erreur]')>-1){
					//  Erreur
						msg=msg.replace(/\[erreur\]/,'');
						if(msg!='nomsg'){alertdiv('img/erreur.gif',msg,'');}
						
						
					}else{
					//  Success	
						removeLayer(aParam['idPop']);
						degrise();
						if(msg!='nomsg'){alertdiv('img/info.gif',msg,'');}
						
					}  
				}
        	}
			);
		}
	}else{
		if(msg != '' ){
			if(!msg.indexOf("lot de pochettes")){
				msg = 'Les champs suivi de * sont obligatoires<br/>'+msg;
			}
		}else{
			msg = 'Les champs suivi de * sont obligatoires';
		}
		
		
		alertdiv('img/erreur.gif','<div style=\'color:#990000;\'>'+msg+'</div>','');
		$(aParam['idPop']+'-td-societe').style.color = '#990000';
		$(aParam['idPop']+'-td-num_siret').style.color = '#990000';
		$(aParam['idPop']+'-td-nom').style.color = '#990000';
		$(aParam['idPop']+'-td-fonction').style.color = '#990000';
		$(aParam['idPop']+'-td-adresse').style.color = '#990000';
		$(aParam['idPop']+'-td-cp').style.color = '#990000';
		$(aParam['idPop']+'-td-ville').style.color = '#990000';
		$(aParam['idPop']+'-td-pays').style.color = '#990000';
		$(aParam['idPop']+'-td-tel').style.color = '#990000';
		$(aParam['idPop']+'-td-email').style.color = '#990000';
		$(aParam['idPop']+'-td-activite').style.color = '#990000';
		
		$(aParam['idPop']+'-td-num_client').style.color = '#990000';
		
		$(aParam['idPop']+'-span-nonlog').style.color = '#990000';
		$(aParam['idPop']+'-span-log').style.color = '#990000';
	}
}

function getMsgFromAjax(t){
	var resXML=t.responseXML;         
	var resultat_node = resXML.getElementsByTagName('resultat').item(0);
	var msg = resultat_node.childNodes[0].nodeValue;
	return msg;
}

function validationMail(mailteste){
	if(mailteste.indexOf('@')>0 && mailteste.indexOf('.')>0){
		return true;
	}else{
		return false;
	}
}

function validationSIRET(sSiret){
	var regSpace=new RegExp(" ", "g");
	sSiret.replace(regSpace,"");
	var regInc = new RegExp("^[0-9]{14}$", "g");
	var bIsOk  = regInc.test(sSiret);
	return bIsOk;
}

function recup_log_step(aParam){
	var nNumStep = aParam['num'];
	var sId = aParam['id'];
	
	var sParam = "";
	var bOk = false;
	var msg = "";
	switch(nNumStep){
		case '2':
		case 2:
			sParam = 'compte='+$('compte').value;
			bOk = true;
			break;
		case '3':
		case 3:
			if($('mail').value!=''){
				if(!validationMail($('mail').value)){
					msg = "L'adresse e-mail saisie ne para&icirc;t pas valide !";
				}else{
					sParam = 'compte='+$('compte').value+'&mail='+$('mail').value;
					bOk = true;
				}
			}else{
				sParam = 'compte='+$('compte').value;
					bOk = true;
			}
			break;
		
	}
	if(bOk){
		var divLoading=document.createElement('div');	
		divLoading.setAttribute("id",sId+'ContentLoading');	
		$(sId).appendChild(divLoading);
		
		$(sId+'ContentLoading').style.backgroundColor='#dddddd';
		$(sId+'ContentLoading').style.margin=GLOBAL_nBordureLayer+'px';
		$(sId+'ContentLoading').style.height=(parseInt($(sId).offsetHeight)-(GLOBAL_nBordureLayer*2))+"px";
		$(sId+'ContentLoading').style.width=(parseInt($(sId).offsetWidth)-(GLOBAL_nBordureLayer*2))+"px";
		$(sId+'ContentLoading').style.display='none';
		$(sId+'ContentLoading').style.position='absolute';
		$(sId+'ContentLoading').style.top='0px';
		$(sId+'ContentLoading').style.textAlign='center';	
		$(sId+'ContentLoading').innerHTML='<img src="img/loadingLayer.gif" style="margin-top:-16px;top:50%; left:50%;position:absolute;" alt="chargement ..."/>';
		$(sId+'ContentLoading').style.zIndex='999';
		$(sId+'ContentLoading').appear();
		
		new Ajax.Request(
			'aja/index.php?page=recup_log&nid='+nNumStep,
			{
				asynchronous:true,
				method:'post',
				parameters:'idLayer='+sId+'&'+sParam,
				onSuccess:function(t){
					var sChaine=t.responseText;
					$(sId).removeChild($(sId+'ContentLoading'));
					$(sId+'ContentHtml').innerHTML=sChaine+"";
					autoLoad({id:sId+'ContentHtml'});
				}
			}
		);
	}else{
		alertdiv('img/erreur.gif','<div style=\'color:#990000;\'>'+msg+'</div>','');
	}
}

function getPositionHPopup(nh){
	var oBody = document.documentElement;
	var oBody2 = document.getElementsByTagName('body')[0];
	
	var nDep = 200;
	
	if(typeof(nh)!='undefined'){
		var nH = oBody.clientHeight;
		nDep = nH/2;//(nH-nh)/2;
		if(nDep<0){nDep=35;}
	}
	
	var sUserAgent = navigator.userAgent;
	if(sUserAgent.indexOf("Safari") != -1 ){
		var nHsupplement = window.pageYOffset;
	}else{
		var nHsupplement = document.documentElement.scrollTop;
	}
	nHsupplement=nHsupplement + nDep;
	
	return nHsupplement;
//	getPositionHPopup()+'px';//
}

function sendDmdContact(aParam){	
	/*
	idPop : id de la popup
	liste_champs : array avec les champs a valide
	nocolor : false par defaut, avec true , le changement de couleur n'est pas applique.
	init : false par defaut, remet les couleurs de bases quelque soit le resultat
	*/
	var msg = '';
	
	var aLst = new Array('nom', 'email', 'message', 'type_client');
	if($(aParam['idPop']+'type_client').value=='Professionnel'){aLst.push('societe', 'siret');}
	var nVerif = verifieChampsObligatoire({idPop:aParam['idPop'], liste_champs:aLst});
	
	if(nVerif==0){
		if(!validationMail($(aParam['idPop']+'email').value)){
			if(msg!=''){msg = msg + '<br/>'; }
			msg += "L'adresse e-mail saisie ne para&icirc;t pas valide !";
			nVerif++;
		}
	}
	
	if($(aParam['idPop']+'type_client').value=='Professionnel'){
		if($(aParam['idPop']+'siret').value==''){
			if(msg!=''){msg = msg + '<br/>'; }
			msg += "Le num&eacute;ro de siret est obligatoire !";
			nVerif++;
		}else{
			if(!validationSIRET($(aParam['idPop']+'siret').value)){
				if(msg!=''){msg = msg + '<br/>'; }
				msg += "Le num&eacute;ro de siret saisi ne para&icirc;t pas valide !";
				nVerif++;
			}
		}
	}
	
	if(nVerif==0){
		if(document.getElementById('btnSendContact')){
			$('btnSendContact').onclick=function(){};
		}
	
		autoSubmit(
			{	
				id:aParam['idPop']+"ContentHtml",
				url:'ajax/index.php?page=contact',
				onSuccess : function(t){
					var msg=getMsgFromAjax(t);
					if(msg.indexOf('[erreur]')>-1){
					//  Erreur
						msg=msg.replace(/\[erreur\]/,'');
						if(msg!='nomsg'){alertdiv('img/erreur.gif',msg,'');}
					}else{
					//  Success	
						removeLayer(aParam['idPop']);
						degrise();
						if(msg!='nomsg'){alertdiv('img/info.gif',msg,'');}
					}  
				}
        	}
		);
	}else{
		if(msg != '' ){
			msg = 'Les champs suivi de * sont obligatoires<br/>'+msg;
		}else{
			msg = 'Les champs suivi de * sont obligatoires';
		}
		alertdiv('img/erreur.gif','<div style=\'color:#990000;\'>'+msg+'</div>','');
		
		$(aParam['idPop']+'-td-nom').style.color = '#990000';
		$(aParam['idPop']+'-td-email').style.color = '#990000';
		$(aParam['idPop']+'-td-message').style.color = '#990000';
		$(aParam['idPop']+'oblig').style.color = '#990000';
	}
}



function sendInfoMail(aParam){	
	/*
	idPop : id de la popup
	liste_champs : array avec les champs a valide
	nocolor : false par defaut, avec true , le changement de couleur n'est pas applique.
	init : false par defaut, remet les couleurs de bases quelque soit le resultat
	*/
	var msg = '';
	
	var aLst = new Array('email');
	var nVerif = verifieChampsObligatoire({idPop:aParam['idPop'], liste_champs:aLst});
	
	if(nVerif==0){
		if(!validationMail($(aParam['idPop']+'email').value)){
			msg += "L'adresse e-mail saisie ne para&icirc;t pas valide !";
			nVerif++;
		}
	}
	
	if(nVerif==0){
		autoSubmit(
			{	
				id:aParam['idPop']+"ContentHtml",
				url:'ajax/index.php?page=demande-mail',
				onSuccess : function(t){
					var msg=getMsgFromAjax(t);
					if(msg.indexOf('[erreur]')>-1){
					//  Erreur
						msg=msg.replace(/\[erreur\]/,'');
						if(msg!='nomsg'){alertdiv('img/erreur.gif',msg,'');}
					}else{
					//  Success	
						removeLayer(aParam['idPop']);
						degrise();
						if(msg!='nomsg'){alertdiv('img/info.gif',msg,'');}
					}
					isDataSending=false;
				}
        	}
		);
	}else{
		if(msg != '' ){
			//msg = "Vous n'avez pas saisie d'adresse e-mail.";
		}else{
			msg = "Vous n'avez pas saisie d'adresse e-mail.";
		}
		alertdiv('img/erreur.gif','<div style=\'color:#990000;\'>'+msg+'</div>','');
		
		/*$(aParam['idPop']+'-td-nom').style.color = '#990000';
		$(aParam['idPop']+'-td-email').style.color = '#990000';
		$(aParam['idPop']+'-td-message').style.color = '#990000';
		$(aParam['idPop']+'oblig').style.color = '#990000';*/
	}
}



function get_left(size) {
	var x=0;
	var ecran=screen.width;
	return Math.round((ecran/2)-(size/2));	
}

function get_top(size) {
	var y=0;
	var ecran=screen.height;
	return Math.round((ecran/2)-(size/2));	
}




var popUpWin=0;
function popUpWindow(URLStr, width, height)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menub ar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+get_left(width)+', top='+get_top(height));
}

function _flLaunchCommande(){
	document.location.href='index.php?page=commander';
	
}


