pointe=0;
initOk=false;
function entete1() 
	{
	browser = navigator.appName;
	version = navigator.appVersion;
	os = navigator.platform;
	ie = "Microsoft Internet Explorer";
	nn = "Netscape";
	document.write('<link rel="stylesheet" type="text/css" href="css/ie.css" title="style">');
	}
function redimensionne()
	{
	var dimhb=screen.availHeight - 180;
	if (dimhb > 800)
		{
		dimhb=800;
		}
	if (dimhb < 550)
		{
		dimhb=550;
		}
	var dimhc=dimhb - 162;
	document.getElementById('bandeau').style.height=dimhb + "px";
	document.getElementById('cadre').style.height=dimhc + "px";
	initOk=true;
	}
function controlesaisie(champ)
	{
	para=document.forms.recherches.rechs.value;
	if (para.length <2)
		{
		alert("le contenu de " + champ + " doit comporter au moins 2 caractères");
		}
	else
		{
		document.getElementById('recherches').submit();
		}
	}

function verifid()
	{
	ret=true;
	formulaire=document.getElementById('identification');
	if (formulaire.login.value.length < 4)
		{
		alert("Votre identifiant doit comporter au moins 4 caractères");
		ret=false;
		}
	if (formulaire.pass.value.length < 6)
		{
		alert("Votre mot de passe doit comporter au moins 6 caractères");
		ret=false;
		}
	if (formulaire.pass.value != formulaire.confpass.value)
		{
		alert("Mot de passe différent de sa confirmation");
		ret=false;
		}
	return ret;
	}

function clignote1(idelement) 
{
para="clignote2('" + idelement + "')";
//if (pointe==8)
//	{
//	document.getElementById(idelement).style.color="FF0000";
//	}
//else
//	{
	document.getElementById(idelement).style.visibility="hidden";
//	}
setTimeout(para,500);
}

function clignote2(idelement) 
{
para="clignote1('" + idelement + "')";
//if (pointe==8)
//	{
//	document.getElementById(idelement).style.color="FF0000";
//	}
//else
//	{
	document.getElementById(idelement).style.visibility="visible";
//	}
setTimeout(para,500);
}

function clignote(idelement) 
{
para="clignote1('" + idelement + "')";
setTimeout(para,500);
}

function ouvre(aurl) 
	{
	window.open(aurl,'fenetre','resizable=no, location=no, width=480, height=348, top=10,left=10, status=no, scrollbars=no, menubar=yes');
	}
function ouvrelien(aurl) 
	{
	window.open(aurl,'fenetrelien','resizable=yes, location=no, width=800, height=450, top=10,left=10, status=no, scrollbars=yes, menubar=no');
	}

function controleformulaire(controle,nom,mess)
{
if (document.getElementById(controle).value)
	{
	return (true);
	}
else
	{
	alert(mess + ' ' + nom );
	document.getElementById(controle).focus();
	return (false);
	}
}

function controleliste()
{
/*1er argument texte boite dialogue, n id du champ, n+1 texte du champ  n>=1*/
brk=false;
args=controleliste.arguments;
for(i=1; i<args.length; i+=2)
	{
	if (!controleformulaire(args[i],args[i+1],args[0]))
		{
		i=args.length;
		brk=true;
		}
	}
if (brk)
	{
	return (false);
	}
else
	{
	return (true);
	}
}

function mefmessage(idformulaire)
{
formulaire=document.getElementById(idformulaire);
texte='';
rl=unescape("%0D");
for (i=0;i<formulaire.length;i++)
	{
	if ((formulaire.elements[i].type!='hidden')&&(formulaire.elements[i].type!='submit')&&(formulaire.elements[i].type!='button'))
		{
		texte +=formulaire.elements[i].name + ': ' + formulaire.elements[i].value + rl;
		}
	}
return (texte);
}

function controlenombrentier(vari,avert)
{
a=parseInt(vari);
//alert(a);
if (isNaN(a))
	{
	alert (avert);
	return (false);
	}
else
	{
	return (true);
	}
}

function controletype(vari,avert)
{
a=1;
a=1*vari;
if (!a)
	{
	alert (avert);
	return (false);
	}
else
	{
	return (true);
	}
}

function datelocalesql() 
	{
	dtsql=new Date();
	ansql=dtsql.getFullYear();
	mosql=dtsql.getMonth()+1;
	jmsql=dtsql.getDate();
	datesql= ansql + "-" + mosql + "-" + jmsql;
	return (datesql);
	}

