/**
 * jQuery Plugin by Jorge H. Morales www.jhmorales.es 17/01/2009 
 * * Copyright (c) 2009 Jorge H. Morales (www.jhmorales.es). GPL License.
 * * http://www.gnu.org/licenses/gpl.html
 * (original version in spanish fontReSizer.js) *  based on http://www.shopdev.co.uk/blog/text-resizing-with-jquery/ 						
*/
$(function(){
var initialFontSize=16,minFontSize=12;maxFontSize=28,siteName="www.reumabond.nl",eParent="#sizer",eSon="div:first";
$(eSon,(eParent)).before("<div id='changeFontSize'><p><a href='#' id='initialFontSize'></a><a href='#' id='decreaseFont'>-a&nbsp;</a><a href='#' id='resetFont'>&nbsp;a&nbsp;</a><a href='#' id='increaseFont'>&nbsp;a+</a></p></div>");
$("#changeFontSize") .css("position", "relative") .css("top", "-4px") .css("z-index",999) .css("width","auto") .css("height","auto") .css("margin", "0 11px 16px 0") .css("text-align","right")
$("#changeFontSize a") .css("display", "inline-block") .css("padding", 2) .css("margin", "1%") .css("width", "auto") .css("font","bold 13px Verdana") .css("text-decoration","none") .css("text-transform","uppercase") .css("text-align","center") .css("color","white") .css("background-color", "#73162e")
var screenWidth=screen.availWidth,CalcQuotient=screenWidth/initialFontSize;
if (screenWidth < 1100) { fontHeight = screenWidth / CalcQuotient; }
else { fontHeight = screenWidth / (CalcQuotient/1.2);}
if ($.browser.msie){if(screenWidth<1100){fontHeight=screenWidth/CalcQuotient; }else{fontHeight=screenWidth/(CalcQuotient/1.2);}}
$("body").css("font-size", "62.5%"); $("a:last",("#changeFontSize")).after("<div></div>").css("clear","both"); $("#changeFontSize").show();
var $cookieName = siteName + "-changeFontSize";
if ($.cookies.get($cookieName)) { var $getSize = $.cookies.get($cookieName); $("html").css({fontSize: $getSize + ($getSize.indexOf("px") != -1 ? "" : "px")}); }
else { $.cookies.set($cookieName, fontHeight, { expires: 30 }); }
$("#resetFont").bind("click", function(){ $("html").css("font-size", fontHeight); $.cookies.set($cookieName, fontHeight, { expires: 30 }); });
$("#increaseFont").bind("click", function(){ var actualFontHeight = $("html").css("font-size"); var actualFontHeightNum = parseFloat(actualFontHeight, 10); var newFontHeight = actualFontHeightNum * 1.1; 
 if (newFontHeight < maxFontSize) { $("html").css("font-size", newFontHeight); $.cookies.set($cookieName, newFontHeight, { expires: 30 }); } return false; });
$("#decreaseFont").bind("click", function(){ var actualFontHeight = $("html").css("font-size"); var actualFontHeightNum = parseFloat(actualFontHeight, 10); var newFontHeight = actualFontHeightNum * 0.9; 
	if (newFontHeight > minFontSize) { $("html").css("font-size", newFontHeight); $.cookies.set($cookieName, newFontHeight, { expires: 30 }); }
    return false; });
$("#initialFontSize").css("visibility", "hidden").css("font-size", 0).css("padding", 0).css("margin", 0).css("width",0);
$("#initialFontSize").bind("click", function(){ var $getSize = $.cookies.get($cookieName); var prevFontHeight = $getSize + ($getSize.indexOf("px") != -1 ? "" : "px"); 
 $("html").css("font-size", prevFontHeight); $.cookies.set($cookieName, prevFontHeight, { expires: 30 }); });
 if ($.cookies.get($cookieName)) { $("#initialFontSize").click();}
 else { $("#resetFont").click(); }
});
