
/*
	PRELOAD ROLLOVER IMAGES
	-------------------------------------------------------------------------
*/

	jQuery.preloadImages = function()
	{
	  for(var i = 0; i<arguments.length; i++)
	  {
		jQuery("<img>").attr("src", arguments[i]);
	  }
	}

	$.preloadImages(

		"/images/logo_circle.gif"

	);




/*
	COOKIE MANAGEMENT
	-------------------------------------------------------------------------
*/

	function createCookie(name,value,days) {
		if (days) {
			var date = new Date();
			date.setTime(date.getTime()+(days*24*60*60*1000));
			var expires = "; expires="+date.toGMTString();
		}
		else var expires = "";
		document.cookie = name+"="+value+expires+"; path=/";
	}

	function readCookie(name) {
		var nameEQ = name + "=";
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++) {
			var c = ca[i];
			while (c.charAt(0)==' ') c = c.substring(1,c.length);
			if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
		}
		return null;
	}

	function eraseCookie(name) {
		createCookie(name,"",-1);
	}



/*
	FONT SIZE CHANGE
	-------------------------------------------------------------------------
*/

	var tags = [ 'div', 'p', 'li', 'input', 'font', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'h7' ];

	// initialize the jquery code
	$(document).ready(

		function()
		{
			// changer links when clicked
			$("a.FontChanger").click(
			
				function()
				{
					for (var x = 0; x < tags.length; x++)
					{
						if ( $(tags[x] + '.SizableText').length > 0 )
						{
							//set the div with class mainText as a var called $mainText 
							var $mainText = $(tags[x] + '.SizableText');

							// set the current font size of .mainText as a var called currentSize
							var currentSize = $mainText.css('font-size');

							// 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);

							// set the current line height of .mainText as a var called currentLH
							var currentLH = $mainText.css('line-height');

							// parse the number value out of the line-height value, set as a var called 'numLH'
							var numLH = parseFloat(currentLH, 10);

							// make sure current line height is 2 digit number, save as var called 'unitLH'
							var unitLH = currentLH.slice(-2);

							// javascript lets us choose which link was clicked, by ID
							if (this.id == 'LargerFont')
							{
								num = num * 1.2;
								numLH = numLH * 1.2;
								
								createCookie("jQueryFontSize" + tags[x], num, 30);
								createCookie("jQueryFontLineHeight" + tags[x], numLH, 30);

								// jQuery lets us set the font Size value of the mainText div
								$mainText.css('font-size', num + unit);

								// jQuery lets us set the line height value of the mainText div
								$mainText.css('line-height', numLH + unitLH);
							}
							else if (this.id == 'SmallerFont')
							{
								for (var x = 0; x < tags.length; x++)
								{
									eraseCookie("jQueryFontSize" + tags[x]);
									eraseCookie("jQueryFontLineHeight" + tags[x]);
								}

								window.history.go(0);									

								/*
								num = num / 1.2;
								numLH = numLH / 1.2;

								createCookie("jQueryFontSize" + tags[x], num, 30);
								createCookie("jQueryFontLineHeight" + tags[x], numLH, 30);

								// jQuery lets us set the font Size value of the mainText div
								$mainText.css('font-size', num + unit);

								// jQuery lets us set the line height value of the mainText div
								$mainText.css('line-height', numLH + unitLH);
								*/
							}
						}
					}
				
					return false;
				}
			);
		}
	);

	function SetFontSize()
	{
		for (var x = 0; x < tags.length; x++)
		{
			if (readCookie("jQueryFontSize" + tags[x]) != null && readCookie("jQueryFontLineHeight" + tags[x]) != null)
			{
				if (readCookie("jQueryFontSize" + tags[x]).length > 0 && readCookie("jQueryFontLineHeight" + tags[x]).length > 0)
				{
					if ( $(tags[x] + '.SizableText').length > 0 )
					{
						var $mainText = $(tags[x] + '.SizableText');

						var num = parseFloat(readCookie("jQueryFontSize" + tags[x]), 10);
						var numLH = parseFloat(readCookie("jQueryFontLineHeight" + tags[x]), 10);

						var currentSize = $mainText.css('font-size');
						var currentLH = $mainText.css('line-height');

						var unit = currentSize.slice(-2);
						var unitLH = currentLH.slice(-2);

						// jQuery lets us set the font Size value of the mainText div
						$mainText.css('font-size', num + unit);

						// jQuery lets us set the line height value of the mainText div
						$mainText.css('line-height', numLH + unitLH);
					}
				}			
			}
		}
	}

