if (typeof bgimage == 'undefined') { var bgimage = "back_jaune.gif";}
if (typeof cellcolor == 'undefined') { var cellcolor = "#2739a3";}
if (typeof fcolor == 'undefined') { var fcolor = "#FFFFCC";}
if (typeof bcolor == 'undefined') { var bcolor = "#aeaeae";}	
if (typeof legendwidth == 'undefined') { var legendwidth = 450;}	
if (typeof backcolor == 'undefined') { var backcolor = "#2739a3";}
if (typeof imagetextcolor == 'undefined') { var imagetextcolor = "#FFFFCC";}
if (typeof textcolor == 'undefined') { var textcolor = "#000000";}
if (typeof textfamily == 'undefined') { var textfamily = "arial";}	
if (typeof capcolor == 'undefined') { var capcolor = "#FFFFFF";}
if (typeof closecolor == 'undefined') { var closecolor = "#FFFF33";}
if (typeof width == 'undefined') { var width = "300";}
if (typeof border == 'undefined') { var border = "2";}
if (typeof offsetx == 'undefined') { var offsetx = 10;}
if (typeof offsety == 'undefined') { var offsety = 10;}

ns4 = (document.layers)? true:false
ie4 = (document.all)? true:false

// Microsoft Stupidity Check.
if (ie4) {
	if (navigator.userAgent.indexOf('MSIE 5')>0) {
		ie5 = true;
	} else {
		ie5 = false; }
} else {
	ie5 = false;
}

var x = 0;
var y = 0;
var snow = 0;
var sw = 0;
var cnt = 0;
var dir = 1;


if ( (ns4) || (ie4) ) {
	if (ns4) over = document.overDiv
	if (ie4) over = overDiv.style
	document.onmousemove = mouseMove
	if (ns4) document.captureEvents(Event.MOUSEMOVE)
}


// Simple popup right
function drs(text) {
	dts(1,text);
}

// Caption popup right
function drc(text, title) {
	dtc(1,text,title);
}

// Sticky caption right
function src(text,title,image) {
	stc(1,text,title);
}

// Simple popup left
function dls(text) {
	dts(0,text);
}

// Caption popup left
function dlc(text,title) {
	dtc(0,text,title);
}

// Sticky caption left
function slc(text,title) {
	stc(0,text,title);
}

// Simple popup center
function dcs(text) {
	dts(2,text);
}

// Caption popup center
function dcc(text, title) {
	dtc(2,text,title);
}

// Sticky caption center
function scc(text,title) {
	stc(2,text,title);
}


// IMAGE ZOOM  CAPTION CENTER
function zoom(self,larg,haut,title) {
	sicz(2,self,larg,haut,title);
}

//*****************CENTER LAYERS here
//  IMAGE STICKY CAPTION CENTER
function im(self,comment) {
	center_im(2,self,comment);
}
//*****************
// IMAGE center layers ex:gde image
function center(self,larg,haut,comment) {
	rcm_centerLayers(3,self,larg,haut,comment);
}
//  IMAGE LEGENDE STICKY 
function legend(img,text,width,title) {
	leg(4,img,text,width,title);
}


// Clears popups if appropriate
function nd() {
	if ( cnt >= 1 ) { sw = 0 };
	if ( (ns4) || (ie4) ) {
		if ( sw == 0 ) {
			snow = 0;
			hideObject(over);
		} else {
			cnt++;
		}
	}
}
//***************

// Simple popup
function dts(d,text) {
	txt = "<TABLE WIDTH="+width+" BORDER=0 CELLPADDING="+border+" CELLSPACING=0 BGCOLOR=\""+backcolor+"\"><TR><TD><TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=0 BGCOLOR=\""+fcolor+"\"><TR><TD align=center><FONT FACE=\"Arial,Helvetica\" COLOR=\""+textcolor+"\" SIZE=\"-2\">"+text+"</FONT></TD></TR></TABLE></TD></TR></TABLE>"
	layerWrite(txt);
	dir = d;
	disp();
}

