YOffset=305; // no quotes!!
staticYOffset=0; // no quotes!!
slideSpeed=10; // no quotes!!
waitTime=1000; // no quotes!! this sets the time the menu stays out for after the mouse goes off it.
menuIsStatic="yes"; //this sets whether menu should stay static on the screen
menuWidth=200; // Must be a multiple of 10! no quotes!!

NS6 = (document.getElementById&&!document.all);
IE = (document.all);
NS = (navigator.appName=="Netscape" && navigator.appVersion.charAt(0)=="4");

tempBar='';
barBuilt=0;
lastY = 0;

function makeStatic() {
	if (NS||NS6) {
		winY = window.pageYOffset;
	}
	if (IE) {
		var winY = document.body.scrollTop;
	}
	if (NS6||IE||NS) {
		if (winY != lastY && winY > YOffset - staticYOffset) {
			smooth = .2 * (winY - lastY - YOffset + staticYOffset);
		}else if (YOffset - staticYOffset + lastY > YOffset - staticYOffset) {
			smooth = .2 * (winY - lastY - (YOffset-(YOffset-winY)));
		}else {
			smooth = 0;
		}
		if(smooth > 0){
			smooth = Math.ceil(smooth);
		}else{
			smooth = Math.floor(smooth);
		}
		if (IE){
			bssm.pixelTop = bssm.pixelTop+smooth;
			bssm.visibility = "visible";
		}
		if (NS6||NS) {
		bssm.style.top=parseInt(bssm.style.top)+smooth+'px';
		}
		lastY = lastY+smooth;
		setTimeout('makeStatic()', 1);
	}
}

function initSlide() {
	if (NS6){
		bssm = document.getElementById("fonctions");
		bssm.style.top = "310px";
	}else if (IE) {
		bssm=document.all("fonctions").style;
		bssm.pixelTop = 310;
	}else if (NS) {
		menuIsStatic = "no";
	}
	if (menuIsStatic=="yes") makeStatic();
}





function setActiveStyleSheet(title) {
  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }
}

function getActiveStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
  }
  return null;
}

function getPreferredStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1
       && a.getAttribute("rel").indexOf("alt") == -1
       && a.getAttribute("title")
       ) return a.getAttribute("title");
  }
  return null;
}

/*
##########################################

Code from http://arstechnica.com/
respect.
   
########################################## 
*/
var prefsLoaded = false;
var currentFontSize = 11;
var currentFontType = 1;
var currentStyle = "White";
var currentWidth = 990;
function revertStyles(){
	currentFontType = 1;
	setFontFace(1);
	
	currentFontSize = 11;
	changeFontSize(0);
	
	currentStyle = "White";
	setColor("White");
}
function toggleColors(){
	if(currentStyle == "White"){
		setColor("Black");
	}else{
		setColor("White");
	}
}
function setColor(color){
	if(color != "White"){
		document.body.className = 'Retro';
		currentStyle = "Black";
	}else{
		document.body.className = '';
		currentStyle = "White";
	}
}

function toggleWidth(){
	currentWidth = parseInt(currentWidth);
	var newWidth = 990;
	if(currentWidth == 990){
		newWidth = 1200;
	}
	setWidth(newWidth);
	currentWidth = newWidth;
}
function setWidth(width){
	if(width != 990){
		newWidth = 1200;
		document.body.style.width = '90%';
	}else{
		document.body.style.width = '990px';
	}
}
function changeFontSize(sizeDifference){
	currentFontSize = parseInt(currentFontSize) + parseInt(sizeDifference);
	setFontSize(currentFontSize);
};
function setFontSize(fontSize){
	var stObj = (document.getElementById) ? document.getElementById('conteneur') : document.all('Content');
	stObj.style.fontSize = fontSize + 'px';
};
function toggleSerif(){
	currentFontType = parseInt(currentFontType);
	if(currentFontType == 1){
		currentFontType = 2;
	}else{
		currentFontType = 1;
	}
	setFontFace(currentFontType);
};
function setFontFace(fontType){
	var stObj = (document.getElementById) ? document.getElementById('conteneur') : document.all('Content');
	if(fontType == 2){
		stObj.style.fontFamily = 'georgia,times,times new roman,serif';
		changeFontSize(1);
	}else{
		stObj.style.fontFamily = 'verdana,arial,helvetica,sans-serif';
		changeFontSize(-1);
	}
}

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
};

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
	//	alert(c);
    	if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
};


function setUserOptions(){
	if(!prefsLoaded){
		cookie = readCookie("fontFace");
		currentFontType = cookie ? cookie : 1;
		setFontFace(currentFontType);

		cookie = readCookie("fontSize");
		currentFontSize = cookie ? cookie : 11;
		setFontSize(currentFontSize);
		prefsLoaded = true;
	}
	var cookie = readCookie("style");
  	var title = cookie ? cookie : getPreferredStyleSheet();
  	setActiveStyleSheet(title);
}
// window.onload = setUserOptions;


function saveSettings()
{
  createCookie("fontSize", currentFontSize, 365);
  createCookie("fontFace", currentFontType, 365);

  var title = getActiveStyleSheet();
  createCookie("style", title, 365);
/*
  	alert(title);
  createCookie("pageWidth", currentWidth, 365);
  createCookie("pageColor", currentStyle, 365);
*/
}
window.onunload = saveSettings;


