<!--
wF=new Array();
var wFC = 1;
var wLN = 1;
var sSourcePage="perso_work.asp?Mode=LessonList";
//------------ open win
function popupFlash(Url,mode) {
	var winname = "";
	if (mode == "lesson") {
		winname="l"+wLN; wLN++;
	} else {
		if ((wFC > 1) && (! wF[1].closed)) {
			alert("Une fenêtre du Code de la Route est déjà ouverte.\nVous devez d'abord la quitter par le bouton 'RETOUR'\navant d'ouvrir une nouvelle fenêtre");
		} else {
			wFC = 1;
			winname+=wFC; wFC++;
		}
	}
	if (winname != "") {
		popupFullScreen(Url,winname,winname);
	}
}
function popupWindow(curURL,curName,iWidth,iheight,iTop,iLeft,bToolbar,bLocation,bStatus,bMenubar,bScrollbars,bResizable,bFullscreen,wC)
{	
	curFeatures='width='+iWidth+',height='+iheight+',top='+iTop+',left='+iLeft;
	curFeatures+=',toolbar='+bToolbar+',location='+bLocation+',status='+bStatus;
	curFeatures+=',menubar='+bMenubar+',scrollbars='+bScrollbars+',resizable='+bResizable+',fullscreen='+bFullscreen;
	wF[wC]=window.open(curURL,curName,curFeatures);
}
function popupFullScreen(newUrl,Title,wC)
{
  CheckBrowser();
  if (Browser == IE)
    wF[wC] = window.open(newUrl, Title, "theatremode=yes,scrollbars=yes,location="+dbgModeWin+",menubar="+dbgModeWin);
  else
    wF[wC] = window.open(newUrl, Title, "left=0,top=0,width=" + top.screen.width + ",height=" + top.screen.height + ",scrollbars=yes"+",location="+dbgModeWin+",menubar="+dbgModeWin+",resizable="+dbgModeWin);
}
//--------------- links
function submitLink(mode,Num,str) {
	if (mode == "gotoLessonList") {
		with (top.frames["main"]) {
			location.href = "perso_work.asp?Mode=LessonList";
		}
	} else if (mode == "gotoLessonFlash") {
		with (top.frames["main"]) {
			location.href = "perso_work.asp?Mode=LessonFlash&NbX="+Num;
		}
		with (top.frames["nothing"]) {
			location.href = "perso_work.asp?Mode=LessonUpdate&NbX="+Num;
		}
	} else if (mode == "gotoLessonUpdate") {
		with (top.frames["nothing"]) {
			location.href = "perso_work.asp?Mode=LessonUpdate&NbX="+Num;
		}
	} else if (mode == "gotoExamList") {
		with (top.frames["main"]) {
			location.href = "perso_work.asp?Mode=ExamList";
		}
	} else if (mode == "gotoTestFlash") {
		if (0) {
			//with (top.opener.frames["main"]) {
			with (top.opener) {
				popupFlash("perso_test.asp?Mode=Window&SubMode=Test&NbX="+Num,"");
			}
		} else {
			with (top.frames["main"]) {
				location.href = "perso_work.asp?Mode=TestFlash&NbX="+Num;
			}
		}
	} else if (mode == "gotoExamFlash") {
		with (top.frames["main"]) {
			location.href = "perso_work.asp?Mode=ExamFlash&NbX="+Num;
		}
	} else if (mode == "gotoExamQuestions") {
		with (top.frames["nothing"]) {
			location.href = "perso_work.asp?Mode=ExamQuestions&NbX="+Num;
		}
	} else if (mode == "gotoTestExamCorrection") {
		with (top.frames["nothing"]) {
			document.FCdr.action = "perso_work.asp";
			document.FCdr.submit();
		}
	} else if (mode == "gotoTLibreQuestion") {
		with (top.frames["nothing"]) {
			location.href = "perso_work.asp?Mode=TLibreQuestion&CodeRubList="+top.frames["main"].gCodeRubList;
		}
	} else if (mode == "gotoTLibreUpdate") {
		with (top.frames["nothing"]) {
			location.href = "perso_work.asp?Mode=TLibreUpdate&NbX="+str;
		}
	} else if (mode == "gotoTLibreCorrection") {
		with (top.frames["nothing"]) {
			document.FCdr.action = "perso_work.asp";
			document.FCdr.submit();
		}
	} else if (mode == "exitWindowFlash") {
		with (top.frames["main"]) { location.href=sSourcePage;}
	} else {
		// mode invalide
	}
}
function submitForm(mode) {
	if (mode == "gotoExamCorrection") {
		with (top.frames["nothing"]) {
			document.FCdr.action = "perso_work.asp";
		}
		return(true);
	} else if (mode == "gotoTLibreQuestion") {
		with (top.frames["nothing"]) {
			document.FCdr.action = "perso_work.asp";
		}
		return(true);
	} else if (mode == "gotoTLibreRubriques") {
		submitLink("gotoTLibreQuestion",0,"");
		return(false);
	} else {
		// mode invalide
	}
	return(false);
}
//--------------- cookies
function getCookieVal(offset) {
	var endstr = document.cookie.indexOf(";",offset);
	if (endstr == -1) { endstr = document.cookie.length; }
	return unescape(document.cookie.substring(offset,endstr));
}
function GetCookie(name) {
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	var j;
	while (i < clen) {
		j = i + alen;
		if (document.cookie.substring(i,j) == arg) {
			return getCookieVal(j);
		}
		i = document.cookie.indexOf(" ",i) + 1;
		if (i == 0) break;
	}
	return null;
}
function getElementVal(str,offset) {
	var endstr1 = str.indexOf(";",offset);
	if (endstr1 == -1) { endstr1 = str.length; }
	var endstr2 = str.indexOf("&",offset);
	if (endstr2 == -1) { endstr2 = str.length; }
	var endstr = (endstr1 < endstr2 ? endstr1 : endstr2);
	return unescape(str.substring(offset,endstr));
}
function GetCookieElement(groupName,elementName) {
	var str = GetCookie(groupName);
	var arg = elementName + "=";
	var alen = arg.length;
	var clen = str.length;
	var i = 0;
	var j;
	while (i < clen) {
		j = i + alen;
		if (str.substring(i,j) == arg) {
			return getElementVal(str,j);
		}
		i = str.indexOf("&",i) + 1;
		if (i == 0) break;
	}
	return null;
}
function DeleteCookie(name,path,domain) {
	if (GetCookie(name)) {
		document.cookie = name + "=" +
			((path) ? "; path=" + path : "") +
			((domain) ? "; domain=" + domain : "") +
			"; expires=Thu, 01-Jan-70 00:00:01 GMT";
	}
}
function SetCookie(name,value,expires,path,domain,secure) {
	document.cookie = name + "=" + escape(value) +
		((expires) ? "; expires=" + expires.toGMTString() : "") +
		((path) ? "; path=" + path : "") +
		((domain) ? "; domain=" + domain : "") + 
		((secure) ? "; secure" : "");
}
function checkCookiesEnabled() {
	var strCookie = "Enabled=true"
	document.cookie = strCookie;
	var cookieValid = document.cookie;
	if (cookieValid.indexOf(strCookie) != -1) { 
		cookiesEnabled = true; 
	} else { 
		cookiesEnabled = false; 
		alert("Pour bénéficier des possibilités de sélection de vos préférences (audio on/off, avancement automatique dans les séries d'examen) vous devez activer les cookies sur votre navigateur");
	}
}
function validOptionsExam() {
	var dateHoy = new Date();
	var dateExp = new Date();
	dateExp.setTime(dateHoy.getTime() + 1000*60*60*24*366);
	var strHideChrono = "no";
	if (document.FCdr.HideChrono.checked == true) { strHideChrono = "yes"; }
	SetCookie("HideChrono",strHideChrono,dateExp,"","","");

	var strValidOff = "no";
	if (document.FCdr.ValidOff.checked == true) { strValidOff = "yes"; }
	SetCookie("ValidOff",strValidOff,dateExp,"","","");
}
//-------------------
// rubriques
function initRub2(rName,rMax,textSel,libelle) {
	this.rName	= rName;
	this.rMax	= rMax;
	this.textSel	= textSel;
	this.libelle	= libelle;
}
gRub2 = new Array();
var	debug_tlibre0 = false;		// false
gRubItems = new Array("CD","CI","PR","SI","ST","VC","MO");

