/*
 *  UPDATED: 01.30.09 | 1:00 PM
 *
 *  This class will create a fade in slide show and will preload the next image.
 *  It requires 2 parameters: the ID of the slide show image, and an array of the images (or an array of objects with img and file propeties).
 *  All images must be the same size.
 * 
 *  Options {
 *		speed: 9 		// Seconds each image is on screen	 
 *	 	duration: 1 	// Seconds of fade between images
 *  }
 *  
 *  Exapmle: 
 *  var myShow = WSC.SlideShow('show2',Slide2, {speed: 5, duration: 2});
 *  
 * ------------------------------------------------------------------------------------------------ */
if(!window.WSC){var WSC={}}(function(a){WSC.SlideShow=function(j,d){var p=a.extend({speed:9,duration:1},arguments[2]||{});var m=null;var c=null;var e=null;var l=(typeof d[0]=="object"&&d[0].link!="undefined");var o=(typeof d[0]=="object"&&d[0].img!="undefined");var b=0;var h=false;var g=null;var k=function(){c=a("#"+j).wrap('<div style="position:relative;z-index:1;"></div');e=c.clone().attr("id","").css({opacity:0});e.css({left:0,top:0,position:"absolute",zIndex:2}).insertAfter(c);if(l&&c.parent().parent()[0].tagName.toUpperCase()=="A"){m=c.parent().parent()}f()};var f=function(){e.attr("src",(d[b].img)?d[b].img:d[b]);i();if(!g){g=setInterval(i,p.speed*1000)}};var n=function(){clearInterval(g);g=null};var i=function(){var q=(o)?d[b].img:d[b];e.attr("src",q);e.animate({opacity:1},p.duration*1000,function(){c.attr("src",q).load(function(){e.css({opacity:0})});if(m){m.attr("href",d[b].link)}if(!h){if(b<d.lenth-1){var r=new Image();r.src=(o)?d[b+1].img:d[b+1]}else{h=true}}b++;if(b==d.length){b=0}})};a(function(){k()});return{Start:function(){f()},Stop:function(){n()},Show:function(q){n();b=q;f();n()}}}})(jQuery);
