a = document.cookie;

sizeCookie = a.substring(0,a.indexOf('='));
if(a.indexOf(';') != -1)
{cookievalue1 = a.substring(a.indexOf('=')+1,a.indexOf(';'));}
else{cookievalue1 = a.substr(a.indexOf('=')+1,a.length);}

a = a.substring(a.indexOf(';')+1,a.length);

colorCookie = a.substring(0,a.indexOf('='));
if(a.indexOf(';') != -1)
{cookievalue2 = a.substring(a.indexOf('=')+1,a.indexOf(';'));}
else{cookievalue2 = a.substr(a.indexOf('=')+1,a.length);}

if(sizeCookie){
   document.write("<link rel=stylesheet type='text/css' href='" + cookievalue1+"'>" );
}

if(colorCookie){
   document.write("<link rel=stylesheet type='text/css' href='" + cookievalue2+"'>" );
}

  function changeSize(value){
	container = document.getElementById('styleContainer');
	
	header = document.getElementsByTagName('head')[0];
	if(document.getElementById('sizeCss'))
	header.removeChild(document.getElementById('sizeCss'));
	
	styleElement = document.createElement('LINK');
	styleElement.setAttribute('id', 'sizeCss');
	styleElement.setAttribute('rel', 'StyleSheet');
	styleElement.setAttribute('type', 'text/css');
	
	if(value == 1){
		var styleCSS = 'util/schrift_klein.css';
		styleElement.setAttribute('href', styleCSS);
		header.appendChild(styleElement);

	}else if(value == 2){
		var styleCSS = 'util/schrift_mittel.css';
		styleElement.setAttribute('href', styleCSS);
		header.appendChild(styleElement);
		
	}else if(value == 3){
		var styleCSS = 'util/schrift_gross.css';
		styleElement.setAttribute('href', styleCSS);
		header.appendChild(styleElement);
		
	}else{
		alert('{L_INVALIDSIZE}');
	}
	setCookie(styleCSS);
 }

  function changeColor(value){

	container = document.getElementById('styleContainer');
	
	header = document.getElementsByTagName('head')[0];
	if(document.getElementById('colorCss'))
	header.removeChild(document.getElementById('colorCss'));
	
	styleElement = document.createElement('LINK');
	styleElement.setAttribute('id', 'colorCss');
	styleElement.setAttribute('rel', 'StyleSheet');
	styleElement.setAttribute('type', 'text/css');
	
	
	if(value == 'beamer'){
		var colorCSS = 'util/schriftfarbe_beamer.css';
		styleElement.setAttribute('href', colorCSS);
		header.appendChild(styleElement);
	}else if(value == 'normal'){
		var colorCSS = 'util/schriftfarbe_normal.css';
		styleElement.setAttribute('href', colorCSS);
		header.appendChild(styleElement);
	}else{
		alert('{L_INVALIDSIZE}');
	}
	setCookie2(colorCSS);
  }

 function setCookie(value){
	var date = new Date();
	date.setTime(date.getTime()+(1*24*60*60*1000));
	var expires = "; expires="+date.toGMTString();
	
    document.cookie = "styleCookie="+value+expires+"; path=/";
 }

 function setCookie2(value){
	var date = new Date();
	date.setTime(date.getTime()+(1*24*60*60*1000));
	var expires = "; expires="+date.toGMTString();
	
    document.cookie = "colorstyleCookie="+value+expires+"; path=/";
 }
