﻿/* Adapted from http://www.mredesign.com/ */
/* Easy text Resizer with jQuery */

function textResize(id){
//alert('tell me');
$(id).click(function(){

//set the div with class mainText as a var called $mainText 
var $container = $('div#container');
// set the current font size of .mainText as a var called currentSize
var currentSize = $container.css('font-size');
// parse the number value out of the font size value, set as a var called 'num'
var num = parseFloat(currentSize, 10);
// make sure current size is 2 digit number, save as var called 'unit'
var unit = currentSize.slice(-2);
// javascript lets us choose which link was clicked, by ID
if (this.id == 'linkLarge'){
num = num * 1.2;
} else if (this.id == 'linkSmall'){
num = num / 1.2;
}
// jQuery lets us set the font Size value of the mainText div
$container.css('font-size', num + unit);
createCookie('tsCookie', num, 100);
   return false; 
});
}

function setTextsize(unit){
//Read Cookie
var cookie = readCookie ('tsCookie');
//alert(cookie);
if (cookie){
var num = parseFloat(cookie, 10);
//set the div with class mainText as a var called $mainText 
var $container = $('div#container');
// jQuery lets us set the font Size value of the mainText div
$container.css('font-size', num + unit);
}
}

