/*if (getCookie("UQARBrowser") == null) {
	if (getCookie("UQARBrowser") != "ok") {
		var navigateur = navigator.appVersion.toLowerCase();
		if ((navigateur.indexOf("windows") != -1 && navigateur.indexOf("msie 5.") != -1) || (navigateur.indexOf("Netscape") != -1 && navigateur.indexOf("msie 4.") != -1)) {
			document.location.replace("/requis.html");
		}
	}
}*/
window.onload=myOnLoad;
function myOnLoad() {
	initOnglet();
}


function setZone(strZone) {
	setCookie("UQARZone", strZone, 30);
	var strLocation = document.location.href.toString().toLowerCase();
	if (strZone == "levis") {
		strLocation = strLocation.replace("rimouski", "levis");
		strLocation = strLocation.replace("hors", "levis");
	} else if (strZone == "rimouski") {
		strLocation = strLocation.replace("levis", "rimouski");
		strLocation = strLocation.replace("hors", "rimouski");
	} else if (strZone == "hors") {
		strLocation = strLocation.replace("rimouski", "hors");
		strLocation = strLocation.replace("levis", "hors");
	}
	if (strLocation.indexOf("#") != -1) {
		var arrurl = strLocation.split("#");
		strLocation = arrurl[0];
	}
	document.location = strLocation;
}

function initOnglet() {
	for (var i = 0; i < document.getElementsByTagName("DIV").length; i++) {
		if (document.getElementsByTagName("DIV")[i].getAttribute("ouvert") != null) {
			if (document.getElementsByTagName("DIV")[i].getAttribute("ouvert") == "false") {
				toggleOnglet(document.getElementsByTagName("DIV")[i], false);
			}
		}
	}
}

function ouvrirOnglet() {
	var objOnlgetCont;
	for (var i = 0; i < ouvrirOnglet.arguments.length; i++) {
		objOnlgetCont = document.getElementById(ouvrirOnglet.arguments[i]);
		if (objOnlgetCont) {
			toggleOnglet(objOnlgetCont, true);
		} else {
			return;
		}
	}
}

function fermerOnglet() {
	var objOnlgetCont;
	for (var i = 0; i < fermerOnglet.arguments.length; i++) {
		objOnlgetCont = document.getElementById(fermerOnglet.arguments[i]);
		if (objOnlgetCont) {
			toggleOnglet(objOnlgetCont, false);
		} else {
			return;
		}
	}
}

function toggleOnglet(obj, ouvre) {
	if (ouvre) {
		//obj.style.visibility = "visible";
		obj.style.display = "block";
	} else {
		//obj.style.visibility = "hidden";
		obj.style.display = "none";
	}
}


function allerSection(strSelect) {
	if (document.getElementById) {
		var strUrl = document.getElementById(strSelect).value;
		if (strUrl != null && strUrl != "") {
			document.location = strUrl;
		}
	} else {
		
	}
}
function showUrl() {
	return document.location;
}
function showOutilContent(strDiv, strImg) {
	if (document.getElementById("typo")) document.getElementById("typo").style.display = "none";
	if (document.getElementById("print")) document.getElementById("print").style.display = "none";
	if (document.getElementById("signet")) document.getElementById("signet").style.display = "none";
	if (document.getElementById("text")) document.getElementById("text").style.display = "none";
	
	if (document.getElementById("imgTypo")) document.getElementById("imgTypo").src = document.getElementById("imgTypo").src.replace("On.gif", "Of.gif");
	if (document.getElementById("imgImprimer")) document.getElementById("imgImprimer").src = document.getElementById("imgImprimer").src.replace("On.gif", "Of.gif");
	if (document.getElementById("imgSignet")) document.getElementById("imgSignet").src = document.getElementById("imgSignet").src.replace("On.gif", "Of.gif");
	if (document.getElementById("imgText")) document.getElementById("imgText").src = document.getElementById("imgText").src.replace("On.gif", "Of.gif");
	
	if (document.getElementById(strDiv)) document.getElementById(strDiv).style.display = "block";
	if (document.getElementById(strImg)) document.getElementById(strImg).src = document.getElementById(strImg).src.replace("Of.gif", "On.gif");
}




function getHtmlOfOngletText() {
	var strHtml;
	if (strIsText == "true") {
		strHtml = '<a href="javascript:versionText(false);">Version normale de cette page</a>';
	} else {
		strHtml = '<a href="javascript:versionText(true);">Version texte de cette page</a>';
	}
	if (document.getElementById("text")) document.getElementById("text").innerHTML = strHtml;
}
var strIsText;
if (getCookie("UQARTypo")) setTypo(getCookie("UQARTypo"));
if (getCookie("UQARText")) setVersionText(getCookie("UQARText"));
function changeTypo(num) {
	setTypo("css"+num)
	setCookie("UQARTypo", "css"+num, 30);
}
function setTypo(strCss) {
	setActiveStyleSheet(strCss);
}
function versionText(isText) {
	setVersionText(isText)
	setCookie("UQARText", isText, 30);
}
function setVersionText(isText) {
	strIsText = isText.toString().toLowerCase();
	if (strIsText == "true") {
		disableScreenCss();
		setActiveStyleSheetVersionText("versionText");	
	} else {
		enableScreenCss();
		setInActiveStyleSheet("versionText");	
	}
	getHtmlOfOngletText();
}


