// To set an active stylesheet
// type : FONT, LARG or BACK
function setActiveStyleSheet(title, type) {
  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").substr(0, 4) == type) {
        a.disabled = true;
        if(a.getAttribute("title") == title)
          a.disabled = false;
      }
    }
  }
}

/*

// To get the active stylesheet
// type : FONT, LARG or BACK
function getActiveStyleSheet(type) {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && (a.getAttribute("title").substr(0, 4) == type) && !a.disabled)
      return a.getAttribute("title");
  }

  return null;
}

// On unload of the page, write preffered settings to a cookie
window.onunload = function(e) {
  var title = getActiveStyleSheet('FONT');
  setCookie('ASQ_FONT', title, 'Sun, 31 Dec 2034 12:00:00 GMT', '/', '.asqenligne.com');

  title = getActiveStyleSheet('LARG');
  setCookie('ASQ_LARG', title, 'Sun, 31 Dec 2034 12:00:00 GMT', '/', '.asqenligne.com');

  title = getActiveStyleSheet('BACK');
  setCookie('ASQ_BACK', title, 'Sun, 31 Dec 2034 12:00:00 GMT', '/', '.asqenligne.com');
}

// On load of the page, restore style based on the settings in the cookie
//  if no cookie info is present, load the default styles
var thiscookie = getCookie('ASQ_FONT');
var style_font = thiscookie ? thiscookie : 'FONT1';
setActiveStyleSheet(style_font, 'FONT');

thiscookie = getCookie('ASQ_LARG');
var style_larg = thiscookie ? thiscookie : 'LARG940';
setActiveStyleSheet(style_larg, 'LARG');

thiscookie = getCookie('ASQ_BACK');
var style_back = thiscookie ? thiscookie : 'BACKIMG';
setActiveStyleSheet(style_back, 'BACK');

*/
