function toggleAllcde ( ) {
	if(document.getElementById("divcde")) {
		var d = document.getElementById("divcde");
		var divs = d.getElementsByTagName( "div" );
		for ( var i=0; i < divs.length; i++ )
			divs[ i ].style.display = "block";
	}
}

function toggleProd (divid)
{
	var d = document.getElementById(divid);
	var divs = d.getElementsByTagName("div");
	for ( var i=0; i < divs.length; i++ )
		divs[ i ].style.display = "block";
}

function openTopWindow(urlDest, width, height, target)
{
    window.open(urlDest, target, "resizable=yes,scrollbars=yes,width=" + width + ",height=" + height + ",top=0");
}


function openWindow(urlDest, width, height, target, blankPage)
{
    var dlg;
    var name = "_blank";
    if((target!=null) && (target != ""))
        name=target;

    dlg = window.open(blankPage, name, "resizable=yes,scrollbars=yes,width=" + width + ",height=" + height);

    dlg.location=urlDest;
    dlg.opener = window;
}

function openFixedWindow(urlDest, width, height, target, blankPage)
{
    var dlg;
    var name = "_blank";
    if((target!=null) && (target != ""))
        name=target;

    dlg = window.open(blankPage, name, "resizable=no,scrollbars=no,width=" + width + ",height=" + height);
    dlg.location=urlDest;
    dlg.opener = window;
}

function openNotFixedWindow(urlDest, width, height, target, blankPage)
{
    var dlg;
    var name = "_blank";
    if((target!=null) && (target != ""))
        name=target;

    dlg = window.open(blankPage, name, "resizable=yes,scrollbars=yes,width=" + width + ",height=" + height);
    dlg.location=urlDest;
    dlg.opener = window;
}


function printFrame(frame) 
{
    if(window.print)
    {
        frame.focus();
        frame.print();
    }
    else
    {
        alert("Veuillez utiliser la commande d'impression de votre navigateur.");
    }
}

function toggleDiv(divid) {

	if (document.getElementById) 
	{
		if (document.getElementById(divid).style.display == "inline") 
		{
			document.getElementById(divid).style.display = "none";
		}
		else document.getElementById(divid).style.display = "inline";
	}
		
	else if (document.all) 
	{
		if (document.all[divid].style.display == "inline") 
		{
			document.all[divid].style.display = "none";
		}
		else document.all[divid].style.display = "inline";
	}
		
	else if (document.layers) 
	{
		if (document.layers[divid].display == "inline") 
		{
			document.layers[divid].display = "none";
		}
		else document.layers[divid].display = "inline";
	}
}



function toggleDiv2(id,flagit) {
	if (flagit=="1") {
		if (document.layers) document.layers[id].display = "inline"
		else if (document.all) document.all[id].style.display = "inline"
		else if (document.getElementById) document.getElementById(id).style.display = "inline"
	}
	else if (flagit=="0") {
		if (document.layers) document.layers[id].display = "none"
		else if (document.all) document.all[id].style.display = "none"
		else if (document.getElementById) document.getElementById(id).style.display = "none"
	}
}


var LDTabChildDivs = new Array();
var LDTabIdxDivShown = new Array();
var LDTabIsWaitingTimeout = new Array();
var LDTabIsLooping = new Array();
// Loop Div Start
function LDStart(containerDivId, loopKey, duration)
{
	LDTabIsLooping[loopKey]= true;
	if(LDTabIsWaitingTimeout[loopKey] ==false)
		LDRun(containerDivId, loopKey, duration);
}
function LDStop(loopKey)
{
	LDTabIsLooping[loopKey] = false;
}

// Loop Div Run
function LDRun(containerDivId, loopKey, duration)
{
	LDTabIsWaitingTimeout[loopKey]=false;
	if( LDTabChildDivs[loopKey] == null )
	{
		//alert('Récupération de l ensemble des divs');
		// Récupération de l'ensemble des divs
		//alert('containerDivId' + document.getElementById(containerDivId));
		LDTabChildDivs[loopKey]=document.getElementById(containerDivId).getElementsByTagName("DIV");
		LDTabIdxDivShown[loopKey]=0;
		LDTabIsLooping[loopKey]=true;
	}
	else
	{
		if(LDTabIsLooping[loopKey]==false)
			return;
		// Masquage de la div affichée
		//alert('masquage de ' + LDTabChildDivs[loopKey][LDTabIdxDivShown[loopKey]].id);
		toggleDiv(LDTabChildDivs[loopKey][LDTabIdxDivShown[loopKey]].id);
		LDTabIdxDivShown[loopKey]++;
		//alert('LDTabIdxDivShown[loopKey] = ' + LDTabIdxDivShown[loopKey] + ' - LDTabChildDivs[loopKey].length = ' +LDTabChildDivs[loopKey].length);
		if(LDTabIdxDivShown[loopKey]>=LDTabChildDivs[loopKey].length)
			LDTabIdxDivShown[loopKey]=0;
	}

	//alert('affichage de ' + LDTabChildDivs[loopKey][LDTabIdxDivShown[loopKey]].id);
	toggleDiv(LDTabChildDivs[loopKey][LDTabIdxDivShown[loopKey]].id);
	fct = "LDRun('"+containerDivId+"',"+loopKey+","+duration+")";
	//alert('fct : ' + fct);
	setTimeout(fct, duration);
	LDTabIsWaitingTimeout[loopKey]=true;
}
// verification de la validite d'une adresse email
function checkEmail( input )
{
    if ( input.value + "" == "" )
	return false;
    var reg1str = "(@.*@)|(\\.\\.)|(@\\.)|(\\.@)|(^\\.)|(\\s)";
    var reg2str = "^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$";
    var reg1 = new RegExp(reg1str);
    var reg2 = new RegExp(reg2str);
    if (reg1.test( input.value ) || !reg2.test( input.value ))
    {
	alert( "L'adresse e-mail saisie n'est pas valide" )
	input.focus()
        return false;
    }	
    return true;
}
function readCookie(name)
{
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for(var i=0;i < ca.length;i++)
    {
	var c = ca[i];
	while (c.charAt(0)==' ') c = c.substring(1,c.length);
	if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
    }
    return null;
}

function trim(val) {
	var retour = ""
	for(var i=0;i < val.length;i++)
		if(val.charAt(i) != " ") {
			retour += val.charAt(i)
		}
	return retour
}

function openIdentificationHelp() {
	window.open('http://' + document.location.host + '/portailel/jsp/layout/externalhtml.jsp?conf=ELNET_HELP_IDENTIFICATION','POPHELP','toolbar=no,location=no,directories=no,status=no,scrollbars=yes,width=440,height=400');
}

function link_e_catal(balise){
	balise.href += "S00T0299";
}