    var curPW = "Piccolo1015";

	function getCookieData(labelName) {
	
		var cookieData = document.cookie;
		
		var cReturn = -1;
		var cNb = 0;
		var intNb = 0;
		
		var thisCookie;
		var expireDate = new Date();

		thisCookie=cookieData.split("; ");
		cNb=thisCookie.length;
		
//		alert ("Nb cookies: " + thisCookie.length);

//		if (cNb == 1) {
//			cReturn = (decodeURIComponent(thisCookie[0].split("=")[1]));
//			alert ("cookie: " + cReturn);
//		}
//		if (cNb > 1) {
			for (k = 0; k < cNb; k++) {
				if (decodeURIComponent(thisCookie[k].split("=")[0]) == labelName) {
					intNb++;
					cReturn = (decodeURIComponent(thisCookie[k].split("=")[1]));
				}
			}
//		}
		
		if (intNb > 1) {	
			expireDate.setDate(expireDate.getDate() - 1);
			for (k = 0; k < cNb; k++) {
				if (decodeURIComponent(thisCookie[k].split("=")[0]) == labelName) {
					document.cookie = thisCookie[k] + "=;expires=" + expireDate.toGMTString();
				}
			}
			cReturn = -1;
        }
        if (cReturn == "undefined") cReturn = -1;
		
//		alert ("getCookieData: " + cReturn);
		
		return cReturn;
		
	}
	
	function setCookieData(cookieItem, nbMonths) {

		var nbDays;
		
		var exp = new Date();
		var newExp;

		if (nbMonths == 0) {
		    nbDays = 1;
		} else {
		    nbDays = parseInt(nbMonths * 365 / 12);
        }
		newExp = exp.getTime() + (nbDays * 24 * 60 * 60 * 1000);

		if (nbMonths < 0) newExp = exp.getTime() - (nbMonths * 1000);

		exp.setTime(newExp);

		document.cookie = cookieItem + ";expires=" + exp.toGMTString() + ";path=/";
		
	}
	
	function getUserPrefLang() {
		var rLang;
		rLang = getCookieData("PrefLang");
		
		if (rLang == -1) {
			rLang = 0;
			setUserPrefLang(0);
		}
		return rLang;
	}
	
	function setUserPrefLang(newUserLang) {
		setCookieData("PrefLang=" + newUserLang, 1000);
	}

	function getAccessCode() {
		return getCookieData("Egypte2009Access");
	}
	 
	function setAccessCode(newAccessCode) {
		setCookieData("Egypte2009Access=" + newAccessCode, 6);
	}

	function enCrypt(strItem) {
	
		var encCode;
		var i;
		var sChar = new Array();
		
//		alert ("enCrypt");
		
		encCode = "";
		for (i = 0; i < strItem.length; i++) {
		    sChar[i] = "0x" + strItem.charCodeAt(i).toString(16) + "0";
			sChar[i] = parseInt(sChar[i], 16);
			sChar[i] >>= ((i % 2) + 1);
			encCode = encCode + "0x" + sChar[i].toString(16) + ",";
//			alert("char: " + strItem.charAt(i) + "\ncode: " + strItem.charCodeAt(i) + "\nsChar: " + sChar[i] + "\nenCode: " + encCode);
}
		encCode = encCode.substring(0, encCode.length - 1);
		
		return encCode;
		
	}
	
	function deCrypt(strItem) {
		
		var encCode;
		var i;
		var sChar;
		var uParams;
		
//		alert ("deCrypt " + strItem);
		
		uParams = strItem.split(",");
		encCode = "";
		for (i = 0; i < uParams.length; i++) {
			sChar = uParams[i];
			sChar <<= ((i % 2) + 1);
			sChar >>= 4;
			encCode += String.fromCharCode(sChar);
		}
		return encCode;
		
	}

	function changecss(theClass,element,value) {
		//Last Updated on October 10, 1020
		//documentation for this script at
		//http://www.shawnolson.net/a/503/altering-css-class-attributes-with-javascript.html
		var cssRules;
		
		var added = false;
		for (var S = 0; S < document.styleSheets.length; S++){
	
			if (document.styleSheets[S]['rules']) {
				cssRules = 'rules';
			} else if (document.styleSheets[S]['cssRules']) {
				cssRules = 'cssRules';
			} else {
				alert ("inconnu");
			}
		

			for (var R = 0; R < document.styleSheets[S][cssRules].length; R++) {
			    if (document.styleSheets[S][cssRules][R].selectorText.toLowerCase() == theClass.toLowerCase()) {
					if(document.styleSheets[S][cssRules][R].style[element]){
					    document.styleSheets[S][cssRules][R].style[element] = value;
					    added=true;
						break;
				    }
				}
			}
		}
	}

	function getCSS(theClass, element) {

	    var cssRules;

	    for (var S = 0; S < document.styleSheets.length; S++) {

	        if (document.styleSheets[S]['rules']) {
	            cssRules = 'rules';
	        } else if (document.styleSheets[S]['cssRules']) {
	            cssRules = 'cssRules';
	        } else {
	            alert("inconnu");
	        }

	        for (var R = 0; R < document.styleSheets[S][cssRules].length; R++) {
	            if (document.styleSheets[S][cssRules][R].selectorText.toLowerCase() == theClass.toLowerCase()) {
	                if (document.styleSheets[S][cssRules][R].style[element]) {
	                    return document.styleSheets[S][cssRules][R].style[element];
	                    break;
	                } else {
	                    return "";
	                }
	            }
	        }
	    }
	}


	function listCSS(theClass) {

	    var txt = "";
	    var cssRules;

	    for (var S = 0; S < document.styleSheets.length; S++) {

	        if (document.styleSheets[S]['rules']) {
	            cssRules = 'rules';
	        } else if (document.styleSheets[S]['cssRules']) {
	            cssRules = 'cssRules';
	        } else {
	            alert("inconnu");
	        }

	        for (var R = 0; R < document.styleSheets[S][cssRules].length; R++) {
	            if (document.styleSheets[S][cssRules][R].selectorText.toLowerCase() == theClass.toLowerCase()) {

	                for (var i = 0; i < document.styleSheets[S][cssRules][R].style.length; i++) {
	                    txt = txt + document.styleSheets[S][cssRules][R].style[i] + " = " + document.styleSheets[S][cssRules][R].style[document.styleSheets[S][cssRules][R].style[i]] + "\n";
	                }
	            }
	        }
	    }
	    alert(txt);
	}



	function setRatios() {

	    if (typeof (window.innerWidth) == 'number') {

	        //Non-IE 

	        clientWidth = window.innerWidth;
	        clientHeight = window.innerHeight;

	    } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {

	        //IE 6+ in 'standards compliant mode' 

	        clientWidth = document.documentElement.clientWidth;
	        clientHeight = document.documentElement.clientHeight;

	    } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {

	        //IE 4 compatible 

	        clientWidth = document.body.clientWidth;
	        clientHeight = document.body.clientHeight;

	    }

	    if (clientWidth < 500) clientWidth = 500;
	    if (clientHeight < 400) clientHeight = 400;

	    clientHeight = Math.ceil(0.99 * clientHeight) - 15;

	    if (getDocWidth() > clientWidth) clientWidth -= 16;

	    var ratioH = (clientHeight > 800 ? 1 : clientHeight / 800);
	    var ratioW = (clientWidth > 1200 ? 1 : clientWidth / 1200);
	    clientRatio = Math.round(Math.min(ratioH, ratioW) * 100) / 100;
	    if (clientRatio > 1) clientRatio = 1;

	    pageWidth = Math.floor(0.99 * clientWidth);
	    imageWidth = Math.floor(0.97 * clientWidth);
	    
	    pageHeight = Math.floor(0.95 * clientHeight);

	}

	function setFontPoints()
	
	{
	    pt12 = Math.ceil(Math.max(8, clientRatio * 12));
	    pt14 = Math.ceil(Math.max(8, clientRatio * 14));
	    pt16 = Math.ceil(Math.max(8, clientRatio * 16));
	    pt18 = Math.ceil(Math.max(8, clientRatio * 18));
	    pt20 = Math.ceil(Math.max(8, clientRatio * 20));
	    pt22 = Math.ceil(Math.max(8, clientRatio * 22));
	    pt24 = Math.ceil(Math.max(8, clientRatio * 24));

	    changecss(".font08", "fontSize", Math.ceil(Math.max(6, clientRatio * 8)) + "pt");
	    changecss(".font09", "fontSize", Math.ceil(Math.max(6, clientRatio * 9)) + "pt");
	    changecss(".font10", "fontSize", Math.ceil(Math.max(6, clientRatio * 10)) + "pt");
	    changecss(".font11", "fontSize", Math.ceil(Math.max(7, clientRatio * 11)) + "pt");
	    changecss(".font12", "fontSize", Math.ceil(Math.max(7, clientRatio * 12)) + "pt");
	    changecss(".font14", "fontSize", Math.ceil(Math.max(8, clientRatio * 14)) + "pt");
	    changecss(".font16", "fontSize", Math.ceil(Math.max(8, clientRatio * 16)) + "pt");
	    changecss(".font18", "fontSize", Math.ceil(Math.max(9, clientRatio * 18)) + "pt");
	    changecss(".font20", "fontSize", Math.ceil(Math.max(10, clientRatio * 20)) + "pt");
	    changecss(".font22", "fontSize", Math.ceil(Math.max(11, clientRatio * 22)) + "pt");
	    changecss(".font24", "fontSize", Math.ceil(Math.max(12, clientRatio * 24)) + "pt");

	}
	
	function getDocHeight() {
	    var D = document;
	    return Math.max(
	        Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),
	        Math.max(D.body.offsetHeight, D.documentElement.offsetHeight),
	        Math.max(D.body.clientHeight, D.documentElement.clientHeight)
	    );
	}

	function getDocWidth() {
	    var D = document;
	    return Math.max(
	        Math.max(D.body.scrollHeight, D.documentElement.scrollWidth),
	        Math.max(D.body.offsetHeight, D.documentElement.offsetWidth),
	        Math.max(D.body.clientHeight, D.documentElement.clientWidth)
	    );
	}

	function CouleurShadow(txtRGB) {
	    var totalCnt = 0;
	    var niveauGris;

	    var oldCol = txtRGB.split('(')[1].split(')')[0].split(',');
	    for (var i = 0; i < 3; i++) {
	        totalCnt += parseInt(oldCol[i], 10);
	    }

        niveauGris = (totalCnt > 300 ? 20 : 245);

	    return "rgb(" + niveauGris + ", " + niveauGris + ", " + niveauGris + ")";

	}

	function getElement(id) {
	    if (document.getElementById) {
	        return document.getElementById(id);
	    }
	    else if (document.all) {
	        return window.document.all[id];
	    }
	    else if (document.layers) {
	        return window.document.layers[id];
	    }
	}

	function IterateStyles(button) {
	    for (var i = 0; i < button.style.length; i++) {
	        var propName = button.style.item(i);
	        var value = button.style.getPropertyValue(propName);
	        alert(propName + " = " + value);
	    }
	}

	function scrollDetect(elemId) {
	    var elem = document.getElementById(elemId);
	    if (elem.scrollHeight > elem.clientHeight) {
	        return true;
	    } else {
	        return false;
	    }
	}

	function Asc(String) {

	    return String.charCodeAt(0);

	}

	function Chr(AsciiNum) {

	    return String.fromCharCode(AsciiNum);

	}

	function addRow(tableId, texte1) {
	    var tbody = document.getElementById(tableId).getElementsByTagName("tbody")[0];
	    var row = document.createElement("tr")
	    var data1 = document.createElement("td")
	    data1.appendChild(document.createTextNode(texte1))
//	    var data2 = document.createElement("td")
//	    data2.appendChild(document.createTextNode("Column2"))
	    row.appendChild(data1);
//	    row.appendChild(data2);
	    tbody.appendChild(row);
	}

    function resetTable(tableId) {
        for (var i = document.getElementById(tableId).rows.length; i > 0; i--) {
            document.getElementById(tableId).deleteRow(i - 1);
        }
    }

	function setTextWithShadow(lObject, leTexte) {
	    document.getElementById(lObject).innerHTML = leTexte;
	    document.getElementById(lObject + "S").innerHTML = leTexte;
	}

	function trim(s) {
	    var l = 0; var r = s.length - 1;
	    while (l < s.length && s[l] == ' ')
	    { l++; }
	    while (r > l && s[r] == ' ')
	    { r -= 1; }
	    return s.substring(l, r + 1);
	}

	function getExplorer() {

	    if (navigator.userAgent.indexOf("Firefox") > 0) {
	        browserName = "Firefox";
	    }
	    else if (navigator.userAgent.indexOf("Chrome") > 0) {
	        browserName = "Chrome";
	    }
	    else if (navigator.userAgent.indexOf("Safari") > 0) {
	        browserName = "Safari";
	    }
	    else {
	        browserName = "IE";
	    }

	}

