jQuery.fn.slideshow=function(a){var b={fadetime:'slow',timeout:'2000',type:'sequence',pauselink:null,playcallback:null,pausecallback:null};if(a){jQuery.extend(b,a)}var c=0,current=1,last=0,timer='';var d=function(){if(c==0){for(var i=0;i<f.length;i++){jQuery(f[i]).css('display','none')}jQuery(f[last]).css('display','block').css('zIndex','0');jQuery(f[current]).css('zIndex','1').fadeIn(b.fadetime);if(b.type=='sequence'){if((current+1)<f.length){current=current+1;last=current-1}else{current=0;last=f.length-1}}else if(b.type=='random'){last=current;while(current==last){current=Math.floor(Math.random()*(f.length))}}else{alert('type must either be \'sequence\' or \'random\'')}timer=setTimeout(d,b.timeout)}};var e=function(){if(c==0){c=1;clearTimeout(timer);if(b.playcallback!=null){b.pausecallback(jQuery('#'+b.pauselink))}}else{c=0;d();if(b.playcallback!=null){b.playcallback(jQuery('#'+b.pauselink))}}return false};this.css('position','relative');var f=this.find('img').get();jQuery.each(f,function(i){jQuery(f[i]).css('zIndex',f.length-i).css('position','absolute').css('top','0').css('left','0')});if(b.type=='sequence'){timer=setTimeout(d,b.timeout)}else if(b.type=='random'){do{current=Math.floor(Math.random()*(f.length))}while(current==0);timer=setTimeout(d,b.timeout)}else{alert('type must either be \'sequence\' or \'random\'')}if(b.pauselink!=null){jQuery('#'+b.pauselink).click(e)}return this};