if (debug_tlibre0 == true) {
	gRub2["CD"] = new initRub2("CD",15,"","Croiser-dépasser");
	gRub2["CI"] = new initRub2("CI",15,"","Circulation");
	gRub2["MO"] = new initRub2("MO",15,"","Moto");
	gRub2["PR"] = new initRub2("PR",12,"","Priorité");
	gRub2["SI"] = new initRub2("SI",15,"","Signalisation");
	gRub2["ST"] = new initRub2("ST",11,"","Stationnement");
	gRub2["VC"] = new initRub2("VC",13,"","Véhicule et conducteur");
} else {
	gRub2["CD"] = new initRub2("CD",154,"","Croiser-dépasser");
	gRub2["CI"] = new initRub2("CI",159,"","Circulation");
	gRub2["MO"] = new initRub2("MO",150,"","Moto");
	gRub2["PR"] = new initRub2("PR",120,"","Priorité");
	gRub2["SI"] = new initRub2("SI",159,"","Signalisation");
	gRub2["ST"] = new initRub2("ST",119,"","Stationnement");
	gRub2["VC"] = new initRub2("VC",139,"","Véhicule et conducteur");
}

function validFormRubriques() {
	var lCodeRubList = "";
	var nRub;
	var rub;
	var chckd = "";
	for (nRub in gRubItems) {
		rub = gRubItems[nRub];
		if (eval("document.FRubriques."+rub+".checked") == true) {
			if (lCodeRubList != "") {
				lCodeRubList += ",";
			}
			lCodeRubList += "'"+rub+"'";
		}
	}
	if (lCodeRubList == "") {
		lCodeRubList = "'CD'";
	}
	setCookieCodeRubList(lCodeRubList);
}

function setCookieCodeRubList(s) {
	var dateHoy = new Date();
	var dateExp = new Date();
	dateExp.setTime(dateHoy.getTime() + 1000*60*60*24*366);
	SetCookie("CodeRubList",s,dateExp,"","","");
}

//---------- quit
function ExitWindowCdr() {
	with (top.frames["main"]) {
		location.href = "dossier_perso.asp";
	}
}

function ExitWindowCdrFromOpener() {
	if (1) {
		submitLink("exitWindowFlash",0,"");
	} else {
		with (top.frames["main"]) {
			location.href = "dossier_perso.asp";
		}
	}
}

gFlashOpenLibLoaded = 1;


/* -------------------------------------------------- */
/*  CheckBrowser()                                    */
/*                                                    */
/* -------------------------------------------------- */
IE = 1;
NS = 2;
var Browser = 0;
function CheckBrowser()
{
  if ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) >= 4 ))
    Browser = NS;
  else if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) > 4 ))
    Browser = IE;
  else
    Browser = 0;
}
//-->