var ts_sizeSmall= 0.5;  
var ts_sizeLarge= 1; 
var ts_styleElement="#textarea";

function ts_setCookie (name, value, expires, path, domain, secure) {
    var curCookie = name + "=" + escape(value) + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : "");
    document.cookie = curCookie;
}

function ts_getCookie (name) {
    var prefix = name + '=';
    var c = document.cookie;
    var nullstring = '';
    var cookieStartIndex = c.indexOf(prefix);
    if (cookieStartIndex == -1) return nullstring;
    var cookieEndIndex = c.indexOf(";", cookieStartIndex + prefix.length);
    if (cookieEndIndex == -1) cookieEndIndex = c.length;
    return unescape(c.substring(cookieStartIndex + prefix.length, cookieEndIndex));
}


var ts_fontsize = ts_getCookie('ts_fontsize');
if (!ts_fontsize) var ts_fontsize = 1;
 smallnext = ts_fontsize * 0.9;
 bignext = ts_fontsize * 1.1;
 if (bignext >= 1.771561) {
	  bignext = 1.771561;
    }
 if (smallnext <= 0.8) {
	  smallnext = 0.8;
    }


function showReadabilityMenu (myTitle) {

	if (smallnext <= 0.8) {
	  var ts_fontsize = 0.8;
	  document.write('<span class="small">A</span> ');
    }else{
    	document.write('<a href="#" onclick="changeFontSize('+smallnext+');return false;" title="Display smaller text size" class="small">A</a> ');}
   
   
if (bignext >= 1.771561) {
	  var ts_fontsize = 1.771561;
	  document.write('<span class="big">A</span> ');
    }else{
	
    	document.write('<a href="#" onclick="changeFontSize('+bignext+');return false;" title="Display larger text size" class="big">A</a> ');
 
}}


function changeFontSize (fontsize) {
    var untilDate = new Date();
    untilDate.setTime( untilDate.getTime() + 365 * 24 * 60 * 60 * 1000);
    ts_setCookie('ts_fontsize', fontsize, untilDate, '/');
    self.location.href = self.location.href;
}
