var WEB_SITE_ROOT = "http://www.infini-software.com/";
var __defaultId = 0;

document.oncontextmenu = function ContextMenu() { return false; }


function gm( username ) {
	var m = username + "@infini-software.com";
	document.write( "<a href='mai" + "lto:" + m + "'>" + m + "</a>" );
}


function insertSeparator() { document.writeln("<HR>"); }


function Button( text, url, style ) {
	var idButton = "button" + (__defaultId++);
	var codeHTML = "<DIV class='Button' id='" + idButton + "'>" + text + "</DIV>";
	document.writeln(codeHTML);
	var buttonNode = document.getElementById(idButton);
	buttonNode.url = url;
	if (arguments.length>2) buttonNode.style.cssText = style;
	
	buttonNode.onmouseover = function Button_onMouseOver() {
		this.style.background = "#DDECFE";
	}

	buttonNode.onmouseout = function Button_onMouseOut() {
		this.style.background = "#BAD0F1";
	}
	
	buttonNode.onmousedown = function Button_onMouseOver() {
		this.style.background = "#FFFFFF";
	}

	buttonNode.onmouseup = function Button_onMouseOver() {
		this.onmouseover();
		window.top.frames["Cours"].location.href = this.url;
	}
	
	return buttonNode;
}

function GraphicTitle( texte , level ) {
    var posStyle = "";
    switch(level) {
        case 1: posStyle += "align='center'";							break;
        case 2: posStyle += "style='position: relative; left:-86;'";	break;
        case 3: posStyle += "style='margin-left:-0;'"; 					break;
    }
	document.write("<TABLE border='0' cellpadding='0' cellspacing='0' " + posStyle + ">");
	document.write("    <TR>");
	document.write("        <TD><IMG src='" + WEB_SITE_ROOT + "Images/TitleLeft.gif' border='0'></TD>");
	//document.write("        <TD style='width:82px; height:40px; background-image: url(\"Images/TitleLeft.gif\");'>&nbsp;</TD>");
	document.write("        <TD style='background-image: url(\"" + WEB_SITE_ROOT + "Images/TitleCenter.gif\"); background-repeat: repeat-x'>");
	document.write(             "<H" + level +" style='margin-bottom: 6px'>" + texte + "</H" + level + ">");
	document.write("        </TD>");
	document.write("        <TD><IMG src='" + WEB_SITE_ROOT + "Images/TitleRight.gif' border='0'></TD>");
	document.write("    </TR>");
	document.write("</TABLE>");
}

window.onload = function() {
    try {
        var _pnlContent = document.getElementById("__pnlContent");
        if (_pnlContent != null) {
            window.onresize = function() {
                document.getElementById("__back").style.height = window.document.body.offsetHeight;
                //document.getElementById("__back").style.background = "red";
                if (document.all) { 
                    _pnlContent.firstChild.style.height = _pnlContent.clientHeight;
                } else {
                    _pnlContent.firstChild.nextSibling.style.height = _pnlContent.offsetHeight;                    
                }
            }
            window.onresize();
        }
    } catch(e) {}
}

function CookiesManager() {
    this.cookies = new Array();
    //--- Construction de la structure. ---
    var tempCookies = document.cookie.split(";");
	for(var i=0; i<tempCookies.length; i++) {
        var currentCookie = tempCookies[i].split("=");
        this.cookies[i] = currentCookie;
    }
    
    this.getValue = function CookiesManager_getValue(name) {

        for(var i=0;i<this.cookies.length; i++) {
            if (this.cookies[i][0].indexOf(name) > -1) {
			return this.cookies[i][1];
			}
        }
        return null; 
    }
    
    this.setValue = function CookieManager_setValue(key, value, expirationDate) {
        if (arguments.length != 3) {
        	expirationDate = new Date();
         	expirationDate.setTime( expirationDate.getTime()*1 + (365*24*60*60*1000) );
        }
	    document.cookie = key + "=" + value + ";expires=" + expirationDate.toGMTString();
    }
}

var cookiesManager = new CookiesManager();