function controlecb(d,mess)
{
if ((d.pays.value!=1)&&(d.reglement.value==1))
	{
	d.reglement.value='';
	d.selectreglement.value='';
	alert(mess);
	return (false);
	}
else
	{
	return (true);
	}
}


function controlenombrentier(vari,avert)
{
a=parseInt(vari);
//alert(a);
if (isNaN(a))
	{
	alert (avert);
	return (false);
	}
else
	{
	return (true);
	}
}
//******************************* menu déroulant *************************************************
vu=new Array(2);
idaefface='';
listesousmenus=';';
listeefface='';
menuidcourant='';
menuidcourantold='';
function affichesmenu(n,coordx,coordy,hauteur,largeur,repx,repy)
	{
	if ((idaefface)&&(idaefface!=n))
		{
		cachesmenu(idaefface);
		}
	ns=n.split(';');
	for (var i=0;i<ns.length;i++)
		{
		if (ns[i].replace(/no.*/g,''))
			{
			var obj;
			obj=document.getElementById(ns[i]);
			obj.style.visibility='visible';
			obj.style.left=repx + coordx   + largeur + 'px';
			obj.style.top=repy +coordy + 'px';
//document.test.visu.value=obj.style.left + ';' +obj.style.top + ' x=' +coordx+ ' y=' +coordy;
			}
		afficheslistemenu(ns[i]);
		}
	idaefface=n;
	}

function cachesmenu(n)
	{
	ns=n.split(';');
	for (var i=0;i<ns.length;i++)
		{
		var obj;
		if (ns[i].replace(/no.*/g,''))
			{
			obj=document.getElementById(ns[i]);
			obj.style.visibility='hidden';
			tempn='s'+ns[i];
			}
		else
			{
			tempn=ns[i];
			}
		var tempobj;
		tempobj=document.getElementById(tempn);
		if(tempobj)
			{
			tempobj.style.background=fondsousmenu;
			}
		}
	}

function liste(menuid)
{
tempmenuid=new RegExp('.*' + menuid + ';',"g");
tempef=listesousmenus.replace(tempmenuid,'');
if (tempef) 				// menuid n'est pas en fin de liste
	{
	if(tempef==listesousmenus)		// menuid inexistant dans liste sous menus
		{
		listesousmenus += menuid + ';'; 
		}
	else				// retour arrière
		{
		listeefface=';'+tempef;
		}
	}
}


function afficheslistemenu(n)
{
if (listesousmenus != ';')
	{
	listes=listesousmenus.split(";");
	for (var i=0;i<listes.length;i++)
		{
		if(listes[i])
			{
			var obj;
			obj=document.getElementById(listes[i]);
			obj.style.visibility='visible';
			tempn='s'+listes[i];
			var tempobj;
			tempobj=document.getElementById(tempn);
			if(tempobj )
				{
				tempobj.style.background=fondbarreselmenu;
				}
			}
		}
	}
if (listeefface != ';' && listeefface)
	{
	temp=listeefface.replace(/;([^;]+).*/,'$1');
	if(temp==n)
		{
		listeefface=listeefface.replace(';' + n +';',';');
		listesousmenus=listesousmenus.replace(';' + n +';',';');
		}
	listefs=listeefface.split(";");
	for (var i=0;i<listefs.length;i++)
		{
		if(listefs[i])
			{
			var obj;
			obj=document.getElementById(listefs[i]);
			obj.style.visibility='hidden';
			tmpn='s'+listefs[i];	
			var tmpobj;
			tmpobj=document.getElementById(tmpn);
			if(tmpobj)
				{
				tmpobj.style.background=fondsousmenu;
				}
			}
		}
	}
}

function masquelistemenu()
{
if (idaefface)
	{
	cachesmenu(idaefface);
	}
listeefface=listesousmenus;
if (listeefface != ';' && listeefface)
	{
	listefs=listeefface.split(";");
	for (var i=0;i<listefs.length;i++)
		{
		if(listefs[i])
			{
			var obj;
			obj=document.getElementById(listefs[i]);
			obj.style.visibility='hidden';
			tpn='s'+listefs[i];
			var tpobj;
			tpobj=document.getElementById(tpn);
			if(tpobj)
				{
				tpobj.style.background=fondsousmenu;
				}
			}
		}
	}
listeefface=';';
listesousmenus=';';
if (menuidcourant)
	{
	document.getElementById(menuidcourant).style.background=fondbarremenu;
	}
if (menuidcourantold)
	{
	document.getElementById(menuidcourantold).style.background=fondbarremenu;
	}
menuidcourantold=menuidcourant;
}

