//<!--

//*** Identification du navigateur :
var ie4=document.all;
var ns6=document.getElementById&&!document.all;
fsr_browser="fsr_nn6";
if(document.all){ 
	fsr_browser = "fsr_ie";
}
if(document.layers){
	fsr_browser = "fsr_nn";
}

//*** Bouton + et - des descriptions de Modules
var idDevelopper=0;

//*** Tableau des Activation des Boutons :
var aryFctBT = new Array("DetailPosSC","ListeOPSCRC","ListeOPSCADM","Modules","Bonus","ModulesADM","BonusADM","ListeSCRqOff","ListeSCRqOn","AdmVide","AdmClie","AdmSC");
var aryNomBT = new Array("btRech","btEfface","btAccActif","btAjout","btRegul","btModules","btReleve","btRetire","btRetour","btReq","btAide");

var aryBTS = new Array();
for (var i=0; i<aryFctBT.length; i++){
	aryBTS[aryFctBT[i]] = new Array();
	for (var j=0; j< aryNomBT.length; j++){
		aryBTS[aryFctBT[i]][aryNomBT[j]]= "none";
	}
}
//*** Affectation des boutons visible par fonctions :
aryBTS["DetailPosSC"]["btRetour"]="inline";
aryBTS["DetailPosSC"]["btAide"]="inline";
aryBTS["ListeOPSCRC"]["btReleve"]="inline";
aryBTS["ListeOPSCRC"]["btRetour"]="inline";
aryBTS["ListeOPSCRC"]["btAide"]="inline";
aryBTS["ListeOPSCADM"]["btRegul"]="inline";
aryBTS["ListeOPSCADM"]["btModules"]="inline";
aryBTS["ListeOPSCADM"]["btReleve"]="inline";
aryBTS["ListeOPSCADM"]["btRetour"]="inline";
aryBTS["ListeOPSCADM"]["btAide"]="inline";
aryBTS["Modules"]["btRetour"]="inline";
aryBTS["Modules"]["btAide"]="inline";
aryBTS["Bonus"]["btRetour"]="inline";
aryBTS["Bonus"]["btAide"]="inline";
aryBTS["ModulesADM"]["btAjout"]="inline";
aryBTS["ModulesADM"]["btRetour"]="inline";
aryBTS["ModulesADM"]["btAide"]="inline";
aryBTS["BonusADM"]["btAjout"]="inline";
aryBTS["BonusADM"]["btRetour"]="inline";
aryBTS["BonusADM"]["btAide"]="inline";
aryBTS["ListeSCRqOff"]["btReq"]="inline";
aryBTS["ListeSCRqOff"]["btAide"]="inline";
aryBTS["ListeSCRqOn"]["btRech"]="inline";
aryBTS["ListeSCRqOn"]["btEfface"]="inline";
aryBTS["ListeSCRqOn"]["btReq"]="inline";
aryBTS["ListeSCRqOn"]["btAide"]="inline";
aryBTS["AdmVide"]["btRech"]="inline";
aryBTS["AdmVide"]["btAccActif"]="inline";
aryBTS["AdmVide"]["btAide"]="inline";
aryBTS["AdmClie"]["btRech"]="inline";
aryBTS["AdmClie"]["btEfface"]="inline";
aryBTS["AdmClie"]["btAjout"]="inline";
aryBTS["AdmClie"]["btAccActif"]="inline";
aryBTS["AdmClie"]["btAide"]="inline";
aryBTS["AdmSC"]["btRech"]="inline";
aryBTS["AdmSC"]["btAccActif"]="inline";
aryBTS["AdmSC"]["btEfface"]="inline";
aryBTS["AdmSC"]["btRetire"]="inline";
aryBTS["AdmSC"]["btAide"]="inline";

var bOutils;				// Affichage Bt a Outils (true par la page qui souhaite l'affichage)
var	szFctBT="ListeSCRqOff";	// Nom de la fonction Outils à afficher (avec valeur par défaut minimaliste)

function BtOutils(Action){
	// Affiche ou masque la Boite a outils, si affichage personnalisation préalable
	if(Action) PersonnaliseBT();
	xObj("ToolBox").style.visibility = (Action) ? "visible" : "hidden";
}
function PersonnaliseBT(){
	if( szFctBT=="") szFctBT="ListeSCRqOff";
	//alert(szFctBT);
	for (var valNomBT in aryBTS[szFctBT]){
		if( xObj(valNomBT) ){
			xObj(valNomBT).style.display=aryBTS[szFctBT][valNomBT];
		}
	}
}

//*** Extraction du QueryString ***
var Query = window.location.search.substr(1, window.location.search.length);
var ListeQuery = Query.split('&');
var Param = new Array();    // Pour stock. le nom des paramètres
var ValPar = new Array();    // Pour stock. la valeur des paramètres
var objParam = new Object();  // Objet pour enregistrer le nom des paramètres

