 			
$(document).ready(function(){

	tooltip();
	
	$('#nojs').remove();
	setTimeout( function() { 
	//	$('#graphic').fadeIn(1800); 
		$('#graphic').stop().animate({'top' : '0px'},{duration:1200, easing:'easeOutExpo'});	
		$('#banner').fadeIn(1200); 		
	} , 300 );
	 
	 $('#vid-sc').click(function(){ $('#vid-play').click();}); 
	 
	$('#header>div>ul>li>a, #side>ul>li>a, ul.media>li, .blog>ul>li>ul>li>a ').append('<span>ogk</span>');
	$('.blank').click(function(){ window.open(this.href);return false });	

	$('#header>div>ul>li>a').hover(
		function(){$(this).find('span').stop(true,true).fadeTo(100, 1);}, 
		function(){$(this).find('span').stop(true,true).fadeTo(500, 0);}
	);
	$('ul.media>li').hover(
		function(){
			$(this).find('span').stop(true,true).fadeTo(100, 1);
			$(this).find('a').stop(true,true).fadeTo(100, .5);
		}, 
		function(){
			$(this).find('span').stop(true,true).fadeTo(500, .5);
			$(this).find('a').stop(true,true).fadeTo(500, 1);  
		});
	 	
	$('#nav a').hover(
		function(){$(this).stop().animate({'color' : '#fff'}, 50);}, 
		function(){$(this).stop().animate({'color' : '#666'}, 300);	
	});	
	
	$('.breadcrumbs>a').hover(
		function(){$(this).stop().animate({'color' : '#00ccff'}, 50);}, 
		function(){$(this).stop().animate({'color' : '#999'}, 300);	
	});	
	
	$('#header li a').hover(
		function(){$(this).stop().animate({'color' : '#00ccff'}, 50);}, 
		function(){$(this).stop().animate({'color' : '#fff'}, 300);	
	});	
	
	// Reset Search FIeld
	if ( $('#searchform').length ){		
		$('.fixsearch').click(function() { 
		if ($(this).val() == 'Type to search...') {   
			$(this).data('original', $(this).val()).val('');
		}
		});
		
		$('.fixsearch').blur(function() { 
			if ($(this).val() == '') {   
				$(this).val($(this).data('original'));
			}
		});
	}
	// Adjust Sub Nav Menu
	$('#menu-item-97').find('ul').addClass('showMenu');
	$('#menu-item-97>a').addClass('defaultOn');	
	$('#menu-item-107, #menu-item-113').mouseenter(function(){
			$('#menu-item-97').find('ul').removeClass('showMenu');
			$('#menu-item-97>a').removeClass('defaultOn');
	});
	$('#menu-item-107, #menu-item-113').mouseleave(function(){
			$('#menu-item-97').find('ul').addClass('showMenu');
			$('#menu-item-97>a').addClass('defaultOn');			
	});
	
	$('#side>ul>li>a, .blog>ul>li>ul>li>a').hover(
		function(){
			$(this).find('span').stop(true,true).fadeTo(100, 1);
			$(this).stop().animate({'color' : '#33ccff'}, 100);
		}, 
		function(){
			$(this).find('span').stop(true,true).fadeTo(800, 0);
			$(this).stop().animate({'color' : '#666'}, 800);			
	});	
	 	
	$('#callout a').hover(
		function(){
			$(this).find('strong').stop().animate({'color' : '#666'}, 100);
			$(this).find('span').stop().animate({'color' : '#333'}, 100);			
		}, 
		function(){
			$(this).find('strong').stop().animate({'color' : '#ccc'}, 500);	
			$(this).find('span').stop().animate({'color' : '#999'}, 500);				
	});		

	if($("#gal").length)
	{	
		$("a[rel=lbx]").fancybox({
				'transitionIn'		: 'fade',
				'transitionOut'		: 'none',
				'titlePosition' 	: 'over',
				'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
						return '<span id="fancybox-title-over">' +  (currentIndex + 1) + ' / ' + currentArray.length + '<\/span>';
			}			
		});
		$("a.iframe").fancybox({
			'width'				: 790,
			'height'			: '90%',
			'autoScale'			: false,
			'transitionIn'		: 'fade',
			'transitionOut'		: 'fade',
			'type'				: 'iframe',
			'scrolling'			: 'auto'	
		});		
	}


	$('img').each(function(index){
		
		$(this).load(function(){
			
		});
			
	});
	
	if( $('.blogtxt').length || $('.media').length ) {
		// Set fancybox to blog images
		var select = $('a[href$=".bmp"],a[href$=".gif"],a[href$=".jpg"],a[href$=".jpeg"],a[href$=".png"],a[href$=".BMP"],a[href$=".GIF"],a[href$=".JPG"],a[href$=".JPEG"],a[href$=".PNG"]');
		select.attr('rel', 'lbx');
		$("a[rel=lbx]").fancybox({
					'transitionIn'		: 'fade',
					'transitionOut'		: 'none',
					'titlePosition' 	: 'over',
					'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
							return '<span id="fancybox-title-over">' +  (currentIndex + 1) + ' / ' + currentArray.length + '<\/span>';
				}			
		});
	}	 
	if($("#main-banner").length)
	{
		
		
	 $('.slideshow').each(function(index) {
        $(this).cycle({
            pager:  '#pager-lg',
			next: '#hbc-pics',
            pagerAnchorBuilder: function(i) {
                if (index == 0)
                    // for first slideshow, return a new anchor
                    return '<a href="#">'+(i+1)+'</a>';
                // for 2nd slideshow, select the anchor created previously
                return '#pager-lg a:eq('+i+')';
            }
        });
    });
	

	/*	$('#hbcs').prepend('<div id="pager-lg"></div>');
		
		$('#main-banner').cycle({
				fx: 'fade',
				pager: '#pager-lg',
				slideExpr: 'div',
				timeout: 4200,
				speed: 1200,
				delay: 0
		});
		$('#hbc-txts').cycle({
				fx: 'scrollDown',
				pager: '#pager-lg',
				slideExpr: 'div',
				easing: 'easeInOutExpo',
				timeout: 4000,
				speed: 1400,
				delay: 0
		});
		$('#hbc-pics').cycle({
				fx: 'scrollUp',
				pager: '#pager-lg',
				slideExpr: 'div',
				easing: 'easeInOutExpo',
				timeout: 4200,
				speed: 1200,
				delay: 0
		});
		
		*/
		
			
		 $('.slideshow2').each(function(index) {
			$(this).cycle({
				pager:  '#pager-sm',
				rev: 1,
				slideExpr: 'li',
				next: '#hmwrapper',
				pagerAnchorBuilder: function(i) {
					if (index == 0)
						// for first slideshow, return a new anchor
						return '<a href="#">'+(i+1)+'</a>';
					// for 2nd slideshow, select the anchor created previously
					return '#pager-sm a:eq('+i+')';
				}
			});
		});
			
	}

});
 