// Caption popup
function dtc(d,text, title) {
	txt = "<TABLE WIDTH="+width+" BORDER=0 CELLPADDING="+border+" CELLSPACING=0 BGCOLOR=\""+backcolor+"\"><TR><TD><TABLE WIDTH=100% BORDER=0 CELLPADDING=0 CELLSPACING=0><TR><TD><SPAN ID=\"PTT\"><B><FONT COLOR=\""+capcolor+"\">"+title+"</FONT></B></SPAN></TD></TR></TABLE><TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=0 BGCOLOR=\""+fcolor+"\"><TR><TD><SPAN ID=\"PST\"><FONT COLOR=\""+textcolor+"\">"+text+"</FONT><SPAN></TD></TR></TABLE></TD></TR></TABLE>"
	layerWrite(txt);
	dir = d;
	disp();
}

// Sticky
function stc(d,text, title) {
	sw = 1;
	cnt = 0;
	txt = "<TABLE WIDTH="+width+" BORDER=0 CELLPADDING="+border+" CELLSPACING=0 BGCOLOR=\""+backcolor+"\"><TR><TD><TABLE WIDTH=100% BORDER=0 CELLPADDING=0 CELLSPACING=0><TR><TD bgcolor="+cellcolor+" width=100%><SPAN ID=\"PTT\"><B><FONT COLOR=\""+capcolor+"\" face=\""+textfamily+"\" SIZE=\"-1\">"+title+"</FONT></B></SPAN></TD><TD><A HREF=\"/\" onMouseover=\"cClick();\" ID=\"PCL\"><IMG SRC='bouton_close2.gif' border=0></A></TD></TR></TABLE><TABLE background="+bgimage+" WIDTH=100% BORDER=0 CELLPADDING=10 CELLSPACING=0><TR><TD><FONT COLOR=\""+textcolor+"\" face=\""+textfamily+"\" SIZE=\"-2\">"+text+"</FONT></TD></TR></TABLE></TD></TR></TABLE>"
	layerWrite(txt);
	dir = d;
	disp();
	snow = 0;
}


// STICKY POUR IMAGE POPUP
function center_im(d,self,comment){
	sw = 1;
	cnt = 0;
	txt = "<table bgcolor='#0080c0' BORDER=0 CELLPADDING=3 CELLSPACING=0><tr><td><TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0><tr bgcolor='#0080c0' width=100%><td><FONT COLOR='white' face='arial' SIZE='-1'><b><div align=center>Affichage de l\'\image</div></b></td></tr><tr bgcolor='#707070'><TD><center><A HREF=\"/\" onMouseDown=\"cClick();\" ID=\"PCL\"><img src="+self+" border=0></a></center></td></tr><TR><td bgcolor='#707070' width=100%><center><B><FONT COLOR='white' face='arial' SIZE='-1'>"+comment+"</FONT></B></center></td></tr><tr bgcolor='#0080c0'><td><font face='arial' size='-2'><b><center>Cliquer sur l\'\image pour fermer la fenêtre</center></b></font></td></tr></td></tr></TABLE></table>"

layerWrite(txt);
dir = d;	
disp();
	snow = 0;
}
//*************************CENTER LAYER Pour petite page et gde image===ca marche A ameliorer
function rcm_centerLayers(d,self,larg,haut,comment){
	sw = 1;
	cnt = 0;
	txt = "<table bgcolor='#0080c0' BORDER=0 CELLPADDING=3 CELLSPACING=0><tr><td><TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0><tr bgcolor='#0080c0' width=100%><td><FONT COLOR='white' face='arial' SIZE='-1'><b><div align=center>Affichage de l\'\image</div></b></td></tr><TR><td bgcolor='#707070' width=100%><center><B><FONT COLOR='white' face='arial' SIZE='-1'>"+comment+"</FONT></B></center></td></tr><tr bgcolor='#707070'><TD><center><A HREF=\"/\" onMouseDown=\"cClick();\" ID=\"PCL\"><img src="+self+" width="+larg+" height="+haut+" border=0></a></center></td></tr><tr bgcolor='#0080c0'><td><font face='arial' size='-2'><b><center>Cliquer sur l\'\image pour fermer la fenêtre</center></b></font></td></tr></td></tr></TABLE></table>"

LeftPos = (screen.width) ? (screen.width-larg)/2 : 0;

layerWrite(txt);
dir = d;	
disp();
	snow = 0;
}