function disableScreenCss() {
	var i, a, main;
	for(i=0; (a = document.getElementsByTagName("style")[i]); i++) {
		if(a.getAttribute("type").indexOf("text/css") != -1 && a.getAttribute("title")) {
			if(a.getAttribute("title") == "screen") a.disabled = true;
		}
	}
}
function enableScreenCss() {
	var i, a, main;
	for(i=0; (a = document.getElementsByTagName("style")[i]); i++) {
		if(a.getAttribute("type").indexOf("text/css") != -1 && a.getAttribute("title")) {
			if(a.getAttribute("title") == "screen") a.disabled = false;
		}
	}
}
function setActiveStyleSheetVersionText(title) {
	var i, a, main;
	for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
		if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") == "versionText") {
			a.disabled = true;
			if(a.getAttribute("title") == "versionText") {
				a.disabled = false;
			}
		}
	}
}
function setActiveStyleSheet(title) {
	var i, a, main;
	for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
		if (a.getAttribute("title") != null) {
			if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title").indexOf("css") != -1) {
				a.disabled = true;
				if(a.getAttribute("title") == title) {
					a.disabled = false;
				}
			}
		}
	}
}
function setInActiveStyleSheet(title) {
	var i, a, main;
	for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
		if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
			if(a.getAttribute("title") == title) a.disabled = true;
		}
	}
}
function setCookie(cookieName, cookieValue, expiredays) {
 	var expire = new Date ();
	expire.setTime (expire.getTime() + (expiredays*(1000*60*60*24)));
	expire = expire.toGMTString();
	var newCookie;
	newCookie = cookieName + "=" + cookieValue + "; path=/; expires=" + expire;
	document.cookie = newCookie;
}

function getCookie(cookieName) {
	var CookieString = "";
	strCookieName = cookieName + '=';
	strCookie = null;
	tempArray = document.cookie.split(";");
	for (tA = 0; tA < tempArray.length; tA++) {
		if (tempArray[tA].indexOf(strCookieName) > -1) {							//found the clippings section
			tPos = tempArray[tA].indexOf("=")+1;
			CookieString = tempArray[tA].substring(tPos,tempArray[tA].length);	//striping out "clippings=^"
		}
	}
	if (CookieString!="")
		return CookieString;
	else
		return null;
}
/*  -------------------------------------------------------------------------------------------------------------- */
/*  -------------------------------------------------------------------------------------------------------------- */
//Bottin du personnel
/*  
	Code pour permettre l'envoie du formulaire avec la touche ENTER dans IE 
	Ajout&eacute; par Marc-Andr&eacute; Marchand, 20 avril 2006
	marc-andre.marchand@uqar.qc.ca
	
	Code trouv&eacute; sur:
		- D&eacute;tection du navigateur : http://www.pageresource.com/jscript/jbrowse.htm
		- Pour connaître la touche pes&eacute;e : http://jennifermadden.com/javascript/stringEnterKeyDetector.html 
*/
function checkEnter(e){
	// Variable pour le nom du navigateur
	var browserName=navigator.appName;
	// Variable pour la touche pes&eacute;e, en occurence pour le ENTER
	var characterCode;
	
	
	if(e && e.which){ //if which property of event object is supported (NN4)
		e = e
		characterCode = e.which //character code is contained in NN4's which property
	}
	else{
		e = event
		characterCode = e.keyCode //character code is contained in IE's keyCode property
	}

	if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)
		// Si le nom du navigateur est IE
		if (browserName=="Microsoft Internet Explorer"){
			document.formBottin.submit(MonPopup()) //submit the form
		}
		return false
	}
		else{
		return true
	}
}

//Ajout Bruno 4 sept 2005
//Script = 'http://www.uqar.qc.ca/bottin/recherchNew.cgi';
Swing = '?';
//URL = Script;
URL ='http://www.uqar.qc.ca/bottin/recherchNew.cgi';
function MonPopup() {
constructURL( 'nom', document.formBottin.nom.value );
var att = 'width=550,height=600,scrollbars=yes, resizable=no';
var pu = window.open('BottinUQAR','PU',att);
pu.location.href = URL;
Swing = '?';
//URL = Script;
}

function constructURL(n,v) {
v = escape(v);
URL = URL + Swing + n + '=' + v;
Swing = '&';
}
/*  -------------------------------------------------------------------------------------------------------------- */
/*  -------------------------------------------------------------------------------------------------------------- */


/*  -------------------------------------------------------------------------------------------------------------- */
/*  -------------------------------------------------------------------------------------------------------------- */
//Recherche sur le site
/*  
	Code pour permettre l'envoie du formulaire avec la touche ENTER dans IE 
	Ajout&eacute; par Marc-Andr&eacute; Marchand, 20 avril 2006
	marc-andre.marchand@uqar.qc.ca
	
	Code trouv&eacute; sur:
		- D&eacute;tection du navigateur : http://www.pageresource.com/jscript/jbrowse.htm
		- Pour connaître la touche pes&eacute;e : http://jennifermadden.com/javascript/stringEnterKeyDetector.html 
*/
function checkEnterRecherche(e){
	// Variable pour le nom du navigateur
	var browserName=navigator.appName;
	// Variable pour la touche pes&eacute;e, en occurence pour le ENTER
	var characterCode;
	
	
	if(e && e.which){ //if which property of event object is supported (NN4)
		e = e
		characterCode = e.which //character code is contained in NN4's which property
	}
	else{
		e = event
		characterCode = e.keyCode //character code is contained in IE's keyCode property
	}

	if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)
		// Si le nom du navigateur est IE
		if (browserName=="Microsoft Internet Explorer"){
			document.QueryForm.submit() //submit the form
		}
		return false
	}
		else{
		return true
	}
}



/*pour sortir du mode s&eacute;curis&eacute;*/
if (window.location.protocol == 'https:')
{	window.location = 'http://' + window.location.hostname + window.location.pathname + window.location.hash + window.location.search;
}
