
ns4 = (document.layers)? true:false;
ie4 = (document.all)? true:false;
browsertype=(ns4)? "ns4":"ie4";
//alert("ns4? "+ns4+"\tie4? "+ie4);	// ## for debugging
mac = (navigator.appVersion.indexOf("Mac")> -1 || navigator.appVersion.indexOf("mac")> -1);
doc = ie4? "document":"document.layers";
curr_hash="#";
//----------------------------------------------------------------------------
if(document.location.toString().indexOf("lejour")>0){
	//alert(document.location.toString().lastIndexOf("/"));
	//s1 =document.location.toString().indexOf("bottom")>0;
	//s2 =document.location.toString().indexOf("navig")>0;
	//if (!s1 && !s2 && document.location==top.location) document.location="index.asp";
}
//----------------------------------------------------------------------------
function testVersion() {
	if (!ie4 ) {
		alert("Ce site en developpement n'est pas visible encore en dehors de Explorer 4+ . Merci de changer votre configuration ou de venir nous voir dans quelques semaines.\n\n\n\n\t\t\t\t\t\t\tLe webmaster");	
	} else {
		top.location = "entreeSite/index.htm";
	}
}
//----------------------------------------------------------------------------
function doc_init(doc_obj,name) {
	doc_obj.browsertype = (document.layers)? "ns4":"ie4";
	doc_obj.curr_hash ="01"; // Page design has changed: no more .mov bug to avoid, should not be "00" anymore...
	doc_obj.currentpage= doc_obj;
	doc_obj.path=''+doc_obj.location;
	doc_obj.path = doc_obj.path.substring(0,doc_obj.path.lastIndexOf("/")+1);
//	alert (resolve_path("LAUTRE",doc_obj)+"\n"+doc_obj.path);
}
//----------------------------------------------------------------------------
function resolve_path(target,doc_obj) {  // <usage> resolve_path ("LAUTRESITE",this)
// alert (target+ "\n" +doc_obj.location);
	myRE=eval (" /"+ target +"/gi");
	s = ""+doc_obj.location;
	s=s.substring (s.search(myRE),s.lastIndexOf("/"));
	var m="";
	for (var i=0; i< s.length; i++) {if (s.charAt(i)=="/") m+="../";}
	return m;
}
//----------------------------------------------------------------------------
function popWin (url,settings) {
	var set = defineWindowSettings(settings);
	var theWin= new Object();
	theWin.name="a";	
	
	if (!mac && theWin.name!="a" && theWin !=null) { theWin.close();theWin=null; }

	if(set['centered']) {
		x = (screen.width/2 - set['w']/2);
		y = (screen.height/2 - set['h']/2);
		theWin = open(url,set['name'],args);
		theWin.moveTo(x,y);
	} else {
		theWin = open(url,set['name'],args);	
	}
	theWin.focus();
}
//----------------------------------------------------------------------------

var thePopup=null;

