var autoTimerId = -1;

    jQuery(document).ready(function(jQuery) {       
        jQuery("#rotate > div:eq(1) > a").click(function(){rotate()});       
        jQuery("#rotate").hover(function() {jQuery("#rotate > div:eq(1) > a > img").show();clearInterval(autoTimerId)}, function() {jQuery("#rotate > div:eq(1) > a > img").hide();clearInterval(autoTimerId);autoTimerId = setInterval("rotate()", 5000)});
        autoTimerId = setInterval("rotate()", 5000);        
        jQuery("#rotate > div:eq(1) > a > img").mousedown(function(){jQuery("#rotate > div:eq(1) > a > img").attr({src : "http://www.popmag.com.au/blog/wp-content/themes/chinatown/images/arrow_down.png"})}).mouseup(function(){jQuery("#rotate > div:eq(1) > a > img").attr({src : "http://www.popmag.com.au/blog/wp-content/themes/chinatown/images/arrow_over.png"})});
        jQuery("#rotate > div:eq(1) > a > img").hide();
    });

    function rotate(){
        //rotate right list
        jQuery("#rotate > div:eq(1) > ul > li:last").insertBefore("#rotate > div:eq(1) > ul > li:first");
        jQuery("#rotate > div:eq(1) > ul").css("top","-100px").animate({top:"0px"},500); 

        //crossfade left image
        if (jQuery('div.fade > div').is(':animated')) {  
          jQuery('div.fade > div').stop().fadeTo(250, 1, function(){setUpNextImgForCrossFade()});
        } else {    
          jQuery('div.fade > div').fadeIn(250, function(){setUpNextImgForCrossFade()});
        }
    }
    
    function setUpNextImgForCrossFade(){
          jQuery('div.fade > a > img').attr('src', jQuery("#rotate > div:eq(1) > ul > li:eq(3) > a > img").attr('src'));
          jQuery('div.fade > a').attr('href', jQuery("#rotate > div:eq(1) > ul > li:eq(3) > a").attr('href'));
          jQuery('div.fade > div').hide();
          jQuery('div.fade > div > a > img').attr('src', jQuery("#rotate > div:eq(1) > ul > li:eq(2) > a > img").attr('src')); 
          jQuery('div.fade > div > a').attr('href', jQuery("#rotate > div:eq(1) > ul > li:eq(2) > a").attr('href')); 
    }