var prefsLoaded = false;
var defaultFontSize = 62.5;
var currentFontSize = defaultFontSize;

function revertStyles() {
	currentFontSize = defaultFontSize;
	changeFontSize(0);
	}

function changeFontSize(sizeDifference) {

	switch (sizeDifference) {
		case 0:
		currentFontSize = 62.5;
		break
		case 1:
		currentFontSize = 67,5;
		break
		case 2:
		currentFontSize = 75;
		break
		default:
		currentFontSize = 62.5;
		}

	setFontSize(currentFontSize);
	createCookie("vhto-fontsize", currentFontSize, 365);
	}

function setFontSize(fontSize) {
	var stObj = (document.getElementById) ? document.getElementById('layout-content') : document.all('layout-content');
	document.body.style.fontSize = fontSize + '%';
/*	fontSize = fontSize * 1.6;
	stObj.style.fontSize = fontSize + '%';*/
	}

function setUserOptions() {
	var cookie = readCookie("style");
	if(!prefsLoaded) {
		cookie = readCookie("vhto-fontsize");
		currentFontSize = cookie ? cookie : defaultFontSize;
		setFontSize(currentFontSize);
		prefsLoaded = true;
		}
	}

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
		}
	else expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
	}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
		}
	return null;
	}

window.onload = function() {
	setUserOptions();
	}