function popFrameset() { 
this.url="";
this.mode="no";
this.h=480;
this.w=750;
var ar=popFrameset.arguments;
switch (ar.length) {
	case(0): return;
	case(1): this.url= ar[0]; break; //args => url
	case(2): this.url= ar[0]; this.mode=ar[1];	break;//args => url,mode
	case(3): this.url= ar[0]; this.h=ar[1]; 		this.w=ar[2]; break;//args => url,h,w
	case(4): this.url= ar[0]; this.h=ar[1]; 		this.w=ar[2]; this.mode=ar[3]; break;//args => url,h,w,mode
}
	args ='height='+this.h+',width='+this.w+',toolbar=1,resizable=1,menubar=1,scrollbars='+mode;

	calendar= resolve_path("LAUTRE",this)+"commun/calendar.html";
	thePopup = null; 
	thePopup = open("",'popup',args);
	thePopup.focus();

	str ='<html><head><title>'+url+'</title></head>';
	str+='<frameset rows="60,*" frameborder="NO" border="0" framespacing="0">';
  str+='<frame name="topFrame" scrolling="NO" noresize src='+calendar+'>'; //'+(mypath+'commun.calendar.html')+'
  str+='<frame name="mainFrame" src="'+url+'">';
	str+='</frameset><noframes><body bgcolor="#FFFFFF" text="#000000"></body></noframes>';
	thePopup.document.write(str);
	thePopup.document.close();
}
//----------------------------------------------------------------------------
function popFrameset2(url, settings) {
	var set = defineWindowSettings(settings);
	var theWin= new Object();
	var calendarStr =  resolve_path("LAUTRE",this)+"commun/calendar.html";
	theWin.name="?";
	if (!mac && theWin.name!="?" && theWin !=null) {theWin.close();theWin=null; }
	theWin = open("",set['name'],args);
	str ='<html><head>\n<title>'+url+'</title>\n</head>\n';
	str+='<frameset rows="60,*" frameborder="NO" border="0" framespacing="0">\n';
	str+='\t<frame name="topFrame" scrolling="NO" noresize src='+calendarStr+'>\n'; 
	str+='\t<frame name="mainFrame" src="'+url+'">\n';
	str+='</frameset>\n<noframes>\n\t<body></body>\n</noframes>\n</html>\n';
	theWin.document.write(str);
	theWin.document.close();
}
//----------------------------------------------------------------------------
function defineWindowSettings(settings) {
	var set = new Array();
	set['name']= 'myWin';		set['h']= 380;			set['w']=200;			set['top']=50;
	set['left']=50;				set['location']= "no";	set['menubar']= "no";	set['toolbar']= "no";
	set['scrollbars']= "yes";		set['resizable']= "yes";	set['status']= "no";		set['centered']= false;		
	set['fullscreen']= false;
	
	var props = settings.split(",");
	for (i=0;i<props.length;i++) {
		a= props[i].split("="); 	name=a[0]; 	value= a[1]; 	set[name]=value;
	}
	if (set['fullscreen']) {
		set['centered'] = false; 
		args = 'height=' + (screen.availHeight-30) + ', width=' + (screen.width-10)+ ',';
	} else {
		args = 'height='+ set['h'] + ', width=' + set['w'] + ',';
	}
	if (set['location'].indexOf("y")>-1) 				args +='location,';
	if (set['status'].indexOf("y")>-1) 				args +='status,';
	if (set['toolbar'].indexOf("y")>-1) 				args +='toolbar,';
	if (set['menubar'].indexOf("y")>-1) 				args +='menubar,';
	if (set['scrollbars'].indexOf("n")>-1) 			args +='scrollbars=no, ';
	if (set['scrollbars'].indexOf("y")>-1) 			args +='scrollbars=yes, ';
	if (set['scrollbars'].indexOf("auto")>-1) 			args +='scrollbars=auto, ';
	if (set['resizable'].indexOf("y")>-1) 			args +='resizable,resizable=yes,';
	return set;
}
//----------------------------------------------------------------------------
function updateWindows(url) {
	if (top.thePopup != null) { 
	alert ("referring popup: " +top.thePopup.location); 
		top.thePopup.close();
		top.thePopup= null;
	}
	top.location= url;
}
//----------------------------------------------------------------------------
	function loadDocument2parent (url,thepath) {
		path="";
		if (thepath != null) {
			path= thepath;
		} 
		top_win= window.opener.parent;
		top_win.location = path+ url;
		top.close();
	}
