// JavaScript Document
//
//     JQuery Text resize + Cookie recall
//     by Jonny Kamaly
//     based on script written by Faisal &amp; Homar
//
 
 

 
jQuery(document).ready(function($){//Bill added
	
	var sitefunctions = {
		textresize : function(){
			// show text resizing links
			$(".FontSize").show();
			var $cookie_name = "RCJ-FontSize";
			var originalFontSize = $("body").css("font-size");
		
			// if exists load saved value, otherwise store it
			if($.cookie($cookie_name)) {
				var $getSize = $.cookie($cookie_name);
				$("body").css({fontSize : $getSize + ($getSize.indexOf("px")!=-1 ? "" : "px")}); // IE fix for double "pxpx" error
			} else {
				$.cookie($cookie_name, originalFontSize);
			}
			// reset link
			$(".FontSizeReset").bind("click", function() {
				$("body").css("font-size", originalFontSize);//This line not work Richard?
				$.cookie($cookie_name, originalFontSize);
			});
			// text "+" link
			$(".FontSizeInc").bind("click", function() {
				var currentFontSize = $("body").css("font-size");
				var currentFontSizeNum = parseFloat(currentFontSize, 10);
				var newFontSize = currentFontSizeNum+2;//could be *0.8
				if (newFontSize < 20) {
					//alert ("currentFontSize: " + currentFontSize + "  newFontSize: " + newFontSize);
					$("body").css("font-size", newFontSize +"px");//This line not work Richard?
					$.cookie($cookie_name, newFontSize);
				}
				return false;	
			});
			// text "-" link
			$(".FontSizeDec").bind("click", function() {
				var currentFontSize = $("body").css("font-size");
				var currentFontSizeNum = parseFloat(currentFontSize, 10);
				var newFontSize = currentFontSizeNum-2;//could be *0.8
				if (newFontSize > 8) {//was<20
					$("body").css("font-size", newFontSize);//This line not work Richard?
					$.cookie($cookie_name, newFontSize);
				}
				return false;
			});
		}
	}
	sitefunctions.textresize();	
		
})



