// JavaScript Document

var InTimer;
var curSubmenu;
var res = 1;

function open_sub(whmenu) {
	if (curSubmenu == whmenu) {
		close_sub(curSubmenu);
		curSubmenu = null;
		return;
	}
	if (curSubmenu != null && curSubmenu != whmenu) {
		close_sub(curSubmenu);
	}
	document.getElementById('s'+whmenu).style.display = 'block';
	document.getElementById(whmenu).className = 'NavON';
	curSubmenu = whmenu;
	/*if (InTimer) {
		clearTimeout(InTimer);
		InTimer = setTimeout("close_sub(curSubmenu)",8000);
	} else {
		InTimer = setTimeout("close_sub(curSubmenu)",8000);
	}*/
}
function close_sub(whmenu) {
	document.getElementById('s'+whmenu).style.display = 'none';
	document.getElementById(whmenu).className = 'none';
}

function open_horaire(wh) {
	var optparms = "scrollbars=0,toolbar=0,location=0,status=0,menubar=0,resizable=0,width=506,height=560";
	var page = "horaire/int-" + wh + ".html";
	WinHOR = window.open(page, "Horaire", optparms);
	WinHOR.focus();
}

// Resolution
////////////////////////
function open_prefs() {
	if (res == 1) {
		widen_site();
	} else {
		short_site();
	}
	return false;
}
function widen_site() {
	document.getElementById('TheSite').style.width = '950px';
	document.getElementById('leftSide').style.width = '790px';
	document.getElementById('rightSide').style.width = '160px';
	document.getElementById('conPortal').style.width = '588px';
	//document.getElementById('imgPort').src = 'images/sideimg-lg.jpg';
	res = 2;
	set_cookie(2);
}
function short_site() {
	document.getElementById('TheSite').style.width = '750px';
	document.getElementById('leftSide').style.width = '590px';
	document.getElementById('rightSide').style.width = '160px';
	document.getElementById('conPortal').style.width = '388px';
	//document.getElementById('imgPort').src = 'images/sideimg-sm.jpg';
	res = 1;
	set_cookie(1);
}

// Cookies
// //////////////
function set_cookie(value) {
	var today = new Date();
	var expiry = new Date(today.getTime() + 90 * 24 * 60 * 60 * 1000);
	document.cookie = "Resolution=" + value + "; expires=" + expiry.toGMTString();
	return;
}

var bikky = document.cookie;

function getCookie(name) {
	var index = bikky.indexOf(name + "=");
	if (index == -1) return null;
	index = bikky.indexOf("=", index) + 1;
	var endstr = bikky.indexOf(";", index);
	if (endstr == -1) endstr = bikky.length;
	return unescape(bikky.substring(index, endstr));
}

var cookievalue = getCookie('Resolution');
if (cookievalue == null) {
	cookievalue = '0';     // Set to 0 if not set.
}
