YUI.add("imageloader",function(l,t){l.ImgLoadGroup=function(){this._init(),l.ImgLoadGroup.superclass.constructor.apply(this,arguments)},l.ImgLoadGroup.NAME="imgLoadGroup",l.ImgLoadGroup.ATTRS={name:{value:""},timeLimit:{value:null},foldDistance:{validator:l.Lang.isNumber,setter:function(t){return this._setFoldTriggers(),t},lazyAdd:!1},className:{value:null,setter:function(t){return this._className=t},lazyAdd:!1},classNameAction:{value:"default"}},l.extend(l.ImgLoadGroup,l.Base,{_init:function(){this._triggers=[],this._imgObjs={},this._timeout=null,this._classImageEls=null,this._className=null,this._areFoldTriggersSet=!1,this._maxKnownHLimit=0,l.on("domready",this._onloadTasks,this)},addTrigger:function(t,e){return t&&e&&this._triggers.push(l.on(e,function(){this.fetch()},t,this)),this},addCustomTrigger:function(t,e){var s;return t&&(s=function(){this.fetch()},l.Lang.isUndefined(e)?this._triggers.push(l.on(t,s,this)):this._triggers.push(e.on(t,s,this))),this},_setFoldTriggers:function(){var t;this._areFoldTriggersSet||(this._triggers.push(l.on("scroll",t=function(){this._foldCheck()},window,this)),this._triggers.push(l.on("resize",t,window,this)),this._areFoldTriggersSet=!0)},_onloadTasks:function(){var t=this.get("timeLimit");t&&0<t&&(this._timeout=setTimeout(this._getFetchTimeout(),1e3*t)),l.Lang.isUndefined(this.get("foldDistance"))||this._foldCheck()},_getFetchTimeout:function(){var t=this;return function(){t.fetch()}},registerImage:function(){var t=arguments[0].domId;return t?(this._imgObjs[t]=new l.ImgLoadImgObj(arguments[0]),this._imgObjs[t]):null},fetch:function(){for(var t in this._clearTriggers(),this._fetchByClass(),this._imgObjs)this._imgObjs.hasOwnProperty(t)&&this._imgObjs[t].fetch()},_clearTriggers:function(){clearTimeout(this._timeout);for(var t=0,e=this._triggers.length;t<e;t++)this._triggers[t].detach()},_foldCheck:function(){var t,e,s,i,h,n=!0,a=l.DOM.viewportRegion().bottom+this.get("foldDistance");if(!(a<=this._maxKnownHLimit)){for(t in this._maxKnownHLimit=a,this._imgObjs)this._imgObjs.hasOwnProperty(t)&&(e=this._imgObjs[t].fetch(a),n=n&&e);if(this._className)for(null===this._classImageEls&&(this._classImageEls=[],(s=l.all("."+this._className)).each(function(t){this._classImageEls.push({el:t,y:t.getY(),fetched:!1})},this)),i=0,h=(s=this._classImageEls).length;i<h;i++)s[i].fetched||(s[i].y&&s[i].y<=a?(this._updateNodeClassName(s[i].el),s[i].fetched=!0):n=!1);n&&this._clearTriggers()}},_updateNodeClassName:function(t){var e;"enhanced"==this.get("classNameAction")&&"img"==t.get("tagName").toLowerCase()&&(e=t.getStyle("backgroundImage"),/url\(["']?(.*?)["']?\)/.test(e),e=RegExp.$1,t.set("src",e),t.setStyle("backgroundImage","")),t.removeClass(this._className)},_fetchByClass:function(){this._className&&l.all("."+this._className).each(l.bind(this._updateNodeClassName,this))}}),l.ImgLoadImgObj=function(){l.ImgLoadImgObj.superclass.constructor.apply(this,arguments),this._init()},l.ImgLoadImgObj.NAME="imgLoadImgObj",l.ImgLoadImgObj.ATTRS={domId:{value:null,writeOnce:!0},bgUrl:{value:null},srcUrl:{value:null},width:{value:null},height:{value:null},setVisible:{value:!1},isPng:{value:!1},sizingMethod:{value:"scale"},enabled:{value:"true"}},l.extend(l.ImgLoadImgObj,l.Base,{_init:function(){this._fetched=!1,this._imgEl=null,this._yPos=null},fetch:function(t){if(!this._fetched){var e,s=this._getImgEl();if(!s)return!1;if(t&&(!(e=this._getYPos())||t<e))return!1;null!==this.get("bgUrl")?this.get("isPng")&&l.UA.ie&&l.UA.ie<=6?s.setStyle("filter",'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="'+this.get("bgUrl")+'", sizingMethod="'+this.get("sizingMethod")+'", enabled="'+this.get("enabled")+'")'):s.setStyle("backgroundImage","url('"+this.get("bgUrl")+"')"):null!==this.get("srcUrl")&&s.setAttribute("src",this.get("srcUrl")),this.get("setVisible")&&s.setStyle("visibility","visible"),this.get("width")&&s.setAttribute("width",this.get("width")),this.get("height")&&s.setAttribute("height",this.get("height")),this._fetched=!0}return!0},_getImgEl:function(){return null===this._imgEl&&(this._imgEl=l.one("#"+this.get("domId"))),this._imgEl},_getYPos:function(){return null===this._yPos&&(this._yPos=this._getImgEl().getY()),this._yPos}})},"patched-v3.18.4",{requires:["base-base","node-style","node-screen"]});