(function(a){a.fn.jshowoff=function(c){var b={animatePause:true,autoPlay:true,changeSpeed:2000,controls:true,controlText:{play:"Play",pause:"Pause",next:"Next",previous:"Previous"},effect:"fade",hoverPause:true,links:true,rss:true,speed:6000};if(c){a.extend(true,b,c)}if(b.speed<(b.changeSpeed+20)){alert("jShowOff: Make speed at least 20ms longer than changeSpeed; the fades aren't always right on time.");return this}this.each(function(t){var l=a(this);var d=a(this).children().remove();var p="";var o=0;var s=[];var j=a(".jshowoff").length+1;var m="jshowoff-"+j;var n=b.cssClass!=undefined?b.cssClass:"";l.css("position","relative").wrap('<div class="jshowoff '+m+'" />');var q=a("."+m);q.css("position","relative").addClass(n);a(d[0]).clone().appendTo(l);k();k();if(b.controls){v();if(b.autoPlay==false){a("."+m+"-play").addClass(m+"-paused jshowoff-paused").text(b.controlText.play)}}if(b.links){u();a("."+m+"-slidelinks a").eq(0).addClass(m+"-active jshowoff-active")}if(b.hoverPause){l.hover(function(){if(g()){h("hover")}},function(){if(g()){x("hover")}})}if(b.autoPlay&&d.length>1){p=setInterval(function(){x()},b.speed)}if(d.length<1){a("."+m).append("<p>For jShowOff to work, the container element must have child elements.</p>")}function e(z,B){var i=o;if((o>=z.length)||(B>=z.length)){o=0;var D=true}else{if((o<0)||(B<0)){o=z.length-1;var A=true}else{o=B}}if(b.effect=="slideLeft"){var E,F;function C(G){E=G=="right"?"left":"right";F=G=="left"?"left":"right"}o>=i?C("left"):C("right");a(z[o]).clone().appendTo(l).slideIt({direction:E,changeSpeed:b.changeSpeed});if(l.children().length>1){l.children().eq(0).css("position","absolute").slideIt({direction:F,showHide:"hide",changeSpeed:b.changeSpeed},function(){a(this).remove()})}}else{if(b.effect=="fade"){a(z[o]).clone().appendTo(l).hide().fadeIn(b.changeSpeed,function(){if(a.browser.msie){this.style.removeAttribute("filter")}});if(l.children().length>1){l.children().eq(0).css("position","absolute").fadeOut(b.changeSpeed,function(){a(this).remove()})}}else{if(b.effect=="none"){a(z[o]).clone().appendTo(l);if(l.children().length>1){l.children().eq(0).css("position","absolute").remove()}}}}if(b.links){a("."+m+"-active").removeClass(m+"-active jshowoff-active");a("."+m+"-slidelinks a").eq(o).addClass(m+"-active jshowoff-active")}}function g(){return a("."+m+"-play").hasClass("jshowoff-paused")?false:true}function x(i){if(!y()){o++;e(d,o);if(i=="hover"||!g()){p=setInterval(function(){x()},b.speed)}if(!g()){a("."+m+"-play").text(b.controlText.pause).removeClass("jshowoff-paused "+m+"-paused")}}}function h(i){clearInterval(p);if(!i||i=="playBtn"){a("."+m+"-play").text(b.controlText.play).addClass("jshowoff-paused "+m+"-paused")}if(b.animatePause&&i=="playBtn"){a('<p class="'+m+'-pausetext jshowoff-pausetext">'+b.controlText.pause+"</p>").css({fontSize:"62%",textAlign:"center",position:"absolute",top:"40%",lineHeight:"100%",width:"100%"}).appendTo(q).addClass(m+"pauseText").animate({fontSize:"600%",top:"30%",opacity:0},{duration:500,complete:function(){a(this).remove()}})}}function r(){w(o+1)}function f(){w(o-1)}function y(){return l.children().length>1?true:false}function w(i){l.children().stop(true,true);if((o!=i)||((o==i)&&y())){if(y()){l.children().eq(0).remove()}e(d,i);h()}}function k(){a(d).each(function(z){a(this).find("img").each(function(A){s[A]=a("<img>").attr("src",a(this).attr("src"))})})}function v(){q.append('<p class="jshowoff-controls '+m+'-controls"><a class="jshowoff-play '+m+'-play" href="#null">'+b.controlText.pause+'</a> <a class="jshowoff-prev '+m+'-prev" href="#null">'+b.controlText.previous+'</a> <a class="jshowoff-next '+m+'-next" href="#null">'+b.controlText.next+"</a></p>");a("."+m+"-controls a").each(function(){if(a(this).hasClass("jshowoff-play")){a(this).click(function(){g()?h("playBtn"):x();return false})}if(a(this).hasClass("jshowoff-prev")){a(this).click(function(){f();return false})}if(a(this).hasClass("jshowoff-next")){a(this).click(function(){r();return false})}})}function u(){q.append('<p class="jshowoff-slidelinks '+m+'-slidelinks"></p>');a.each(d,function(z,B){var A=a(this).attr("title")!=""?a(this).attr("title"):z+1;a('<a class="jshowoff-slidelink-'+z+" "+m+"-slidelink-"+z+'" href="#null">'+A+"</a>").bind("click",{index:z},function(i){w(i.data.index);return false}).appendTo("."+m+"-slidelinks")});if(b.rss){a('<a class="jshowoff-rss '+m+'-rss" href="/CWS_rss.aspx">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>').appendTo("."+m+"-slidelinks")}}});return this}})(jQuery);(function(a){a.fn.slideIt=function(c,d){var b={direction:"left",showHide:"show",changeSpeed:600};if(c){a.extend(b,c)}this.each(function(f){a(this).css({left:"auto",right:"auto",top:"auto",bottom:"auto"});var g=(b.direction=="left")||(b.direction=="right")?a(this).outerWidth():a(this).outerHeight();var e={};e.position=a(this).css("position")=="static"?"relative":a(this).css("position");e[b.direction]=(b.showHide=="show")?"-"+g+"px":0;var h={};h[b.direction]=b.showHide=="show"?0:"-"+g+"px";a(this).css(e).animate(h,b.changeSpeed,d)});return this}})(jQuery);
