/* Copyright (c) 2009 WhiteInteractive
 *
 * Version: 4.0
 *
 * Requires: jQuery 1.3.1+, jQuery Cookie plugin
 */

(function($){

	$.roundedCorners = function() {
		// ********************************************************************** 
		// Adds rounded corners to boxes that require it
		// **********************************************************************
		
		$('#navigation ul li').corner("round bl 6px");
	}
	
	$.presentation = function() {
		// ********************************************************************** 
		// Visual adjustments to fix browser or styling issues
		// **********************************************************************
		
		// Close the gap after the final navigation list item
		$('#navigation ul li:last').css("margin-bottom","0px");
		
		// Fix the extra margin problem in lists with older version of IE
		if ($.browser.msie) {
			if($.browser.version == "6.0" || $.browser.version == "7.0") {
				$('#navigation ul li').css("margin-bottom","1px");
			}
		}
	}

	$.fontSize = function() {
		// ********************************************************************** 
		// If the fontsize cookie is set then the site fontsize is increased
		// **********************************************************************
		
		if ($.cookie('fontsize') == "1") {
			$('body').css("font-size","1.1em");
			$('#lstTextSize').val('1');
		} else if ($.cookie('fontsize') == "2") {
			$('body').css("font-size","1.2em");
			$('#lstTextSize').val('2');
			$('#footer').css("height","310px");
			$('#footerInner').css("height","310px");
		}	
	}
	
	function saveFontSize(i) {
		// ********************************************************************** 
		// Saves the font size as a cookie or deletes as appropriate
		// **********************************************************************
		
		if (i == '1') {
			$.cookie('fontsize','1');
			$('body').css("font-size","1.1em");
			$('#footer').css("height","290px");
			$('#footerInner').css("height","290px");
		} else if (i == '2') {
			$.cookie('fontsize','2');
			$('body').css("font-size","1.2em");
			$('#footer').css("height","310px");
			$('#footerInner').css("height","310px");
		} else { 
			$.cookie('fontsize', null);
			$('body').css("font-size","1em");
			$('#footer').css("height","290px");
			$('#footerInner').css("height","290px");
		}
	}
	
	$.createFontSizeLinks = function() {
		// ********************************************************************** 
		// Attaches events to the font sizing links
		// **********************************************************************
		
		$('#lstTextSize').bind('change',function(event) {
			saveFontSize($(this).val());
		});
	}
	
	
})(jQuery);
