(function(c){c.fn.showcase=function(d){if(a[d]){return a[d].apply(this,Array.prototype.slice.call(arguments,1))}else{if(typeof d==="object"||!d){return a.init.apply(this,arguments)}else{c.error("Method "+d+" does not exist on jQuery.plugin")}}};c.fn.showcase.debug=false;c.fn.showcase.defaults={autoPlay:true,speed:4000,transitionTime:1200,controls:true,first:"random",play:function(){return true},pause:function(){return true},next:function(){return true},previous:function(){return true}};var a={init:function(d){var d=c.extend({},c.fn.showcase.defaults,d);return this.each(function(){var m=c(this);b("$('#"+m.attr("id")+"').showcase('init')");var f=m.data("showcase");if(!f){m.css({position:"relative"});var j=m.children("div:not(.showcase-controls)");j.css({position:"absolute",display:"none","z-index":"0"});if(m.has(".showcase-controls").length){b("Showcase: Configuring custom controls ...");c(".showcase-controls",m).css({position:"absolute","z-index":"3"})}else{if(d.controls){b("Showcase: Enabling default controls");var k=c("<div/>",{"class":"showcase-controls",style:"position: absolute; z-index: 3; bottom: 0; right: 0;"});var o=c("<button/>",{"class":"showcase-button-previous",text:"Previous",click:function(){m.showcase("previous")}});var h=c("<button/>",{"class":"showcase-button-play",text:"Play"});var n=c("<button/>",{"class":"showcase-button-next",text:"Next",click:function(){m.showcase("next")}});m.append(k);c(".showcase-controls",m).append(o);c(".showcase-controls",m).append(h);c(".showcase-controls",m).append(n);c(".showcase-button-previous",m).button({text:false,icons:{primary:"ui-icon-seek-prev"}});c(".showcase-button-play",m).button({text:false,icons:{primary:"ui-icon-play"}}).click(function(){var i;if(c(this).text()=="Play"){m.showcase("advance");m.showcase("play");i={label:"Pause",icons:{primary:"ui-icon-pause"}}}else{m.showcase("pause");i={label:"Play",icons:{primary:"ui-icon-play"}}}c(this).button("option",i)});c(".showcase-button-next",m).button({text:false,icons:{primary:"ui-icon-seek-next"}})}}var g=j.length;var e;if(d.first=="random"){e=Math.floor(Math.random()*g)}else{if(!isNaN(parseInt(d.first))){e=parseInt(d.first)}else{e=0}}j.eq(e).css({display:"block","z-index":"2"});c(this).data("showcase",{target:m,options:d,items:j,count:g,i:e,intervalId:null});if(d.autoPlay==true){b("Showcase: Auto Playing...");m.showcase("play");var l={label:"Pause",icons:{primary:"ui-icon-pause"}};c(".showcase-button-play",m).button("option",l)}}})},get:function(d){var f=c(this);var e=f.data("showcase");if(e){if(d=="status"){if(e.intervalId==null){return"paused"}else{return"playing"}}else{if(d=="page"){return e.i}else{c.error("Showcase: Invalid key '"+d+"'")}}}else{c.error("Showcase plugin has not been initialized for this element")}},destroy:function(){return this.each(function(){var e=c(this);b("$('#"+e.attr("id")+"').showcase('destroy')");var d=e.data("showcase");if(d){if(d.intervalId!=null){clearInterval(d.intervalId)}if(d.options.controls){b("Showcase: Destroy: Tearning down default controls");c(".showcase-controls").remove()}}e.unbind(".showcase");e.removeData("showcase")})},play:function(){return this.each(function(){var g=c(this);b("$('#"+g.attr("id")+"').showcase('play')");var f=g.data("showcase");if(f){if(f.intervalId==null){var e=jQuery.Event("showcaseplay");if(typeof f.options.play=="function"){f.options.play(e)}g.trigger(e);var d=setInterval(function(){g.showcase("advance")},(f.options.speed+f.options.transitionTime));f.intervalId=d}else{c.error("This target's showcase plugin is already playing")}}else{c.error("Showcase plugin has not been initialized for this element")}})},pause:function(){return this.each(function(){var f=c(this);b("$('#"+f.attr("id")+"').showcase('pause')");var e=f.data("showcase");if(e){if(e.intervalId!=null){var d=jQuery.Event("showcasepause");if(typeof e.options.pause=="function"){e.options.pause(d)}f.trigger(d);clearInterval(e.intervalId);e.intervalId=null}else{c.error("This target's showcase plugin is already paused")}}else{c.error("Showcase plugin has not been initialized for this element")}})},next:function(){return this.each(function(){var h=c(this);b("$('#"+h.attr("id")+"').showcase('next')");var g=h.data("showcase");if(g){var f=g.i;var d=((f+1)<g.count)?(f+1):0;var j=g.items;g.i=d;var e=jQuery.Event("showcasenext");e.nextI=d;if(typeof g.options.next=="function"){g.options.next(e)}h.trigger(e);j.filter(":animated").each(function(l,k){c(k).stop(true,false);c(k).css("opacity","0")});j.eq(d).css({"z-index":"2",display:"block",opacity:"1.0"});j.eq(f).css({"z-index":"0",display:"none",opacity:"1.0"});if(h.showcase("get","status")=="playing"){clearInterval(g.intervalId);g.intervalId=setInterval(function(){h.showcase("advance")},(g.options.speed+g.options.transitionTime))}}else{c.error("Showcase plugin has not been initialized for this element")}})},previous:function(){return this.each(function(){var h=c(this);b("$('#"+h.attr("id")+"').showcase('previous')");var g=h.data("showcase");if(g){var f=g.i;var d=(f>0)?(f-1):(g.count-1);var j=g.items;g.i=d;var e=jQuery.Event("showcaseprevious");e.nextI=d;if(typeof g.options.previous=="function"){g.options.previous(e)}h.trigger(e);j.filter(":animated").each(function(l,k){b("Showcase: Previous: Stopping animation on #"+c(k).attr("id"));c(k).stop(true,false)});j.eq(d).css({"z-index":"2",display:"block",opacity:"1.0"});j.eq(f).css({"z-index":"0",display:"none",opacity:"1.0"});if(h.showcase("get","status")=="playing"){clearInterval(g.intervalId);g.intervalId=setInterval(function(){h.showcase("advance")},(g.options.speed+g.options.transitionTime))}}else{c.error("Showcase plugin has not been initialized for this element")}})},advance:function(){return this.each(function(){var h=c(this);b("$('#"+h.attr("id")+"').showcase('advance')");var g=h.data("showcase");if(g){var f=g.i;var d=((f+1)<g.count)?(f+1):0;var j=g.items;g.i=d;var e=jQuery.Event("showcasenext");e.nextI=d;if(typeof g.options.next=="function"){g.options.next(e)}h.trigger(e);j.eq(d).css({"z-index":"1",display:"block",opacity:"1.0"});j.eq(f).fadeOut(g.options.transitionTime,function(){c(this).css({"z-index":"0",display:"none"});j.eq(d).css({"z-index":"2"})})}else{c.error("Showcase plugin has not been initialized for this element")}})}};function b(d){if((c.fn.showcase.debug==true)&&("console" in window)&&("log" in window.console)){console.log(d)}}})(jQuery);
