if (typeof fcolor == 'undefined') 
    { var fcolor="#FEF3CB";} // couleur du fond
if (typeof backcolor == 'undefined')
    { var backcolor="#FFCC00";} // couleur du fond du titre
if (typeof textcolor == 'undefined')
    { var textcolor="#000000";} // couleur du texte
if (typeof capcolor == 'undefined')
    { var capcolor="#000000";} // couleur du titre
if (typeof closecolor == 'undefined')
    { var closecolor="red";} // couleur de 'close'
if (typeof width == 'undefined')
    { var width="75";} // largeur de la bulle
if (typeof border == 'undefined')
    { var border="1";} // taille de la bordure
if (typeof offsetx == 'undefined')
    { var offsetx=20;} // distance verticale du curseur
if (typeof offsety == 'undefined')
    { var offsety=20;} // distance horizontale du curseur

var x=0;
var y=0;
var snow=0;
var sw=0;
var cnt=0;
var dir=1;

over = document.getElementById('overDiv');
document.onmousemove = mouseMove;

function drs(text) {
    dts(1,text);
}
function drc(text, title) {
    dtc(1,text,title);
}
function src(text,title) {
    stc(1,text,title);
}
function dls(text) {
    dts(0,text);
}
function dlc(text, title) {
    dtc(0,text,title);
}
function slc(text,title) {
    stc(0,text,title);
}
function dcs(text) {
    dts(2,text);
}
function dcc(text, title) {
    dtc(2,text,title);
}
function scc(text,title) {
    stc(2,text,title);
}
function nd() {
    if ( cnt >= 1 ) { 
        sw = 0;
    }
    
    if ( sw == 0 ) {
        snow=0;
        hideObject(over);
    } else {
    cnt++;    
}
}
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><FONT FACE=\"Arial,Helvetica\" COLOR=\""+textcolor+"\" SIZE=\"-2\">"+text+"</FONT></TD></TR></TABLE></TD></TR></TABLE>"
    layerWrite(txt);
    dir=d;
    disp();
}
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 NOWRAP><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 NOWRAP><SPAN ID=\"PST\"><FONT COLOR=\""+textcolor+"\">"+text+"</FONT><SPAN></TD></TR></TABLE></TD></TR></TABLE>"
    layerWrite(txt);
    dir=d;
    disp();
}
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><SPAN ID=\"PTT\"><B><FONT COLOR=\""+capcolor+"\">"+title+"</FONT></B></SPAN></TD><TD ALIGN=RIGHT><A HREF=../fr//%22//%22 onMouseOver=\"cClick();\" ID=\"PCL\"><FONT COLOR=\""+closecolor+"\">Close</FONT></A></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();
    snow=0;
}
function disp() {   
    
    if (snow == 0){
        
        if (dir == 2) {
            moveTo(over,x+offsetx-(width/2),y+offsety);
        }
        if (dir == 1) {
            moveTo(over,x+offsetx,y+offsety);
        }
        if (dir == 0) {
            moveTo(over,x-offsetx-width,y+offsety);
        }       
        
        showObject(over);
        snow=1;
    }
}

function mouseMove(e) {    
    
    var posx = 0;    
    var posy = 0;
    
    if (!e) var e = window.event;
    
    if (e.pageX || e.pageY){
        
        posx = e.pageX;        
        posy = e.pageY;        
    }
    
    else if (e.clientX || e.clientY){
        
        posx = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;        
        posy = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;        
    }
    
    
    if (snow) {
        if (dir == 2) {
            moveTo(over,posx+offsetx-(width/2),posy+offsety);
        }
        if (dir == 1) {
            moveTo(over,posx+offsetx,posy+offsety);
        }
        if (dir == 0) {
            moveTo(over,posx-offsetx-width,posy+offsety);
        }
    }
}

function cClick() {
    hideObject(over);
    sw=0;
}

function layerWrite(txt) {    
    var lyr = document.getElementById('overDiv');
    lyr.innerHTML = txt;
}

function showObject(obj) {
    obj.style.visibility = "visible";
}

function hideObject(obj) {
    obj.style.visibility = "hidden";
}

function moveTo(obj,xL,yL) {    
    obj.style.left = xL+'px';
    obj.style.top = yL+'px';   
}