//***********************************************
// STICKY POUR IMAGE POPUP AVEC LEGENDE A DROITE
function leg(d,img,text,width,title) {
	sw = 1;
	cnt = 0;
	
	txt = "<TABLE WIDTH="+width+" BORDER=0 CELLPADDING=1 CELLSPACING=1 BGCOLOR='#ff0080'><TR><TD><TABLE WIDTH=100% BORDER=0 CELLPADDING=0 CELLSPACING=0>	<TR><td></td><TD bgcolor='#707070' width=100%><center><SPAN ID=\"PTT\"><B><FONT COLOR='white' face=\""+textfamily+"\" SIZE=\"-2\">"+title+"</FONT></B></SPAN></center></TD><TD></TD></TR></TABLE><TABLE WIDTH=100% BORDER=0 CELLPADDING=4 CELLSPACING=0 BGCOLOR='#808080'><TR><TD valign=top ><A HREF=\"/\" onMouseDown=\"cClick();\" ID=\"PCL\"><img src="+img+" border=0 alt='image' align=left></a></td><td valign=top><p align=justify><FONT COLOR='#ffff80' face=\""+textfamily+"\" SIZE='-2'>"+text+"</FONT></b><br><br><center><table bgcolor='#0080c0' CELLPADDING=0 CELLSPACING=2 BORDER=0><tr><td><font face='arial' size='-2'><b><center>Cliquer sur l\'\image pour fermer la fenêtre</center></b></font></td></tr></table></center></TD></TR></TABLE></TD></TR></TABLE>"
LeftPos = (screen.width) ? (screen.width-width)/2 : 0;
	layerWrite(txt);
	dir = d;
	disp();
	snow = 0;
}

// ZOOM pour IMAGE POPUP
function sicz(d,self,larg,haut,title) {

	
	txt = "<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0><TR><td bgcolor='#707070' width=100%><center><B><FONT COLOR='white' face='arial SIZE='-1'>"+title+"</FONT></B></center></td></tr><tr><TD><TABLE WIDTH=100% BORDER=0 CELLPADDING=0 CELLSPACING=0><TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=0 bgcolor='#707070'><TR><TD><center><img src="+self+" width="+larg+" height="+haut+" border=10></center></td></tr><tr></TR></TABLE></TD></TR></TABLE>"
	layerWrite(txt);
	dir = d;
	disp();
	snow = 0;
}

// Common calls
function disp() {
	if ( (ns4) || (ie4) )  {
		if (snow == 0) 	{
			if (dir == 2) { // Center
				moveTo(over,x+offsetx-(width/2),y+offsety);
			}
			if (dir == 1) { // Right
				moveTo(over,x+offsetx,y+offsety);
			}
			if (dir == 0) { // Left
				moveTo(over,x-offsetx-width,y+offsety);
			}
//**************center layers
		if (dir == 3) { // Center the layer
				moveTo(over,LeftPos,y-(width/2));
			}
		if (dir == 4) { // Center the layer
				moveTo(over,LeftPos,y-(width/2));
			}
//***************
			showObject(over);
			snow = 1;
		}
	}

}


// Moves the layer
function mouseMove(e) {
	if (ns4) {x=e.pageX; y=e.pageY;}
	if (ie4) {x=event.x; y=event.y;}
	if (ie5) {x=event.x+document.body.scrollLeft; y=event.y+document.body.scrollTop;}
	if (snow) {
		if (dir == 2) { // Center
			moveTo(over,x+offsetx-(width/2),y+offsety);
		}
		if (dir == 1) { // Right
			moveTo(over,x+offsetx,y+offsety);
		}
		if (dir == 0) { // Left
			moveTo(over,x-offsetx-width,y+offsety);
		}

	}
}

// The Close onMouseclick function for Sticky
function cClick() {
	hideObject(over);
	sw=0;
}

// Writes to a layer
function layerWrite(txt) {
        if (ns4) {
                var lyr = document.overDiv.document
                lyr.write(txt)
                lyr.close()
        }
        else if (ie4) document.all["overDiv"].innerHTML = txt

}

// Make an object visible
function showObject(obj) {
        if (ns4) obj.visibility = "show"
        else if (ie4) obj.visibility = "visible"
}

// Hides an object
function hideObject(obj) {
        if (ns4) obj.visibility = "hide"
        else if (ie4) obj.visibility = "hidden"
}

// Move a layer
function moveTo(obj,xL,yL) {
        obj.left = xL
        obj.top = yL
}







