
var ns4 = (navigator.appName == 'Netscape' && parseInt(navigator.appVersion) == 4);
var ns6 = (document.getElementById)? true:false;
var ie4 = (document.all)? true:false;
var ie5 = false;

if (ie4)
{
	if ((navigator.userAgent.indexOf('MSIE 5') > 0) || (navigator.userAgent.indexOf('MSIE 6') > 0))
	{
		ie5 = true;
	}
	if (ns6)
	{
		ns6 = false;
	}
}

function cache_popup(nom_popup)
{
	popup = document.getElementById(nom_popup);
	if (ns4) popup.visibility = "hide";
	else popup.style.visibility = "hidden";
}

function affiche_popup(nom_popup)
{
	popup = document.getElementById(nom_popup);
	if (ns4) popup.visibility = "visible";
	else popup.style.visibility = "visible";
//	deroule_popup(nom_popup);
}

function deroule_popup(nom_popup)
{
	popup = document.getElementById(nom_popup);
	popup.style.right="-350";
	scroll_popup("-100",nom_popup);
}

function scroll_popup(Y,nom_popup)
{	
	//var toto=nom_popup;
	window.scrollTo(0,0);
	if ( Y!=2 )
	{	
		Ypos=Y;
		
		popup = document.getElementById(nom_popup);
		popup.style.right=Ypos;
		
		Ypos=parseInt(Ypos)+2;
		//tim=window.setTimeout('scroll_popup(Ypos,nom_popup)',5);

		tim=window.setTimeout(function() { scroll_popup(Ypos,nom_popup); }, 5);

	}
	else
	{
		window.clearTimeout(tim);
	}
}

function recupValeurURL(chaine)
{
	var adres=self.parent.location;

	URL=adres.toString();
	resURL=URL.split('?');
	
	var vTEST=eval("/"+chaine+"=/");
	resTEST=vTEST.test(resURL);

	if ( resTEST )
	{
		resURLbis=resURL[1].split("&");
		//resURLbis=resURL[1].split("%26");

		for ( i=0 ; i<resURLbis.length ; i++ )
		{	
			var vTEST=eval("/"+chaine+"=/");
			resTEST=vTEST.test( resURLbis[i] );

			if ( resTEST)
			{
				var res=resURLbis[i].split("=");
			}
		}

		return res[1];
	}
}

function affecter_param(url,parm) {
	var valeur=recupValeurURL(parm);
	var toto=url+"?"+parm+"="+valeur;
	self.parent.location=toto;
}

function display_html(txt,var_div)
{
	document.getElementById(var_div).innerHTML=txt;
	affiche_popup(var_div);

}

function display_xml()
{
	
}

function display_alert(txt,var_div)
{
	cache_popup(var_div)
	alert(txt);
}


function open_popup(nom_popup)
{
	 popup = document.getElementById(nom_popup);
	popup.style.visibility = "visible";
}

function close_popup(nom_popup)
{
	popup = document.getElementById(nom_popup);
	popup.style.visibility = "hidden";
}

function getElemRefs(id) {
	var el = (document.getElementById)? document.getElementById(id): (document.all)? document.all[id]: (document.layers)? document.layers[id]: null;
	if (el) el.css = (el.style)? el.style: el;
	return el;
}

function showLayer(id) {
	var lyr = getElemRefs(id);
	if (lyr && lyr.css) lyr.css.visibility = "visible";
}

function hideLayer(id) {
//alert(id);
	var lyr = getElemRefs(id);
	if (lyr && lyr.css) lyr.css.visibility = "hidden";
}

function displayLayer(id) {
	var lyr = getElemRefs(id);
	if (lyr && lyr.css) lyr.css.display = "block";
}

function dontDisplayLayer(id) {
	var lyr = getElemRefs(id);
	if (lyr && lyr.css) lyr.css.display = "none";
}

function toggleDisplayLayer(id) {
	var lyr = getElemRefs(id);
	if (lyr.css.display == "none") {
		displayLayer(id);
	}
	else {
		dontDisplayLayer(id);
	}
}

function displayOnglet(id) {
	var lyr = getElemRefs(id);
	if (lyr && lyr.css) lyr.css.display = "block";
}

function dontDisplayOnglet(id) {
	var lyr = getElemRefs(id);
	if (lyr && lyr.css) lyr.css.display = "none";
}

function toggleDisplayOnglet(id) {
	var lyr = getElemRefs(id);
	if (lyr.css.display == "none") {
		displayOnglet(id);
	}
	else {
		dontDisplayOnglet(id);
	}
}
