

function switchStyle(){
  if(activeStyle == 'Standard'){
    setActiveStyleSheet('Kontrast');
  }else{
    setActiveStyleSheet('Standard');
  }
}

function switchHtmlText(currentStyle){
  //alert("function switchhtmlText" + currentStyle);
  if(currentStyle == 'Standard'){
//    document.getElementById("kontrastreich").innerHTML = "Kontrastreiche Ansicht";
  }else{
//    document.getElementById("kontrastreich").innerHTML = "Standard Ansicht";
  }
  
}

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

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 setFlashMode(enable) {
	if(enable) {
		cookieManager.setCookie("flash", "on", 365);
	} else {
		cookieManager.setCookie("flash", "off", 365);
	}
	cookieManager.setDocumentCookies();
	window.location.reload();
}

var cookie = cookieManager.getCookie("style");
var flashcookie = cookieManager.getCookie("flash");
var activeStyle;
var title = cookie ? cookie : getPreferredStyleSheet();
//alert("inhalt von Cookie = " + title);
setActiveStyleSheet(title);

