	/*
	*Date:2006-03-15
	*Bug:Qd on agrandit le texte, l'espace inter-ligne ne change pas,
	*ce qui fait que le texte se tasse
	*Modif:ajouter une var tableau arlineHeightSize au meme titre que arFontSize
	*changer aussi style.lineHeight qd on change la taille du texte (ligne 31)
	*/
	var arFontSize = new Array( 'xx-small','x-small','small','medium','large','x-large','xx-large' );
	var arlineHeightSize = new Array( '10px','14px','16px','20px','24px','32px','40px' );
	var startSize = -1;
	
	//var tags = new Array( 'div','td','tr', 'a', 'span', 'h1', 'h2', 'p', 'li', 'strong', 'em', 'i', 'b');
	var tags = new Array( 'div','td','tr', 'th', 'a', 'span', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'li', 'i', 'b');

	function initTextSize( target, cookieSize ) {
		if (!document.getElementById) return
		
		var d = document,cEl = null,i,j,cTags;
		if ( !( cEl = d.getElementById( target ) ) ) cEl = d.getElementsByTagName( target )[ 0 ];
		
		//alert("cookieSize = " + cookieSize);
		
		if ( d.getElementById( target ) ) {
						
			elt = d.getElementById( target ).style.fontSize;
			
			if (!(elt == "")) {
				tmp = (elt).substr(0,(elt).length-2);
				tmp = parseInt(tmp) + parseInt(cookieSize);		
				d.getElementById( target ).style.fontSize = tmp + "px";
				d.getElementById( target ).style.lineHeight = tmp + 5 + "px";
			}	else {
				//alert("elt = vide !!");
				tmp = 12 + parseInt(cookieSize);
				d.getElementById( target ).style.fontSize =  tmp + 'px'; //arFontSize[ size ];
				d.getElementById( target ).style.lineHeight = tmp + 5 + 'px';
			}

			//alert("content = " + d.getElementById( target ).style.fontSize);
			
			for ( i = 0 ; i < tags.length ; i++ ) {
			cTags = cEl.getElementsByTagName( tags[ i ] );			
			for ( j = 0 ; j < cTags.length ; j++ ){
			//alert("TEST = " + cTags[ j ].innerHTML);
					
				elt = cTags[ j ].style.fontSize;
				if (!(elt == "")) {
					tmp = (cTags[ j ].style.fontSize).substr(0,(cTags[ j ].style.fontSize).length-2);
					//alert("TEST tmp + cookieSize + inc = " + tmp + " // " + cookieSize + " // " + inc);
					tmp = parseInt(tmp) + parseInt(cookieSize);
					if (tmp > 0) {
						//alert(parseInt(inc) + " = " + tmp  + "    // style = " + cTags[ j ].style.fontSize);
						cTags[ j ].style.fontSize = tmp + 'px'; //arFontSize[ size ];
					 	cTags[ j ].style.lineHeight = tmp + 5 + 'px';
					}
				}	else {
					//alert("TEST tmp + incrementation = " + tmp + " // " + incrementation);
					tmp = 12 + parseInt(cookieSize);
					//alert("elt = vide !! // TMP = " + tmp);
					cTags[ j ].style.fontSize =  tmp + 'px'; //arFontSize[ size ];
					cTags[ j ].style.lineHeight = tmp + 5 + 'px';
				}			 
			}
		}
			
		}
	}	
	
	function changeTextSize( target,inc ) {
		if (!document.getElementById) return
		
		var d = document,cEl = null,i,j,cTags;
		
		if ( !( cEl = d.getElementById( target ) ) ) cEl = d.getElementsByTagName( target )[ 0 ];
		
		cookieSize = parseInt(cookieTextSize.fontSize);
		incrementation = cookieSize + parseInt(inc);
		
		//alert("incrementation = " + incrementation);
		if ( incrementation > -2 && incrementation < 10 ) {
			cookieTextSize.fontSize = "" + incrementation;
			cookieTextSize.store();
	
			for ( i = 0 ; i < tags.length ; i++ ) {
				cTags = cEl.getElementsByTagName( tags[ i ] );			
				for ( j = 0 ; j < cTags.length ; j++ ){
				//alert("TEST = " + cTags[ j ].innerHTML);
						
					elt = cTags[ j ].style.fontSize;
					if (!(elt == "")) {
						tmp = (cTags[ j ].style.fontSize).substr(0,(cTags[ j ].style.fontSize).length-2);
						//alert("TEST tmp + cookieSize + inc = " + tmp + " // " + cookieSize + " // " + inc);
						tmp = parseInt(tmp) + inc;
						if (tmp > 0) {
							//alert(parseInt(inc) + " = " + tmp  + "    // style = " + cTags[ j ].style.fontSize);
							cTags[ j ].style.fontSize = tmp + 'px'; //arFontSize[ size ];
						 	cTags[ j ].style.lineHeight = tmp + 5 + 'px';
						}
					}	else {
						//alert("TEST tmp + incrementation = " + tmp + " // " + incrementation);
						tmp = 12 + inc;
						//alert("elt = vide !! // TMP = " + tmp);
						cTags[ j ].style.fontSize =  tmp + 'px'; //arFontSize[ size ];
						cTags[ j ].style.lineHeight = tmp + 5 + 'px';
					}			 
				}
			}
		}
		

	}	
	
	function changeTextSize___( target,inc ) {
		if (!document.getElementById) return
			var d = document,cEl = null,size = startSize,i,j,cTags;
			size += inc;
		if ( size < 0 ) size = 0;
		if ( size > 6 ) size = 6;
		startSize = size;
		cookieTextSize.fontSize = startSize;
		//alert("new size=" + startSize);
		cookieTextSize.store();
			if ( !( cEl = d.getElementById( target ) ) ) cEl = d.getElementsByTagName( target )[ 0 ];
		
		cEl.style.fontSize = arFontSize[ size ];
	
		for ( i = 0 ; i < tags.length ; i++ ) {
			cTags = cEl.getElementsByTagName( tags[ i ] );			
			for ( j = 0 ; j < cTags.length ; j++ ){
				 cTags[ j ].style.fontSize = arFontSize[ size ];
				 //Changer aussi l'interligne
				 cTags[ j ].style.lineHeight = arlineHeightSize[ size];
			} 
		}
	}	

var cookieTextSize=null;
function setTextSize(){
cookieTextSize = new Cookie(document, "lasik_text_size", 720, "/"); //30 days validity
cookieTextSize.load();
if (!cookieTextSize.fontSize){
	//alert(1);
	cookieTextSize.fontSize = 1;
	cookieTextSize.store();
	cookieSize = 0;
	//alert("STORE 1 =" + cookieTextSize.fontSize);
}else{
	//alert(cookieTextSize.fontSize);
	cookieSize = parseInt(cookieTextSize.fontSize); 	
	//alert("STARTSIZE =" + startSize);
}
initTextSize('content',cookieSize);
//changeTextSize('content',startSize);
}	