// JavaScript Document
var expDays = 9999;  
var standardStyle = '1'; 
var nameOfCookie = 'switchstyle'; 
var urlToCSSDirectory = 'https://www.ornamin-provita.com/shop/out/oxbaseshop/html/0/'; 

var ScreenCSS_1 = 'cbOrnamin_0.css';
var ScreenCSS_2 = 'cbOrnamin_1.css';
var ScreenCSS_3 = 'cbOrnamin_2.css';
var ScreenCSS_4 = 'cbOrnamin_3.css';
var ScreenCSS_5 = 'screen_5.css';

var PrintCSS_1 = 'oxid_0.css';
var PrintCSS_2 = 'oxid_1.css';
var PrintCSS_3 = 'oxid_2.css';
var PrintCSS_4 = 'print_4.css';
var PrintCSS_5 = 'print_5.css';


/***********************************************************************************************
	
	DO NOT CHANGE ANYTHING UNDER THIS LINE, UNLESS YOU KNOW WHAT YOU ARE DOING
	
***********************************************************************************************/

// This is the main function that does all the work
function switchStyleOfUser()
{
	var fontSize = GetCookie(nameOfCookie);
	if (fontSize == null) {
		fontSize = standardStyle;
	}

	if ( fontSize <= 0 )
	{
		fontSize = 1;
	}
	else if ( fontSize >= 2 )
	{
		fontSize = 2;
	}
	
	SetCookie(nameOfCookie,fontSize);
	
	if (fontSize == "1") 
	{ 
		document.write('<link rel="stylesheet" type"text/css" href="' + urlToCSSDirectory + ScreenCSS_1 + '">'); 
		document.write('<link rel="stylesheet" type"text/css" href="' + urlToCSSDirectory + PrintCSS_1 + '">');
	}
	if (fontSize == "2") 
	{ 
		document.write('<link rel="stylesheet" type"text/css" href="' + urlToCSSDirectory + ScreenCSS_2 + '">'); 
		document.write('<link rel="stylesheet" type"text/css" href="' + urlToCSSDirectory + PrintCSS_2 + '">'); 
	}
		
	if (fontSize == "3") 
	{ 
		document.write('<link rel="stylesheet" type"text/css" href="' + urlToCSSDirectory + ScreenCSS_3 + '">'); 
		document.write('<link rel="stylesheet" type"text/css" href="' + urlToCSSDirectory + PrintCSS_3 + '">');
	}
	
	if (fontSize == "4") 
	{ 
		document.write('<link rel="stylesheet" type"text/css" href="' + urlToCSSDirectory + ScreenCSS_4 + '">');
		document.write('<link rel="stylesheet" type"text/css" href="' + urlToCSSDirectory + PrintCSS_4 + '">'); 
		}
	
	if (fontSize == "5") 
	{ 
		document.write('<link rel="stylesheet" type"text/css" href="' + urlToCSSDirectory + ScreenCSS_5 + '">'); 
		document.write('<link rel="stylesheet" type"text/css" href="' + urlToCSSDirectory + PrintCSS_5 + '">');
	}
	return fontSize;
}

var exp = new Date(); 


// Function to get the settings of the user
function getCookieVal (offset) {  
	var endstr = document.cookie.indexOf (";", offset);  
	if (endstr == -1)    
	endstr = document.cookie.length;  
	return unescape(document.cookie.substring(offset, endstr));
}
	
// Function to get the settings of the user
function GetCookie (name) {  
	var arg = name + "=";  
	var alen = arg.length;  
	var clen = document.cookie.length;  
	var i = 0;  
	while (i < clen) {    
		var j = i + alen;    
		if (document.cookie.substring(i, j) == arg)      
		{
			return getCookieVal (j);    
		}
		i = document.cookie.indexOf(" ", i) + 1;    
		if (i == 0) 
			break;   
	}  
	return null;
}

// Function to remember the settings
function SetCookie (name, value) 
{
	var argv = SetCookie.arguments;  
	var argc = SetCookie.arguments.length;  
	var expires = (argc > 2) ? argv[2] : null;  
	var path = (argc > 3) ? argv[3] : null;  
	var domain = (argc > 4) ? argv[4] : null;  
	var secure = (argc > 5) ? argv[5] : false;  
	document.cookie = name + "=" + escape (value) + 
	((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
	((path == null) ? "" : ("; path=" + path)) +  
	((domain == null) ? "" : ("; domain=" + domain)) +    
	((secure == true) ? "; secure" : "");
}

// Function to remove the settings
function DeleteCookie (name) {  
	var exp = new Date();  
	exp.setTime (exp.getTime() - 1);  
	var cval = GetCookie (name);  
	document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}

// This function is used when the user gives his selection
function doRefresh(){
	location.reload();
}

// This will call the main function.  Do not remove this, because otherwise this script will do nothing...
switchStyleOfUser();