﻿/*

Variables
	
*/
var startingFontSize = 12;
var minFontSize = 10;
var maxFontSize = 16;

/*

Runs when document has finished loading
	
*/
$(document).ready(function() {
	setInitialFontSize();
});


/*

Sets default font size

*/
function setDefaultFontSize() {

	$.cookie('currentFontSize', startingFontSize);
	$('#printArea').css('fontSize', startingFontSize + 'px');	
	$('#rightcolumnsection').css('fontSize', startingFontSize + 'px');
	
}


/*

Sets initial font size from cookie
	
*/
function setInitialFontSize() {

	var currentFontSize = startingFontSize;

	if ($.cookie('currentFontSize') != null)
		currentFontSize = $.cookie('currentFontSize');

	$('#printArea').css('fontSize', currentFontSize + 'px');
	$('#rightcolumnsection').css('fontSize', currentFontSize + 'px');

}

/*

Increases font size unless max has already reached

*/
function increaseFontSize() {

	var currentFontSize = startingFontSize;

	if ($.cookie('currentFontSize') != null)
		currentFontSize = $.cookie('currentFontSize');

	if (currentFontSize < maxFontSize) {
		currentFontSize++;
		$.cookie('currentFontSize', currentFontSize)
	}

	$('#printArea').css('fontSize', currentFontSize + 'px');
	$('#rightcolumnsection').css('fontSize', currentFontSize + 'px');

}

/*

Decreases font size unless min has already been reached

*/
function decreaseFontSize() {

	var currentFontSize = startingFontSize;

	if ($.cookie('currentFontSize') != null)
		currentFontSize = $.cookie('currentFontSize');

	if (currentFontSize > minFontSize) {
		currentFontSize--;
		$.cookie('currentFontSize', currentFontSize)
	}

	$('#printArea').css('fontSize', currentFontSize + 'px');
	$('#rightcolumnsection').css('fontSize', currentFontSize + 'px');

}