/**
 * Font object for handling font sizes
 */
var Font = {
	/**
	 * Acceptable sizes
	 */
	Sizes: new Array(100, 110, 120, 130, 140, 150),

	/**
	 * Currently selected size
	 */
	Current: 100,
	
	/**
	 * Function to make font sizes larger in the content area
	 */
	Larger: function() {
		// Find the current value
		for (var i = 0; i < this.Sizes.length; ++i) {
			// Skip
			if (this.Sizes[i] != this.Current)
				continue;
			
			// If we're on the last item, we can't get any larger...
			if (i == this.Sizes.length - 1)
				continue;
			
			// Make it larger
			this.Set(this.Sizes[i + 1]);
			return;
		}
	},
	
	/**
	 * Function to make font sizes smaller in the content area
	 */
	Smaller: function() {
		// Find the current value
		for (var i = 0; i < this.Sizes.length; ++i) {
			// Skip
			if (this.Sizes[i] != this.Current)
				continue;
			
			// If we're on the first item, we can't get any smaller...
			if (!i)
				continue;
			
			// Make it smaller
			this.Set(this.Sizes[i - 1]);
			return;
		}
	},
	
	/**
	 * Sets the new size of the content area
	 */
	Set: function(new_size) {
		this.Current = new_size;
		Cookie.Set('fontSize', this.Current, 30, '/', '', '');
		$('#content').css('font-size', new_size + '%');
	}
}

// Initialize the font engine
if (Cookie && Cookie.Get('fontSize') > 0)
	$(document).ready(function() {
		Font.Set(Cookie.Get('fontSize'));
	});

