var obj = null; var proj = 0; function checkHover() { if (obj) { obj.find('ul').fadeOut('fast'); } } function ufadeIn(num) { jQuery('.details').children('li:eq('+num+')').fadeIn(); } jQuery(function() { jQuery('.photo p').cycle({ fx: 'scrollRight', speed: 1000, timeout: 6000, next: '.nextproject' }); jQuery('.nextproject').click(function() { jQuery('.details').children('li:eq('+proj+')').fadeOut(400); proj++; var i = jQuery('.details li').size() - 1; if (proj>i) proj = 0; setTimeout('ufadeIn('+proj+')', 400); }); jQuery('#nav > li').hover( function() { if (obj) { obj.find('ul').css('display', 'none'); obj = null; } jQuery(this).find('ul').fadeIn(500); }, function() { obj = jQuery(this); setTimeout("checkHover()", 400); } ); }); function autoDetails() { jQuery('.details').children('li:eq('+proj+')').fadeOut(400); proj++; var i = jQuery('.details li').size() - 1; if (proj>i) proj = 0; setTimeout('ufadeIn('+proj+')', 400); } setInterval('autoDetails();', 6000);