<!--

// prepare cookies for getter and setter
document.cookies=document.cookie.split(";")

function trim(s) 
{
	if (typeof(s)=="string") {
		var i=0;
		var j=s.length-1;		
	
		while ((i<j) && (s.charAt(i)==" ")) i++;
		while ((j>=i) && (s.charAt(j)==" ")) j--;
		return s.substring(i,j+1);
	}
}

function getCookie(n) 
{
	var cookie;

	if (document.cookies) {
		for (var i=0; i<document.cookies.length; i++) {
			cookie=document.cookies[i].split("=");
			if ((cookie.length=2) && (trim(cookie[0].toUpperCase())==n.toUpperCase())) {
				return trim(cookie[1]);
			}
		}
	}
	return "";
}

function setCookie(n,v)	
{
	if (n.length>0) document.cookie=n+"="+v+";";
}

function setStyleSheet(csshref) 
{
	document.getElementById('styleSheet').href=csshref;
	setCookie("css",csshref);
}

function styleSheetString() {
	if (document.getElementById && document.getElementById('styleSheet').href.indexOf("large")>0)
		return "<div id=\"menu\">Trop gros ?  <a href=\"#\" onClick=\"setStyleSheet(location.href.substring(0,location.href.lastIndexOf('/'))+'/econnex.css'); updateStyleSheetMenu();\">De plus petits caractères</a> sont disponibles</div>";
	else
		return "<div id=\"menu\">Trop petit ?  <a href=\"#\" onClick=\"setStyleSheet(location.href.substring(0,location.href.lastIndexOf('/'))+'/econnex-large.css'); updateStyleSheetMenu();\">De plus gros caractères</a> sont disponibles</div>";
}

function styleSheetMenu() {
	document.write(styleSheetString());
}

function updateStyleSheetMenu() {
	if (document.getElementById) document.getElementById("menu").innerHTML=styleSheetString();
}


// set css according to cookie
var css=getCookie("css");
if (css.length>0) setStyleSheet(css);

//-->
