// JavaScript Document
//------------------------------------------------- Début functions Cookies ----------------------------------------------
// Function DateExpiration Cookie
// fixe la date d'expiration
function DateExpiration (DateExp) {
	var aujourdhui = new Date(0);
	var aujourdhuidate = aujourdhui.getTime();
	if (aujourdhuidate > 0)
		DateExp.setTime (DateExp.getTime() - aujourdhuidate);
	}

// Function FixeCookie
// pour créer ou modifier un cookie
function FixeCookie (nom,valeur,expire,path,domaine,securise) {
	document.cookie = nom + "=" + escape (valeur) + ((expire) ? ";expires=" + expire.toGMTString() : "") + ((path) ? ";path=" + path : "") + ((domaine) ? "; domain=" + domaine : "") + ((securise) ? "; secure" : "");
	}
	
	
// Function ValeurCookie
// Utiliser par GetValeurCookie
function ValeurCookie (Pos) {
	var endstr = document.cookie.indexOf (";", Pos);
	if (endstr == -1)
	endstr = document.cookie.length;
	return unescape(document.cookie.substring (Pos, endstr));
	}

// Function GetValeurCookie
// pour récupérer la valeur d'un cookie
function GetValeurCookie (nom) {
	var cookielength = document.cookie.length;
	var arg = nom + "=";
	var arglength = arg.length;
	var i = 0;
	while (i < cookielength) {
	var j = i + arglength;
	if (document.cookie.substring(i, j) == arg)
	return ValeurCookie (j);
	i = document.cookie.indexOf(" ", i) + 1;
	if (i == 0) break; 
		}
	return null;
	}

function testCookies(){
	var MonCookie = GetValeurCookie("MonCookie");	
		if (MonCookie != "visite") {
			var expdate = new Date ();
			DateExpiration (expdate);
			expdate.setTime (expdate.getTime()+ (1000 * 60 * 60 * 24 )); // Ici on définit une durée de vie de 365 jours
			FixeCookie ("MonCookie", "visite", expdate);
			window.open('guide_popup.htm','guide','height=202,width=409');
			}
		}
//------------------------------------------------- Fin functions Cookies ----------------------------------------------

//***************************************************************************jumpMenu
function jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//***************************************************************************openBrWindow
function openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

//-->

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

//***************************************************************************
<!--
/**********************************************************************************   
TopMenu 
*   Copyright (C) 2001 <a href="/dhtmlcentral/thomas_brattli.asp">Thomas Brattli</a>
*   This script was released at DHTMLCentral.com
*   Visit for more great scripts!
*   This may be used and changed freely as long as this msg is intact!
*   We will also appreciate any links you could give us.
*
*   Made by <a href="/dhtmlcentral/thomas_brattli.asp">Thomas Brattli</a> 
*********************************************************************************/

function lib_bwcheck(){ //Browsercheck (needed)
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent
	this.dom=document.getElementById?1:0
	this.opera5=this.agent.indexOf("Opera 5")>-1
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
	this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
	this.ie=this.ie4||this.ie5||this.ie6
	this.mac=this.agent.indexOf("Mac")>-1
	this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
	return this
}
var bw=new lib_bwcheck()


/* Set the variables below.
If you look at the init function you can see that you can also set
these variables different for each menu!

If you only want 1 menu just remove the lines marked with *
in the init function and the divs from the page.
*/

//How many pixels should it move every step? 
var tMove=3;

//At what speed (in milliseconds, lower value is more speed)
var tSpeed=40

//Do you want it to move with the page if the user scroll the page?
var tMoveOnScroll=false

//How much of the menu should be visible in the in state?
var tShow=25

/********************************************************************
Contructs the menuobjects -Object functions
*********************************************************************/
function makeMenu(obj,nest,show,move,speed){
    nest=(!nest) ? "":'document.'+nest+'.'
	this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0;
  	this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0;		
	this.x=this.css.left||this.css.pixelLeft||this.el.offsetLeft||0
	this.y=this.css.top||this.css.pixelTop||this.el.offsetTop||0
	this.state=1; this.go=0; this.mup=b_mup; this.show=show; this.mdown=b_mdown; 
	this.height=bw.ns4?this.css.document.height:this.el.offsetHeight
	this.moveIt=b_moveIt; this.move=move; this.speed=speed
    this.obj = obj + "Object"; 	eval(this.obj + "=this")	
}

// A unit of measure that will be added when setting the position of a layer.
var px = bw.ns4||window.opera?"":"px";

