﻿jQuery.noConflict();jQuery(document).ready(function(){		var $j = jQuery;	initjQuery();	// Init Function	function initjQuery()	{				// Setup all input text box to clear on focus		$j('input[type="text"]:not(.txtField)').each(function()		{			$j(this).autoSelect();		});						// Horizontal Scrollers		if ($j('.sliderHor').length > 0)		{			$j('.sliderHor').each(function()			{				var classnames = $j(this).attr('class');				var isAuto = matchString('autoSlide', classnames);				var isSwap = matchString('swapContent', classnames);				var isZoom = false;								var holder = $j(this).parent();								if ($j(this).parent().attr('class') == 'zoomSliderBound')				{					isZoom = true;					var html ='<div class="sliderHorZoom"><dl class="zoom"></dl></div>';					$j(this).parent().append(html);				}								$j(this).slider({autoSlide: isAuto});				if (isSwap) { $j('.slideItem', holder).swapContent({zoom: isZoom, container: holder, contentContainer: holder.next()}); }			});		}				//  Vertical Scrollers		if ($j('.sliderVert').length > 0)		{			$j('.sliderVert').each(function()			{ 				var classnames 	= $j(this).attr('class');				var isAuto 		= matchString('autoSlide', classnames);												$j(this).slider({direction: "vert", autoSlide: isAuto});			});		}									//  Create Tabs		if ($j('.tabs-holder').length > 0)		{			$j('.tabs-holder').each(function()			{				var id = $j(this).attr('id');								$j(this).CreateTabs({tabsID: id});			});		}				// Ajax Call		if ($j('.ajax').length > 0)		{			$j('.ajax').each(function()			{				var id = $j(this).attr('id');				var prevItem;								var openElement;								$j('li', this).hover(function()				{					$j('li.open').each(function()					{						openElement = $j(this);						$j(this).removeClass('open');					});										$j(this).addClass('hover');				}, function()				{					$j(this).removeClass('hover');					openElement.addClass('open');				}).click(function()				{					return false;				});								$j('a', this).each(function()				{					$j(this).css({cursor: 'pointer'});					var rel = $j(this).attr('href');					$j(this).attr('rel', rel);															if (rel != '/')					{						$j(this).click(function()						{							$j('li.open').each(function()							{								$j(this).removeClass('open');							});														$j(this).parents('li').addClass('open');							openElement = $j(this).parents('li');														if ($j(this).attr('class') != 'selected')							{								updateContent(rel, '#' + id + '-holder');								$j(this).addClass('selected');								if (prevItem) { prevItem.removeClass('selected'); }																prevItem = $j(this);							}							return false;						});					}				});			});		}				// Cover Flow		if ($j('.coverflow').length > 0)		{			$j('.coverflow').each(function()			{				$j('a', this).lightBox();				$j(this).CoverFlow({hasControls: true});			});		}	}		function updateContent(page, holder)	{	    $j(holder).html('<img src="/common/images/ajax-loader.gif" />');				$j.ajax(		{			url: 		page,			type: 		"GET",			cache:		false,			success: 	function(data)			{				$j(holder).html(data);				window.location = "#selected";			}		});	}		function matchString(keyword, string)	{		var arr = string.split(' ');		var i = 0;		var len_i = arr.length;		for (i; i < len_i; i++)		{			if (arr[i] == keyword)			{				return true;				break;			}		}		return false;	}
});
// IFT Namespace
IFT = {
	/*		 * FontSize		 * Adds user-defined font sizing to a page by detecting their preference;		 * either from a cookie or a click event from the toolbar. This will place		 * a classname of the desired font-size on the BODY tag. From there, you can		 * use the CSS cascade to attach page elements to the desired font preference.		 */
	FontSize: {
		/* 							 * changeFontSize							 * Applies the desired fontsize to the document.							 * @argument - String fontClass - the CSS classname to be applied to the body element.							 */
		changeFontSize: function(fontClass) {
			// update the fontsize class to the document body.
			jQuery('body').removeClass('txt-small txt-normal txt-large').addClass(fontClass);
			// update toolbar to indicate the current fontsize selection.
			jQuery('.fontsize li').each(function(i, item) {
				var btnContainer = jQuery(item);
				var btn = btnContainer.find('span');
				// if this button is the currently desired font, then update the UI
				if (btn.hasClass(fontClass)) {
					btnContainer.addClass('current');
				} else {
					// remove the current class
					btnContainer.removeClass('current');
				}
			});
			// store the fontsize preference for use between pages.
			jQuery.cookie('fontsize', fontClass);
		},
		/*							 * handleChangeFontSizeClick							 * Handles the click event when a user clicks on fontsize toolbar.							 * If the event target contains a classname that will effect the layout,							 * then call changeFontSize with the CSS classname.							 * @argument - Event e - the DOM click event fired.							 */
		handleChangeFontSizeClick: function(e) {
			var fontClass = undefined;
			if (jQuery(e.target).hasClass('txt-small')) {
				fontClass = 'txt-small';
			} else if (jQuery(e.target).hasClass('txt-normal')) {
				fontClass = 'txt-normal';
			} else if (jQuery(e.target).hasClass('txt-large')) {
				fontClass = 'txt-large';
			}
			// once we determine what fontsize is desired, update the UI.
			if (fontClass) {
				IFT.FontSize.changeFontSize(fontClass);
			}
		},
		// initialize the fontsize functionality
		init: function() {
			// attach event handlers
			jQuery('.fontsize').click(this.handleChangeFontSizeClick);
			// read user cookie for fontsize preferences
			if (jQuery.cookie('fontsize')) {
				IFT.FontSize.changeFontSize(jQuery.cookie('fontsize'));
			}
		}
	}, // end IFT.FontSize
	/*		 * RotateBanner		 * This adds functionality to the jquery.slideshow plugin. Basically, there's		 * no auto-rotate option in that plugin, so this adds a periodic click event to the		 * navigation buttons on the slideshow which fires periodically, causing a rotating slideshow.		 */
	RotateBanner: {
		btns: [],   // list of banner buttons
		current: 0, // pointer to current position in banner list
		/*					 * rotate					 * This function is called periodically to rotate the banner.					 * Based on the current position of the banner, it will trigger the 					 * click event on the next nav element. This winds up looking like a rotating slideshow.					 */
		rotate: function() {
			// trigger click event on slide nav item.
			jQuery(this.btns[this.current]).click();
			// if this is the end of the slideshow, reset the counter to the beginning.
			(this.current >= this.btns.length - 1) ? this.current = 0 : this.current++;
		},
		// initialize the banner rotator						
		init: function(interval) {
			// get the navigation buttons
			IFT.RotateBanner.btns = jQuery('.btn-banner li a');
			// Update current position counter when user clicks on nav item
			IFT.RotateBanner.btns.each(function(idx, item) {
				jQuery(item).click(function() {
					IFT.RotateBanner.current = idx;
				});
			});
			// call rotate every X seconds
			setInterval("IFT.RotateBanner.rotate()", interval);
		}
	},
	/*		 * Place dyanamic styling fixes here. 		 * Basically, there are some cases where you have to use JS to fix some layout bugs.		 * This is a placeholder for those cases.		 */
	postLoadRendering: {
		// IE6 fix for column height.				
		fixColumnHeights: function() {
			// if there is a col wrapper, get the heighest column
			var height = 0;
			// find the tallest column
			jQuery('.ctn-highlight .col3 .col').each(function(index, item) {
				var colHeight = jQuery(item).height();
				height = (height > colHeight) ? height : colHeight;
			});
			// update the column container to the tallest column height.
			jQuery('.ctn-highlight .col3').css("height", height);
		},
		init: function() {
			IFT.postLoadRendering.fixColumnHeights();
		}
	},
	// initialize IFT namespace
	init: function() {
		IFT.FontSize.init();
		IFT.postLoadRendering.init();
		//IFT.RotateBanner.init();
	}
}; // end IFT
// Wireup IFT to DOM Ready event.
jQuery(document).ready(IFT.init);

/** Begin: HoverIntent **/
jQuery(document).ready(function() {
	jQuery('#mainnav li').hoverIntent({
		over: hoverOver,
		timeout: 500,
		sensitivity: 1,
		out: hoverOut
	});
}); //close document ready

function hoverOver() { jQuery('ul', this).addClass('active'), jQuery(this).addClass('active') };
function hoverOut() { jQuery('ul', this).removeClass('active'), jQuery(this).removeClass('active') };
/** End: HoverIntent **/