//----------------------------------------------------------------------------
//old, not used
function load(page,target) {
	alert("load(page,target)  page: "+page+"\ttarget: "+target);
	target +="";
	if (target=="undefined") target="level1";
    if (ie4) {
     	document.all[target].src = page; 
   }    else {
   		document.layers[target].src = page;
   }
}
//----------------------------------------------------------------------------
function go_prev(){
	if ( curr_hash=="01" || curr_hash==currentpage.firstpage) return;
	num= eval (curr_hash) -1;
	curr_hash = (num<10)? "0"+num : ""+num;
	currentpage.location.hash = "page"+curr_hash;
}
//----------------------------------------------------------------------------
function go_next() {
//alert ("go_next; curr_hash: "+ curr_hash+"\n top.totalsections: "+  top.totalsections+" \n currentpage.totalsections: "+currentpage.t);
	if ( eval (curr_hash)>=currentpage.totalsections) return;
	num= eval (curr_hash) +1;
	curr_hash = (num<10)? "0"+num : ""+num;
	currentpage.location.hash = "page"+curr_hash;	
}
//----------------------------------------------------------------------------
// not used
function layer_visible(theLayer,bool) {
	if (bool) {
		//alert (theLayer);
		eval ("document.all."+theLayer).style.visibility="visible";
	} else {
		eval ("document.all."+theLayer).style.visibility="hidden";
	}
}
//----------------------------------------------------------------------------
function blank(color) {
	if (blank.arguments.length<1) color="black";
	return "<html><head></head><body bgcolor="+color+"></body></html>";
}
//----------------------------------------------------------------------------
function btn_action (id,mypath) {
	//alert("id: "+id+"; mypath: "+mypath); 
	if(mypath==null || mypath=="undefined") mypath = resolve_path("Revue",this);
	//alert (" id= "+id+"\n mypath= "+mypath + "\n currentpage= "+currentpage);
	if (eval(id>0)) {
		currentpage.location.hash = "page"+id;
		curr_hash =id;
	} else {
		switch (id) {
			case "home" :			top.location= "../../../index.asp"; break;
			case "reload" :		top.location= "../../../index.asp"; break;
			case "menus" :		top.location= "../../../sitemap/index.htm"; break;
			//case "dossiers" :		top.location= mypath+"m_edition/explo/chaps/prefab/a_intro/index.htm"; break;
			case "sources" :		{	popWin( "../../../sources/index.htm","name=src,h=445,w=550,scrollbars='no'"); break;}			
			case "avis" :				{	popWin( "../../../avis/avis.html","name=avis,h=460,w=545,scrollbars='no'"); break;}			
			case "liens" :			{	popWin( "../../../liens/index.asp","name=liens,h=435,w=550,scrollbars='no'"); break;}			
			case "bios" :				{	popWin( "../../../bios/bios.html","name=bios,h=500,w=550,scrollbars='no'"); break;}			
			case "mozaik" :		top.location= "../commun/mozaik_FS.html"; break;
			case "prev" :			go_prev(); break;
			case "next" :			go_next(); break;
			case "intentions":			{ hash="page_00"; top.location= mypath+"m_intentions/index.htm"; break;}
			case "construct": 			{ hash="page_00"; top.location= "../chapenconstr/index.htm"; break;}
			case "explo": 				{ top.location = mypath+"explo/index.htm"; break;}			
			case "prefab":				{ top.location = mypath+"m_edition/explo/chaps/prefab/index.htm"; break;}
			case "correspo":			{ top.location=  mypath+"m_edition/correspo/index.htm"; break;}
			case "carnets": 			{ top.location=  mypath+"m_edition/carnets/index.htm"; break;}
			case "aujourd": 			{ top.location=  mypath+"m_edition/aujourd/index.htm"; break;}
 			case "capharnaum": 		{ top.location=  mypath+"m_capharnaum/index.htm"; break;}
 			case "caphar": 		{ top.location=  mypath+"m_capharnaum/index.htm"; break;}
			case "mail" :				{ 
									  if(browsertype=="ie4") popWin( "../../../mail/mail.html","name=mail,scrollbars=no,h=515,w=371"); 
									  else 				popWin( "../../../mail/mail.html","name=mail,scrollbars=no,h=450,w=313"); 
									  break;
									}
			case "particip_intellect":	{ popWin( mypath+"commun/forms/particip/particip.html","name=particip,h=500,w=330,scrollbars='no'"); break;}
			case "particip_reseau":		{ popWin( mypath+"commun/forms/particip/particip.html","name=particip,h=500,w=330,scrollbars='no'"); break;}	
			case "particip_echanges":	{ popWin( mypath+"commun/forms/particip/particip.html","name=particip,h=500,w=330,scrollbars='no'"); break;}
			case "debat":				{ popWin( mypath+"commun/forms/particip/particip.html","name=particip,h=500,w=330,scrollbars='no'"); break;}
			case "particip":			{ popWin( mypath+"commun/forms/particip/particip.html","name=particip,h=500,w=330,scrollbars='no'"); break;}
			case "inscription": 			{ popWin( mypath+"commun/forms/mail/mail_list.html","name=mailinglist,h=370,w=300,scrollbars='no'"); break;}
			case "virement": 			{ popWin( mypath+"commun/forms/virement.html","name=virement,h=440,w=600,menubar=yes,toolbar=yes"); break;}
			case "vivre": 				{ top.location= mypath+"/m_intentions/index.htm#page05","name=vivre,h=440,w=600,menubar=yes,toolbar=yes"; break;}
		}
	}
}
//----------------------------------------------------------------------------
function popup_bios(name) {
		mypath= resolve_path ("LAUTRE",this);
		dx=(mac)?  -1:0; 	// corrects differences in implementations of IE
		dy=(mac)? 20:0;	 //
		popWin( mypath+"commun/refs/bios/bios.html#"+name,"name=biographies,h="+(450+dy)+",w="+(547+dx)+",scrollbars=no");		
/*
   + + old + + +
   +		w=(mac)? 547:548; 
   +		h=(mac)? 470:450; 
   +		popWin( mypath+"commun/refs/bios/bios.html#"+name,"name=biographies,h="+h+",w="+w+",scrollbars=no");		
   + + + + + + + +
*/
}
//----------------------------------------------------------------------------
function test(msg) { alert (""+msg);}
//----------------------------------------------------------------------------
function create_layer(browser,id,src,style,scrolling) {
	//if (browser=="ie4" || ie4) {
		str   ="<div><iframe" ;
		str +=" style='position:" + style.position ; 
		str +="; top:" + style.top ; 
		str +="; left:" + style.left ; 
		str +="' name=" + id ; 
		str +=" id=" + id ; 
		str +=" src="+ src ;
		str +=" scrolling="+scrolling ;
		str +="  width="+ style.width ;
		str +=" height="+ style.height ;
		str +=" marginwidth=0 marginheight=0 frameborder=no" ;
		str +=" z-index=" + style.z_index ; 
		str +="></iframe></div>" ;
	/*} else {
	 //netscape
		str   ="<ilayer name=" + id ;
		str +=" src=" + src ; 
		str +=" id=" + id ;
		str +=" top=" + style.top ; 
		str +=" left=" + style.left ;
		str +=" height="+ style.height ;
		str +=" z-index="+ style.z_index ;
		str +=" width="+ style.width ;
		str +="></ilayer>" ;
	}*/
//	alert ("inside create_layer, browser type: "+ browsertype + "\nstr: " + str);
	document.writeln(str );
}
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
function Xstyle() { this.position="absolute";  this.top=0;  this.left=0; this.width=200; this.height=200; this.z_index; this.visibility="visible";   return this; }
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
style0 = new Xstyle(); 	
with (style0) {
	position="absolute";	top="0";	left="0"; 	width="750"; 	height="480";	visibility="visible";	z_index="2";	
}
style1 = new Xstyle(); 	
with (style1) {
	position="absolute";	top="40";	left="160"; 	width="590"; 	height="610";	visibility="visible";	z_index="2";	
}
//----------------------------------------------------------------------------
		
		function getCookie2 (name) {
			if (document.cookie.length > 0) { 
			x0 = document.cookie.indexOf(name+"="); 
		 	if (x0 != -1) x0 += name.length+1; 
				x1 = document.cookie.indexOf(";", x0);
				if (x1 == -1) x1 = document.cookie.length;
					return unescape(document.cookie.substring(x0,x1)); 
				} 
			return null;
		}
