//
// 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=130;  // adjust this for the SMALL size in percent
var ts_sizeLarge=160; //    "                LARGE
var ts_styleElement="#content"; // 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>');
	document.write('<span>');
	if (ts_fontsize!=100) 
    	document.write('<a href="#" onclick="changeFontSize(100);return false;" title="Normal text"><img src="/fileadmin/templates/fmh/images/Tliten.gif" border="0" ALT="Normal text!" ></a>');
    else document.write('<img src="/fileadmin/templates/fmh/images/Tliten.gif" border="0" ALT="Normal textstorlek visas nu!">');	
	//document.write('</span> &nbsp; <span style="font-size:'+ts_sizeSmall+'%">');
	document.write('</span>&nbsp;<span>');
	if (ts_fontsize!=ts_sizeSmall) 
    	document.write('<a href="#" onclick="changeFontSize('+ts_sizeSmall+');return false;" title="Större text"><img src="/fileadmin/templates/fmh/images/Tmellan.gif" border="0" ALT="Stor text!" ></a>');
    else document.write('<img src="/fileadmin/templates/fmh/images/Tmellan.gif" border="0" ALT="Stor textstorlek visas nu!">');
	//document.write('</span>&nbsp;<span  style="font-size:'+ts_sizeLarge+'%">');
	document.write('</span>&nbsp;<span>');	
	if (ts_fontsize!=ts_sizeLarge) 
    	document.write('<a href="#" onclick="changeFontSize('+ts_sizeLarge+');return false;" title="Extra stor text"><img src="/fileadmin/templates/fmh/images/Tstor.gif" border="0" ALT="Extra stor text!" ></a>');
    else document.write('<img src="/fileadmin/templates/fmh/images/Tstor.gif" border="0" ALT="Extra stor textstorlek visas nu!">');
	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
