var min=12;
var max=18;
function increaseFontSize() {
	var p = document.getElementsByTagName('div');
	for(i=0;i<p.length;i++) {
		var s = parseInt(readCookie('fontSize'));
		if(s!=max) {
			s += 1;
		}
		p[i].style.fontSize = s+"px"
	}
	var q = document.getElementsByTagName('span');
	for(j=0;j<q.length;j++) {
		var t = parseInt(readCookie('fontSize'));
		if(t!=max) {
			t += 1;
		}
		q[j].style.fontSize = t+"px"
	}
	createCookie('fontSize',s,999);
	return false;
}
function decreaseFontSize() {
	var p = document.getElementsByTagName('div');
	for(i=0;i<p.length;i++) {
		var s = readCookie('fontSize');
		if(s!=min) {
			s -= 1;
		}
		p[i].style.fontSize = s+"px"
	}
	var q = document.getElementsByTagName('span');
	for(j=0;j<q.length;j++) {
		var t = readCookie('fontSize');
		if(t!=min) {
			t -= 1;
		}
		q[j].style.fontSize = t+"px"
	}
	createCookie('fontSize',s,999);
	return false;
}
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;
};
function checkFontSize() {
	var currentFontSize = readCookie('fontSize')
	if (currentFontSize!=null && currentFontSize!="")  {
		if (currentFontSize == max) {
			increaseFontSize();
		}
		else if (currentFontSize == min) {
			decreaseFontSize();
		}
		else {
			increaseFontSize();
			decreaseFontSize();			
		}
	}
	else {
		createCookie('fontSize',11,999);
	}
}
