﻿$(document).ready(function() {

// http://www.shopdev.co.uk/blog/text-resizing-with-jquery/

  var size = $.cookie('ate-fontsize')
  if (size != null)
  { 
	$("html").css({fontSize : size+ (size.indexOf("px")!=-1 ? "" : "px")}); // IE fix for double "pxpx" error
  }

  // Reset Font Size
  $(".resetFont").click(function(){
 	$('html').css('font-size', '16px');
 	
	SetFontSize($("html").css("font-size"));
  });
  
  // Increase Font Size
  $(".increaseFont").click(function(){
  	var currentFontSize = $('html').css('font-size');
 	var currentFontSizeNum = parseFloat(currentFontSize, 10);
    var newFontSize = currentFontSizeNum*1.2;
	$('html').css('font-size', newFontSize);
	
	SetFontSize($("html").css("font-size"));
	
	return false;
  });
  
  // Decrease Font Size
  $(".decreaseFont").click(function(){
  	var currentFontSize = $('html').css('font-size');
 	var currentFontSizeNum = parseFloat(currentFontSize, 10);
    var newFontSize = currentFontSizeNum*0.8;
	$('html').css('font-size', newFontSize);
	
	SetFontSize($("html").css("font-size"));
	  
	return false;
  });  
  

  

});


function SetFontSize(size) {
  $.cookie('ate-fontsize',size);
}

