
document.write('<link rel="shortcut icon" href="http://www.uqar.ca/favicon.ico" >');

/*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");
		}
	}
}*/



/*  -------------------------------------------------------------------------------------------------------------- */
/*  -------------------------------------------------------------------------------------------------------------- */
//Met en cookie un campus (Rimouski ou Lévis)
function setZone(strZone) {
	setCookie("UQARZone", strZone, 30);
	var strLocation = document.location.href.toString().toLowerCase();
	if (strZone == "levis") {
		strLocation = strLocation.replace("rimouski", "levis");
	} else if (strZone == "rimouski") {
		strLocation = strLocation.replace("levis", "rimouski");
	} 
	if (strLocation.indexOf("#") != -1) {
		var arrurl = strLocation.split("#");
		strLocation = arrurl[0];
	}
	document.location = strLocation;
}
/*  -------------------------------------------------------------------------------------------------------------- */
/*  -------------------------------------------------------------------------------------------------------------- */


/*  -------------------------------------------------------------------------------------------------------------- */
/*  -------------------------------------------------------------------------------------------------------------- */
//Code pour les onglets de la colonne de droite
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";
	}
}
/*  -------------------------------------------------------------------------------------------------------------- */
/*  -------------------------------------------------------------------------------------------------------------- */


/*  -------------------------------------------------------------------------------------------------------------- */
/*  -------------------------------------------------------------------------------------------------------------- */
//Code pour les outils de la colonne de droite


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;
		}
	}
}

/*  -------------------------------------------------------------------------------------------------------------- */
/*  -------------------------------------------------------------------------------------------------------------- */

/*  -------------------------------------------------------------------------------------------------------------- */
/*  -------------------------------------------------------------------------------------------------------------- */
//Code pour cookie

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;
}
/*  -------------------------------------------------------------------------------------------------------------- */
/*  -------------------------------------------------------------------------------------------------------------- */

/*  -------------------------------------------------------------------------------------------------------------- */
/*  -------------------------------------------------------------------------------------------------------------- */
//Code pour tous les menus déroulants
function allerSection(strSelect) {
	if (document.getElementById) {
		var strUrl = document.getElementById(strSelect).value;
		if (strUrl != null && strUrl != "") {
			document.location = strUrl;
		}
	} 
}

/*  -------------------------------------------------------------------------------------------------------------- */
/*  -------------------------------------------------------------------------------------------------------------- */
//Bottin du personnel
/*  
	Code pour permettre l'envoie du formulaire avec la touche ENTER dans IE 
	Ajouté le 20 avril 2006
	Pour info, contactez le webmestre de l'UQAR
	
	Code trouvé sur:
		- Détection du navigateur : http://www.pageresource.com/jscript/jbrowse.htm
		- Pour connaître la touche pesé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é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.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é le 20 avril 2006
	Pour info, contactez le webmestre de l'UQAR
	
	Code trouvé sur:
		- Détection du navigateur : http://www.pageresource.com/jscript/jbrowse.htm
		- Pour connaître la touche pesé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é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)
		// Test
		//alert('Allo!');
		// Si le nom du navigateur est IE
		if (browserName=="Microsoft Internet Explorer"){
			//document.QueryForm.submit(); //submit the form
			//document.QueryForm.action ="/moteurDeRecherche/index.asp";
		}
		return false;
	}
		else{
		return true;
	}
}
/*  -------------------------------------------------------------------------------------------------------------- */
/*  -------------------------------------------------------------------------------------------------------------- */


/*  -------------------------------------------------------------------------------------------------------------- */
/*  -------------------------------------------------------------------------------------------------------------- */
//Pour le liste déroulante
/*  
	Code pour permettre le menu déroulant sous IE 6
	Ajouté le 26 juillet 2006
	Pour info, contactez le webmestre de l'UQAR
	
	Code trouvé sur:
		- Pour que le menu fonctionne sous IE : http://www.villesainte-anne-des-monts.qc.ca/
*/
sfHover = function() {
	var sfEls = document.getElementById("menu");
	if (sfEls != null)
	{
		sfEls = sfEls.getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				this.className+=" sfhover";
			}
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
			}
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);
/*  -------------------------------------------------------------------------------------------------------------- */
/*  -------------------------------------------------------------------------------------------------------------- */


/*pour sortir du mode sécurisé*/
if (window.location.protocol == 'https:')
{	window.location = 'http://' + window.location.hostname + window.location.pathname + window.location.hash + window.location.search;
}





/*
Philippe Lemieux
2007-11-11
Script pour valider un email dans un formulaire.
Format minimum : x@x.xx
*/
function ValidationEmail(input)
{
var regvalidationemail =/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/ ;
var msg = "Courriel invalide";
if (regvalidationemail.test(input))
    {
    return true;
    }
  else
    {
    alert(msg);
	document.getElementById('Email').focus();
    return false;
    }

 with (document.test) {
  t_date = re_date.test(date.value);
  t_email = re_email.test(email.value);
 }
 if (t_email && t_date) msg = "test correct.";
 else {
  msg = msg_debut;
  if (!t_email) msg += "l'adresse courriel est incorrecte\n" ;
  if (!t_date) msg += "la date est incorrecte\n" ;
 }
 alert(msg);
}

/*
Philippe Lemieux
2007-11-11
Script pour vider le champ email si c'est la valeur par défaut.
*/
function Click_Email(input_email)
{
if (input_email.value == "Votre courriel...")
    {
    input_email.value = "";
    }
}