YAHOO.namespace("myowndb");YAHOO.myowndb.slideshow=function(B,E){this.container=YAHOO.util.Dom.get(B);this.effect=E.effect;var D=E.frames;this.frames=[];var A=YAHOO.util.Dom.getElementsByClassName("yui-sldshw-frame",null,this.container);for(var C=0;C<A.length;C++){this.frames[C]={id:C,type:"cached",value:A[C]}}if(D!=null&&D!=undefined){for(var C=0;C<E.frames.length;C++){this.frames[C+A.length]=E.frames[C]}}if(!E.slide_selector){this.next_selector=function(F,G){return(G+1)%F};this.prev_selector=function(F,H){var G=H-1;if(G<0){G=F-1}return G};this.slide_selector=this.next_selector}else{this.slide_selector=E.slide_selector}if(E.interval){this.interval=E.interval}else{this.interval=5000}this.init()};YAHOO.myowndb.slideshow.prototype={init:function(){if(!this.effect){this.effect=YAHOO.myowndb.slideshow.effects.slideUp}this.active_frame=this.get_active_frame();this.choose_next_frame()},get_active_frame:function(){var A=YAHOO.util.Dom.getElementsByClassName("yui-sldshw-active",null,this.container)[0];return A},get_frame_index:function(B){for(var A=0;A<this.frames.length;A++){if(this.frames[A].value==B){return A}}return -1},choose_next_frame:function(){var G=this.get_frame_index(this.get_active_frame());if(G<0){G=0}var A=this.frames;var B=this.slide_selector(A.length,G);this.setIndexLbl(G);var C=A[B];var F;if(C.type=="cached"){F=C.value;YAHOO.util.Dom.replaceClass(F,"yui-sldshw-cached","yui-sldshw-next");this.next_frame=F;this.effect.setup(this.next_frame)}else{if(C.type=="image_url"){F=document.createElement("img");F.setAttribute("src",C.value);C.type="cached";C.value=F;YAHOO.util.Dom.addClass(F,"yui-sldshw-frame");YAHOO.util.Dom.addClass(F,"yui-sldshw-next");this.container.appendChild(F);this.next_frame=F;this.effect.setup(this.next_frame)}else{if(C.type=="remote_html"){var E={success:function(H){var I=document.createElement("div");I.innerHTML=H.responseText;I.setAttribute("id","frame_"+H.argument.id);H.argument.type="cached";H.argument.value=I;YAHOO.util.Dom.addClass(I,"yui-sldshw-frame");YAHOO.util.Dom.addClass(I,"yui-sldshw-next");this.container.appendChild(I);this.next_frame=H.argument.value;this.effect.setup(this.next_frame)},failure:function(H){this.type="broken";this.choose_next_frame()},scope:this,argument:C};var D=YAHOO.util.Connect.asyncRequest("GET",C.value,E,null)}}}},clean_up_transition:function(){YAHOO.util.Dom.replaceClass(this.active_frame,"yui-sldshw-active","yui-sldshw-cached");YAHOO.util.Dom.replaceClass(this.next_frame,"yui-sldshw-next","yui-sldshw-active");this.active_frame=this.next_frame;this.inTrans=false;this.choose_next_frame()},transition:function(){var A=this.effect.get_animation(this.active_frame);A.onComplete.subscribe(this.clean_up_transition,this,true);A.animate();this.inTrans=true;if(this.isPlaying()){this.loop()}},loop:function(){var A;A=this;clearInterval(this.loop_interval);this.loop_interval=setInterval(function(){A.transition()},this.interval);this.buttonOn("play")}};YAHOO.myowndb.slideshow.effects={slideRight:{setup:function(A){YAHOO.util.Dom.setStyle(A,"top","0");YAHOO.util.Dom.setStyle(A,"left","0")},get_animation:function(B){var A=YAHOO.util.Dom.getRegion(B);return new YAHOO.util.Motion(B,{points:{by:[A.right-A.left,0]}},1,YAHOO.util.Easing.easeOut)}},slideLeft:{setup:function(A){YAHOO.util.Dom.setStyle(A,"top","0");YAHOO.util.Dom.setStyle(A,"left","0")},get_animation:function(B){var A=YAHOO.util.Dom.getRegion(B);return new YAHOO.util.Motion(B,{points:{by:[A.left-A.right,0]}},1,YAHOO.util.Easing.easeOut)}},squeezeLeft:{setup:function(A){YAHOO.util.Dom.setStyle(A,"width","100%")},get_animation:function(B){var A=YAHOO.util.Dom.getRegion(B);return new YAHOO.util.Anim(B,{width:{to:0}},1,YAHOO.util.Easing.easeOut)}},squeezeRight:{setup:function(A){YAHOO.util.Dom.setStyle(A,"width","100%");YAHOO.util.Dom.setStyle(A,"right","0px")},get_animation:function(B){var A=YAHOO.util.Dom.getRegion(B);YAHOO.util.Dom.setStyle(B,"right","0px");return new YAHOO.util.Anim(B,{width:{to:0}},1,YAHOO.util.Easing.easeOut)}},squeezeUp:{setup:function(A){YAHOO.util.Dom.setStyle(A,"height","100%")},get_animation:function(B){var A=YAHOO.util.Dom.getRegion(B);return new YAHOO.util.Anim(B,{height:{to:0}},1,YAHOO.util.Easing.easeOut)}},squeezeDown:{setup:function(A){YAHOO.util.Dom.setStyle(A,"height","100%")},get_animation:function(B){var A=YAHOO.util.Dom.getRegion(B);YAHOO.util.Dom.setStyle(B,"bottom","0px");return new YAHOO.util.Anim(B,{height:{to:0}},1,YAHOO.util.Easing.easeOut)}},fadeOut:{setup:function(A){YAHOO.util.Dom.setStyle(A,"opacity","1")},get_animation:function(A){return new YAHOO.util.Anim(A,{opacity:{to:0}},1,YAHOO.util.Easing.easeOut)}},fadeIn:{setup:function(A){YAHOO.util.Dom.setStyle(A,"opacity","0");YAHOO.util.Dom.setStyle(A,"z-index","20")},get_animation:function(B){var A=YAHOO.util.Dom.getRegion(B);return new YAHOO.util.Anim(B,{opacity:{to:1}},1,YAHOO.util.Easing.easeOut)}}};YAHOO.myowndb.slideshow.effects.slideUp={setup:function(A){YAHOO.util.Dom.setStyle(A,"top","0");YAHOO.util.Dom.setStyle(A,"left","0")},get_animation:function(B){var A=YAHOO.util.Dom.getRegion(B);return new YAHOO.util.Motion(B,{points:{by:[0,A.top-A.bottom]}},1,YAHOO.util.Easing.easeOut)}};YAHOO.myowndb.slideshow.prototype.stop=function(){this.buttonOff("play");this.buttonOn("stop");clearInterval(this.loop_interval);this.loop_interval=-1};YAHOO.myowndb.slideshow.prototype.inTrans=false;YAHOO.myowndb.slideshow.prototype.isPlaying=function(){return !(this.loop_interval===undefined||this.loop_interval==-1)};YAHOO.myowndb.slideshow.prototype.play=function(){if(this.slide_selector!=this.next_selector){this.slide_selector=this.next_selector;this.clean_up_transition();this.clean_up_transition()}if(!this.isPlaying()){this.buttonOff("stop");this.slide_selector=this.next_selector;this.loop()}};YAHOO.myowndb.slideshow.prototype.next=function(){if(this.inTrans){return }var A=this.isPlaying();this.stop();if(this.slide_selector!=this.next_selector){this.slide_selector=this.next_selector;this.clean_up_transition();this.clean_up_transition()}this.transition();if(A){this.play()}};YAHOO.myowndb.slideshow.prototype.prev=function(){if(this.inTrans){return }this.stop();if(this.slide_selector!=this.prev_selector){this.slide_selector=this.prev_selector;var A=this.active_frame;this.active_frame=this.next_frame;this.next_frame=A;this.clean_up_transition()}this.transition()};YAHOO.myowndb.slideshow.prototype.buttons=new Object();YAHOO.myowndb.slideshow.prototype.bind=function(G,C,D,F){this.buttons.play=YAHOO.util.Dom.get(G);this.buttons.stop=YAHOO.util.Dom.get(C);this.buttons.next=YAHOO.util.Dom.get(D);this.buttons.prev=YAHOO.util.Dom.get(F);var B=this;var A=YAHOO.util.Event;var E=this.buttons;A.addListener(E.play,"click",function(H){YAHOO.util.Event.preventDefault(H);B.play();return false});A.addListener(E.stop,"click",function(H){YAHOO.util.Event.preventDefault(H);B.stop();return false});A.addListener(E.next,"click",function(H){YAHOO.util.Event.preventDefault(H);B.next();return false});A.addListener(E.prev,"click",function(H){YAHOO.util.Event.preventDefault(H);B.prev();return false});A.addListener(E.play,"mouseover",function(H){B.buttonOn("play");return false});A.addListener(E.stop,"mouseover",function(H){B.buttonOn("stop");return false});A.addListener(E.next,"mouseover",function(H){B.buttonOn("next");return false});A.addListener(E.prev,"mouseover",function(H){B.buttonOn("prev");return false});A.addListener(E.play,"mouseout",function(H){if(!B.isPlaying()){B.buttonOff("play")}return false});A.addListener(E.stop,"mouseout",function(H){if(B.isPlaying()){B.buttonOff("stop")}return false});A.addListener(E.next,"mouseout",function(H){B.buttonOff("next");return false});A.addListener(E.prev,"mouseout",function(H){B.buttonOff("prev");return false})};YAHOO.myowndb.slideshow.prototype.buttonOff=function(A){this.buttons[A].firstChild.src="/listing_nav_pictures/"+A+".gif"};YAHOO.myowndb.slideshow.prototype.buttonOn=function(A){this.buttons[A].firstChild.src="/listing_nav_pictures/active-"+A+".gif"};YAHOO.myowndb.slideshow.prototype.setIndexLbl=function(B){var A=YAHOO.util.Dom.get("lgal_status");A.innerHTML='<span style="color:#fff;">Picture <strong style="color:#fff;">'+(B+1)+'</strong> of <strong style="color:#fff;">'+this.frames.length+"</strong></span>"};
