/* 091610 Red5 */
$(document).ready(function() {
		$('#quicklinks li a').mouseenter(function () {
		        var tooltip = $(this).children(':first-child');
		        //console.log(tooltip.height() + ' : ' + tooltip.css('top'));
		        tooltip.css({'top':( - (tooltip.height() + 20)),'display':'block'})
		});        
		$('#quicklinks li a').mouseleave(function () {
		        var tooltip = $(this).children(':first-child');
		        //console.log(tooltip.height() + ' : ' + tooltip.css('top'));
		        tooltip.css({'top':'-999px','display':'none'})
		}); 
		
    theRotator();		
		       
});



function theRotator() {
      $('div#subheadimg ul li').css({opacity: 0.0});
      var $imageArr = $('div#subheadimg ul li'),
      imageArrLength = $imageArr.length,
      randNum = Math.floor ( Math.random ( ) * imageArrLength + 1 );
      $imageArr.eq(randNum-1).css({opacity: 0.0}).addClass('show').animate({opacity: 1.0}, 1000);
    //$('div#subheadimg ul li:first').css({opacity: 1.0}); Use this to start at the begining  
    setInterval('rotate()',6000);
}

function rotate() {    
    var current = ($('div#subheadimg ul li.show')?  $('div#subheadimg ul li.show') : $('div#subheadimg ul li:first'));
    var next = ((current.next().length) ? ((current.next().hasClass('show')) ? $('div#subheadimg ul li:first') :current.next()) : $('div#subheadimg ul li:first'));    
	next.css({opacity: 0.0})
    .addClass('show')
    .animate({opacity: 1.0}, 1000);
    current.animate({opacity: 0.0}, 1000)
    .removeClass('show');
};


