<!--
/////////////////////////////////////////////////
// Approachpeople for ASP IE5/6 DHTML script
/////////////////////////////////////////////////

//----------------------------------------------------------------------------------
// Fonctions de gestion des cookies d'après http://www.anguenot.com/cookies.html
// Attention: Ne pas modifier ces fonctions
// La personnalisation se fait dans les scripts d'appel de ces fonctions
//----------------------------------------------------------------------------------

function CookieWriter(name, value)
{
   var argv=CookieWriter.arguments;
   var argc=CookieWriter.arguments.length;
   var expires=(argc > 2) ? argv[2] : null;
   var path=(argc > 3) ? argv[3] : null;
   var domain=(argc > 4) ? argv[4] : null;
   var secure=(argc > 5) ? argv[5] : false;
   document.cookie=name+"="+escape(value)+
      ((expires==null) ? "" : ("; expires="+expires.toGMTString()))+
      ((path==null) ? "" : ("; path="+path))+
      ((domain==null) ? "" : ("; domain="+domain))+
      ((secure==true) ? "; secure" : "");
}
function getCookieVal(offset)
{
   var endstr=document.cookie.indexOf (";", offset);
   if (endstr==-1) endstr=document.cookie.length;
   return unescape(document.cookie.substring(offset, endstr));
}
function CookieReader(name) {
   var arg=name+"=";
   var alen=arg.length;
   var clen=document.cookie.length;
   var i=0;
   while (i<clen)
   {
      var j=i+alen;
      if (document.cookie.substring(i, j)==arg) return getCookieVal(j);
      i=document.cookie.indexOf(" ",i)+1;
      if (i==0) break;
   }
   return null;
}


//var cspbDetectedBrowser='IE6DHTML';
var cspbVS="cspbPanelBarLoading";var cspbVSIcons=-1;var cspbGD=new Object();var cspbID=new Object();var cspbBoH=32;var cspbBuH=0;var cspbSH=0;var cspbBM=0;var cspbBS=0;var cspbAF=false;var cspbCT=0;var cspbCB=0;var cspbSS=false;var cspbMA=0;var cspbUEI="images/vivre_en_irlande/scrollup_enable.gif";var cspbUDI="images/vivre_en_irlande/scrollup_disable.gif";var cspbUAI="images/vivre_en_irlande/scrollup_active.gif";var cspbDEI="images/vivre_en_irlande/scrolldown_enable.gif";
var cspbDDI="images/vivre_en_irlande/scrolldown_disable.gif";var cspbDownActiveImg="images/vivre_en_irlande/scrolldown_active.gif";var cspbSelI=0;var cspbVGD=new Object();var cspbFO=true;var cspbTL=0;var cspbVTL=0;var cspbTD=0;var cspbVTD=0;var cspbGDH=0;var cspbVGDH=0;var cspbEIA=false;var cspbVSH=0;
var cspbVSID=-1;

function cspbShowSection(id){			
	if(cspbEIA){return;}
	if(cspbVS=="cspbPanelBarLoading") {document.all.cspbButtons.style.display="inline";}
	if(typeof(id)=='string') {id=cspbGetGroupIndex(id);}
	if(("cspbGroup" + id)!=cspbVS){
		cspbSelI=id;cspbGD=document.all['cspbGroup'+id];
		if(cspbFO||navigator.platform=='MacPPC'){document.all[cspbVS].style.display='none';
		cspbGD.style.display='none';
		cspbVS='cspbGroup'+id;
		cspbRS(cspbVS);
		cspbGD.style.height=cspbSH;cspbGD.style.display='inline';cspbDI();}
	else{
		document.all.cspbScrollUp.style.display='none';
		document.all.cspbScrollDown.style.display='none';
		cspbVGD=document.all[cspbVS];
		cspbVGDH=cspbSH;
		cspbGD.style.display='inline';cspbGDH=cspbSH;cspbGD.style.height=1;
		cspbEO(cspbGDH,0);cspbVS='cspbGroup'+id;}
	}
	cspbFO=false;
	
	// Ecrire le cookie, valide 1 mois
	date=new Date;
	CookieWriter('IDMENU', 0, date, path='/');	
	date.setMonth(date.getMonth()+1);
	CookieWriter("IDMENU", id, date, path='/');
					
}
function cspbGetGroupIndex(caption){
	var aCaptions=new Array();aCaptions[0]='Modification';aCaptions[1]='Création';
	var count=0;
	for(count=0;count<aCaptions.length;count++){
		if(aCaptions[count]==caption){return count;}
		}
		return 0;
	}
