// following two functions kindly provided by Jonathan Howard $.fn.pause = function(milli,type) { milli = milli || 1000; type = type || "fx"; return this.queue(type,function(){ var self = this; setTimeout(function(){ $(self).dequeue(); },milli); }); }; $.fn.clearQueue = $.fn.unpause = function(type) { return this.each(function(){ type = type || "fx"; if(this.queue && this.queue[type]) { this.queue[type].length = 0; } }); }; /////////// var numpics; $(document).ready(function(){ numpics = $('.fadepic').length; $('.fadepic').hide(); $('.rolloverimage').fadeTo(1, 0.5); $(".rolloverimage").hover( function () { $(this).fadeTo(1, 0.999); },function(){ $(this).fadeTo(1, 0.5); } ); // trigger off the fading setTimeout("fade()", 13); }); var lastnumber = 1; function fade() { var timeperpic = 2500; setTimeout('fade()', timeperpic * 2); var random = Math.ceil(Math.random() * numpics); if (random == lastnumber) { random++; } if (random > numpics) { random = 1; } lastnumber = random; $('#pic' + random).fadeIn(timeperpic).pause(timeperpic).fadeOut(timeperpic); //alert(random); /* var randompic = Math.floor((Math.random() * 7) + 1); $('#sidepic').html(''); $('#sidepic').pause(40).fadeIn(1500); */ }