function increaseFont(){
	// get the current value from the cookie
	var cv1 = readCookie("ihtuserdata");
	if(cv1) {
		cookieValues = parseCookie(cv1);
		var currentFontSize = parseInt(cookieValues[0]);
		var newFontSize = currentFontSize + 1;
		if (newFontSize > 17){
			newFontSize = 17;
		}
		// save new value in the cookie
		var cv = "fontSize:" + newFontSize;
		createCookie("ihtuserdata",cv,7);
	
		// re-draw article
		obj = document.getElementById("content");
		obj.style.fontSize = newFontSize + "px";
	}
}

// increases the font and adjusts the article layout
function decreaseFont(){
	// get the current value from the cookie
	var cv1 = readCookie("ihtuserdata");
	if(cv1) {
		cookieValues = parseCookie(cv1);
		var currentFontSize = parseInt(cookieValues[0]);
		var newFontSize = currentFontSize - 1;
		if (newFontSize < 10){
			newFontSize = 10;
		}
		// save new value in the cookie
		var cv = "fontSize:" + newFontSize;
		createCookie("ihtuserdata",cv,7);
		// re-draw article
		obj = document.getElementById("content");
		obj.style.fontSize = newFontSize + "px";
	}
}

function articleSetup(){
	// get the fontSize value from the cookie
	var cv1 = readCookie("ihtuserdata");
	if(cv1) {
		cookieValues = parseCookie(cv1);
		var fontSize = cookieValues[0];
		var parentDiv = document.getElementById("content");
		if(parentDiv) {
		parentDiv.style.fontSize = fontSize + "px";
		}
	}
}

function initArticle(){
	if (document.getElementById("content") != null){
		articleSetup();
	}
}
// creates a cookie with the given parameters
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 {
		var expires = "";
	}
	document.cookie = name + "=" + value + expires + "; path=/";
}

// locates and reads the value of a cookie with a specified name
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;
}

// deletes a cookie with a specified name
function eraseCookie(name){
	createCookie(name,"",-1);
}
function parseCookie(cookievalues){
	if (cookieValues.length > 0){
		var cookieValuesArray = new Array(3);
		var CookiesArray = cookievalues.split("&");
		for (var i = 0; i < CookiesArray.length; i++){
			var v = CookiesArray[i].split(":");
			cookieValuesArray[i] = v[1];
		}
		return cookieValuesArray;
	} else {
		return null;
	}
}

var cookieValues = new Array(3);
var cv = readCookie("ihtuserdata");
if (cv){
	cookieValues = parseCookie(cv);

} else {
	createCookie("ihtuserdata","fontSize:13",7);
	cv = readCookie("ihtuserdata");
	if (cv){
		// the cookie was created, parse the values
		cookieValues = parseCookie(cv);
	} else {
			cookieValues[0] = "13"; // font size
	}
}