function cspbHBT(id){
	document.all['cspbBtnText'+id].className='cspbBtnHvr';
}
function cspbDBT(id){
	document.all['cspbBtnText'+id].className='cspbBtn';
}
function cspbEO(l,vl){
	var RES=3;cspbEIA=true;cspbTL=l;cspbVTL=vl;
	if(cspbVGDH==cspbVTL||cspbTL==0){
		cspbVGD.style.display='none';cspbVGD.style.height=cspbVGDH;
		cspbGD.style.height=cspbGDH;cspbEIA=false;cspbSH=cspbGDH;
		cspbDI();
	}else{if((cspbVGDH-cspbVTL)<=RES){
		cspbVTD=1;}
		else{
			cspbVTD=parseInt((cspbVGDH-cspbVTL)/RES);}
		if(cspbTL<=RES){
			cspbTD=1;}
		else{
		cspbTD=parseInt(cspbTL/RES);}
		if(cspbGDH!=cspbTL){
			cspbSH=cspbGDH-cspbTL;cspbGD.style.height=cspbSH;
			cspbVSH=cspbVGDH-cspbVTL;cspbVGD.style.height=cspbVSH;
			document.all['cspbIcons'+cspbSelI].style.display='block';
			cspbPI(cspbSelI,cspbGD);cspbCI(cspbSelI,cspbSH);
			cspbPI(cspbVSIcons,cspbVGD);cspbCI(cspbVSIcons,cspbVSH);
		}
		setTimeout('cspbEO(cspbTL-cspbTD,cspbVTL+cspbVTD);',25);}
}
function cspbDI(){
	if(cspbVSIcons!=-1){
		document.all['cspbIcons'+cspbVSIcons].style.display='none';
	}
	cspbVSIcons=cspbSelI;
	document.all['cspbIcons'+cspbVSIcons].style.display='block';
	cspbPI(cspbSelI,cspbGD);
	if(cspbID.clientHeight>cspbSH){
		ScrollStop=false;cspbCT=0;cspbCB=0;cspbMA=0;cspbCI(cspbSelI,cspbSH);
		cspbSP();cspbSI();}else{document.all.cspbScrollUp.style.display='none';
		document.all.cspbScrollDown.style.display='none';}
}
function cspbRS(id){
	cspbSSH(id);
	if(cspbSH>0){
		cspbGD.style.height = cspbSH;}
}
function cspbSSH(id){
	if(cspbAF==true){
		cspbBM=document.all.cspbPanelBar.offsetTop*2;
		cspbBoH=document.body.clientHeight;
		if(navigator.platform=="MacPPC"){
			cspbBuH=document.all.cspbButtons.clientHeight+(cspbBS*2);
		}
		else{
			cspbBuH=document.all.cspbButtons.offsetHeight+(cspbBS*2);
		}
		cspbSH=(cspbBoH-cspbBM)-(cspbBuH);
		}
	else{
	cspbBuH=document.all.cspbButtons.offsetHeight+(cspbBS*2);
	cspbSH=cspbBoH-cspbBuH;}if(cspbSH<32){cspbSH=32;}
}
function cspbPI(id,div){
	cspbID=document.all["cspbIcons" + id];
	cspbID.style.clip="rect(0 "+cspbGD.clientWidth+" "+cspbSH+" 0)";
	cspbID.y=0;
	if(cspbBS>0 && navigator.platform!="MacPPC"){
		cspbID.y=1;
	}
	cspbID.x=cspbBS;var cspbPO=div;var cspbPId="";
	while(cspbPId!="cspbButtons"){
		cspbID.y+=cspbPO.offsetTop;cspbPO=cspbPO.parentElement;
		if(cspbPO.tagName=="TR"){
			cspbPO=cspbPO.parentElement;
		}
		cspbPId=cspbPO.id;
	}
	cspbID.style.top=cspbID.y;cspbID.style.left=cspbID.x;
}
function cspbCI(id,h){
	cspbID.style.clip="rect(0 "+cspbGD.clientWidth+" "+h+" 0)";
}
function cspbSP(){
	document.all.cspbScrollUp.style.top=cspbID.y;
	document.all.cspbScrollUp.style.left=(cspbGD.clientWidth-16)+cspbBS;
	document.all.cspbScrollDown.style.top=(cspbID.y+cspbSH)-16;
	document.all.cspbScrollDown.style.left=(cspbGD.clientWidth-16)+cspbBS;
	document.all.cspbScrollUp.style.display="block";
	document.all.cspbScrollDown.style.display="block";
}
function cspbSI(dir){
	var UE;var DE;
	if(cspbCB>=cspbID.clientHeight){
		document.all.cspbScrollDownImg.src=cspbDDI;DE=false;
	}
	else{
		document.all.cspbScrollDownImg.src=cspbDEI;DE=true;
	}
	if(cspbMA != 0){
		document.all.cspbScrollUpImg.src=cspbUEI;UE=true;
	}
	else{
		document.all.cspbScrollUpImg.src=cspbUDI;UE=false;
	}
	if(dir=="inactive"){
		if(DE==true){
			document.all.cspbScrollDownImg.src=cspbDEI;
		}
	}
	else if(dir=="down"){
		document.all.cspbScrollDownImg.src=cspbDownActiveImg;
	}
	else if(dir=="up"){
		document.all.cspbScrollUpImg.src=cspbUAI;
	}
}
	
