	
	function getCookie(c_name)
	{
	var i,x,y,ARRcookies=document.cookie.split(";");
	for (i=0;i<ARRcookies.length;i++)
	{
	  x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
	  y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
	  x=x.replace(/^\s+|\s+$/g,"");
	  if (x==c_name)
		{
		return unescape(y);
		}
	  }
	}	
	
	function loadCar(){

		datetoday = new Date();
		timenow=datetoday.getTime();
		datetoday.setTime(timenow);
		thehour = datetoday.getHours();

		styleCook = getCookie("style");
		if(styleCook){
			if(styleCook == "day"){
				var min_random = 1;
				var max_random = 13;
				max_random++;
				var range = max_random - min_random;
				var n=Math.floor(Math.random()*range) + min_random;
				document.getElementById('usercar').src  = 'fileadmin/templates/cars/' + n + '.png';
			}else{
				var min_random = 14;
				var max_random = 14;
				max_random++;
				var range = max_random - min_random;
				var n=Math.floor(Math.random()*range) + min_random;
				document.getElementById('usercar').src  = 'fileadmin/templates/cars/' + n + '.png';
			}
		}else{
			if((thehour>=7) && (thehour<=21)){
				var min_random = 1;
				var max_random = 13;
				max_random++;
				var range = max_random - min_random;
				var n=Math.floor(Math.random()*range) + min_random;
				document.getElementById('usercar').src  = 'fileadmin/templates/cars/' + n + '.png';
			}
			if((thehour>21) && (thehour<=23) || (thehour>=0) && (thehour<7)){
				var min_random = 14;
				var max_random = 14;
				max_random++;
				var range = max_random - min_random;
				var n=Math.floor(Math.random()*range) + min_random;
				document.getElementById('usercar').src  = 'fileadmin/templates/cars/' + n + '.png';
			}
		}
	}
	
	function getCSS(){
		
			styleCook = getCookie("style");
			if(styleCook){
				if(styleCook == "day"){
					display = "fileadmin/templates/css/style_new.css";
				}else{
					display = "fileadmin/templates/css/style_old.css";
				}
				var css = '<';  css+='link rel="stylesheet" href=' + display + ' \/';  css+='>';
				//alert(css);
			}else{
				datetoday = new Date();
				timenow=datetoday.getTime();
				datetoday.setTime(timenow);
				thehour = datetoday.getHours();
	
				if((thehour>=7) && (thehour<=21))
				{display = "fileadmin/templates/css/style_new.css";}
				
				if((thehour>21) && (thehour<=23) || (thehour>=0) && (thehour<7))
				{display = "fileadmin/templates/css/style_old.css";}
				//else {display = "fileadmin/templates/assets/evening.css";}
				var css = '<';  css+='link rel="stylesheet" href=' + display + ' \/';  css+='>';
			}
			document.write(css);
	}