function masquesmenu(n)
{
var obj;
obj=document.getElementById(n);
//zoomm(n,'0px');
//if (vu[n]=='non')
	//{
	obj.style.visibility='hidden';
	//}
}

h=0;
function zoomp(n,hauteur,unit)
{
var obj;
obj=document.getElementById(n);
obj.style.height=hauteur+unit;
/*setTimeout("zoomp('"+n+"','300px')",350);*/
//alert (hauteur);
}

function zoomm(n,hauteur)
{
var obj;
obj=document.getElementById(n);
obj.style.height=hauteur;
h=0;
}

vareffetallonge=0;
function effetallonge(image,lgmax)
	{
	if ((vareffetallonge < lgmax)&&(vareffetallonge > 0))
		{
		vareffetallonge +=15;
		setTimeout("effetallonge(" + image + ",330)",5);
		}
	if (vareffetallonge > lgmax)
		{
		vareffetallonge =lgmax;
		}
	document.getElementById(image).style.height=vareffetallonge +'px';
	}
function effetaffiche(objet)
	{
	document.getElementById(objet).style.visibility='visible';
	vareffetallonge =1;
	effetallonge(objet,330);
	}
function effetmasque(objet)
	{
	document.getElementById(objet).style.visibility='hidden';
	vareffetallonge=0;
	}

//******************************* arborescence *************************************************
verrou=0;
function transfo(celid,idtabsuiv,menu)
	{
	if (!document.getElementById(celid).name && !verrou) 
		{
		//alert(celid +' ' +idtabsuiv);
		mec=document.getElementById(idtabsuiv).innerHTML.replace(/<TBODY>/g,'');
		mec=mec.replace(/=polarbre/g,'=\"polarbre\"');
		mec=mec.replace(/=sbr([0-9]+)/g,'=\"sbr$1\"');
		mec=mec.replace(/<tbody>/g,'');
		mec=mec.replace(/<\/TBODY>/g,'');
		mec=mec.replace(/<\/tbody>/g,'');
		mec=mec.replace(/<TR/g,'<tr');
		mec=mec.replace(/<TD/g,'<td');
		mec=mec.replace(/<\/TR/g,'</tr');
		mec=mec.replace(/<\/TD/g,'</td');
		mec=mec.replace(/id=\"sbr/g,'id=\"ssbr');
		menu=menu.replace(/\"/g,'&quot;');
		menu=menu.replace(/\'/g,'&rsquo;');

		tmpaction='onmouseover=\"verrou=0\" onclick=\"remet(\'' + celid + '\',\'' + menu + '\')\"';

		tmpcont ='<table style=\"background-color:' + fondbarreselmenubr + ';border:1px solid #CCCCCC; width:100%\">\n';
		tmpcont +='<tr><td class=\"polarbre\" ' + tmpaction + ' bgcolor=\"' + fondbarreselmenubr + '\">\n' + menu + '</td></tr>\n' + mec + '\n</table>\n';

		document.getElementById(celid).innerHTML=tmpcont;
		document.getElementById(celid).bgcolor='transparent';
		document.getElementById(celid).name='dev' + celid;
		verrou=1;
		}
	}
function remet(celid,menu)
	{
	//alert(document.getElementById(celid).bgcolor);
	document.getElementById(celid).bgcolor=fondsousmenubr;
	document.getElementById(celid).innerHTML =menu;
	document.getElementById(celid).name='';
	}

function enrcontexte(tableau)
	{
	return document.getElementById(tableau).innerHTML;
	}

function effetelargi(objet,lgmax)
	{
	vareffetelargi=document.getElementById(objet).style.width;
	vareffetelargi=parseInt(vareffetelargi.replace(/px/g,''));
	if ((vareffetelargi < lgmax)&&(vareffetelargi >= 0))
		{
		vareffetelargi +=15;
		churl="effetelargi(\'"+ objet + "\'," + lgmax + ")";
		setTimeout(churl,5);
		}
	if (vareffetelargi > lgmax)
		{
		vareffetelargi =lgmax;
		}
	document.getElementById(objet).style.width=vareffetelargi +'px';
	}