function cspbSD(speed){
	if(cspbSS==false){
		cspbCB=cspbSH+cspbMA;
		if(cspbCB<cspbID.clientHeight){
			cspbMA+=7;cspbID.style.top=cspbID.offsetTop-7;
			cspbCT=cspbMA;cspbCB=cspbSH+cspbMA;
			cspbID.style.clip="rect("+cspbCT+" "+cspbID.clientWidth+" "+cspbCB+" 0)";
			cspbSI("down");
			setTimeout("cspbSD("+speed+");",speed);
		}else{
			cspbSS=true;cspbSI();
		}
	}
}
	
function cspbSU(speed){
	if(cspbSS==false){
		cspbCB=cspbSH+cspbMA;
		if(cspbMA>0){
			cspbMA-=7;cspbID.style.top=cspbID.offsetTop+7;
			cspbCT=cspbMA;cspbCB=cspbSH+cspbMA;
			cspbID.style.clip="rect("+cspbCT+" "+cspbID.clientWidth+" "+cspbCB+" 0)";
			cspbSI("up");
			setTimeout("cspbSU("+speed+");",speed);}else{cspbSS=true;cspbSI();
		}
	}
}
	
function cspbRefresh(){
	cspbVS="cspbPanelBarLoading";cspbFO=true;
	cspbShowSection(cspbSelI);
}
function cspbSetHeight(px){
	cspbBoH=px;
}

var cspbFSTID;var cspbFSIID;var cspbFSE=false;

function cspbWSEH(){
	if(cspbFSE==true){
		clearTimeout(cspbFSTID);
		cspbFSTID=window.setTimeout('cspbSFSI();',200);
	}
	else if((navigator.userAgent.indexOf('MSIE')>-1)&&(navigator.platform!='MacPPC')){
		cspbFSE=true;
	}
}
	
function cspbSFSI(){
	clearInterval(cspbFSIID);cspbFSIID=window.setInterval('cspbFS();',1);
}

function cspbFS(){
	var scrollTop=parseInt(document.body.scrollTop)+0;
	var PBTop=parseInt(document.all['cspbPanelBar'].style.top);
	if(scrollTop==PBTop){
		clearInterval(cspbFSIID);
	}
	else if(PBTop<scrollTop){
		if((scrollTop-PBTop)<=6){
			document.all['cspbPanelBar'].style.top=PBTop+1;
		}else{
			document.all['cspbPanelBar'].style.top=parseInt(PBTop+((scrollTop-PBTop)/6));
		}
	}else{if((PBTop-scrollTop)<=6){
		document.all['cspbPanelBar'].style.top=PBTop-1;
	}
	else{
		document.all['cspbPanelBar'].style.top=parseInt(PBTop-((PBTop-scrollTop)/6));
	}
	}
}
// Fonction de scroll de l'ensemble du menu
/*function cspbASH(){
	var e=window.onscroll;
	if (typeof(e)=='function'){
		e=e.toString();
		e=e.substring(e.indexOf('{')+1,e.lastIndexOf('}'));
		var f=cspbWindowScroll.toString();
		f=f.substring(f.indexOf('{')+1,f.lastIndexOf('}'));
		var sh=new Function(f+e);
		window.onscroll=sh;
	}else{
		window.onscroll=cspbWSEH;
	}
}

if(navigator.platform!='MacPPC'){
	this.attachEvent('onscroll',cspbWSEH);
}
*/


//	
// number of days cookie lives for
num_days = 2;
function ged(noDays){
    var today = new Date();
    var expr = new Date(today.getTime() + noDays*24*60*60*1000);
    return  expr.toGMTString();
}

function csWindowLoad() {
	csSetHeight();
	csWindowWidthCookie();
	
	var menu = 0;
	if (CookieReader("IDMENU")!=null) {
		menu = parseInt(CookieReader("IDMENU"));
	}
	
	//alert("valeur des cookies : " + document.cookie);
	
	cspbShowSection(menu);
}

function csWindowResize()
{
	csSetHeight();
	csWindowWidthCookie();
	cspbRefresh();
}

// Client-side PanelBar height setting
function csSetHeight()
{
	if(window.innerHeight)
		//cspbSetHeight(window.innerHeight-300);
		cspbSetHeight(285);
	else if(document.body.clientHeight)
		//cspbSetHeight(document.body.clientHeight-300);
		cspbSetHeight(285);
}

// Detect window size and set cookie
function csWindowWidthCookie()
{
	var csWindowWidth = 750;
	if(window.innerWidth)
		csWindowWidth = window.innerWidth;
	else if(document.body.offsetWidth)
		csWindowWidth = document.body.offsetWidth;
	if(document.cookie)
		document.cookie = "WindowWidth=" + csWindowWidth + ";path=/";
}	

//-->