var currentFontSize;
var defaultSizeValue = 11;
var minSizeValue = 10;
var maxSizeValue = 18;
function EcrireCookie(nom, valeur)
{
//alert ("nom: " + nom);
//alert ("valeur: " + valeur);
	var argv=EcrireCookie.arguments;
	var argc=EcrireCookie.arguments.length;
	var expires=(argc > 2) ? argv[2] : null;
	var path=(argc > 3) ? argv[3] : null;
	var domain=(argc > 4) ? argv[4] : null;
	var secure=(argc > 5) ? argv[5] : false;
	document.cookie=nom+"="+escape(valeur)+
	((expires==null) ? "" : ("; expires="+expires.toGMTString()))+
	((path==null) ? "" : ("; path="+path))+
	((domain==null) ? "" : ("; domain="+domain))+
	((secure==true) ? "; secure" : "");
}

function LireCookie(nom)
{
	var label = nom + "="
	var labelLen = label.length
	var cLen = document.cookie.length
	var i = 0
	while (i < cLen) 
	{
		var j = i + labelLen
		if (document.cookie.substring(i,j) == label) 
		{ 
			var cEnd = document.cookie.indexOf(";",j)
			if (cEnd ==     -1) 
				cEnd = document.cookie.length
			return unescape(document.cookie.substring(j,cEnd))
		}
		i++
	}
	return ""
}

function initSize()
{
//alert ("initSize");
	if (LireCookie("CosmosCurFontSize") != "")
		currentFontSize = LireCookie("CosmosCurFontSize");
	else
	{
		currentFontSize = defaultSizeValue;
		EcrireCookie("CosmosCurFontSize", currentFontSize);
	}
	document.write('<body style="font-size:'+currentFontSize+'px;" id="body">');
	setFontSize(currentFontSize);
}

function defaultTxt(){
    currentFontSize = defaultSizeValue;
    EcrireCookie("CosmosCurFontSize", currentFontSize);
    changeTxt(0);
    }
function changeTxt(sizeDifference)
{ 
    currentFontSize = parseInt(currentFontSize) + parseInt(sizeDifference);
    if(currentFontSize > maxSizeValue){
        currentFontSize = maxSizeValue;
    }else if(currentFontSize < minSizeValue){
            currentFontSize = minSizeValue;
    }
    EcrireCookie("CosmosCurFontSize", currentFontSize);
    setFontSize(currentFontSize);
};
function setFontSize(fontSize){
     var stObj = (document.getElementById) ? document.getElementById('body') :  document.all('Content');
     //alert (stObj.style.fontSize);
    if (stObj)    stObj.style.fontSize = fontSize + 'px'; 
    //alert (stObj.style.fontSize);
}; 
