var SessionWB = (GetCookieVar ("SessionWB"));
if (SessionWB =="Ouverte") { //alert("1");
document.write("<style type='text/css'>");
document.write("#MascAff{");
document.write("   display: block;");
document.write("}");
document.write("#MascAffMasc{");
document.write("   display: none;");
document.write("}");
document.write("</style>");
}
else {
document.write("<style type='text/css'>");
document.write("#MascAff{");
document.write("   display: none;");
document.write("}");
document.write("#MascAffMasc{");
document.write("   display: block;");
document.write("}");
document.write("</style>");
}

function Left(str, n){
	if (n <= 0)
	    return "";
	else if (n > String(str).length)
	    return str;
	else
	    return String(str).substring(0,n);
}
function Right(str, n){
    if (n <= 0)
       return "";
    else if (n > String(str).length)
       return str;
    else {
       var iLen = String(str).length;
       return String(str).substring(iLen, iLen - n);
    }
}
function Remplacer(chaine, quoi, par){
i=0;k=0;r="";match=false;
while(i<chaine.length){
c=chaine.charAt(i);
if(c==quoi.charAt(k)){
	match=true;k++;
		}
		else{
			if(match==true){
				for(z=i-k; z<i; z++)
				{r=r+chaine.charAt(z);}
				}
		match=false;k=0;
			};
if(match==false){
	r=r+c;
	i++;
	}else{
		if(k==quoi.length){
		r=r+par;
		match=false;
		k=0;}
	i++;}
	}
return r;
}

function getCookieVal(offset)
{
var endstr=document.cookie.indexOf (";", offset);
if (endstr==-1) endstr=document.cookie.length;
return unescape(document.cookie.substring(offset, endstr)); 
}

//récupère la valeur du cookie
function GetCookieVar (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 "";
}

function Affiche()
{
document.getElementById("ZoneImagesSuppRight").style.display = "block";
init();
}

function Initialise(){
 NavFiches('goto', 1);
}

			function Submit(Nom){ 
			document.forms[Nom].submit();
			}

  function MsgPerso(frt,ght) {
	if (document.getElementById("Opt1b").selectedIndex == "0"){
  if (null == document.getElementById("Onglet1")){}else{
  	document.getElementById("Onglet1").style.display = "none"; document.getElementById("Onglet2").style.display = "none";
	document.getElementById("Onglet3").style.display = "none"; document.getElementById("Onglet4").style.display = "none";}
	
	document.getElementById("Text1b").disabled=true;
	ImgsOptionsSurvollees(frt,ght,"Opt1b","Emballage Cadeau");
	document.getElementById("Text1b").disabled=false;
	
	var NomFichier = document.getElementById("Text1a").value;
	var Fichier = "./MemosArticles/"+ NomFichier + ".htm";
	var str = file_get_contents(Fichier);
	var Memo0 = str.split('body {'); 
	var DebMemo =(Memo0[0]);
	var Memo1 = Memo0[1].split('/* ========== Text Styles ========== */'); 
	var DebMemo1 =(Memo1[1]);
	str = (DebMemo + '/* ========== Text Styles ========== */' + DebMemo1); //alert(str);
	
	document.getElementById("Onglet0").innerHTML = NomFichier + " :";
	document.getElementById("Content0").innerHTML = str;
	document.getElementById("TdTableConteneurDivsOnglets").style.display = "block";
	

	document.getElementById("Opt1b").focus();
	}else{document.getElementById("Text1b").focus();}
	}
