// JavaScript Document
// auteur:  Frederic Amyot 
// site Web QI - Les chutes et glissades chez les travailleurs
// 29 mars 2004 
//
//// FNC pour la navigation 
// alert("coco");	
// ce fichier est INCLUS dans: index.htm (inclus au load de la page)
//
var agent = navigator.userAgent.toLowerCase();
var isOP = ((agent.indexOf("opera")!= -1) ||(agent.indexOf("opera")!= -1));
var isIE = ((navigator.appName.indexOf("Microsoft") != -1) && !isOP);
var isNN = agent.indexOf("netscape") != -1;
var isMZ = (agent.indexOf("gecko") != -1 && agent.indexOf("netscape") == -1);
//
var Menu = window.document.swfMenu;
var Entete = window.document.swfEntete;
//
// alert("FNC_TOC: Agent = " + agent + "\r\rPlatforme \risWin = " + isWin + "\risMac = " + isMac + "\r\rNAVIGATEUR \risIE = " + isIE + "\risNN = " + isNN + "\risOP = " + isOP + "\risMZ = " + isMZ);
//
function goSection(sNo, pNo, subPageNo, isFrom) {
	if (subPageNo != 0) {
		// il y a une subpage
		var htmFile = Sections[sNo][pNo][subPageNo].htmFile;
		window.document.swfMenu.GotoFrame((sNo * 100) + (pNo * 10) + subPageNo);
	 } else {
		// il n'y a pas de subpage
		var htmFile = Sections[sNo][pNo].htmFile;
		window.document.swfMenu.GotoFrame((sNo * 10) + pNo);
	}
	// UPDATE du swf entete
	// window.document.swfEntete.GotoFrame(sNo * 10);
	// window.document.swfEntete.GotoFrame(sNo);
	// tester de quel endroit vient le call
	if (isFrom == "swf") {
		// le call vient d'un SWF
		if (isIE) {
			// alert ("isIE");
			window.frames["rightFrame"].location.href = "html/" + htmFile;
		} else if (isNN) {
			// alert ("isNN");
			window["rightFrame"].document.location.href = "html/" + htmFile;
		} else if (isMZ) {
			// alert ("isMZ");
			window["rightFrame"].document.location.href = "html/" + htmFile;
		} 
	} else if (isFrom == "htm") {
		// le call vient d'une page HTML
		if (isIE) {
			window.frames["rightFrame"].location.href = htmFile;
		} else if (isNN) {
			window["rightFrame"].document.location.href = htmFile;
		} else if (isMZ) {
			window["rightFrame"].document.location.href = htmFile;
		} 
	}
	
}
// fnc qui doit etre sur chq page HTML qui affiche dans le frame 'rightFrame'
// fait update des swf
function updateMenus(mySectionNo, myPageNo, mySubPageNo) {
	if (mySubPageNo != 0) {
		// il y a une subpage
		// var htmFile = Sections[sNo][pNo][subPageNo].htmFile;
		// window.document.swfMenu.GotoFrame((mySectionNo * 100) + (myPageNo * 10) + mySubPageNo);
		window.document.swfEntete.GotoFrame((mySectionNo * 100) + (myPageNo * 10) + mySubPageNo);
	} else {
		// il n'y a pas de subpage
		// var htmFile = Sections[sNo][pNo].htmFile;
		// window.document.swfMenu.GotoFrame((mySectionNo * 10) + myPageNo);
		window.document.swfEntete.GotoFrame((mySectionNo * 10) + myPageNo);
	}
	// UPDATE du swfEntete
	// window.document.swfEntete.GotoFrame(10 + mySectionNo);
	// window.document.swfEntete.GotoFrame(mySectionNo);
};

function updateEntete(mySectionNo) {
	window.document.swfEntete.GotoFrame(10 + mySectionNo);
};
function eraseRightFrame() {
	if (isIE) {
		window.frames["rightFrame"].location.href = ""
	} else if (isNN) {
		// alert ("isNN");
		window["rightFrame"].document.location.href = ""
	} else if (isMZ) {
		// alert ("isMZ");
		window["rightFrame"].document.location.href = ""
	} 
};
////////////////////////
function processURL() {
	// var SectionNo = abc;
	var searchString = window.location.search;
	// alert ("MSG from Index.htm" + searchString);
	//   ?s=1%26=2%26sp=0%26f=htm
	var sNo = searchString.charAt(3);
	var pNo = searchString.charAt(9);
	var subPageNo = searchString.charAt(16);
	var isFrom = searchString.slice(22,25);
	// alert ("sNo=" + sNo + " pNo=" + pNo+ " subPageNo=" + subPageNo+ " isFrom= " +isFrom);
	goSection(sNo, pNo, subPageNo, isFrom);
}
//

