// --- Startup ---
// Gestion des arguments - search

function getArgs() {
  var args = new Array()
  var s = document.location.search;
  if(s.length) {
    var al = s.split('&');
    al[0] = al[0].substring(1, al[0].length);
    for (var i=0; i<al.length; i++) {
	var a = al[i].split('=');
        args[a[0]] = a[1];
      }
    }
  return args
  }

var args = getArgs();
if(args['style']) setCookie('STYLE', args['style'], 999)
var curStyle = getCookie('STYLE');

// Appel Style Sheet
if(curStyle != '') document.write('<link rel="stylesheet" href="../css-js/' + curStyle + '.css" type="text/css">')
else document.write('<link rel="stylesheet" href="../css-js/style.css" type="text/css">')

// pre chargement des images
if(document.images) {
  img1 = new Image();
  img1.src = "../graphics/pix_grey.gif";
  }

// --- Functions ---

// Rollover & Nav bar
var curNavbar = '';
function setNavBar(name) {if(document.images && name!='') {document.images[name].src='../graphics/pix_grey.gif'; curNavbar=name;}}
function rollOver(name) {if(document.images && name!=curNavbar) document.images[name].src='../graphics/pix_grey.gif'}
function rollOut(name) {if(document.images && name!=curNavbar) document.images[name].src='../graphics/pix_black.gif'}

// Timestamp
function timeStamp() {
  var justNow = new Date();
  return justNow.getTime()
  }

// Cookies
function setCookie(name, value, days) {
  if(value != "") {
    var date1 = new Date(); 
    var date2 = new Date(); 
    date2.setTime(date1.getTime() + 1000*60*60*24*days);
    document.cookie = name + '=' + escape(value) + '; expires=' + date2.toGMTString();
    }
  }

function getCookie(name) {
  var gato = document.cookie; 
  i1 = gato.indexOf(name+'=');
  if(i1 == -1) return "";
  i2 = gato.indexOf(';', i1);
  if(i2 == -1) i2 = gato.length;
  return unescape(gato.substring(i1 + name.length + 1, i2))
  }

// Debug
function objP(obj, objName) { // debug
  var pList = '';
  for(var p in obj) {
    pList += objName + '.' + p + '=' + obj[p] + ', ';
    }
  return pList
  }

