// ------------------------------------------------------------
window.name = 'page';
// ------------------------------------------------------------
var tgs = new Array( 'div','td','tr','p','h1','h2','h3','h4','h5','h6','span');
var szs = new Array( 'xx-small','x-small','small','medium','large','x-large','xx-large' );
var startSz = 1;
function ts( trgt,inc ) {
	if (!document.getElementById) return
	var d = document,cEl = null,sz = startSz,i,j,cTags;
	if(inc==0)
		sz = 2;
	else
	{
		sz += inc;
		if ( sz < 0 ) sz = 0;
		if ( sz > 6 ) sz = 6;
	}
	startSz = sz;
	if ( !( cEl = d.getElementById( trgt ) ) ) cEl = d.getElementsByTagName( trgt )[ 0 ];
	cEl.style.fontSize = szs[ sz ];
	for ( i = 0 ; i < tgs.length ; i++ ) {
		cTags = cEl.getElementsByTagName( tgs[ i ] );
		for ( j = 0 ; j < cTags.length ; j++ ) {
			cTags[ j ].style.fontSize = szs[ sz ];
		}
	}
}
// ------------------------------------------------------------
function setVolet(divId, volId) {
	for(i=1; i=i++; i++)
	{
		if(!document.getElementById(divId+'_vol_'+i))return;
		document.getElementById(divId+'_vol_'+i).className = 'vol_lst';
		if(i==volId)document.getElementById(divId+'_vol_'+i).className = 'vol_act';
		if(document.getElementById(divId+'_vol_'+i)){
			document.getElementById(divId+'_cnt_'+i).className = 'cnt_lst';
			if(i==volId)document.getElementById(divId+'_cnt_'+i).className = 'cnt_act';
		}
	}
}
// ------------------------------------------------------------
function OnlyNumber(e)
{
// if aEvent is null, means the Internet Explorer event model,
// so get window.event.
var IE5 = false;

if (!e) var e = window.event;
if (e.keyCode) { IE5= true; code = e.keyCode;}
else if (e.which) code = e.which ;

//test du code
if (code < 48 || code > 57)
{
if(IE5) e.returnValue = false;
else e.preventDefault();
}
}
// ------------------------------------------------------------
function cm_bwcheck(){
   this.ver=navigator.appVersion
   this.agent=navigator.userAgent.toLowerCase()
   this.dom=document.getElementById?1:0
   this.op5=(this.agent.indexOf("opera 5")>-1 || this.agent.indexOf("opera/5")>-1) && window.opera
   this.op6=(this.agent.indexOf("opera 6")>-1 || this.agent.indexOf("opera/6")>-1) && window.opera
   this.ie5 = (this.agent.indexOf("msie 5")>-1 && !this.op5 && !this.op6)
   this.ie55 = (this.ie5 && this.agent.indexOf("msie 5.5")>-1)
   this.ie6 = (this.agent.indexOf("msie 6")>-1 && !this.op5 && !this.op6)
   this.ie4=(this.agent.indexOf("msie")>-1 && document.all &&!this.op5 &&!this.op6 &&!this.ie5&&!this.ie6)
   this.ie = (this.ie4 || this.ie5 || this.ie6)
   this.mac=(this.agent.indexOf("mac")>-1)
   this.ns6=(this.agent.indexOf("gecko")>-1 || window.sidebar)
   this.ns4=(!this.dom && document.layers)?1:0;
   this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.op5 || this.op6)
   this.usedom= this.ns6//Use dom creation
   this.reuse = this.ie||this.usedom //Reuse layers
   this.px=this.dom&&!this.op5?"px":""
   return this
}
// ------------------------------------------------------------
function EcrireCookie(nom, 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 getCookieVal(offset)
{
	var endstr=document.cookie.indexOf (";", offset);
	if (endstr==-1) endstr=document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}
function LireCookie(nom)
{
	var arg=nom+"=";
	var alen=arg.length;
	var clen=document.cookie.length;
	var i=0;
	while (i<clen)
	{
		var j=i+alen;
		if (document.cookie.substring(i, j)==arg) return getCookieVal(j);
		i=document.cookie.indexOf(" ",i)+1;
		if (i==0) break;
	}
	return null;
}
// ------------------------------------------------------------
function EffaceCookie(nom)
{
	date=new Date;
	date.setFullYear(date.getFullYear()-1);
	EcrireCookie(nom,null,date);
}
// ------------------------------------------------------------
window.onload = function () {
	if (!LireCookie('ClickAuto')) EcrireCookie('ClickAuto', 0);
	if (LireCookie('ClickAuto')==1) {
		document.getElementById('cmdClickAuto').src='fileadmin/medias/false.gif';
	}else{
		document.getElementById('cmdClickAuto').src='fileadmin/medias/true.gif';
	}
};
// ------------------------------------------------------------
function checkClickAuto()
{
	if (LireCookie('ClickAuto')==1) {
		EcrireCookie('ClickAuto', 0);
		document.getElementById('cmdClickAuto').src='fileadmin/medias/true.gif';
	}else{
		EcrireCookie('ClickAuto', 1);
		document.getElementById('cmdClickAuto').src='fileadmin/medias/false.gif';
	}
}
// ------------------------------------------------------------

