
//<![CDATA[
	 $(document).ready(function(){
	        //HOME PAGE AUTO SCROLL BUG FIX
			
			var easingDuration = 600;
			$('#sub-footer-section ul.nav a').bind('click', function(e) {
				if ($(window).height() <= 768) {
					if ($(window).scrollTop() < 400) {
						
						$.scrollTo( {top:400,left:0}, easingDuration, {axis : 'y' } );
						//alert('height: ' + $(window).height() + ' screen pos: ' + $("#sub-footer-section ul.nav").offset().top + ' window: ' + $(window).scrollTop()  );
					}
				}
			
			});
			
			
			// BANNER SCROLLING
			if ( $('ul#slide-list li').children().size() > 1)
				InitializeBannerScroll();
			var maxHeight = 0; 
			var maxDDHeight = 0;
			var totalDTHeight = 0;
			$('ul.content-panes li').each(function(index) {

				if ($(this).height() > maxHeight) {
					if ($(this).hasClass('faqs')) {
						$(this).find('dl.faq-list dd').each(function(index) {
							
							if ($(this).height() > maxDDHeight )
								maxDDHeight = $(this).outerHeight();
						});
						
						$(this).find('dl.faq-list dt').each(function(index) {
							totalDTHeight += $(this).outerHeight();
						});
						maxHeight = totalDTHeight + maxDDHeight;
						
					} else {
						
						maxHeight = $(this).height();
					}
				}	
					
			});
			
			
			/*
			TABS
			*/
			/*
			if (enableSubSectHeight)
				$('ul.content-panes').height(maxHeight + 20 );
			$('ul.content-panes li').addClass('hidden');
			$('ul.content-panes li').first().removeClass('hidden');
			$('ul.content-panes li').first().addClass('current');
			
			var curTabID;
			curTabID = $('#sub-footer-section ul.nav li:first-child a').attr('id');

			var class_;
			$('#sub-footer-section ul.nav a').bind('click', function(e) {
				e.preventDefault();
				if ($(this).attr('id') !=  curTabID) {
					class_ = $(this).attr('class');
					$('ul.content-panes li.content-pane-item ').each(function(index) {
	
						$(this).addClass('hidden'); 
	
					});
					$('#sub-footer-section ul.nav a').each(function(index) {
	
						$(this).removeClass('current'); 
	
					});
					$('ul.content-panes li.content-pane-item.' + class_).removeClass('hidden');
					$('#sub-footer-section ul.nav a.' + class_).addClass('current');
					curTabID = $(this).attr('id');
				}
			});
			*/

       });

    var scrollTimer;
	var scrollTimerInterval = 7000;
	var scrollPos = 480;
	var segmentLength = 480;
	var segmentCount;
	var direction = -1;
	var firstFlag = 1;
	var SlideNav = new Object();

	function InitializeBannerScroll() {
		segmentCount = $('ul#slide-list').children().length; 

		$('ul#slide-list').css('width', (segmentCount * segmentLength) );

		scrollTimer = window.setInterval( "MoveScroll()", scrollTimerInterval );

		var classString;

		for (i=0;i< segmentCount ;i++)

		{

			SlideNav[(i * segmentLength ) + ''] = '#banner-' + (i + 1) + '-button';

			if (!i) 

				classString = 'banner-button active';

			else

				classString = 'banner-button';

			$('#banner-controls').append("<li><a id='banner-" + (i + 1) + "-button' rel='" + (i * segmentLength ) + "' class='" + classString + "' href='#'>" + (i + 1) + "</a> </li>");

		}

		$('.banner-button').bind('click', function() {

			SlideNavClicked( $(this).attr("rel")  );

		});

	}

	function MoveScroll() {

		$('.banner-button').removeClass('active');

		if (firstFlag) {
			scrollPos = scrollPos + (segmentLength * direction * 2);
			firstFlag = 0;	
		} else
			scrollPos = scrollPos + (segmentLength * direction);

		if (scrollPos >= (segmentLength * segmentCount) || scrollPos < 0  ) {
			direction *= -1; 
			scrollPos = scrollPos + (segmentLength * direction * 2);
		}
		
		$('#slide-list').fadeOut('fast', function() {
			$('#slide-list').css('left' , '-' + scrollPos + 'px');
			UpdateSlideNav(scrollPos);
		});

		$('#slide-list').fadeIn('fast', function() {
			// Animation complete
		});
	
	}

	function UpdateSlideNav(theScrollPos) {

		$(SlideNav[theScrollPos]).addClass('active');

	}

 	function SlideNavClicked(theScrollPos) {

		clearInterval(scrollTimer);

		$('#slide-list').stop(true, true);

		$('.banner-button').removeClass('active');

		$('#slide-list').fadeOut('fast', function() {

			$('#slide-list').css('left' , '-' + theScrollPos + 'px');

		});

		$('#slide-list').fadeIn('fast', function() {

			// Animation complete

		});

		scrollPos = parseInt(theScrollPos) ;

		UpdateSlideNav(parseInt(theScrollPos));

		scrollTimer = window.setInterval( "MoveScroll()", scrollTimerInterval );

	}

//]]>



