
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

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 MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function checkBrowser(){
	this.ver=navigator.appVersion
	this.dom=document.getElementById?1:0
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 & this.dom)?1:0;
	this.ie4=(document.all & !this.dom)?1:0;
	this.ns5=(this.dom & parseInt(this.ver) >= 5) ?1:0;
	this.ns4=(document.layers & !this.dom)?1:0;
	this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5)
	return this
}
bw=new checkBrowser()
fromLeft=70
fromTop=120

function cursorInit(){
	oCursor=new makeCursorObj('divCursor')
	scrolled=bw.ns4 || bw.ns5?"window.pageYOffset":"document.body.scrollTop"
	if(bw.ns4)document.captureEvents(Event.MOUSEMOVE)
	document.onmousemove=move;
}
function makeCursorObj(obj,nest){
	nest=(!nest) ? '':'document.'+nest+'.' 
	this.css=bw.dom? document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+"document.layers." +obj):0; 
	this.moveIt=b_moveIt; 
	return this
}
function b_moveIt(x,y){
	this.x=x; 
	this.y=y; 
	this.css.left=this.x; 
	this.css.top=this.y
}
function move(e){
	x=bw.ns4 || bw.ns5?e.pageX:event.x
	y=bw.ns4 || bw.ns5?e.pageY:event.y
	if(bw.ie4 || bw.ie5) y=y+eval(scrolled)
	oCursor.moveIt(x+fromLeft,y+fromTop)
}
onload=cursorInit;

function remplirRenseignements(msg) {
	calqueInfo=MM_findObj('divCursor');
	calqueInfo.innerHTML=msg;
}

function remplirRenseignementsID(id) {

	msg="Informations en cours de chargement...";
	if (horairesXML.readyState == "complete") {
		racine = horairesXML.documentElement;
		listeElements = racine.childNodes;
		for (var i=0; i<listeElements.length; i++) {
      Item = listeElements.item(i);
			//alert(Item.getAttribute("id"))
      if (Item.getAttribute("id")==id) {
				i=listeElements.length+1;
			} 
			
  	}		
		msg='<div class="svcNom">'+Item.getAttribute("nom")+"</div>\n";
		msg+='<div class="svcAdr">\n';
		if (Item.getAttribute("adresse")!="")   msg+=        Item.getAttribute("adresse")+"<br/>\n";
		if (Item.getAttribute("telephone")!="") msg+="Tél. "+Item.getAttribute("telephone")+"<br/>\n";
		if (Item.getAttribute("web")!="")       msg+="Web " +Item.getAttribute("web")+"\n";
		msg+='</div><div class="svcHor">\n';
		
		listeElements = Item.childNodes;
		msg+="<table>";
		for (var i=0; i<listeElements.length; i++) {
			ItemJour = listeElements.item(i);
			msg+="<tr><td>"+ItemJour.baseName+"</td>" ;
			if (ItemJour.getAttribute("amo")!="") msg+="<td>"+ItemJour.getAttribute("amo"); else msg+="<td></td>";
			if (ItemJour.getAttribute("amf")!="") msg+="-"+ItemJour.getAttribute("amf")+"</td>";
			if (ItemJour.getAttribute("pmo")!="") msg+="<td>"+ItemJour.getAttribute("pmo");
			if (ItemJour.getAttribute("pmf")!="") msg+="-"+ItemJour.getAttribute("pmf")+"</td>";
			msg+="</tr>";
		}
		msg+="</table></div>";
	} else {
		msg="test";
	}
	
	//var re = new RegExp ("\\'", "gi") ;
	//var msg = msg.replace(re, "'") ;

	calqueInfo=MM_findObj('divCursor');
	calqueInfo.innerHTML=msg;
}
function changeStatut (idTBody) {
	var nom = 'var'+idTBody;
	//alert(nom);
	var tbodyChoisi=MM_findObj('cat'+idTBody);
	var titreAChoisi=MM_findObj('titreA'+idTBody);
	var titreBChoisi=MM_findObj('titreB'+idTBody);
	var actuel = tbodyChoisi.style.display;
	//alert(actuel);
	if (actuel=='none') {
	
		tbodyChoisi.style.display = 'inline';
		titreAChoisi.style.display = 'none';
		titreBChoisi.style.display = 'inline';
	} else {
		tbodyChoisi.style.display = 'none';
		titreAChoisi.style.display = 'inline';
		titreBChoisi.style.display = 'none';
	}
}