(function(d,n,m,e){function o(a){a.preventDefault()}function j(a,b,c){this.iscrollview=a;this._emulateBottomOffset=function(){this.iscrollview.options.emulateBottomOffset&&(this.maxScrollY=this.wrapperH-this.scrollerH+this.minScrollY+this.iscrollview.options.bottomOffset)};this._fixInput=function(a){if(this.iscrollview.options.fixInput){var b;for(b=a.target;1!==b.nodeType;)b=b.parentNode;b=b.tagName.toLowerCase();if("select"===b||"input"===b||"textarea"===b)return}this.iscrollview.options.preventTouchHover? a.stopImmediatePropagation():a.preventDefault()};this._doCallback=function(a,b,c){var d=this.iscrollview,e=d._logCallback(a,b);c&&c.call(this,b);d._trigger(a.toLowerCase(),b,{iscrollview:d});d._logCallback(a,b,e)};this._bind=function(a,b,c){var e=this.iscrollview.options.bindIscrollUsingJqueryEvents,i=e&&"mouseout"===a?"mouseleave":a;"orientationchange"===a||"resize"===a?this.iscrollview._logIscrollEvent("iScroll bind (ignored)",a):(this.iscrollview._logIscrollEvent("iScroll bind",a),e?(b?d(b):this.iscrollview.$scroller).bind(i, d.proxy(this.handleEvent,this)):(b||this.scroller).addEventListener(i,this,!!c))};this._unbind=function(a,b,c){var e=this.iscrollview.options.bindIscrollUsingJqueryEvents,i=e&&"mouseout"===a?"mouseleave":a;"orientationchange"===a||"resize"===a?this.iscrollview._logIscrollEvent("iScroll unbind (ignored)"):(this.iscrollview._logIscrollEvent("iScroll unbind",a),e?d(b||this.iscrollview.$scroller).unbind(i,this.handleEvent):(b||this.scroller).removeEventListener(i,this,!!c))};this._origHandleEvent=iScroll.prototype.handleEvent; this.handleEvent=function(a){var b=this.iscrollview.options.bindIscrollUsingJqueryEvents,c;c=this.iscrollview._logIscrollEvent("iScroll.handleEvent",a);b&&"mouseleave"===a.type?(a.type="mouseout",this._origHandleEvent(a),a.type="mouseleave"):this._origHandleEvent(a);this.iscrollview._logIscrollEvent("iScroll.handleEvent",a,c)};this._resize=function(){};iScroll.call(this,b,c)}var k=m.ontouchend!==e,p=/webkit/i.test(navigator.appVersion),q=/android/gi.test(navigator.appVersion),r=/firefox/i.test(navigator.userAgent); /hp-tablet/gi.test(navigator.appVersion);/(iPhone|iPad|iPod).*AppleWebKit/.test(navigator.appVersion);var s=/iPad.*AppleWebKit/.test(navigator.appVersion),t=/(iPhone|iPad|iPod).*AppleWebKit.*Safari/.test(navigator.appVersion);/(iPhone|iPad|iPod).*AppleWebKit.(?!.*Safari)/.test(navigator.appVersion);var u=d.mobile.ignoreContentEnabled===e,l=1,h=function(){};h.prototype=iScroll.prototype;h=new h;h.constructor=j;j.prototype=h;d.widget("mobile.iscrollview",d.mobile.widget,{widgetEventPrefix:"iscroll_", iscroll:null,$window:d(n),$wrapper:[],$scroller:[],$scrollerContent:[],$pullDown:[],$pullUp:[],$pullUpSpacer:[],$page:[],_wrapperHeightAdjustForBoxModel:0,_firstScrollerExpand:!0,createdAt:null,pageID:null,instanceID:null,_dirty:!1,_dirtyCallbackBefore:null,_dirtyCallbackAfter:null,_sizeDirty:!1,options:{hScroll:!1,hScrollbar:!1,debug:!1,traceResizeWrapper:!1,traceRefresh:!1,traceCreateDestroy:!1,traceIscrollEvents:!1,tracedIscrollEvents:[],traceWidgetEvents:!1,tracedWidgetEvents:[],traceIscrollCallbacks:!1, tracedIscrollCallbacks:[],traceWidgetCallbacks:!1,tracedWidgetCallbacks:[],bottomOffset:0,emulateBottomOffset:!0,pageClass:"iscroll-page",wrapperClass:"iscroll-wrapper",scrollerClass:"iscroll-scroller",pullDownClass:"iscroll-pulldown",pullUpClass:"iscroll-pullup",pullLabelClass:"iscroll-pull-label",pullUpSpacerClass:"iscroll-pullup-spacer",scrollerContentClass:"iscroll-content",fixedHeightClass:"iscroll-fixed",fixedHeightSelector:":jqmData(role='header'), :jqmData(role='footer'), :jqmData(iscroll-fixed)", resizeWrapper:!0,resizeEvents:"resize"+(d.support.orientation?" orientationchange":""),refreshOnPageBeforeShow:!1,fixInput:!0,wrapperAdd:0,refreshDelay:q?200:0,scrollShortContent:!0,removeWrapperPadding:!0,addScrollerPadding:!0,scrollTopOnResize:!0,scrollTopOnOrientatationChange:!0,createScroller:!0,deferNonActiveRefresh:!0,deferNonActiveResize:!0,preventTouchHover:u&&k,bindIscrollUsingJqueryEvents:!1,fastDestroy:!1,preventPageScroll:!0,pullDownResetText:"Pull down to refresh...",pullDownPulledText:"Release to refresh...", pullDownLoadingText:"Loading...",pullUpResetText:"Pull up to refresh...",pullUpPulledText:"Release to refresh...",pullUpLoadingText:"Loading...",pullPulledClass:"iscroll-pull-pulled",pullLoadingClass:"iscroll-pull-loading",onrefresh:null,onbeforescrollstart:null,onscrollstart:null,onbeforescrollmove:null,onscrollmove:null,onbeforescrollend:null,onscrollend:null,ontouchend:null,ondestroy:null,onzoomstart:null,onzoom:null,onzoomend:null,onpulldownreset:null,onpulldownpulled:null,onpulldown:null,onpullupreset:null, onpulluppulled:null,onpullup:null,onbeforerefresh:null,onafterrefresh:null},_widgetOnlyOptions:"debug traceIscrollEvents tracedIscrollEvents traceIscrollCallbacks tracedIscrollCallbacks traceWidgetEvents tracedWidgetEvents traceWidgetCallbacks tracedWidgetCallbacks traceResizeWrapper traceRefresh traceCreateDestroy bottomOffset emulateBottomOffset pageClass wrapperClass scrollerClass pullDownClass pullUpClass scrollerContentClass pullLabelClass pullUpSpacerClass fixedHeightSelector resizeWrapper resizeEvents refreshOnPageBeforeShow fixInput wrapperAdd refreshDelay scrollShortContent removeWrapperPadding addScrollerPadding createScroller deferNonActiveRefresh preventTouchHover deferNonActiveResize bindIscrollUsingJqueryEvents scrollTopOnResize scrollTopOnOrientationChange pullDownResetText pullDownPulledText pullDownLoadingText pullUpResetText pullUpPulledText pullUpLoadingText pullPulledClass pullLoadingClass onpulldownreset onpulldownpulled onpulldown onpullupreset onpulluppulled onpullup onbeforerefresh onafterrefresh fastDestroy".split(" "), _event_map:{onrefresh:"onRefresh",onbeforescrollstart:"onBeforeScrollStart",onscrollstart:"onScrollStart",onbeforescrollmove:"onBeforeScrollMove",onscrollmove:"onScrollMove",onbeforescrollend:"onBeforeScrollEnd",onscrollend:"onScrollEnd",ontouchend:"onTouchEnd",ondestroy:"onDetroy",onzoomstart:"onZoomStart",onzoom:"onZoom",onzoomend:"onZoomEnd"},_proxy_event_funcs:{onRefresh:function(a){this._doCallback("onRefresh",a,function(a){this._emulateBottomOffset();this.iscrollview._pullOnRefresh.call(this.iscrollview, a)})},onBeforeScrollStart:function(a){this._doCallback("onBeforeScrollStart",a,function(a){this._fixInput(a)})},onScrollStart:function(a){this._doCallback("onScrollStart",a)},onBeforeScrollMove:function(a){this._doCallback("onBeforeScrollMove",a);a.preventDefault()},onScrollMove:function(a){this._doCallback("onScrollMove",a,function(a){this.iscrollview._pullOnScrollMove.call(this.iscrollview,a)})},onBeforeScrollEnd:function(a){this._doCallback("onBeforeScrollEnd",a)},onScrollEnd:function(a){this._doCallback("onScrollEnd", a,function(a){this.iscrollview._pullOnScrollEnd.call(this.iscrollview,a)})},onTouchEnd:function(a){this._doCallback("onTouchEnd",a)},onDestroy:function(a){this._doCallback("onDestroy",a)},onZoomStart:function(a){this._doCallback("onZoomStart",a)},onZoom:function(a){this._doCallback("onZoom",a)},onZoomEnd:function(a){this._doCallback("onZoomEnd",a)}},_merge_from_iscroll_options:function(){var a=d.extend(!0,{},this.iscroll.options);d.each(this._proxy_event_funcs,function(b){delete a[b]});this.options.emulateBottomOffset&& delete a.bottomOffset;d.extend(this.options,a)},_create_iscroll_options:function(){var a=d.extend(!0,{},this.options);d.each(this._widgetOnlyOptions,function(b,c){delete a[c]});d.each(this._event_map,function(b){delete a[b]});this.options.emulateBottomOffset&&delete a.bottomOffset;return d.extend(a,this._proxy_event_funcs)},_pad:function(a,b,c){a=a.toString();for(c=c||"0";a.length");a.parent().addClass(this.options.scrollerContentClass).css({"padding-left":this._origWrapperPaddingLeft, "padding-right":this._origWrapperPaddingRight,"padding-top":this._origWrapperPaddingTop,"padding-bottom":this._origWrapperPaddingBottom})}},_undoAddScrollerPadding:function(){this.options.removeWrapperPadding&&this.options.addScrollerPadding&&d("."+this.options.scrollerContentClass,this.$scroller).children().unwrap()},_addWrapperClasses:function(){this.$wrapper.addClass(this.options.wrapperClass);this.$scroller.addClass(this.options.scrollerClass)},_undoAddWrapperClasses:function(){this.$scroller.removeClass(this.options.scrollerClass); this.$wrapper.removeClass(this.options.wrapperClass)},_expandScrollerToFillWrapper:function(){if(this.options.scrollShortContent||this.$pullDown.length||this.pullUp.length)this._firstScrollerExpand&&(this._origScrollerStyle=this.$scroller.attr("style")||null,this._firstScrollerExpand=!1),this.$scroller.css("min-height",this.$wrapper.height()+(this.$pullDown.length?this.$pullDown.outerHeight(!0):0)+(this.$pullUp.length?this.$pullUp.outerHeight(!0):0))},_undoExpandScrollerToFillWrapper:function(){this._restoreStyle(this.$scroller, this._origScrollerStyle)},_resizeWrapper:function(){var a=null,b,c;this.options.resizeWrapper&&(this.options.traceResizeWrapper&&(a=this._log("resizeWrapper() start")),this.$wrapper.trigger("updatelayout"),b=m.documentElement.clientHeight,c=this._calculateBarsHeight(),b=b-c-this._wrapperHeightAdjustForBoxModel+(t&&!s?60:0)+this.options.wrapperAdd,this.$wrapper.css("height",b),this._expandScrollerToFillWrapper(),this.options.traceResizeWrapper&&this._logInterval("resizeWrapper() end"+(this._sizeDirty? " (dirty)":""),a))},resizeWrapper:function(){var a=this._setPageVisible();this._resizeWrapper();this._restorePageVisibility(a)},_undoResizeWrapper:function(){},_modifyWrapper:function(){this._addWrapperClasses();this._modifyWrapperCSS();this._wrapperHeightAdjustForBoxModel=this._getHeightAdjustForBoxModel(this.$wrapper)},_undoModifyWrapper:function(){this._undoResizeWrapper();this._undoModifyWrapperCSS();this._undoAddWrapperClasses()},_modifyPullDown:function(){var a,b;if(0!==this.$pullDown.length&& (a=d("."+this.options.pullLabelClass,this.$pullDown),a.length)){(this._origPullDownLabelText=a.text())?this.options.pullDownResetText=this._origPullDownLabelText:a.text(this.options.pullDownResetText);if(b=a.jqmData("iscroll-pulled-text"))this.options.pullDownPulledText=b;if(a=a.jqmData("iscroll-loading-text"))this.options.pullDownLoadingText=a}},_undoModifyPullDown:function(){if(0!==this.$pullDown.length){var a=d("."+this.options.pullLabelClass,this.$pullDown);0!==a.length&&a.text(this._origPullDownLabelText)}}, _modifyPullUp:function(){var a,b;if(0!==this.$pullUp.length&&(d("
").insertBefore(this.$pullUp).css("height",this.$pullUp.outerHeight(!0)),this.$pullUpSpacer=this.$pullUp.prev(),this.$pullUpSpacer.addClass(this.options.pullUpSpacerClass),a=d("."+this.options.pullLabelClass,this.$pullUp),a.length)){(this._origPullUpLabelText=a.text())?this.options.pullUpResetText=this._origPullUpLabelText:a.text(this.options.pullUpResetText);if(b=a.jqmData("iscroll-pulled-text"))this.options.pullUpPulledText= b;if(a=a.jqmData("iscroll-loading-text"))this.options.pullUpLoadingText=a}},_undoModifyPullUp:function(){0!==this.$pullUp.length&&(this.$pullUp.prev().remove(),this._origPullUpLabelText&&d("."+this.options.pullLabelClass,this.$pullUp).text(this._origPullUpLabelText))},_correctPushedDownPage:function(){this.options.resizeWrapper&&this.options.scrollTopOnResize&&d.mobile.silentScroll(0)},refresh:function(a,b,c,g){var f,h;if(!g&&this.options.deferNonActiveRefresh&&!this.$page.is(d.mobile.activePage))this._dirty= !0,this._dirtyCallbackBefore=b,this._dirtyCallbackAfter=c,this.options.traceRefresh&&this._log("refresh() (deferred)");else{f=this;h=this._startTiming();if(a===e||null===a)a=this.options.refreshDelay;setTimeout(function(){var a=null,d;f.options.traceRefresh&&(a=f._logInterval("refresh() start",h));d=f._setPageVisible();b&&b();f._triggerWidget("onbeforerefresh");f.iscroll.refresh();f._triggerWidget("onafterrefresh");c&&c();f._restorePageVisibility(d);d||f._correctPushedDownPage();f.options.traceRefresh&& f._logInterval2("refresh() end"+(g?" (dirty)":""),h,a)},a);this.options.traceRefresh&&this._log("refresh() will occur after >= "+a+"mS")}},_create_iscroll_object:function(){this.iscroll=new j(this,this.$wrapper.get(0),this._create_iscroll_options())},_createScroller:function(){this.options.createScroller&&(this.$wrapper.children().length?this.$wrapper.children().wrapAll("
"):this.$wrapper.append("
"))},_undoCreateScroller:function(){this.options.createScroller&&this.$scroller.children().unwrap()}, _setPageVisible:function(){var a=this.$page.is(":hidden");a&&this.$page.css("display","block");return a},_restorePageVisibility:function(a){a&&this.$page.css("display","")},_create:function(){var a=new Date,b;this.$wrapper=this.element;this.$page=this.$wrapper.parents(":jqmData(role='page')");this.options.debug&&this.options.traceCreateDestroy&&this._log("_create() start",a);this.createdAt=a;this._instanceCount(this._instanceCount()+1);this.instanceID=this._nextInstanceID();this._nextInstanceID(this._instanceID+ 1);1===this.instanceID&&(this._pageID(l),l+=1);this.pageID=this._pageID();b=this._setPageVisible();this._adaptPage();this._createScroller();this.$scroller=this.$wrapper.children(":first");0!==this.$scroller.length&&(this.$pullDown=d("."+this.options.pullDownClass,this.$scroller),this._modifyPullDown(),this.$pullUp=d("."+this.options.pullUpClass,this.$scroller),this._modifyPullUp(),d.extend(!0,this.options,this.$wrapper.jqmData("iscroll")),this._modifyWrapper(),this._bindPage("pagebeforeshow",this._pageBeforeShowFunc), this._setTopOffsetForPullDown(),this._setBottomOffsetForPullUp(),this._resizeWrapper(),this._addScrollerPadding(),this._create_iscroll_object(),this._merge_from_iscroll_options(),this._restorePageVisibility(b),this.options.resizeWrapper&&(this._isvBind(this.$window,this.options.resizeEvents,this._windowResizeFunc,"$window"),this.options.scrollTopOnOrientationChange&&this._isvBind(this.$window,"orientationchange",this._orientationChangeFunc,"$window")),this.$scrollerContent=this.$scroller.find("."+ this.options.scrollerContentClass),this._isvBind(this.$scrollerContent,"updatelayout",this._updateLayoutFunc,"$scrollerContent"),this.options.debug&&this.options.traceCreateDestroy&&this._logInterval("_create() end",a))},destroy:function(){var a=null;this.options.debug&&this.options.traceCreateDestroy&&(a=this._log("destroy() start"));this._isvUnbind(this.$scrollerContent,"updatelayout","$scrollerContent");this._isvUnbind(this.$window,this.options.resizeEvents,"$window");this._isvUnbind(this.$window, "orientationchange","$window");1===this._instanceCount()&&(this._unbindPage("pagebeforeshow"),k&&this._unbindPage("touchmove"));this.options.fastDestroy||(this.iscroll.destroy(),this.iscroll=null,this._undoExpandScrollerToFillWrapper(),this._undoModifyPullDown(),this._undoModifyPullUp(),this._undoAddScrollerPadding(),this._undoModifyWrapper(),this.$wrapper.removeClass(this.options.wrapperClass),this.$scroller.removeClass(this.options.scrollerClass),this._undoCreateScroller());this._instanceCount(this._instanceCount()- 1);0===this._instanceCount()&&this._undoAdaptPage();d.Widget.prototype.destroy.call(this);this.options.debug&&this.options.traceCreateDestroy&&this._logInterval("destroy() end",a)},enable:function(){this.iscroll.enable();d.Widget.prototype.enable.call(this)},disable:function(){this.iscroll.disable();d.Widget.prototype.disable.call(this)},_setOption:function(a,b){var c;this.options[a]=b;this.iscroll.destroy();c=this._setPageVisible();this._create_iscroll_object();this._restorePageVisibility(c);d.Widget.prototype._setOption.apply(this, arguments)},scrollTo:function(a,b,c,d){this.iscroll.scrollTo(a,b,c,d)},scrollToElement:function(a,b){this.iscroll.scrollToElement(a,b)},scrollToPage:function(a,b,c){this.iscroll.scrollToPage(a,b,c)},stop:function(){this.iscroll.stop()},zoom:function(a,b,c,d){this.iscroll.zoom(a,b,c,d)},isReady:function(){return this.iscroll.isReady()},x:function(){return this.iscroll.x},y:function(){return this.iscroll.y},wrapperW:function(){return this.iscroll.wrapperW},wrapperH:function(){return this.iscroll.wrapperH}, scrollerW:function(){return this.iscroll.scrollerW},scrollerH:function(){return this.iscroll.scrollerH},minScrollX:function(a){a!==e&&(this.iscroll.minScrollX=a);return this.iscroll.minScrollX},minScrollY:function(a){a!==e&&(this.iscroll.minScrollY=a);return this.iscroll.minScrollY},maxScrollX:function(a){a!==e&&(this.iscroll.maxScrollX=a);return this.iscroll.maxScrollX},maxScrollY:function(a){a!==e&&(this.iscroll.maxScrollY=a);return this.iscroll.maxScrollY},_pullDownIsPulled:function(){return this.$pullDown.length&& this.$pullDown.hasClass(this.options.pullPulledClass)},_pullUpIsPulled:function(){return this.$pullUp.length&&this.$pullUp.hasClass(this.options.pullPulledClass)},_replacePullText:function(a,b){var c;b&&(c=d("."+this.options.pullLabelClass,a))&&c.text(b)},_pullSetStateReset:function(a,b){a.is("."+this.options.pullLoadingClass+", ."+this.options.pullPulledClass)&&(a.removeClass(this.options.pullPulledClass+" "+this.options.pullLoadingClass),this._replacePullText(a,b))},_pullDownSetStateReset:function(a){this._pullSetStateReset(this.$pullDown, this.options.pullDownResetText);this._triggerWidget("onpulldownreset",a)},_pullUpSetStateReset:function(a){this._pullSetStateReset(this.$pullUp,this.options.pullUpResetText);this._triggerWidget("onpullupreset",a)},_pullSetStatePulled:function(a,b){a.removeClass(this.options.pullLoadingClass).addClass(this.options.pullPulledClass);this._replacePullText(a,b)},_pullDownSetStatePulled:function(a){this._pullSetStatePulled(this.$pullDown,this.options.pullDownPulledText);this._triggerWidget("onpulldownpulled", a)},_pullUpSetStatePulled:function(a){this._pullSetStatePulled(this.$pullUp,this.options.pullUpPulledText);this._triggerWidget("onpulluppulled",a)},_pullSetStateLoading:function(a,b){a.removeClass(this.options.pullPulledClass).addClass(this.options.pullLoadingClass);this._replacePullText(a,b)},_pullDownSetStateLoading:function(a){this._pullSetStateLoading(this.$pullDown,this.options.pullDownLoadingText);this._triggerWidget("onpulldownloading",a)},_pullUpSetStateLoading:function(a){this._pullSetStateLoading(this.$pullUp, this.options.pullUpLoadingText);this._triggerWidget("onpulluploading",a)},_pullOnRefresh:function(a){this.$pullDown.length&&this._pullDownSetStateReset(a);this.$pullUp.length&&this._pullUpSetStateReset(a)},_pullOnScrollMove:function(a){var b,c,d=this.y();this.$pullDown.length&&(b=this._pullDownIsPulled(),c=this.options.topOffset,!b&&d>c/2?(this._pullDownSetStatePulled(a),this.minScrollY(0)):b&&0>=d&&(this._pullDownSetStateReset(a),this.minScrollY(-c)));this.$pullUp.length&&(b=this._pullUpIsPulled(), c=this.options.bottomOffset,!b&&d=this.maxScrollY()&&(this._pullUpSetStateReset(a),this.maxScrollY(this.wrapperH()-this.scrollerH()+this.minScrollY()+c)))},_pullOnScrollEnd:function(a){this._pullDownIsPulled(a)?(this._pullDownSetStateLoading(a),this._triggerWidget("onpulldown",a)):this._pullUpIsPulled(a)&&(this._pullUpSetStateLoading(a),this._triggerWidget("onpullup",a))}})})(jQuery, window,document);jQuery(document).bind("pagecreate",function(d){jQuery(d.target).find(":jqmData(iscroll)").iscrollview()});