var resolutionX = screen.availWidth;
var resolutionY = screen.availHeight;

var IB=new Object;
var posX=0;posY=0;

function AffBulle(texte, xOffset, yOffset) {
  contenu="<TABLE border=0 cellspacing=0 cellpadding="+IB.NbPixel+"><TR bgcolor='"+IB.ColContour+"'><TD><TABLE border=0 cellpadding=2 cellspacing=0 bgcolor='"+IB.ColFond+"'><TR><TD><FONT size='-1' face='arial' color='"+IB.ColTexte+"'>"+texte+"</FONT></TD></TR></TABLE></TD></TR></TABLE>&nbsp;";
  var finalPosX=posX-xOffset;
  if (finalPosX<0) finalPosX=0;
  if (document.layers) {
    document.layers["bulle"].document.write(contenu);
    document.layers["bulle"].document.close();
    document.layers["bulle"].top=posY+yOffset;
    document.layers["bulle"].left=finalPosX;
    document.layers["bulle"].visibility="show";}
  if (document.all) {
    //var f=window.event;
    //doc=document.body.scrollTop;
    bulle.innerHTML=contenu;
    document.all["bulle"].style.top=posY+yOffset;
    document.all["bulle"].style.left=finalPosX;//f.x-xOffset;
    document.all["bulle"].style.visibility="visible";
  }
  //modif CL 09/2001 - NS6 : celui-ci ne supporte plus document.layers mais document.getElementById
  else if (document.getElementById) {
    document.getElementById("bulle").innerHTML=contenu;
    document.getElementById("bulle").style.top=posY+yOffset;
    document.getElementById("bulle").style.left=finalPosX;
    document.getElementById("bulle").style.visibility="visible";
  }
}

function getMousePos(e) {
  if (document.all) {
  posX=event.x+document.body.scrollLeft; //modifs CL 09/2001 - IE : regrouper l'ˇv¸nement
  posY=event.y+document.body.scrollTop;
  }
  else {
  posX=e.pageX; //modifs CL 09/2001 - NS6 : celui-ci ne supporte pas e.x et e.y
  posY=e.pageY; 
  }
}

function HideBulle() {
	if (document.layers) {document.layers["bulle"].visibility="hide";}
	if (document.all) {document.all["bulle"].style.visibility="hidden";}
	else if (document.getElementById){document.getElementById("bulle").style.visibility="hidden";}
}

function InitBulle(ColTexte,ColFond,ColContour,NbPixel) {
	IB.ColTexte=ColTexte;IB.ColFond=ColFond;IB.ColContour=ColContour;IB.NbPixel=NbPixel;
	if (document.layers) {
		window.captureEvents(Event.MOUSEMOVE);window.onMouseMove=getMousePos;
		document.write("<LAYER name='bulle' top=0 left=0 visibility='hide'></LAYER>");
	}
	if (document.all) {
		document.write("<DIV id='bulle' style='position:absolute;top:0;left:0;visibility:hidden'></DIV>");
		document.onmousemove=getMousePos;
	}
	//modif CL 09/2001 - NS6 : celui-ci ne supporte plus document.layers mais document.getElementById
	else if (document.getElementById) {
	        document.onmousemove=getMousePos;
	        document.write("<DIV id='bulle' style='position:absolute;top:0;left:0;visibility:hidden'></DIV>");
	}

}

function imprimepage(page, selected) {
	window.open("index.php?page="+page+"&print");
}

function show(id) {
	var menu = GetCookie("openmenu");

	if(document.getElementById(id).style.display == "none") {
		document.getElementById(id).style.display 	= "";
		document.getElementById("img"+id).src		= "http://www.adasea.net/img/moins.gif";
		txtmenu										= menu+id+"=O;";
	} else {
		document.getElementById(id).style.display 	= "none";
		document.getElementById("img"+id).src		= "http://www.adasea.net/img/plus.gif";
		txtmenu										= menu+id+"=N;";
	}
	
	SetCookie("openmenu", txtmenu);
}


function showDiv(id) {
	if(document.getElementById(id).style.display == "none") {
		document.getElementById(id).style.display 	= "";
	} else {
		document.getElementById(id).style.display 	= "none";
	}
}

function getCookieVal(offset) {
	var endstr=document.cookie.indexOf (";", offset);
	
	if (endstr==-1)
		endstr=document.cookie.length;
		
	return unescape(document.cookie.substring(offset, endstr));
}

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;
}

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() - 100000);
	var cval=GetCookie (name);
	document.cookie=name+"="+cval+"; expires="+exp.toGMTString();
}


function PopupCentrer(page, largeur, hauteur, options) {
	var top		= (screen.height-hauteur)/2;
	var left	= (screen.width-largeur)/2;
	window.open(page,"","top="+top+",left="+left+",width="+largeur+",height="+hauteur+","+options);
}

function PopupSimple(page) {
	window.open(page,'popup','width=400,height=200,toolbar=false,scrollbars=auto');	
}

// affiche un sablier pendant le chargement de la page
function chargement() {
	return null;
}