for (i=0;i < ListeQuery.length;i++){
	Param[i+1] = ListeQuery[i].substring(0, ListeQuery[i].indexOf('='));
	ValPar[i+1] = unescape(ListeQuery[i].substring(ListeQuery[i].indexOf('=')+1, ListeQuery[i].length));
	objParam[Param[i+1]] = ValPar[i+1];
}

function getQueryStringByName(NomParam){
	//*** Recherche par NOM de Parametre, Valeur en retour :
	return eval("objParam." + NomParam);
}
function getQueryStringByPos(PosParam){
	//*** Recherche par POSITION de Parametre, Valeur en retour :
	return ValPar[PosParam];
}
function getParamNameByPos(PosParam){
	//*** Recherche par POSITION de Parametre, Nom en retour :
	return Param[PosParam];
}
function UpdateLeftNav(){
	//*** Mise à jour du positionnement du navigateur :
	var Mnu = getQueryStringByName("Mnu");
	var Smnu = getQueryStringByName("Smnu");

	if (Mnu=="CTA" ||Mnu=="LNK")
		document.getElementById("id" + Mnu).className = 'leftNavPElement';
	else{
		if (Mnu=="LPP"){
			if (Smnu=="LePlus" ||Smnu=="Metier"){
				document.getElementById("id" + Smnu).className = 'leftNavPElement';
			}else document.getElementById("id" + Mnu).className = 'leftNavPElement';
		}
		else if (Mnu=="RSC"){
			if (Smnu=="CriRsc" ||Smnu=="LocRsc"){
				document.getElementById("id" + Smnu).className = 'leftNavPElement';
			}else document.getElementById("id" + Mnu).className = 'leftNavPElement';
		}
		else if (Mnu=="SCC"){
			if (Smnu=="DemQual" ||Smnu=="GarSCC" ||Smnu=="LocCertif"){
				document.getElementById("id" + Smnu).className = 'leftNavPElement';
			}else document.getElementById("id" + Mnu).className = 'leftNavPElement';
		}
		else if (Mnu=="SIC"){
			if (Smnu=="Tendances" ||Smnu=="ColorAc" ||Smnu=="Echantillon" ||Smnu=="ConseilCoul" ||Smnu=="NuancierPers"){
				document.getElementById("id" + Smnu).className = 'leftNavPElement';
			}else document.getElementById("id" + Mnu).className = 'leftNavPElement';
		}
		else if (Mnu=="NRC"){
			if (Smnu=="PresPoudre" ||Smnu=="LesSupports" ||Smnu=="LesRetouches" ||Smnu=="ElemThermo" ||Smnu=="LeMontage" ||Smnu=="LeNettoyage"){
				document.getElementById("id" + Smnu).className = 'leftNavPElement';
			}else document.getElementById("id" + Mnu).className = 'leftNavPElement';
		}
		else if (Mnu=="ESC"){
			if (Smnu=="SvcInclus" ||Smnu=="LesModules" ||Smnu=="OffrePref" ||Smnu=="GroupeEtude" ||Smnu=="GuideTechnique" ||Smnu=="VosPoints" ||Smnu=="CharteGraph" ||Smnu=="GalerieImg" ||Smnu=="LettreSC" ||Smnu=="DocEvent" ||Smnu=="Admin" ||Smnu=="Gestion"){
				document.getElementById("id" + Smnu).className = 'leftNavPElement';
			}else document.getElementById("id" + Mnu).className = 'leftNavPElement';
		}
		else document.getElementById("idHOME").className = 'leftNavPElement';
	}
}
function xObj(Ref){
	// Recherche un objet html en fonction du navigateur
	var obj;
	if(ns6) obj=document.getElementById(Ref);
	else if(ie4) obj=document.all[Ref];
	return obj;
}
// Login.asp
function EstLoginValid(e){
	if (!e) var e = window.event;
	var Code = e.keyCode;
	if( Code && Code == 13){
		if(window.external&&ie4){window.external.AutoCompleteSaveForm(document.frmLogin);}
		x=document.frmLogin.submit();
	}
	return true;
}
function PourValidation(){
	if( document.frmLogin.CodeClient.value == "") document.frmLogin.CodeClient.focus();
	else document.frmLogin.btValidation.focus();
	document.onkeypress = EstLoginValid;
}
function AutoComplete(){
	if(window.external&&ie4){window.external.AutoCompleteSaveForm(document.frmLogin);}
	return false;
}
function ResetCookies(){
	var Clef = "FTFS=";
	offset = document.cookie.indexOf(Clef);
	if (offset != -1)
	{ // Si cookie :
		offset += Clef.length;
		// Index au début:
		end = document.cookie.indexOf(";", offset);
		// Index en fin:
		if (end == -1)
			end = document.cookie.length;
		document.cookie = "FTFS=412=251; path=/;"
	}
}
//*** Fin Login
function Gestion(){
	Hauteur = screen.availHeight-72;
	Largeur = screen.width-11;
	settings = "width="+Largeur+",height="+Hauteur+",top=-1,left=-1,scrollbars=yes,location=no,directories=no,status=no,menubar=yes,toolbar=yes,resizable=yes";
	wDupontGestion = window.open("/Adm/Gestion.htm", "wDupontGestion" , settings );
	wDupontGestion.focus();
}
function LitDoc(Dossier, Fichier, Ext, Acces){
	var URI=window.location.protocol + "//" + window.location.host + "/";
	location.href=URI + "LitDoc.asp?Fld=" + Dossier + "&Fic=" + Fichier + "&Ext=" + Ext + "&Acc=" + Acces;
}
function ImgOn(Img){
	var z;
	Img.src=Img.src.replace('bti','bta');
}
function ImgOff(Img){
	var z;
	Img.src=Img.src.replace('bta','bti');
}
function Rech(Cible){
	if(document.frmAdmin.NbPoints){ // Détection Bt AJout Bonus/Regularisation
		if( Cible.search(/AjouteBonus/)!=-1 ){
			if( !CtrlBonus() )
				return false;
		}
	}
	else{
		if( Cible.search(/AjouteModules/)!=-1 ){ // Détection Bt AJout Module
			if( !CtrlModules() )
				return false;
		}
	}
	document.frmAdmin.action = document.frmAdmin.action + "?" + Cible;
	if(window.external&&ie4){window.external.AutoCompleteSaveForm(document.frmAdmin);}
	document.frmAdmin.URLProvenance.value=window.location.href;
	document.frmAdmin.submit();
	return true;
}
function CtrlBonus(){
	if(document.frmAdmin.NbPoints){
		if( isNaN(document.frmAdmin.NbPoints.value)|| (document.frmAdmin.NbPoints.value.length==0)){
			alert( "Vous devez saisir une valeur num\351rique pour les nombre de Points");
			document.frmAdmin.NbPoints.focus();
			document.frmAdmin.NbPoints.select();
			return false;
		}
		if( document.frmAdmin.LibBonus.value.length==0 ){
			alert( "Vous devez saisir une description.");
			document.frmAdmin.LibBonus.focus();
			return false;
		}
	}
	var szMessage="Vous allez ajouter :\n\t" + document.frmAdmin.NbPoints.value + " Points de Régularisation" + "\t\t \n";
		szMessage += "\navec pour mention : \n\t" + document.frmAdmin.LibBonus.value;
	if( confirm( szMessage ) ){
		return true;
	}
	return false;
}
function CtrlModules(){
	var i=1, j=0;
	var szMessage="Vous allez ajouter les modules suivants :\n";
	
	while( document.frmAdmin["cbSC"+i] ){
		if( document.frmAdmin["cbSC"+i].checked ){
			j += 1;
			if( xObj("spnMOD"+i) )
				szMessage += "\t. " + xObj("spnMOD"+i).innerHTML + "\t \n";
		}
		i += 1;
	}
	if( j==0 ){
		alert("Vous devez cocher au moins un Module.");
	}else{
		if( confirm( szMessage+"\n" ) ){
			return true;
		}
	}
	return false;
}
function PgX(Page){
	// Chargeur Page PopUp :
	Hauteur = screen.availHeight-72;
	Largeur = 480;
	settings = "width="+Largeur+",height="+Hauteur+",top=-1,left=-1,scrollbars=auto,location=no,directories=no,status=no,menubar=yes,toolbar=no,resizable=yes";
	wDuPontAide = window.open(Page, "wDuPontAide" , settings );
	wDuPontAide.focus();
}
function SelectAll(){
	var i=1;
	while( document.frmAdmin["cbSC"+i] ){
		document.frmAdmin["cbSC"+i].checked = (document.frmAdmin.cbALL.checked) ? true:false;
		i=i+1;
	}
}
function Developper(obj){
	if( idDevelopper==obj ){
		// Condenser CE texte deja etendu :
		xObj("spnDESC"+obj).className="SousDescModule";
		xObj("btPlus"+obj).src="/Img/btPlus.gif";
		xObj("btPlus"+obj).title="Développer";
		idDevelopper=0;
		return;
	}
	if( idDevelopper!=0 ){
		// Condenser un ancien texte etendu :
		xObj("spnDESC"+idDevelopper).className="SousDescModule";
		xObj("btPlus"+idDevelopper).src="/Img/btPlus.gif";
		xObj("btPlus"+obj).title="Développer";
	}
	// Developper le texte :
	xObj("spnDESC"+obj).className="SousDescModuleExpand";
	xObj("btPlus"+obj).src="/Img/btMoins.gif";
		xObj("btPlus"+obj).title="Condenser";
	idDevelopper=obj;
}
//-->