//----------------------------------------------------------------------------
		function setCookie2 (name,value) {
			var expDays = 1;
			var exp = new Date(); 
			exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
			tomorrow=exp.toGMTString();
		//	alert(tomorrow)
			document.cookie =  name+"="+value //+";expires="+tomorrow;
		}
		
//----------------------------------------------------------------------------
		function popNews() {
			var val="";
			val= getCookie("observ");
			if (val !=parent.curr) {
				setCookie("observ", parent.curr);
			//	popWin ("http://lautre.dad.be/commun/sitemap/en_ce_jour/today.asp","name=pop,"+parent.specs);
				popWin ("http://lautre.dad.be/observ/index.htm","name=pop,"+parent.specs);
			}
		}
//----------------------------------------------------------------------------

		function popNews2() {
			var val="";
			val= getCookie("observ");
			if (val !=parent.curr) {
				setCookie("baka", parent.curr);
				h=(mac)?0:30;
				specs="w=500,h="+(500+h)+",menubar=no,toolbar=no,scrollbars=auto";
				popWin ("http://www.lautresite.com/m_edition/explo/chaps/prefab/zooshumains/baka/index.asp","name=pop,"+specs);
			}
		}
//----------------------------------------------------------

function getCookie (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 expDays="1"
//	var exp = new Date(); 
//	exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
//----------------------------------------------------------

function setCookie (name, value) {  
	var argv = setCookie.arguments;  
	var argc = setCookie.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 deleteCookie (name) {  
	var exp = new Date();  
	exp.setTime (exp.getTime() - 1);  
	var cval = getCookie (name);  
	document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}
//----------------------------------------------------------

function amt(){
	var count = getCookie('count')
	if(count == null) {
		setCookie('count','1')
		return 1
	}
	else {
		var newcount = parseInt(count) + 1;
		deleteCookie('count')
		setCookie('count',newcount,exp)
		return count
	}
}
//----------------------------------------------------------

function getCookieVal(offset) {
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1)
		endstr = document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}
//----------------------------------------------------------

// Preload Images
if (document.images){
    function preload(imgObj,imgSrc) {
        if (document.images) {
            eval(imgObj+' = new Image()');
            eval(imgObj+'.src = "'+imgSrc+'"');
        }
    }
}
//----------------------------------------------------------------------------
function ChangeImage(imgName,imgObj){
    if (document.images) {
        document.images[imgName].src = eval(imgObj+".src");
    }
}
//----------------------------------------------------------------------------
function MM_findObj(n, d) { //v3.0
	var p,i,x;
	if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	d = parent.frames[n.substring(p+1)].document;     
	n = n.substring(0,p);}
	if(!(x=d[n])&&d.all) x=d.all[n];
	for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i>d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}
//----------------------------------------------------------------------------
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
  if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//----------------------------------------------------------------------------
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
//----------------------------------------------------------------------------
function MM_preloadImages() { //v3.0
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i>a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}











//----------------------------------------------------------------------------