function b_moveIt(x,y){this.x=x; this.y=y; this.css.left=this.x+px; this.css.top=this.y+px;}
//Menu in
function b_mup(){
	if(this.y>-this.height+this.show){
		this.go=1; this.moveIt(this.x,this.y-this.move)
		setTimeout(this.obj+".mup()",this.speed)
	}else{this.go=0; this.state=1}	
}
//Menu out
function b_mdown(){
	if(this.y<eval(scrolled)){
		this.go=1; this.moveIt(this.x,this.y+this.move)
		setTimeout(this.obj+".mdown()",this.speed)
	}else{this.go=0; this.state=0}	
}
/********************************************************************************
Deciding what way to move the menu (this is called onmouseover, onmouseout or onclick)
********************************************************************************/
function moveTopMenu(num){
	if(!oMenu[num].go){
		if(!oMenu[num].state)oMenu[num].mup()	
		else oMenu[num].mdown()
	}
	for(i=0;i<oMenu.length;i++){
		if(i!=num && !oMenu[i].state){ oMenu[i].mup()}
	}
}
/********************************************************************************
Checking if the page is scrolled, if it is move the menu after
********************************************************************************/
function checkScrolled(){
	for(i=0;i<oMenu.length;i++){
		if(!oMenu[i].go){
			y=!oMenu[i].state?eval(scrolled):eval(scrolled)-oMenu[i].height+oMenu[i].show
			oMenu[i].moveIt(oMenu[i].x,y)
		}
	}
	if(bw.ns4||bw.ns6) setTimeout('checkScrolled()',40)
}
/********************************************************************************
Inits the page, makes the menu object, moves it to the right place, 
show it
********************************************************************************/
function topMenuInit(){
	oMenu=new Array()
	oMenu[0]=new makeMenu('divMenu0',"",tShow,tMove,tSpeed) 
	
	scrolled=bw.ns4||bw.ns6?"window.pageYOffset":"document.body.scrollTop"
	//Placing and showing menus
	for(i=0;i<oMenu.length;i++){
		oMenu[i].moveIt(oMenu[i].x,-oMenu[i].height+oMenu[i].show)
		oMenu[i].css.visibility='visible'
	}
	if(tMoveOnScroll) bw.ns4||bw.ns6?checkScrolled():window.onscroll=checkScrolled;
}

//Initing menu on pageload
onload=topMenuInit;
/***************
Multiple Scripts
If you have two or more scripts that use the onload event, probably only one will run (the last one).
Here is a solution for starting multiple scripts onload:
   1. Delete or comment out all the onload assignments, onload=initScroll and things like that.
   2. Put the onload assignments in the body tag like in this example, note that they must have braces ().
   Example: <body onload="initScroll(); initTooltips(); initMenu();">
**************/

//cssOnBrowser
css_NN = "../styles/lacaune_n4.css";
css_IE = "../styles/lacaune01.css";
css_IE_2 = "../styles/actualite.css";
if(document.layers){
   document.write("<link rel='stylesheet' href='" + css_NN + "' type='text/css'>");
}
if(document.all){
   document.write("<link rel='stylesheet' href='" + css_IE + "' type='text/css'>");
   document.write("<link rel='stylesheet' href='" + css_IE_2 + "' type='text/css'>");

}//cssOnBrowserEnd

//***************************************************************************
// Afficher la date du jour 
//***************************************************************************
function w(txt) {document.write(txt);}

function don_date_jour(langue)
	{var date_jour=new Date();
	date_jour=don_date_format(date_jour,langue);
	return date_jour;}

function don_date_format(d1,langue) {
	var m=new Array(13);
	var d=new Array(8);
//----------------------------- format en français ---------------------------------
if (langue== "fr" ){ 
	m[1]="Janvier"; m[2]="Février";	m[3]="Mars"; m[4]="Avril"; m[5]="Mai"; m[6]="Juin";
 	m[7]="Juillet";	m[8]="Aout"; m[9]="Septembre"; m[10]="Octobre";	m[11]="Novembre"; m[12]="Décembre";
	d[1]="Dimanche"; d[2]="Lundi"; d[3]="Mardi"; d[4]="Mercredi"; d[5]="Jeudi"; d[6]="Vendredi"; d[7]="Samedi";
}
//----------------------------- format en allemand ---------------------------------
else if (langue== "de" ){
	m[1]="Januar"; m[2]="Februar";	m[3]=" März"; m[4]="April"; m[5]="Mai"; m[6]="Juni";
 	m[7]="Juli";	m[8]="August"; m[9]="September"; m[10]="Oktober";	m[11]="November"; m[12]="Dezember";
	d[1]="Sonntag"; d[2]="Montag"; d[3]="Dienstag"; d[4]="Mittwoch"; d[5]="Donnerstag"; d[6]="Freitag"; d[7]="Samstag ";
}
//----------------------------- format en anglais ---------------------------------
else if (langue== "en" ){
	m[1]="January"; m[2]="February";	m[3]="March"; m[4]="April"; m[5]="May"; m[6]="June";
 	m[7]="July";	m[8]="August"; m[9]="September"; m[10]="October";	m[11]="November"; m[12]="December";
	d[1]="Sunday"; d[2]="Monday"; d[3]="Tuesday"; d[4]="Wednesday"; d[5]="Thursday"; d[6]="Friday"; d[7]="Saturday";
}
	var mois=m[d1.getMonth()+1];
	var jour=d[d1.getDay()+1];
	var date=d1.getDate();
	var an=d1.getYear();
	if (an<200) an=1900+an;
	date=jour+" "+date+" "+mois+" "+an;
	return date;
	}
//***************************************************************************
function MM_findObj(n, d) { //v4.01
  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);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}


function setTextOfTextfield(objName,x,newText) { //v3.0
  var obj = MM_findObj(objName); if (obj) obj.value = newText;
}