/* 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
		// **********************************************************************
		
		$('h1').corner("round 14px");
		$('h2').corner("round 14px");
		$('h3').corner("round 10px");
		$('#expiryAlert').corner("round 14px");
		$('#expiryAlertReduced').corner("round 14px");
		$('#expiryAlertSMSBox').corner("round 10px");
		$('#expiryAlertExample').corner("round 10px");
	}
	
	$.raisedParagraph = function() {
		// ********************************************************************** 
		// Increases the size of the first paragraph
		// **********************************************************************
		
		$('#content p:first').css('font-size','1.2em');
	}
	
	$.fontSize = function() {
		// ********************************************************************** 
		// If the fontsize cookie is set then the site fontsize is increased
		// **********************************************************************
		
		if ($.cookie('fontsize') == "1") {
			$('body').css("font-size","1.1em");
		} else if ($.cookie('fontsize') == "2") {
			$('body').css("font-size","1.2em");
		}	
	}
	
	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");
		} else if (i == '2') {
			$.cookie('fontsize','2');
			$('body').css("font-size","1.2em");
		} else { 
			$.cookie('fontsize', null);
			$('body').css("font-size","1em");
		}
	}
	
	$.createFontSizeLinks = function() {
		// ********************************************************************** 
		// Attaches events to the font sizing links
		// **********************************************************************
		
		$('#fontSize0').bind('click',function(event) {
			saveFontSize('0');
		});
		
		$('#fontSize1').bind('click',function(event) {
			saveFontSize('1');
		});
		
		$('#fontSize2').bind('click',function(event) {
			saveFontSize('2');
		});
	}
	
	
})(jQuery);