//>>built
define("dojox/mobile/Carousel","dojo/_base/array,dojo/_base/connect,dojo/_base/declare,dojo/_base/event,dojo/_base/sniff,dojo/dom-class,dojo/dom-construct,dojo/dom-style,dijit/registry,dijit/_Contained,dijit/_Container,dijit/_WidgetBase,./lazyLoadUtils,./CarouselItem,./PageIndicator,./SwapView,require".split(","),function(e,n,o,p,q,l,h,j,m,r,s,t,u,x,v,k,w){return o("dojox.mobile.Carousel",[t,s,r],{numVisible:2,itemWidth:0,title:"",pageIndicator:!0,navButton:!1,height:"",selectable:!0,baseClass:"mblCarousel",
buildRendering:function(){this.containerNode=h.create("div",{className:"mblCarouselPages"});this.inherited(arguments);if(this.srcNodeRef)for(var a=0,b=this.srcNodeRef.childNodes.length;a<b;a++)this.containerNode.appendChild(this.srcNodeRef.firstChild);this.headerNode=h.create("div",{className:"mblCarouselHeaderBar"},this.domNode);if(this.navButton)this.btnContainerNode=h.create("div",{className:"mblCarouselBtnContainer"},this.headerNode),j.set(this.btnContainerNode,"float","right"),this.prevBtnNode=
h.create("button",{className:"mblCarouselBtn",title:"Previous",innerHTML:"&lt;"},this.btnContainerNode),this.nextBtnNode=h.create("button",{className:"mblCarouselBtn",title:"Next",innerHTML:"&gt;"},this.btnContainerNode),this._prevHandle=this.connect(this.prevBtnNode,"onclick","onPrevBtnClick"),this._nextHandle=this.connect(this.nextBtnNode,"onclick","onNextBtnClick");if(this.pageIndicator){if(!this.title)this.title="&nbsp;";this.piw=new v;j.set(this.piw,"float","right");this.headerNode.appendChild(this.piw.domNode)}this.titleNode=
h.create("div",{className:"mblCarouselTitle"},this.headerNode);this.domNode.appendChild(this.containerNode);this.subscribe("/dojox/mobile/viewChanged","handleViewChanged");this._clickHandle=this.connect(this.domNode,"onclick","_onClick");this._keydownHandle=this.connect(this.domNode,"onkeydown","_onClick");this._dragstartHandle=this.connect(this.domNode,"ondragstart",p.stop);this.selectedItemIndex=-1;this.items=[]},startup:function(){if(!this._started){var a;if("inherit"===this.height)this.domNode.offsetParent&&
(a=this.domNode.offsetParent.offsetHeight+"px");else if(this.height)a=this.height;if(a)this.domNode.style.height=a;if(this.store){if(!this.setStore)throw Error("Use StoreCarousel or DataCarousel instead of Carousel.");a=this.store;this.store=null;this.setStore(a,this.query,this.queryOptions)}else this.resizeItems();this.inherited(arguments);this.currentView=e.filter(this.getChildren(),function(a){return a.isVisible()})[0]}},resizeItems:function(){var a=0,b=this.domNode.offsetHeight-(this.headerNode?
this.headerNode.offsetHeight:0),d=q("ie")?5/this.numVisible-1:5/this.numVisible;e.forEach(this.getChildren(),function(c){if(c instanceof k){if(!c.lazy&&!c.domNode.getAttribute("lazy"))c._instantiated=!0;for(var c=c.containerNode.childNodes,f=0,g=c.length;f<g;f++){var e=c[f];if(1===e.nodeType){var i=this.items[a]||{};j.set(e,{width:i.width||90/this.numVisible+"%",height:i.height||b+"px",margin:"0 "+(i.margin||d+"%")});l.add(e,"mblCarouselSlot");a++}}}},this);if(this.piw)this.piw.refId=this.containerNode.firstChild,
this.piw.reset()},resize:function(){if(this.itemWidth){var a=Math.floor(this.domNode.offsetWidth/this.itemWidth);if(a!==this.numVisible)this.selectedItemIndex=this.getIndexByItemWidget(this.selectedItem),this.numVisible=a,0<this.items.length&&(this.onComplete(this.items),this.select(this.selectedItemIndex))}},fillPages:function(){e.forEach(this.getChildren(),function(a,b){for(var d="",c=0;c<this.numVisible;c++){var f,g="",h;f=b*this.numVisible+c;var i={};f<this.items.length?(i=this.items[f],(f=this.store.getValue(i,
"type"))?(g=this.store.getValue(i,"props"),h=this.store.getValue(i,"mixins")):(f="dojox.mobile.CarouselItem",e.forEach(["alt","src","headerText","footerText"],function(a){var b=this.store.getValue(i,a);void 0!==b&&(g&&(g+=","),g+=a+':"'+b+'"')},this))):(f="dojox.mobile.CarouselItem",g='src:"'+w.toUrl("dojo/resources/blank.gif")+'", className:"mblCarouselItemBlank"');d+='<div data-dojo-type="'+f+'"';g&&(d+=" data-dojo-props='"+g+"'");h&&(d+=" data-dojo-mixins='"+h+"'");d+="></div>"}a.containerNode.innerHTML=
d},this)},onComplete:function(a){e.forEach(this.getChildren(),function(a){a instanceof k&&a.destroyRecursive()});this.selectedItem=null;this.items=a;var b=Math.ceil(a.length/this.numVisible),d=this.domNode.offsetHeight-this.headerNode.offsetHeight;pg=Math.floor((-1===this.selectedItemIndex?0:this.selectedItemIndex)/this.numVisible);for(a=0;a<b;a++){var c=new k({height:d+"px",lazy:!0});this.addChild(c);a===pg?(c.show(),this.currentView=c):c.hide()}this.fillPages();this.resizeItems();d=this.getChildren();
b=pg+1>b-1?b-1:pg+1;for(a=0>pg-1?0:pg-1;a<=b;a++)this.instantiateView(d[a])},onError:function(){},onUpdate:function(){},onDelete:function(){},onSet:function(){},onNew:function(){},onStoreClose:function(){},getParentView:function(a){for(a=m.getEnclosingWidget(a);a;a=a.getParent())if(a.getParent()instanceof k)return a;return null},getIndexByItemWidget:function(a){if(!a)return-1;var b=a.getParent();return e.indexOf(this.getChildren(),b)*this.numVisible+e.indexOf(b.getChildren(),a)},getItemWidgetByIndex:function(a){return-1===
a?null:this.getChildren()[Math.floor(a/this.numVisible)].getChildren()[a%this.numVisible]},onPrevBtnClick:function(){this.currentView&&this.currentView.goTo(-1)},onNextBtnClick:function(){this.currentView&&this.currentView.goTo(1)},_onClick:function(a){if(!1!==this.onClick(a)){if(a&&"keydown"===a.type)if(39===a.keyCode)this.onNextBtnClick();else if(37===a.keyCode)this.onPrevBtnClick();else if(13!==a.keyCode)return;for(a=m.getEnclosingWidget(a.target);;a=a.getParent()){if(!a)return;if(a.getParent()instanceof
k)break}this.select(a);var b=this.getIndexByItemWidget(a);n.publish("/dojox/mobile/carouselSelect",[this,a,this.items[b],b])}},select:function(a){"number"===typeof a&&(a=this.getItemWidgetByIndex(a));if(this.selectable)this.selectedItem&&(this.selectedItem.set("selected",!1),l.remove(this.selectedItem.domNode,"mblCarouselSlotSelected")),a&&(a.set("selected",!0),l.add(a.domNode,"mblCarouselSlotSelected")),this.selectedItem=a},onClick:function(){},instantiateView:function(a){if(a&&!a._instantiated){var b=
"none"===j.get(a.domNode,"display");b&&j.set(a.domNode,{visibility:"hidden",display:""});u.instantiateLazyWidgets(a.containerNode,null,function(){b&&j.set(a.domNode,{visibility:"visible",display:"none"})});a._instantiated=!0}},handleViewChanged:function(a){if(a.getParent()===this)this.currentView.nextView(this.currentView.domNode)===a?this.instantiateView(a.nextView(a.domNode)):this.instantiateView(a.previousView(a.domNode)),this.currentView=a},_setTitleAttr:function(a){this.titleNode.innerHTML=this._cv?
this._cv(a):a;this._set("title",a)}})});