var Stil = "Standard";

// Style Switcher

function switchStyle(s) {
  if (!document.getElementsByTagName) return;
  var tagname = document.getElementsByTagName("link");
  for (var i = 0; i < tagname.length; i++ ) {
    if (tagname[i].getAttribute("rel").indexOf("style") != -1 && tagname[i].getAttribute("title")) {
      tagname[i].disabled = true;
      if (tagname[i].getAttribute("title") == s) tagname[i].disabled = false;
    }
  }
}

function writeCookie(s) {
	ajaxParams = "style=" + s + "&rand=" + Math.floor(Math.random()*100000000);
	jQuery.ajax({
		type: "POST",
		url: "/app/style_cookie.do",
		data: ajaxParams,
		dataType: "html",
		success: function(msg){
		}
	});
}

function setStyle(s) {
  if (s != Stil) {
    switchStyle(s);
	writeCookie(s);
    Stil = s;
  }
}

