//
// Text-resize javascript, let your users resize your text 
//
// by John Mueller, http://johnmu.com/
// Reuse and modification allowed provided above attribution remains intact.
// no link necessary :-)
//
// v1.0 - 2007-July-22 
//

var ts_sizeSmall=80;  // adjust this for the SMALL size in percent
var ts_sizeLarge=130; //    "                LARGE
var ts_styleElement="#wrapper"; // the ID of the content DIV that you want to resize

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));
}

function showReadabilityMenu (myTitle) {
	document.write('<div id="fontsizemenu">' + myTitle + '&nbsp;<span style="font-size:'+ts_sizeSmall+'%">');
	if (ts_fontsize!=ts_sizeSmall) 
    	document.write('<a href="#" onclick="changeFontSize('+ts_sizeSmall+');return false;" title="Display smaller text">A</a>');
    else document.write('A');
	document.write('</span>&nbsp;<span>');
	if (ts_fontsize!=100) 
    	document.write('<a href="#" onclick="changeFontSize(100);return false;" title="Display normal text size">A</a>');
    else document.write('A');
	document.write('</span>&nbsp;<span  style="font-size:'+ts_sizeLarge+'%">');
	if (ts_fontsize!=ts_sizeLarge) 
    	document.write('<a href="#" onclick="changeFontSize('+ts_sizeLarge+');return false;" title="Display larger text size">A</a>');
    else document.write('A');
	document.write('</span></div>');
}

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

var ts_fontsize = ts_getCookie('ts_fontsize');
if (!ts_fontsize) var ts_fontsize = 100;

document.write('<style type="text/css">' + ts_styleElement + '{font-size:'+ts_fontsize+'%;}<\/style>');

// done!
// eat pizza
