function hex2num(C){if(C.charAt(0)=="#"){C=C.slice(1)}C=C.toUpperCase();var D=new Array(3);var A=0;for(var B=0;B<6;B+=2){c1=C.charAt(B);c2=C.charAt(B+1);D[A]=parseInt(c1+""+c2,16);A++}return(D)}function bgGradient(K,J){var C=new Array(3);var L=new Array(3);var B=new Array(3);var D=new Array(3);var A=0;var I=1;var M=2;C=hex2num("#"+K);L=hex2num("#"+J);var D=new Array(3);for(var G=0;G<3;G++){D[G]=(L[G]-C[G])/256}B=C;var F=document.getElementById("tpl_bg_gradx");if(F){F.style.visibility="hidden";F.innerHTML=""}else{F=document.createElement("div");F.style.visibility="hidden";F.style.top="0px";F.style.height="255px";F.style.position="absolute";F.style.left="0px";F.style.width="100%";F.id="tpl_bg_gradx"}var H="";for(var G=0;G<255;G++){for(var E=0;E<3;E++){B[E]=B[E]+D[E]}H+='<div class="gradbar" style="top:'+G+"px;background-color:rgb("+Math.round(B[A])+","+Math.round(B[I])+","+Math.round(B[M])+');">&nbsp</div>'}F.innerHTML=H;var N=document.getElementById("tpl_h_body");N.appendChild(F);F.style.visibility="visible"};
var loadInitialItems=function(C,A){var D=A[0];var B=A[1];_makeRequest(this,D,(B-D+1)*3,1)};var loadNextItems=function(C,A){var E=A[0];var B=A[1];var D=A[2];this.stopAutoPlay();if(!D){makeRequest(this,E,(B-E+1)*3)}};var loadPrevItems=function(C,A){var E=A[0];var B=A[1];var D=A[2];this.stopAutoPlay();if(!D){makeRequest(this,E,(B-E+1)*3)}};var handlePrevButtonState=function(D,B){var C=B[0];var F=B[1];var E=this.getProperty("orientation")=="vertical"?"up":"left";var A="http://mls.concepts.ca/module_images/arrow_blue_";if(C){F.src=A+E+".gif"}else{F.src=A+E+"_inactive.gif"}};var handleNextButtonState=function(E,C){var D=C[0];var A=C[1];var F=this.getProperty("orientation")=="vertical"?"down":"right";var B="http://mls.concepts.ca/module_images/arrow_blue_";if(D){A.src=B+F+".gif"}else{A.src=B+F+"_inactive.gif"}};var animItemsComplete=function(B,A){};var pageLoad=function(){var G=YAHOO.util.Dom.getElementsByClassName("carousel-component","div","tpl_h_main");kr=3;for(var D=0;D<G.length;D++){var B="horizontal";if(G[D].parentNode.className=="lgw_vertical"){B="vertical"}var F=null;var H=G[D].id;if(B=="horizontal"){var C=G[D].parentNode.parentNode.parentNode.parentNode.parentNode;var A=YAHOO.util.Dom.getRegion(C);var E=A.right-A.left;E=E-150;G[D].style.width=E+"px";kr=Math.floor(E/150);ra=Math.floor((E-(kr*150))/2);ra=0;fv=2;F=new YAHOO.extension.Carousel(H,{numVisible:kr,animationSpeed:1,scrollInc:2,size:100,wrap:false,revealAmount:ra,loadInitHandler:loadInitialItems,prevElement:"carousel_prev"+H.substring(14),nextElement:"carousel_next"+H.substring(14),loadNextHandler:loadNextItems,loadPrevHandler:loadPrevItems,animationCompleteHandler:animItemsComplete,autoPlay:6400,animationMethod:YAHOO.util.Easing.easeOut,prevButtonStateHandler:handlePrevButtonState,nextButtonStateHandler:handleNextButtonState})}else{if(B=="vertical"){kr=3;if(window.wgtcarouselheight){kr=window.wgtcarouselheight}G[D].style.width="150px";F=new YAHOO.extension.Carousel(H,{numVisible:kr,animationSpeed:1,scrollInc:2,size:100,wrap:false,revealAmount:20,loadInitHandler:loadInitialItems,prevElement:"carousel_prev"+H.substring(14),nextElement:"carousel_next"+H.substring(14),loadNextHandler:loadNextItems,loadPrevHandler:loadPrevItems,orientation:"vertical",animationCompleteHandler:animItemsComplete,autoPlay:6400,animationMethod:YAHOO.util.Easing.easeOut,prevButtonStateHandler:handlePrevButtonState,nextButtonStateHandler:handleNextButtonState})}}}};YAHOO.util.Event.onDOMReady(pageLoad);var makeRequest=function(B,C,A){_makeRequest(B,C,A,0)};var _makeRequest=function(J,B,E,G){var I=function(U){var M=U.argument[0];var c=U.argument[1];var X=U.argument[2];var R=U.argument[3]==1;if(U.responseText!==undefined){var Y=U.responseText;if(R){var P=Y.split("/;");var Q=P[0];Y=P[1];Q=Q-0;if(Q>0){var L=X._carouselElemID.substring(14);var T=document.getElementById("lgal_frame_"+L);T.style.display="";T.style.visibility="visible"}X.setProperty("size",Q,true);if(Q==0){var L=X._carouselElemID.substring(14);var T=document.getElementById("lgal_frame_"+L);T.style.display="none"}}var S=Y.split("|^");for(var Z=0;Z<S.length;Z++){var b=S[Z].split("~*");var O=b[0];var W=b[1];var a=b[2];var K=b[3];var V="";var N=b[4];X.addItem(M+Z,D(O,W,a,K,V,N))}}};var C=function(K){};var D=function(O,N,P,Q,K,R){if(O===undefined){return""}if(N!==undefined){N=N}else{N="Price N/A"}if(P===undefined){P=""}var S="";if(K=="S"){N="SOLD"}else{if(K=="L"){N="Leased"}}var L="/mlsphoto.php?mls=toronto&lid="+O+"&pic=0&mw=120&mh=86";if(R==0){L="http://mls.concepts.ca/images/not_avail_small.gif"}var M='<div style="margin: 4px;padding: 6px;border: 1px solid #999;" class="carousel-matte""><div style="height:86px;line-height:86px;margin-bottom:6px;"><a style="vertical-align:center;display:inline;" href="index.php?io_listing='+O+'"><img style="vertical-align:center;display:inline;" border="0" src="'+L+'" /></a></div><span style="text-align:center;background-color:#fff;font-size:10px;"><strong style="font-size:10px;">'+N+"</strong>"+P+"<br /></span></div>";return M};var H={success:I,failure:C,argument:[B,E,J,G],timeout:10000};var A="/rgal.php?mls=toronto&uid="+cuid+"&cid="+J._carouselElemID.substring(14)+"&lb="+B+"&nr="+E;if(G==1){A=A+"&f=1"}var F="data=";YAHOO.util.Connect.asyncRequest("POST",A,H,F)};
/**
 * SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;
YAHOO.namespace("extension");YAHOO.extension.Carousel=function(B,A){this.init(B,A)};YAHOO.extension.Carousel.prototype={UNBOUNDED_SIZE:1000000,init:function(N,J){var I=this;this.getCarouselItem=this.getItem;var B="carousel-list";var C="carousel-clip-region";var F="carousel-next";var E="carousel-prev";this._carouselElemID=N;this.carouselElem=YAHOO.util.Dom.get(N);this._prevEnabled=true;this._nextEnabled=true;this.cfg=new YAHOO.util.Config(this);this.cfg.addProperty("scrollBeforeAmount",{value:0,handler:function(P,O,Q){},validator:I.cfg.checkNumber});this.cfg.addProperty("scrollAfterAmount",{value:0,handler:function(P,O,Q){},validator:I.cfg.checkNumber});this.cfg.addProperty("loadOnStart",{value:true,handler:function(P,O,Q){},validator:I.cfg.checkBoolean});this.cfg.addProperty("orientation",{value:"horizontal",handler:function(P,O,Q){I.reload()},validator:function(O){if(typeof O=="string"){return("horizontal,vertical".indexOf(O.toLowerCase())!=-1)}else{return false}}});this.cfg.addProperty("size",{value:this.UNBOUNDED_SIZE,handler:function(P,O,Q){I.reload()},validator:I.cfg.checkNumber});this.cfg.addProperty("numVisible",{value:3,handler:function(P,O,Q){I.reload()},validator:I.cfg.checkNumber});this.cfg.addProperty("firstVisible",{value:1,handler:function(P,O,Q){I.moveTo(O[0])},validator:I.cfg.checkNumber});this.cfg.addProperty("scrollInc",{value:3,handler:function(P,O,Q){},validator:I.cfg.checkNumber});this.cfg.addProperty("animationSpeed",{value:0.25,handler:function(P,O,Q){I.animationSpeed=O[0]},validator:I.cfg.checkNumber});this.cfg.addProperty("animationMethod",{value:YAHOO.util.Easing.easeOut,handler:function(P,O,Q){}});this.cfg.addProperty("animationCompleteHandler",{value:null,handler:function(P,O,Q){if(I._animationCompleteEvt){I._animationCompleteEvt.unsubscribe(I._currAnimationCompleteHandler,I)}I._currAnimationCompleteHandler=O[0];if(I._currAnimationCompleteHandler){if(!I._animationCompleteEvt){I._animationCompleteEvt=new YAHOO.util.CustomEvent("onAnimationComplete",I)}I._animationCompleteEvt.subscribe(I._currAnimationCompleteHandler,I)}}});this.cfg.addProperty("autoPlay",{value:0,handler:function(Q,O,R){var P=O[0];if(P>0){I.startAutoPlay()}else{I.stopAutoPlay()}}});this.cfg.addProperty("wrap",{value:false,handler:function(P,O,Q){},validator:I.cfg.checkBoolean});this.cfg.addProperty("navMargin",{value:0,handler:function(P,O,Q){I.calculateSize()},validator:I.cfg.checkNumber});this.cfg.addProperty("revealAmount",{value:0,handler:function(P,O,Q){I.reload()},validator:I.cfg.checkNumber});this.cfg.addProperty("prevElementID",{value:null,handler:function(P,O,Q){if(I._carouselPrev){YAHOO.util.Event.removeListener(I._carouselPrev,"click",I._scrollPrev)}I._prevElementID=O[0];if(I._prevElementID==null){I._carouselPrev=YAHOO.util.Dom.getElementsByClassName(E,"div",I.carouselElem)[0]}else{I._carouselPrev=YAHOO.util.Dom.get(I._prevElementID)}YAHOO.util.Event.addListener(I._carouselPrev,"click",I._scrollPrev,I)}});this.cfg.addProperty("prevElement",{value:null,handler:function(P,O,Q){if(I._carouselPrev){YAHOO.util.Event.removeListener(I._carouselPrev,"click",I._scrollPrev)}I._prevElementID=O[0];if(I._prevElementID==null){I._carouselPrev=YAHOO.util.Dom.getElementsByClassName(E,"div",I.carouselElem)[0]}else{I._carouselPrev=YAHOO.util.Dom.get(I._prevElementID)}YAHOO.util.Event.addListener(I._carouselPrev,"click",I._scrollPrev,I)}});this.cfg.addProperty("nextElementID",{value:null,handler:function(P,O,Q){if(I._carouselNext){YAHOO.util.Event.removeListener(I._carouselNext,"click",I._scrollNext)}I._nextElementID=O[0];if(I._nextElementID==null){I._carouselNext=YAHOO.util.Dom.getElementsByClassName(F,"div",I.carouselElem)}else{I._carouselNext=YAHOO.util.Dom.get(I._nextElementID)}if(I._carouselNext){YAHOO.util.Event.addListener(I._carouselNext,"click",I._scrollNext,I)}}});this.cfg.addProperty("nextElement",{value:null,handler:function(P,O,Q){if(I._carouselNext){YAHOO.util.Event.removeListener(I._carouselNext,"click",I._scrollNext)}I._nextElementID=O[0];if(I._nextElementID==null){I._carouselNext=YAHOO.util.Dom.getElementsByClassName(F,"div",I.carouselElem)}else{I._carouselNext=YAHOO.util.Dom.get(I._nextElementID)}if(I._carouselNext){YAHOO.util.Event.addListener(I._carouselNext,"click",I._scrollNext,I)}}});this.cfg.addProperty("disableSelection",{value:true,handler:function(P,O,Q){},validator:I.cfg.checkBoolean});this.cfg.addProperty("loadInitHandler",{value:null,handler:function(P,O,Q){if(I._loadInitHandlerEvt){I._loadInitHandlerEvt.unsubscribe(I._currLoadInitHandler,I)}I._currLoadInitHandler=O[0];if(I._currLoadInitHandler){if(!I._loadInitHandlerEvt){I._loadInitHandlerEvt=new YAHOO.util.CustomEvent("onLoadInit",I)}I._loadInitHandlerEvt.subscribe(I._currLoadInitHandler,I)}}});this.cfg.addProperty("loadNextHandler",{value:null,handler:function(P,O,Q){if(I._loadNextHandlerEvt){I._loadNextHandlerEvt.unsubscribe(I._currLoadNextHandler,I)}I._currLoadNextHandler=O[0];if(I._currLoadNextHandler){if(!I._loadNextHandlerEvt){I._loadNextHandlerEvt=new YAHOO.util.CustomEvent("onLoadNext",I)}I._loadNextHandlerEvt.subscribe(I._currLoadNextHandler,I)}}});this.cfg.addProperty("loadPrevHandler",{value:null,handler:function(P,O,Q){if(I._loadPrevHandlerEvt){I._loadPrevHandlerEvt.unsubscribe(I._currLoadPrevHandler,I)}I._currLoadPrevHandler=O[0];if(I._currLoadPrevHandler){if(!I._loadPrevHandlerEvt){I._loadPrevHandlerEvt=new YAHOO.util.CustomEvent("onLoadPrev",I)}I._loadPrevHandlerEvt.subscribe(I._currLoadPrevHandler,I)}}});this.cfg.addProperty("prevButtonStateHandler",{value:null,handler:function(P,O,Q){if(I._currPrevButtonStateHandler){I._prevButtonStateHandlerEvt.unsubscribe(I._currPrevButtonStateHandler,I)}I._currPrevButtonStateHandler=O[0];if(I._currPrevButtonStateHandler){if(!I._prevButtonStateHandlerEvt){I._prevButtonStateHandlerEvt=new YAHOO.util.CustomEvent("onPrevButtonStateChange",I)}I._prevButtonStateHandlerEvt.subscribe(I._currPrevButtonStateHandler,I)}}});this.cfg.addProperty("nextButtonStateHandler",{value:null,handler:function(P,O,Q){if(I._currNextButtonStateHandler){I._nextButtonStateHandlerEvt.unsubscribe(I._currNextButtonStateHandler,I)}I._currNextButtonStateHandler=O[0];if(I._currNextButtonStateHandler){if(!I._nextButtonStateHandlerEvt){I._nextButtonStateHandlerEvt=new YAHOO.util.CustomEvent("onNextButtonStateChange",I)}I._nextButtonStateHandlerEvt.subscribe(I._currNextButtonStateHandler,I)}}});if(J){this.cfg.applyConfig(J)}YAHOO.util.Event.addListener(this.carouselElem,"mousedown",this._handleMouseDownForSelection,this,true);this._origFirstVisible=this.cfg.getProperty("firstVisible");this._currLoadInitHandler=this.cfg.getProperty("loadInitHandler");this._currLoadNextHandler=this.cfg.getProperty("loadNextHandler");this._currLoadPrevHandler=this.cfg.getProperty("loadPrevHandler");this._currPrevButtonStateHandler=this.cfg.getProperty("prevButtonStateHandler");this._currNextButtonStateHandler=this.cfg.getProperty("nextButtonStateHandler");this._currAnimationCompleteHandler=this.cfg.getProperty("animationCompleteHandler");this._nextElementID=this.cfg.getProperty("nextElementID");if(!this._nextElementID){this._nextElementID=this.cfg.getProperty("nextElement")}this._prevElementID=this.cfg.getProperty("prevElementID");if(!this._prevElementID){this._prevElementID=this.cfg.getProperty("prevElement")}this._autoPlayTimer=null;this._priorLastVisible=this._priorFirstVisible=this.cfg.getProperty("firstVisible");this._lastPrebuiltIdx=0;this.carouselList=YAHOO.util.Dom.getElementsByClassName(B,"ul",this.carouselElem)[0];if(this._nextElementID==null){this._carouselNext=YAHOO.util.Dom.getElementsByClassName(F,"div",this.carouselElem)[0]}else{this._carouselNext=YAHOO.util.Dom.get(this._nextElementID)}if(this._prevElementID==null){this._carouselPrev=YAHOO.util.Dom.getElementsByClassName(E,"div",this.carouselElem)[0]}else{this._carouselPrev=YAHOO.util.Dom.get(this._prevElementID)}this._clipReg=YAHOO.util.Dom.getElementsByClassName(C,"div",this.carouselElem)[0];if(this.isVertical()){YAHOO.util.Dom.addClass(this.carouselList,"carousel-vertical")}this._scrollNextAnim=new YAHOO.util.Motion(this.carouselList,this.scrollNextParams,this.cfg.getProperty("animationSpeed"),this.cfg.getProperty("animationMethod"));this._scrollPrevAnim=new YAHOO.util.Motion(this.carouselList,this.scrollPrevParams,this.cfg.getProperty("animationSpeed"),this.cfg.getProperty("animationMethod"));if(this._carouselNext){YAHOO.util.Event.addListener(this._carouselNext,"click",this._scrollNext,this)}if(this._carouselPrev){YAHOO.util.Event.addListener(this._carouselPrev,"click",this._scrollPrev,this)}var H=this.cfg.getProperty("loadInitHandler");if(H){this._loadInitHandlerEvt=new YAHOO.util.CustomEvent("onLoadInit",this);this._loadInitHandlerEvt.subscribe(H,this)}var L=this.cfg.getProperty("loadNextHandler");if(L){this._loadNextHandlerEvt=new YAHOO.util.CustomEvent("onLoadNext",this);this._loadNextHandlerEvt.subscribe(L,this)}var M=this.cfg.getProperty("loadPrevHandler");if(M){this._loadPrevHandlerEvt=new YAHOO.util.CustomEvent("onLoadPrev",this);this._loadPrevHandlerEvt.subscribe(M,this)}var K=this.cfg.getProperty("animationCompleteHandler");if(K){this._animationCompleteEvt=new YAHOO.util.CustomEvent("onAnimationComplete",this);this._animationCompleteEvt.subscribe(K,this)}var A=this.cfg.getProperty("prevButtonStateHandler");if(A){this._prevButtonStateHandlerEvt=new YAHOO.util.CustomEvent("onPrevButtonStateChange",this);this._prevButtonStateHandlerEvt.subscribe(A,this)}var G=this.cfg.getProperty("nextButtonStateHandler");if(G){this._nextButtonStateHandlerEvt=new YAHOO.util.CustomEvent("onNextButtonStateChange",this);this._nextButtonStateHandlerEvt.subscribe(G,this)}var D=this._calculateVisibleExtent();YAHOO.util.Event.onAvailable(this._carouselElemID+"-item-"+D.start,this._calculateSize,this);if(this.cfg.getProperty("loadOnStart")){this._loadInitial()}},_handleMouseDownForSelection:function(A){if(this.cfg.getProperty("disableSelection")){YAHOO.util.Event.preventDefault(A);YAHOO.util.Event.stopPropagation(A)}},clear:function(){var A=this.cfg.getProperty("loadInitHandler");if(A){this._removeChildrenFromNode(this.carouselList);this._lastPrebuiltIdx=0}this.stopAutoPlay();this._priorLastVisible=this._priorFirstVisible=this._origFirstVisible;this.cfg.setProperty("firstVisible",this._origFirstVisible,true);this.moveTo(this._origFirstVisible)},reload:function(B){if(this._isValidObj(B)){this.cfg.setProperty("numVisible",B)}this.clear();var A=this._calculateVisibleExtent();YAHOO.util.Event.onAvailable(this._carouselElemID+"-item-"+A.start,this._calculateSize,this);this._loadInitial()},load:function(){var A=this._calculateVisibleExtent();YAHOO.util.Event.onAvailable(this._carouselElemID+"-item-"+A.start,this._calculateSize,this);this._loadInitial()},addItem:function(C,B,D){if(C>this.cfg.getProperty("size")){return null}var E=this.getItem(C);if(!this._isValidObj(E)){E=this._createItem(C,B);this.carouselList.appendChild(E)}else{if(this._isValidObj(E.placeholder)){var A=this._createItem(C,B);this.carouselList.replaceChild(A,E);E=A}}if(this._isValidObj(D)){YAHOO.util.Dom.addClass(E,D)}if(this.isVertical()){setTimeout(function(){E.style.display="block"},1)}return E},insertBefore:function(B,D){if(B>=this.cfg.getProperty("size")){return null}if(B<1){B=1}var A=B-1;if(A>this._lastPrebuiltIdx){this._prebuildItems(this._lastPrebuiltIdx,B)}var C=this._insertBeforeItem(B,D);this._enableDisableControls();return C},insertAfter:function(B,D){if(B>this.cfg.getProperty("size")){B=this.cfg.getProperty("size")}var A=B+1;if(A>this._lastPrebuiltIdx){this._prebuildItems(this._lastPrebuiltIdx,A+1)}var C=this._insertAfterItem(B,D);if(A>this.cfg.getProperty("size")){this.cfg.setProperty("size",A,true)}this._enableDisableControls();return C},scrollNext:function(){this._scrollNext(null,this);this._autoPlayTimer=null;if(this.cfg.getProperty("autoPlay")!==0){this._autoPlayTimer=this.startAutoPlay()}},scrollPrev:function(){this._scrollPrev(null,this)},scrollTo:function(A){this._position(A,true)},moveTo:function(A){this._position(A,false)},startAutoPlay:function(A){if(this._isValidObj(A)){this.cfg.setProperty("autoPlay",A,true)}if(this._autoPlayTimer!==null){return this._autoPlayTimer}var C=this;var B=function(){C.scrollNext()};this._autoPlayTimer=setTimeout(B,this.cfg.getProperty("autoPlay"));return this._autoPlayTimer},stopAutoPlay:function(){if(this._autoPlayTimer!==null){clearTimeout(this._autoPlayTimer);this._autoPlayTimer=null}},isVertical:function(){return(this.cfg.getProperty("orientation")!="horizontal")},isItemLoaded:function(A){var B=this.getItem(A);if(this._isValidObj(B)&&!this._isValidObj(B.placeholder)){return true}return false},getItem:function(A){var B=this._carouselElemID+"-item-"+A;var C=YAHOO.util.Dom.get(B);return C},show:function(){YAHOO.util.Dom.setStyle(this.carouselElem,"display","block");this.calculateSize()},hide:function(){YAHOO.util.Dom.setStyle(this.carouselElem,"display","none")},calculateSize:function(){var f=this.carouselList.childNodes;var Q=null;for(var a=0;a<f.length;a++){Q=f[a];if(Q.tagName=="LI"||Q.tagName=="li"){break}}var Z=this.cfg.getProperty("navMargin");var h=this.cfg.getProperty("numVisible");var H=this.cfg.getProperty("firstVisible");var d=this._getStyleVal(Q,"paddingLeft");var W=this._getStyleVal(Q,"paddingRight");var c=this._getStyleVal(Q,"marginLeft");var V=this._getStyleVal(Q,"marginRight");var U=this._getStyleVal(Q,"paddingTop");var C=this._getStyleVal(Q,"paddingBottom");var T=this._getStyleVal(Q,"marginTop");var A=this._getStyleVal(Q,"marginBottom");YAHOO.util.Dom.removeClass(this.carouselList,"carousel-vertical");YAHOO.util.Dom.removeClass(this.carouselList,"carousel-horizontal");if(this.isVertical()){var S=d+W+c+V;YAHOO.util.Dom.addClass(this.carouselList,"carousel-vertical");var F=U+C+T+A;var J=this._getStyleVal(this.carouselList,"paddingTop");var Y=this._getStyleVal(this.carouselList,"paddingBottom");var I=this._getStyleVal(this.carouselList,"marginTop");var X=this._getStyleVal(this.carouselList,"marginBottom");var g=J+Y+I+X;var O=(this._isExtraRevealed())?(this.cfg.getProperty("revealAmount")+(F)/2):0;var D=this._getStyleVal(Q,"height",true);this.scrollAmountPerInc=(D+F);var E=this._getStyleVal(Q,"width");this.carouselElem.style.width=(E+S)+"px";this._clipReg.style.height=(this.scrollAmountPerInc*h+O*2+g)+"px";this.carouselElem.style.height=(this.scrollAmountPerInc*h+O*2+Z*2+g)+"px";var b=(this._isExtraRevealed())?(O-(Math.abs(T-A)+Math.abs(U-C))/2):0;YAHOO.util.Dom.setStyle(this.carouselList,"position","relative");YAHOO.util.Dom.setStyle(this.carouselList,"top",""+b+"px");var M=YAHOO.util.Dom.getY(this.carouselList);YAHOO.util.Dom.setY(this.carouselList,M-this.scrollAmountPerInc*(H-1))}else{YAHOO.util.Dom.addClass(this.carouselList,"carousel-horizontal");var R=this._getStyleVal(this.carouselList,"paddingLeft");var L=this._getStyleVal(this.carouselList,"paddingRight");var P=this._getStyleVal(this.carouselList,"marginLeft");var K=this._getStyleVal(this.carouselList,"marginRight");var G=R+L+P+K;var e=c+V;var S=e+W+d;var O=(this._isExtraRevealed())?(this.cfg.getProperty("revealAmount")+(S)/2):0;var E=Q.offsetWidth;this.scrollAmountPerInc=E+e;this._clipReg.style.width=(this.scrollAmountPerInc*h+O*2)+"px";this.carouselElem.style.width=(this.scrollAmountPerInc*h+Z*2+O*2+G)+"px";var B=(this._isExtraRevealed())?(O-(Math.abs(V-c)+Math.abs(W-d))/2-(P+R)):0;YAHOO.util.Dom.setStyle(this.carouselList,"position","relative");YAHOO.util.Dom.setStyle(this.carouselList,"left",""+B+"px");var N=YAHOO.util.Dom.getX(this.carouselList);YAHOO.util.Dom.setX(this.carouselList,N-this.scrollAmountPerInc*(H-1))}},setProperty:function(C,B,A){this.cfg.setProperty(C,B,A)},getProperty:function(A){return this.cfg.getProperty(A)},getFirstItemRevealed:function(){return this._firstItemRevealed},getLastItemRevealed:function(){return this._lastItemRevealed},getFirstVisible:function(){return this.cfg.getProperty("firstVisible")},getLastVisible:function(){var B=this.cfg.getProperty("firstVisible");var A=this.cfg.getProperty("numVisible");return B+A-1},_getStyleVal:function(A,C,D){var B=YAHOO.util.Dom.getStyle(A,C);var E=D?parseFloat(B):parseInt(B,10);if(C=="height"&&isNaN(E)){E=A.offsetHeight}else{if(isNaN(E)){E=0}}return E},_calculateSize:function(A){A.calculateSize();A.show()},_removeChildrenFromNode:function(B){if(!this._isValidObj(B)){return }var A=B.childNodes.length;while(B.hasChildNodes()){B.removeChild(B.firstChild)}},_prebuildLiElem:function(A){if(A<1){return }var B=document.createElement("li");B.id=this._carouselElemID+"-item-"+A;B.placeholder=true;this.carouselList.appendChild(B);this._lastPrebuiltIdx=(A>this._lastPrebuiltIdx)?A:this._lastPrebuiltIdx},_createItem:function(B,A){if(B<1){return }var C=document.createElement("li");C.id=this._carouselElemID+"-item-"+B;if(typeof (A)==="string"){C.innerHTML=A}else{C.appendChild(A)}return C},_insertAfterItem:function(B,A){return this._insertBeforeItem(B+1,A)},_insertBeforeItem:function(G,A){var B=this.getItem(G);var D=this.cfg.getProperty("size");if(D!=this.UNBOUNDED_SIZE){this.cfg.setProperty("size",D+1,true)}for(var C=this._lastPrebuiltIdx;C>=G;C--){var F=this.getItem(C);if(this._isValidObj(F)){F.id=this._carouselElemID+"-item-"+(C+1)}}var H=this._createItem(G,A);var E=this.carouselList.insertBefore(H,B);this._lastPrebuiltIdx+=1;return H},insertAfterEnd:function(A){return this.insertAfter(this.cfg.getProperty("size"),A)},_position:function(A,B){var C=this._priorFirstVisible;if(A>C){var D=A-C;this._scrollNextInc(D,B)}else{var E=C-A;this._scrollPrevInc(E,B)}},_scrollPrev:function(B,A){if(B!==null){A.stopAutoPlay()}A._scrollPrevInc(A.cfg.getProperty("scrollInc"),(A.cfg.getProperty("animationSpeed")!==0))},_scrollNext:function(B,A){if(B!==null){A.stopAutoPlay()}A._scrollNextInc(A.cfg.getProperty("scrollInc"),(A.cfg.getProperty("animationSpeed")!==0))},_handleAnimationComplete:function(C,B,A){var E=A[0];var D=A[1];E._animationCompleteEvt.fire(D)},_areAllItemsLoaded:function(D,C){var A=true;for(var B=D;B<=C;B++){var E=this.getItem(B);if(!this._isValidObj(E)){this._prebuildLiElem(B);A=false}else{if(this._isValidObj(E.placeholder)){A=false}}}return A},_prebuildItems:function(C,B){for(var A=C;A<=B;A++){var D=this.getItem(A);if(!this._isValidObj(D)){this._prebuildLiElem(A)}}},_isExtraRevealed:function(){return(this.cfg.getProperty("revealAmount")>0)},_scrollNextInc:function(E,J){if(this._scrollNextAnim.isAnimated()||this._scrollPrevAnim.isAnimated()){return false}var N=this.cfg.getProperty("numVisible");var L=this._priorFirstVisible;var I=this._priorLastVisible;var O=this.cfg.getProperty("size");var A=this._calculateAllowableScrollExtent();if(this.cfg.getProperty("wrap")&&I==A.end){this.scrollTo(A.start);return }var K=L+E;var G=K+N-1;if(G>A.end){G=A.end;K=G-N+1}E=K-L;this.cfg.setProperty("firstVisible",K,true);if(E>0){if(this._isValidObj(this.cfg.getProperty("loadNextHandler"))){var D=this._calculateVisibleExtent(K,G);var F=(I+1)<D.start?(I+1):D.start;var H=this._areAllItemsLoaded(F,D.end);this._loadNextHandlerEvt.fire(D.start,D.end,H)}if(J){var M={points:{by:[-this.scrollAmountPerInc*E,0]}};if(this.isVertical()){M={points:{by:[0,-this.scrollAmountPerInc*E]}}}this._scrollNextAnim=new YAHOO.util.Motion(this.carouselList,M,this.cfg.getProperty("animationSpeed"),this.cfg.getProperty("animationMethod"));if(this.cfg.getProperty("animationCompleteHandler")){this._scrollNextAnim.onComplete.subscribe(this._handleAnimationComplete,[this,"next"])}this._scrollNextAnim.animate()}else{if(this.isVertical()){var B=YAHOO.util.Dom.getY(this.carouselList);YAHOO.util.Dom.setY(this.carouselList,B-this.scrollAmountPerInc*E)}else{var C=YAHOO.util.Dom.getX(this.carouselList);YAHOO.util.Dom.setX(this.carouselList,C-this.scrollAmountPerInc*E)}}}this._priorFirstVisible=K;this._priorLastVisible=G;this._enableDisableControls();return false},_scrollPrevInc:function(G,J){if(this._scrollNextAnim.isAnimated()||this._scrollPrevAnim.isAnimated()){return false}var N=this.cfg.getProperty("numVisible");var L=this._priorFirstVisible;var I=this._priorLastVisible;var O=this.cfg.getProperty("size");var K=L-G;var A=this._calculateAllowableScrollExtent();K=(K<A.start)?A.start:K;var F=K+N-1;if(F>A.end){F=A.end;K=F-N+1}G=L-K;this.cfg.setProperty("firstVisible",K,true);if(G>0){if(this._isValidObj(this.cfg.getProperty("loadPrevHandler"))){var E=this._calculateVisibleExtent(K,F);var C=(L-1)>E.end?(L-1):E.end;var H=this._areAllItemsLoaded(E.start,C);this._loadPrevHandlerEvt.fire(E.start,E.end,H)}if(J){var M={points:{by:[this.scrollAmountPerInc*G,0]}};if(this.isVertical()){M={points:{by:[0,this.scrollAmountPerInc*G]}}}this._scrollPrevAnim=new YAHOO.util.Motion(this.carouselList,M,this.cfg.getProperty("animationSpeed"),this.cfg.getProperty("animationMethod"));if(this.cfg.getProperty("animationCompleteHandler")){this._scrollPrevAnim.onComplete.subscribe(this._handleAnimationComplete,[this,"prev"])}this._scrollPrevAnim.animate()}else{if(this.isVertical()){var B=YAHOO.util.Dom.getY(this.carouselList);YAHOO.util.Dom.setY(this.carouselList,B+this.scrollAmountPerInc*G)}else{var D=YAHOO.util.Dom.getX(this.carouselList);YAHOO.util.Dom.setX(this.carouselList,D+this.scrollAmountPerInc*G)}}}this._priorFirstVisible=K;this._priorLastVisible=F;this._enableDisableControls();return false},_enableDisableControls:function(){var C=this.cfg.getProperty("firstVisible");var A=this.getLastVisible();var B=this._calculateAllowableScrollExtent();if(this._prevEnabled){if(C===B.start){this._disablePrev()}}if(this._prevEnabled===false){if(C>B.start){this._enablePrev()}}if(this._nextEnabled){if(A===B.end){this._disableNext()}}if(this._nextEnabled===false){if(A<B.end){this._enableNext()}}},_loadInitial:function(){var C=this.cfg.getProperty("firstVisible");this._priorLastVisible=this.getLastVisible();if(this._loadInitHandlerEvt){var A=this._calculateVisibleExtent(C,this._priorLastVisible);var B=this._areAllItemsLoaded(1,A.end);this._loadInitHandlerEvt.fire(A.start,A.end,B)}if(this.cfg.getProperty("autoPlay")!==0){this._autoPlayTimer=this.startAutoPlay()}this._enableDisableControls()},_calculateAllowableScrollExtent:function(){var D=this.cfg.getProperty("scrollBeforeAmount");var A=this.cfg.getProperty("scrollAfterAmount");var B=this.cfg.getProperty("size");var C={start:1-D,end:B+A};return C},_calculateVisibleExtent:function(D,A){if(!D){D=this.cfg.getProperty("firstVisible");A=this.getLastVisible()}var B=this.cfg.getProperty("size");D=D<1?1:D;A=A>B?B:A;var C={start:D,end:A};this._firstItemRevealed=-1;this._lastItemRevealed=-1;if(this._isExtraRevealed()){if(D>1){this._firstItemRevealed=D-1;C.start=this._firstItemRevealed}if(A<B){this._lastItemRevealed=A+1;C.end=this._lastItemRevealed}}return C},_disablePrev:function(){this._prevEnabled=false;if(this._prevButtonStateHandlerEvt){this._prevButtonStateHandlerEvt.fire(false,this._carouselPrev)}if(this._isValidObj(this._carouselPrev)){YAHOO.util.Event.removeListener(this._carouselPrev,"click",this._scrollPrev)}},_enablePrev:function(){this._prevEnabled=true;if(this._prevButtonStateHandlerEvt){this._prevButtonStateHandlerEvt.fire(true,this._carouselPrev)}if(this._isValidObj(this._carouselPrev)){YAHOO.util.Event.addListener(this._carouselPrev,"click",this._scrollPrev,this)}},_disableNext:function(){if(this.cfg.getProperty("wrap")){return }this._nextEnabled=false;if(this._isValidObj(this._nextButtonStateHandlerEvt)){this._nextButtonStateHandlerEvt.fire(false,this._carouselNext)}if(this._isValidObj(this._carouselNext)){YAHOO.util.Event.removeListener(this._carouselNext,"click",this._scrollNext)}},_enableNext:function(){this._nextEnabled=true;if(this._isValidObj(this._nextButtonStateHandlerEvt)){this._nextButtonStateHandlerEvt.fire(true,this._carouselNext)}if(this._isValidObj(this._carouselNext)){YAHOO.util.Event.addListener(this._carouselNext,"click",this._scrollNext,this)}},_isValidObj:function(A){if(null==A){return false}if("undefined"==typeof (A)){return false}return true}};
