
$(document).ready(function(){
	
	$("#loginSub").fadeOut(1);
	$("#contactSub").fadeOut(1);

	$("#topNav #tnLogin").hover(function () {
		$("#loginSub").stop().fadeIn(500, function(){
			$("#loginSub").css("opacity", 1);	
		});
	}, function (){
		$("#loginSub").fadeOut(200);
	});
	$("#topNav #tnContact").hover(function () {
		$("#contactSub").stop().fadeIn(500, function(){
			$("#contactSub").css("opacity", 1);	
		});
	}, function (){
		$("#contactSub").fadeOut(200);
	});

	
////////////////////////////////////////////////fade btns
	$('.fadeThis').append('<span class="hover"></span>').each(function () {
	  var $span = $('> span.hover', this).css('opacity', 0);
	


	  $(this).hover(function () {
			$span.stop().fadeTo(500, 1);
	  }, function () {
		  if ($(this).hasClass('.active')){
		  } else{
			$span.stop().fadeTo(500, 0); 
		  }
	  }); 
	  
	});





	
 ////////////////////////////////////////////////////////menu//////////////////////////
	function megaHoverOver(){
	
		var ah2 = $(this).find(".sub").height(); //grab height of sub
		$(this).find(".mDivider").css('height', ah2); //adjust main divider to submenu's height
		
		$(this).find(".sub").stop().fadeTo('fast', 1).show()
		
	}
	
	function megaHoverOut(){ 
	  $(this).find(".sub").stop().fadeTo('fast', 0, function() {
		  $(this).hide(); 
		  //$(this).css('z-index', '997');
	  });

	}
 
 
	var config = {    
		 sensitivity: 1, // number = sensitivity threshold (must be 1 or higher)    
		 interval: 10, // number = milliseconds for onMouseOver polling interval    
		 over: megaHoverOver, // function = onMouseOver callback (REQUIRED)    
		 timeout: 300, // number = milliseconds delay before onMouseOut    
		 out: megaHoverOut // function = onMouseOut callback (REQUIRED)    
	};

	
	$("#navBar li .sub").css({'opacity':'0'});
	$("#navBar li .sub").css({'display':'none'});
	$("#navBar li").hoverIntent(config);



//////////////////////////////////////////////////////////////////////////////
    $('.slideshow').cycle({
		pager:		'.slideShow',
		timeout:	8000,
		fx:			'fade',
		cleartypeNoBg: false,
		pause:		0	// stop slider on hover
	});
    $('.slideshowNews').cycle({
		pager:		'.slideShowNews',
		timeout:	8000,
		fx:			'fade',
		cleartypeNoBg: false,
		pause:		0	// stop slider on hover
	});

	
});


