/* ****************************************************************** */
function openwindow(t_url, sbars, width, height, bnav) {
    var wx, wy;
    if (bnav == 1) {
    bnav = "menubar=yes,toolbar=yes,";
    } else {
    bnav = "";
    }
    if (sbars == 1) {
        scrollb = "scrollbars=yes,";
    } else {
        scrollb = "";
    }
    if (screen.availWidth >= width) {
        wx = (screen.availWidth - width) / 2;
    } else {
        wx = 0;
    }
    if (screen.availHeight >= height) {
        wy = (screen.availHeight - height) / 2;
    } else {
        wy = 0;
    }
    return window.open(t_url, '', scrollb + bnav + 'width=' + width + ',height=' + height + ',left=' + wx + ',top=' + wy + ', resizable=yes');
}
/* ****************************************************************** */
function wechsel(num) {
 var styles = document.getElementsByTagName('style');
 for(var i = 1; i < (styles.length); i++) {
  if(i==num) {
   styles[i].disabled = false;
  }
  else {
   if(styles[i].getAttribute("title")!="") {
      styles[i].disabled = true;
   }
  }
 }
}
function laden() {
 var stylenum = 1;
 if(stylenum!=-1) {
  wechsel(stylenum);
 }
}
/* ****************************************************************** */
////////// Switcher
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;
}
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);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}
window.onload = function(e) {
  var cookie = readCookie("style");
  var title = cookie ? cookie : getPreferredStyleSheet();
  setActiveStyleSheet(title);
}
window.onunload = function(e) {
  var title = getActiveStyleSheet();
  createCookie("style", title, 365);
}
var cookie = readCookie("style");
var title = cookie ? cookie : getPreferredStyleSheet();
setActiveStyleSheet(title);
/* ****************************************************************** */
function d_support() {
    return (document.layers ||
     document.all ||
     document.getElementById);
}
function d_style(id) {
    if (document.layers) {
 return d_obj(id);
    } else if (document.all || document.getElementById) {
 return d_obj(id).style;
    }
}
function d_obj(id) {
    if (document.layers) {
 return document.layers[id];
    } else if (document.all) {
 return document.all[id];
    } else if (document.getElementById) {
 return document.getElementById(id);
    } 
}
/* ****************************************************************** */
function showCover(){
  coverStyle = d_style('cover');
  if (coverStyle) coverStyle.display = 'block';
}
function hideCover(){
  coverStyle = d_style('cover');
  if (coverStyle) coverStyle.display = 'none';
}
/* ****************************************************************** */