﻿function init() {
    var $mainText = $('#content');
    var currentSize = getCookie('content_fontsize')
    if (currentSize != null)
        $mainText.css('font-size', currentSize);
}


// initialize the jquery code
$(document).ready(function() {
    $(document).load(init());

    // changer links when clicked
    $("a.changer").click(function() {
    var $mainText = $('#content');
        //get font size from cookie
        var currentSize = getCookie('content_fontsize');
        if (currentSize == null)
            currentSize = $mainText.css('font-size');

        // set the current font size of .mainText as a var called currentSize
        // 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
        $mainText.css('font-size', num + unit);
        setCookie('content_fontsize', num + unit);
        return false;
    }
		);
    // hover for links - toggle css background colors
    /*
    $("img.changer").hover(function()
    {
    $(this).css('background-color', '#53ABD8');
    }, 
    function()
    {
    $(this).css('background-color', '#ffffff');
    }
    );
    */
}
);
