;(function($,window,document,undefined){"use strict";var HasTouch=document.ontouchend!==undefined,IsWebkit=(/webkit/i).test(navigator.appVersion),IsAndroid=(/android/gi).test(navigator.appVersion),IsFirefox=(/firefox/i).test(navigator.userAgent),IsTouchPad=(/hp-tablet/gi).test(navigator.appVersion),IsIDevice=(/(iPhone|iPad|iPod).*AppleWebKit/).test(navigator.appVersion),IsIPad=(/iPad.*AppleWebKit/).test(navigator.appVersion),IsMobileSafari=(/(iPhone|iPad|iPod).*AppleWebKit.*Safari/).test(navigator.appVersion),IsUIWebView=(/(iPhone|iPad|iPod).*AppleWebKit.(?!.*Safari)/).test(navigator.appVersion),IsIDeviceStandalone=IsIDevice&&(window.navigator.Standalone!==undefined),JQMIsV1_0=$.mobile.ignoreContentEnabled===undefined,nextPageID=1;function _pageTouchmoveFunc(e){e.preventDefault();}
function _subclass(constructor,superConstructor){function SurrogateConstructor(){}
SurrogateConstructor.prototype=superConstructor.prototype;var prototypeObject=new SurrogateConstructor();prototypeObject.constructor=constructor;constructor.prototype=prototypeObject;}
function IScroll(iscrollview,scroller,options){this.iscrollview=iscrollview;this._emulateBottomOffset=function(e){if(this.iscrollview.options.emulateBottomOffset){this.maxScrollY=this.wrapperH-this.scrollerH+this.minScrollY+this.iscrollview.options.bottomOffset;}};this._fixInput=function(e){if(this.iscrollview.options.fixInput){var tagName,target=e.target;while(target.nodeType!==1){target=target.parentNode;}
tagName=target.tagName.toLowerCase();if(tagName==="select"||tagName==="input"||tagName==="textarea"){return;}}
if(this.iscrollview.options.preventTouchHover){e.stopImmediatePropagation();}
else{e.preventDefault();}};this._doCallback=function(callbackName,e,f){var v=this.iscrollview,then=v._logCallback(callbackName,e);if(f){f.call(this,e);}
v._trigger(callbackName.toLowerCase(),e,{"iscrollview":v});v._logCallback(callbackName,e,then);};this._bind=function(type,el,bubble){var jqEvents=this.iscrollview.options.bindIscrollUsingJqueryEvents,_type=jqEvents&&type==="mouseout"?"mouseleave":type;if(type==="orientationchange"||type==="resize"){this.iscrollview._logIscrollEvent("iScroll bind (ignored)",type);return;}
this.iscrollview._logIscrollEvent("iScroll bind",type);if(jqEvents){(el?$(el):this.iscrollview.$scroller).bind(_type,$.proxy(this.handleEvent,this));}
else{(el||this.scroller).addEventListener(_type,this,!!bubble);}};this._unbind=function(type,el,bubble){var jqEvents=this.iscrollview.options.bindIscrollUsingJqueryEvents,_type=jqEvents&&type==="mouseout"?"mouseleave":type;if(type==="orientationchange"||type==="resize"){this.iscrollview._logIscrollEvent("iScroll unbind (ignored)");return;}
this.iscrollview._logIscrollEvent("iScroll unbind",type);if(jqEvents){$(el||this.iscrollview.$scroller).unbind(_type,this.handleEvent);}
else{(el||this.scroller).removeEventListener(_type,this,!!bubble);}};this._origHandleEvent=iScroll.prototype.handleEvent;this.handleEvent=function(e){var jqEvents=this.iscrollview.options.bindIscrollUsingJqueryEvents,then;then=this.iscrollview._logIscrollEvent("iScroll.handleEvent",e);if(jqEvents&&e.type==="mouseleave"){e.type="mouseout";this._origHandleEvent(e);e.type="mouseleave";}
else{this._origHandleEvent(e);}
this.iscrollview._logIscrollEvent("iScroll.handleEvent",e,then);};this._resize=function(){};iScroll.call(this,scroller,options);}
_subclass(IScroll,iScroll);$.widget("mobile.iscrollview",$.mobile.widget,{widgetEventPrefix:"iscroll_",iscroll:null,$window:$(window),$wrapper:[],$scroller:[],$scrollerContent:[],$pullDown:[],$pullUp:[],$pullUpSpacer:[],$page:[],_wrapperHeightAdjustForBoxModel:0,_firstScrollerExpand:true,createdAt:null,pageID:null,instanceID:null,_dirty:false,_dirtyCallbackBefore:null,_dirtyCallbackAfter:null,_sizeDirty:false,options:{hScroll:false,hScrollbar:false,debug:false,traceResizeWrapper:false,traceRefresh:false,traceCreateDestroy:false,traceIscrollEvents:false,tracedIscrollEvents:[],traceWidgetEvents:false,tracedWidgetEvents:[],traceIscrollCallbacks:false,tracedIscrollCallbacks:[],traceWidgetCallbacks:false,tracedWidgetCallbacks:[],bottomOffset:0,emulateBottomOffset:true,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:true,resizeEvents:"resize"+($.support.orientation?" orientationchange":""),refreshOnPageBeforeShow:false,fixInput:true,wrapperAdd:0,refreshDelay:IsAndroid?200:0,scrollShortContent:true,removeWrapperPadding:true,addScrollerPadding:true,scrollTopOnResize:true,scrollTopOnOrientatationChange:true,createScroller:true,deferNonActiveRefresh:true,deferNonActiveResize:true,preventTouchHover:JQMIsV1_0&&HasTouch,bindIscrollUsingJqueryEvents:false,fastDestroy:false,preventPageScroll:true,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"],_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(e){this._doCallback("onRefresh",e,function(e){this._emulateBottomOffset();this.iscrollview._pullOnRefresh.call(this.iscrollview,e);});},onBeforeScrollStart:function(e){this._doCallback("onBeforeScrollStart",e,function(e){this._fixInput(e);});},onScrollStart:function(e){this._doCallback("onScrollStart",e);},onBeforeScrollMove:function(e){this._doCallback("onBeforeScrollMove",e);e.preventDefault();},onScrollMove:function(e){this._doCallback("onScrollMove",e,function(e){this.iscrollview._pullOnScrollMove.call(this.iscrollview,e);});},onBeforeScrollEnd:function(e){this._doCallback("onBeforeScrollEnd",e);},onScrollEnd:function(e){this._doCallback("onScrollEnd",e,function(e){this.iscrollview._pullOnScrollEnd.call(this.iscrollview,e);});},onTouchEnd:function(e){this._doCallback("onTouchEnd",e);},onDestroy:function(e){this._doCallback("onDestroy",e);},onZoomStart:function(e){this._doCallback("onZoomStart",e);},onZoom:function(e){this._doCallback("onZoom",e);},onZoomEnd:function(e){this._doCallback("onZoomEnd",e);}},_merge_from_iscroll_options:function(){var options=$.extend(true,{},this.iscroll.options);$.each(this._proxy_event_funcs,function(k,v){delete options[k];});if(this.options.emulateBottomOffset){delete options.bottomOffset;}
$.extend(this.options,options);},_create_iscroll_options:function(){var options=$.extend(true,{},this.options);$.each(this._widgetOnlyOptions,function(i,v){delete options[v];});$.each(this._event_map,function(k,v){delete options[k];});if(this.options.emulateBottomOffset){delete options.bottomOffset;}
return $.extend(options,this._proxy_event_funcs);},_pad:function(num,digits,padChar){var str=num.toString(),_padChar=padChar||"0";while(str.length<digits){str=_padChar+str;}
return str;},_toTime:function(date){return this._pad(date.getHours(),2)+":"+this._pad(date.getMinutes(),2)+":"+this._pad(date.getSeconds(),2)+"."+this._pad(date.getMilliseconds(),3);},_log:function(text,now){var _now,id,idStr;if(!this.options.debug){return null;}
_now=now||new Date();id=this.$wrapper.attr("id");idStr=id?"#"+id:"";console.log(this._toTime(_now)+" "+$.mobile.path.parseUrl(this.$page.jqmData("url")).filename+idStr+" "+text);return _now;},_logInterval:function(text,then){var now;if(!this.options.debug){return null;}
now=new Date();return this._log(text+" "+(now-then)+"mS from "+this._toTime(then),now);},_logEvent:function(text,e,then){var now,eventTime,haveEvent=e&&e instanceof Object,type=haveEvent?e.type:e,_text=type+" "+text;if(!this.options.debug){return null;}
now=new Date();if(then){_text+=" end "+(+(now-then))+"mS from "+this._toTime(then);}
else if(haveEvent){_text+=" begin";}
if(haveEvent){eventTime=new Date(e.timeStamp);_text+=" ("+(now-eventTime)+"mS from "+e.type+" @ "+this._toTime(eventTime)+")";}
return this._log(_text,now);},_logCallback:function(callbackName,e,then){if(!this.options.debug||!this.options.traceIscrollCallbacks||(this.options.tracedIscrollCallbacks.length!==0&&$.inArray(callbackName,this.options.tracedIscrollCallbacks)===-1)){return null;}
if(e){return this._logEvent(callbackName,e,then);}
if(then){return this._logInterval(callbackName+" end",then);}
return this._log(callbackName+" begin");},_logIscrollEvent:function(text,e,then){var haveEvent=e instanceof Event,type=haveEvent?e.type:e;if(!this.options.debug||!this.options.traceIscrollEvents||(this.options.tracedIscrollEvents.length!==0&&$.inArray(type,this.options.tracedIscrollEvents)===-1)){return null;}
return this._logEvent(text,e,then);},_logWidgetEvent:function(text,e,then){var haveEvent=e instanceof Object,type=haveEvent?e.type:e;if(!this.options.debug||!this.options.traceWidgetEvents||(this.options.tracedWidgetEvents.length!==0&&$.inArray(type,this.options.tracedWidgetEvents)===-1)){return null;}
return this._logEvent(text,e,then);},_logWidgetCallback:function(callbackName,e,then){if(!this.options.debug||!this.options.traceWidgetCallbacks||(this.options.tracedWidgetCallbacks.length!==0&&$.inArray(callbackName,this.options.tracedWidgetCallbacks)===-1)){return null;}
if(e){return this._logEvent(callbackName,e,then);}
if(then){return this._logInterval(callbackName+" end",then);}
return this._log(callbackName+" begin");},_logInterval2:function(text,then,later){var now;if(!this.options.debug){return;}
now=new Date();this._log(text+" "+(now-later)+"mS from "+this._toTime(later)+" ("+(now-then)+"mS from "+this._toTime(then)+")");},_startTiming:function(){if(!this.options.debug){return null;}
return new Date();},_pageEventNamespace:function(){return".iscroll_"+this.pageID;},_instanceEventNamespace:function(){return this._pageEventNamespace()+"_"+this.instanceID;},_addEventsNamespace:function(types_in,namespace){var types=types_in.split(" ");$.each(types,function(k,v){types[k]+=namespace;});return types.join(" ");},_isvBind:function(obj,types_in,func,objName){var types=this._addEventsNamespace(types_in,this._instanceEventNamespace());this._logWidgetEvent("bind "+objName,types);obj.bind(types,$.proxy(func,this));},_bindPage:function(types_in,func){var types=this._addEventsNamespace(types_in,this._pageEventNamespace());this._logWidgetEvent("bind $page",types);this.$page.bind(types,$.proxy(func,this));},_isvUnbind:function(obj,types_in,objName){var types=this._addEventsNamespace(types_in,this._instanceEventNamespace());this._logWidgetEvent("unbind "+objName,types);obj.unbind(types);},_unbindPage:function(types_in){var types=this._addEventsNamespace(types_in,this._instanceEventNamespace());this._logWidgetEvent("unbind  $page",types);this.$page.unbind(types);},_delegate:function(obj,selector,type,func,objName){this._logWidgetEvent("delegate "+objName+" "+selector,type);obj.delegate(selector,type,$.proxy(func,this));},_triggerWidget:function(type,e){var then=this._logWidgetCallback(type);this._trigger(type,e,{"iscrollview":this});this._logWidgetCallback(type,e,then);},isDirty:function(){return this._dirty;},_restoreStyle:function($ele,originalStyle){if(originalStyle===undefined){return;}
if(originalStyle===null){$ele.removeAttr("style");}
else{$ele.attr("style",originalStyle);}},_pageBeforeShowFunc:function(e){var then=this._logWidgetEvent("_pageBeforeShowFunc",e);if(this._dirty){this.resizeWrapper();this.refresh(null,this._dirtyCallbackBefore,this._dirtyCallbackAfter,true);this._dirty=false;this._dirtyCallbackBefore=null;this._dirtyCallbackAfter=null;}
else if(this.options.refreshOnPageBeforeShow||this._sizeDirty){this.refresh(null,$.proxy(this._resizeWrapper,this),null,true);}
this._sizeDirty=false;this._logWidgetEvent("_pageBeforeShowFunc",e,then);},_windowResizeFunc:function(e){var then=this._logWidgetEvent("_windowResizeFunc",e);if(this.options.deferNonActiveResize&&!(this.$page.is($.mobile.activePage))){this._sizeDirty=true;if(this.options.traceResizeWrapper){this._log("resizeWrapper() (deferred)");}}
else{this.resizeWrapper();this.refresh(null,null,null,true);}
this._logWidgetEvent("_windowResizeFunc",e,then);},_orientationChangeFunc:function(e){var then=this._logWidgetEvent("_orientationChangeFunc",e);if(this.options.scrollTopOnOrientationChange){$.mobile.silentScroll(0);}
this._logWidgetEvent("_orientationChangeFunc",e,then);},_updateLayoutFunc:function(e){this.refresh();},_instanceCount:function(count_in){var key="iscroll-private",count=0,data=this.$page.jqmData(key)||{};if(count_in!==undefined){count=count_in;data.instanceCount=count;this.$page.jqmData(key,data);}
else{if(data.instanceCount!==undefined){count=data.instanceCount;}}
return count;},_nextInstanceID:function(id_in){var key="iscroll-private",id=1,data=this.$page.jqmData(key)||{};if(id_in!==undefined){id=id_in;data.nextInstanceID=id;this.$page.jqmData(key,data);}
else{if(data.nextInstanceID!==undefined){id=data.nextInstanceID;}}
return id;},_pageID:function(id_in){var key="iscroll-private",id=1,data=this.$page.jqmData(key)||{};if(id_in!==undefined){id=id_in;data.pageID=id;this.$page.jqmData(key,data);}
else{if(data.pageID!==undefined){id=data.pageID;}}
return id;},_adaptPage:function(){var _this=this;if(this._instanceCount()===1){this.$page.addClass(this.options.pageClass);this.$page.find(this.options.fixedHeightSelector).each(function(){$(this).addClass(_this.options.fixedHeightClass);});if(HasTouch&&this.options.preventPageScroll){this._bindPage("touchmove",_pageTouchmoveFunc);}}},_undoAdaptPage:function(){var _this=this;if(this._instanceCount()===1){this.$page.find(this.options.fixedHeightSelector).each(function(){$(this).removeClass(_this.options.fixedHeightClass);});this.$page.removeClass(this.options.pageClass);}},_calculateBarsHeight:function(){var barsHeight=0,fixedHeightSelector="."+this.options.fixedHeightClass,$barsInPage=this.$page.find(fixedHeightSelector),$barsOutsidePage=$("body").children(fixedHeightSelector);$barsInPage.each(function(){barsHeight+=$(this).outerHeight(true);});$barsOutsidePage.each(function(){var id=$(this).jqmData("id");if(id===""||!$barsInPage.is(":jqmData(id='"+id+"')")){barsHeight+=$(this).outerHeight(true);}});return barsHeight;},_getBoxSizing:function($elem){var boxSizing,prefix="";if(IsFirefox){prefix="-moz-";}
else if(IsWebkit){prefix="-webkit-";}
boxSizing=$elem.css(prefix+"box-sizing");if(!boxSizing&&prefix){boxSizing=$elem.css("box-sizing");}
if(!boxSizing){if($.boxModel){boxSizing="content-box";}
else{boxSizing="border-box";}}
return boxSizing;},_getHeightAdjustForBoxModel:function($elem){var adjust;switch(this._getBoxSizing($elem)){case"border-box":adjust=$elem.outerHeight(true)-$elem.outerHeight();break;case"padding-box":adjust=$elem.outerHeight()-$elem.height();break;case"content-box":default:adjust=$elem.outerHeight(true)-$elem.height();break;}
return adjust;},_setTopOffsetForPullDown:function(){if(this.$pullDown.length&&!this.options.topOffset){this.options.topOffset=this.$pullDown.outerHeight(true);}},_setBottomOffsetForPullUp:function(){if(this.$pullUp.length&&!this.options.bottomOffset){this.options.bottomOffset=this.$pullUp.outerHeight(true);}},_removeWrapperPadding:function(){var $wrapper=this.$wrapper;if(this.options.removeWrapperPadding){this._origWrapperPaddingLeft=$wrapper.css("padding-left");this._origWrapperPaddingRight=$wrapper.css("padding-right");this._origWrapperPaddingTop=$wrapper.css("padding-top");this._origWrapperPaddingBottom=$wrapper.css("padding-bottom");this.$wrapper.css("padding",0);}},_modifyWrapperCSS:function(){this._origWrapperStyle=this.$wrapper.attr("style")||null;this._removeWrapperPadding();},_undoModifyWrapperCSS:function(){this._restoreStyle(this.$wrapper,this._origWrapperStyle);},_addScrollerPadding:function(){if(this.options.removeWrapperPadding&&this.options.addScrollerPadding){var $scrollerContentWrapper,$scrollerChildren=this.$scroller.children(),$scrollerContent=$scrollerChildren.not(this.$pullDown).not(this.$pullUp).not(this.$pullUpSpacer);$scrollerContent.wrapAll("<div/>");$scrollerContentWrapper=$scrollerContent.parent().addClass(this.options.scrollerContentClass);$scrollerContentWrapper.css({"padding-left":this._origWrapperPaddingLeft,"padding-right":this._origWrapperPaddingRight,"padding-top":this._origWrapperPaddingTop,"padding-bottom":this._origWrapperPaddingBottom});}},_undoAddScrollerPadding:function(){if(this.options.removeWrapperPadding&&this.options.addScrollerPadding){$("."+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){if(this._firstScrollerExpand){this._origScrollerStyle=this.$scroller.attr("style")||null;this._firstScrollerExpand=false;}
this.$scroller.css("min-height",this.$wrapper.height()+(this.$pullDown.length?this.$pullDown.outerHeight(true):0)+(this.$pullUp.length?this.$pullUp.outerHeight(true):0));}},_undoExpandScrollerToFillWrapper:function(){this._restoreStyle(this.$scroller,this._origScrollerStyle);},_resizeWrapper:function(){var then=null,viewportHeight,barsHeight,newWrapperHeight;if(!this.options.resizeWrapper){return;}
if(this.options.traceResizeWrapper){then=this._log("resizeWrapper() start");}
this.$wrapper.trigger("updatelayout");viewportHeight=document.documentElement.clientHeight;barsHeight=this._calculateBarsHeight();newWrapperHeight=viewportHeight-barsHeight-this._wrapperHeightAdjustForBoxModel+(IsMobileSafari&&!IsIPad?60:0)+this.options.wrapperAdd;this.$wrapper.css("height",newWrapperHeight);this._expandScrollerToFillWrapper();if(this.options.traceResizeWrapper){this._logInterval("resizeWrapper() end"+(this._sizeDirty?" (dirty)":""),then);}},resizeWrapper:function(){var hidden=this._setPageVisible();this._resizeWrapper();this._restorePageVisibility(hidden);},_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 $pullDownLabel,pulledText,loadingText;if(this.$pullDown.length===0){return;}
$pullDownLabel=$("."+this.options.pullLabelClass,this.$pullDown);if($pullDownLabel.length){this._origPullDownLabelText=$pullDownLabel.text();if(this._origPullDownLabelText){this.options.pullDownResetText=this._origPullDownLabelText;}
else{$pullDownLabel.text(this.options.pullDownResetText);}
pulledText=$pullDownLabel.jqmData("iscroll-pulled-text");if(pulledText){this.options.pullDownPulledText=pulledText;}
loadingText=$pullDownLabel.jqmData("iscroll-loading-text");if(loadingText){this.options.pullDownLoadingText=loadingText;}}},_undoModifyPullDown:function(){if(this.$pullDown.length===0){return;}
var $pullDownLabel=$("."+this.options.pullLabelClass,this.$pullDown);if($pullDownLabel.length===0){return;}
$pullDownLabel.text(this._origPullDownLabelText);},_modifyPullUp:function(){var $pullUpLabel,pulledText,loadingText;if(this.$pullUp.length===0){return;}
$("<div></div>").insertBefore(this.$pullUp).css("height",this.$pullUp.outerHeight(true));this.$pullUpSpacer=this.$pullUp.prev();this.$pullUpSpacer.addClass(this.options.pullUpSpacerClass);$pullUpLabel=$("."+this.options.pullLabelClass,this.$pullUp);if($pullUpLabel.length){this._origPullUpLabelText=$pullUpLabel.text();if(this._origPullUpLabelText){this.options.pullUpResetText=this._origPullUpLabelText;}
else{$pullUpLabel.text(this.options.pullUpResetText);}
pulledText=$pullUpLabel.jqmData("iscroll-pulled-text");if(pulledText){this.options.pullUpPulledText=pulledText;}
loadingText=$pullUpLabel.jqmData("iscroll-loading-text");if(loadingText){this.options.pullUpLoadingText=loadingText;}}},_undoModifyPullUp:function(){if(this.$pullUp.length===0){return;}
this.$pullUp.prev().remove();if(this._origPullUpLabelText){$("."+this.options.pullLabelClass,this.$pullUp).text(this._origPullUpLabelText);}},_correctPushedDownPage:function(){if(this.options.resizeWrapper&&this.options.scrollTopOnResize){$.mobile.silentScroll(0);}},refresh:function(delay,callbackBefore,callbackAfter,noDefer){var _this,_delay,_callbackBefore,_callbackAfter,_noDefer,then;if(!noDefer&&this.options.deferNonActiveRefresh&&!(this.$page.is($.mobile.activePage))){this._dirty=true;this._dirtyCallbackBefore=callbackBefore;this._dirtyCallbackAfter=callbackAfter;if(this.options.traceRefresh){this._log("refresh() (deferred)");}
return;}
_this=this;_delay=delay;_callbackBefore=callbackBefore;_callbackAfter=callbackAfter;_noDefer=noDefer;then=this._startTiming();if((_delay===undefined)||(_delay===null)){_delay=this.options.refreshDelay;}
setTimeout(function(){var later=null,hidden;if(_this.options.traceRefresh){later=_this._logInterval("refresh() start",then);}
hidden=_this._setPageVisible();if(_callbackBefore){_callbackBefore();}
_this._triggerWidget("onbeforerefresh");_this.iscroll.refresh();_this._triggerWidget("onafterrefresh");if(_callbackAfter){_callbackAfter();}
_this._restorePageVisibility(hidden);if(!hidden){_this._correctPushedDownPage();}
if(_this.options.traceRefresh){_this._logInterval2("refresh() end"+(_noDefer?" (dirty)":""),then,later);}},_delay);if(this.options.traceRefresh){this._log("refresh() will occur after >= "+_delay+"mS");}},_create_iscroll_object:function(){this.iscroll=new IScroll(this,this.$wrapper.get(0),this._create_iscroll_options());},_createScroller:function(){if(this.options.createScroller){if(this.$wrapper.children().length){this.$wrapper.children().wrapAll("<div/>");}
else{this.$wrapper.append("<div><div></div></div>");}}},_undoCreateScroller:function(){if(this.options.createScroller){this.$scroller.children().unwrap();}},_setPageVisible:function(){var hidden=this.$page.is(":hidden");if(hidden){this.$page.css("display","block");}
return hidden;},_restorePageVisibility:function(hidden){if(hidden){this.$page.css("display","");}},_create:function(){var then=new Date(),hidden;this.$wrapper=this.element;this.$page=this.$wrapper.parents(":jqmData(role='page')");if(this.options.debug&&this.options.traceCreateDestroy){this._log("_create() start",then);}
this.createdAt=then;this._instanceCount(this._instanceCount()+1);this.instanceID=this._nextInstanceID();this._nextInstanceID(this._instanceID+1);if(this.instanceID===1){this._pageID(nextPageID);nextPageID+=1;}
this.pageID=this._pageID();hidden=this._setPageVisible();this._adaptPage();this._createScroller();this.$scroller=this.$wrapper.children(":first");if(this.$scroller.length===0){return;}
this.$pullDown=$("."+this.options.pullDownClass,this.$scroller);this._modifyPullDown();this.$pullUp=$("."+this.options.pullUpClass,this.$scroller);this._modifyPullUp();$.extend(true,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(hidden);if(this.options.resizeWrapper){this._isvBind(this.$window,this.options.resizeEvents,this._windowResizeFunc,"$window");if(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");if(this.options.debug&&this.options.traceCreateDestroy){this._logInterval("_create() end",then);}},destroy:function(){var then=null;if(this.options.debug&&this.options.traceCreateDestroy){then=this._log("destroy() start");}
this._isvUnbind(this.$scrollerContent,"updatelayout","$scrollerContent");this._isvUnbind(this.$window,this.options.resizeEvents,"$window");this._isvUnbind(this.$window,"orientationchange","$window");if(this._instanceCount()===1){this._unbindPage("pagebeforeshow");if(HasTouch){this._unbindPage("touchmove");}}
if(!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);if(this._instanceCount()===0){this._undoAdaptPage();}
$.Widget.prototype.destroy.call(this);if(this.options.debug&&this.options.traceCreateDestroy){this._logInterval("destroy() end",then);}},enable:function(){this.iscroll.enable();$.Widget.prototype.enable.call(this);},disable:function(){this.iscroll.disable();$.Widget.prototype.disable.call(this);},_setOption:function(key,value){var hidden;this.options[key]=value;this.iscroll.destroy();hidden=this._setPageVisible();this._create_iscroll_object();this._restorePageVisibility(hidden);$.Widget.prototype._setOption.apply(this,arguments);},scrollTo:function(x,y,time,relative){this.iscroll.scrollTo(x,y,time,relative);},scrollToElement:function(el,time){this.iscroll.scrollToElement(el,time);},scrollToPage:function(pageX,pageY,time){this.iscroll.scrollToPage(pageX,pageY,time);},stop:function(){this.iscroll.stop();},zoom:function(x,y,scale,time){this.iscroll.zoom(x,y,scale,time);},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(val){if(val!==undefined){this.iscroll.minScrollX=val;}return this.iscroll.minScrollX;},minScrollY:function(val){if(val!==undefined){this.iscroll.minScrollY=val;}return this.iscroll.minScrollY;},maxScrollX:function(val){if(val!==undefined){this.iscroll.maxScrollX=val;}return this.iscroll.maxScrollX;},maxScrollY:function(val){if(val!==undefined){this.iscroll.maxScrollY=val;}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($pull,text){var $label;if(text){$label=$("."+this.options.pullLabelClass,$pull);if($label){$label.text(text);}}},_pullSetStateReset:function($pull,text){if($pull.is("."+this.options.pullLoadingClass+", ."+this.options.pullPulledClass)){$pull.removeClass(this.options.pullPulledClass+" "+this.options.pullLoadingClass);this._replacePullText($pull,text);}},_pullDownSetStateReset:function(e){this._pullSetStateReset(this.$pullDown,this.options.pullDownResetText);this._triggerWidget("onpulldownreset",e);},_pullUpSetStateReset:function(e){this._pullSetStateReset(this.$pullUp,this.options.pullUpResetText);this._triggerWidget("onpullupreset",e);},_pullSetStatePulled:function($pull,text){$pull.removeClass(this.options.pullLoadingClass).addClass(this.options.pullPulledClass);this._replacePullText($pull,text);},_pullDownSetStatePulled:function(e){this._pullSetStatePulled(this.$pullDown,this.options.pullDownPulledText);this._triggerWidget("onpulldownpulled",e);},_pullUpSetStatePulled:function(e){this._pullSetStatePulled(this.$pullUp,this.options.pullUpPulledText);this._triggerWidget("onpulluppulled",e);},_pullSetStateLoading:function($pull,text){$pull.removeClass(this.options.pullPulledClass).addClass(this.options.pullLoadingClass);this._replacePullText($pull,text);},_pullDownSetStateLoading:function(e){this._pullSetStateLoading(this.$pullDown,this.options.pullDownLoadingText);this._triggerWidget("onpulldownloading",e);},_pullUpSetStateLoading:function(e){this._pullSetStateLoading(this.$pullUp,this.options.pullUpLoadingText);this._triggerWidget("onpulluploading",e);},_pullOnRefresh:function(e){if(this.$pullDown.length){this._pullDownSetStateReset(e);}
if(this.$pullUp.length){this._pullUpSetStateReset(e);}},_pullOnScrollMove:function(e){var pullDownIsPulled,pullUpIsPulled,pullDownHeight,pullDownPast,pullUpHeight,pullUpPast,y=this.y();if(this.$pullDown.length){pullDownIsPulled=this._pullDownIsPulled();pullDownHeight=this.options.topOffset;pullDownPast=pullDownHeight/2;if(!pullDownIsPulled&&y>pullDownPast){this._pullDownSetStatePulled(e);this.minScrollY(0);}
else if(pullDownIsPulled&&y<=0){this._pullDownSetStateReset(e);this.minScrollY(-pullDownHeight);}}
if(this.$pullUp.length){pullUpIsPulled=this._pullUpIsPulled();pullUpHeight=this.options.bottomOffset;pullUpPast=pullUpHeight/2;if(!pullUpIsPulled&&y<this.maxScrollY()-pullUpHeight-pullUpPast){this._pullUpSetStatePulled(e);this.maxScrollY(this.wrapperH()-this.scrollerH()+this.minScrollY());}
else if(pullUpIsPulled&&y>=this.maxScrollY()){this._pullUpSetStateReset(e);this.maxScrollY(this.wrapperH()-this.scrollerH()+this.minScrollY()+pullUpHeight);}}},_pullOnScrollEnd:function(e){if(this._pullDownIsPulled(e)){this._pullDownSetStateLoading(e);this._triggerWidget("onpulldown",e);}
else if(this._pullUpIsPulled(e)){this._pullUpSetStateLoading(e);this._triggerWidget("onpullup",e);}}});}(jQuery,window,document));jQuery(document).bind("pagecreate",function(e){"use strict";var elements=jQuery(e.target).find(":jqmData(iscroll)");elements.iscrollview();});