(function(n,t,i){typeof define=="function"&&define.amd?define(["jquery"],function(r){return i(r,n,t),r.mobile}):i(n.jQuery,n,t)})(this,document,function(n,t,i,r){(function(n,t,r){var u={},f,e;n.mobile=n.extend({},{version:"1.2.1",ns:"",subPageUrlKey:"ui-page",activePageClass:"ui-page-active",activeBtnClass:"ui-btn-active",focusClass:"ui-focus",ajaxEnabled:!0,hashListeningEnabled:!0,linkBindingEnabled:!0,defaultPageTransition:"fade",maxTransitionWidth:!1,minScrollBack:250,touchOverflowEnabled:!1,defaultDialogTransition:"pop",pageLoadErrorMessage:"Error Loading Page",pageLoadErrorMessageTheme:"e",phonegapNavigationEnabled:!1,autoInitializePage:!0,pushStateEnabled:!0,ignoreContentEnabled:!1,orientationChangeEnabled:!0,buttonMarkup:{hoverDelay:200},keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91},behaviors:{},silentScroll:function(r){n.type(r)!=="number"&&(r=n.mobile.defaultHomeScroll),n.event.special.scrollstart.enabled=!1,setTimeout(function(){t.scrollTo(0,r),n(i).trigger("silentscroll",{x:0,y:r})},20),setTimeout(function(){n.event.special.scrollstart.enabled=!0},150)},nsNormalizeDict:u,nsNormalize:function(t){if(t)return u[t]||(u[t]=n.camelCase(n.mobile.ns+t))},getInheritedTheme:function(n,t){for(var i=n[0],u="",e=/ui-(bar|body|overlay)-([a-z])\b/,r,f;i;){if(r=i.className||"",r&&(f=e.exec(r))&&(u=f[2]))break;i=i.parentNode}return u||t||"a"},closestPageData:function(n){return n.closest(':jqmData(role="page"), :jqmData(role="dialog")').data("page")},enhanceable:function(n){return this.haveParents(n,"enhance")},hijackable:function(n){return this.haveParents(n,"ajax")},haveParents:function(t,i){var o,f,r,s,e,u,h;if(!n.mobile.ignoreContentEnabled)return t;for(o=t.length,f=n(),u=0;u<o;u++){for(s=t.eq(u),e=!1,r=t[u];r;){if(h=r.getAttribute?r.getAttribute("data-"+n.mobile.ns+i):"",h==="false"){e=!0;break}r=r.parentNode}e||(f=f.add(s))}return f},getScreenHeight:function(){return t.innerHeight||n(t).height()}},n.mobile),n.fn.jqmData=function(t,i){var u;return typeof t!="undefined"&&(t&&(t=n.mobile.nsNormalize(t)),u=arguments.length<2||i===r?this.data(t):this.data(t,i)),u},n.jqmData=function(t,i,r){var u;return typeof i!="undefined"&&(u=n.data(t,i?n.mobile.nsNormalize(i):i,r)),u},n.fn.jqmRemoveData=function(t){return this.removeData(n.mobile.nsNormalize(t))},n.jqmRemoveData=function(t,i){return n.removeData(t,n.mobile.nsNormalize(i))},n.fn.removeWithDependents=function(){n.removeWithDependents(this)},n.removeWithDependents=function(t){var i=n(t);(i.jqmData("dependents")||n()).remove(),i.remove()},n.fn.addDependents=function(t){n.addDependents(n(this),t)},n.addDependents=function(t,i){var r=n(t).jqmData("dependents")||n();n(t).jqmData("dependents",n.merge(r,i))},n.fn.getEncodedText=function(){return n("<div/>").text(n(this).text()).html()},n.fn.jqmEnhanceable=function(){return n.mobile.enhanceable(this)},n.fn.jqmHijackable=function(){return n.mobile.hijackable(this)},f=n.find,e=/:jqmData\(([^)]*)\)/g,n.find=function(t,i,r,u){return t=t.replace(e,"[data-"+(n.mobile.ns||"")+"$1]"),f.call(this,t,i,r,u)},n.extend(n.find,f),n.find.matches=function(t,i){return n.find(t,null,null,i)},n.find.matchesSelector=function(t,i){return n.find(i,null,null,[t]).length>0}})(n,this),function(n,t){var r=0,i=Array.prototype.slice,u=n.cleanData;n.cleanData=function(t){for(var i=0,r;(r=t[i])!=null;i++)try{n(r).triggerHandler("remove")}catch(f){}u(t)},n.widget=function(t,i,r){var e,o,u,s,f=t.split(".")[0];t=t.split(".")[1],e=f+"-"+t,r||(r=i,i=n.Widget),n.expr[":"][e]=function(t){return!!n.data(t,e)},n[f]=n[f]||{},o=n[f][t],u=n[f][t]=function(n,t){if(!this._createWidget)return new u(n,t);arguments.length&&this._createWidget(n,t)},n.extend(u,o,{version:r.version,_proto:n.extend({},r),_childConstructors:[]}),s=new i,s.options=n.widget.extend({},s.options),n.each(r,function(t,u){n.isFunction(u)&&(r[t]=function(){var n=function(){return i.prototype[t].apply(this,arguments)},r=function(n){return i.prototype[t].apply(this,n)};return function(){var i=this._super,f=this._superApply,t;return this._super=n,this._superApply=r,t=u.apply(this,arguments),this._super=i,this._superApply=f,t}}())}),u.prototype=n.widget.extend(s,{widgetEventPrefix:t},r,{constructor:u,namespace:f,widgetName:t,widgetBaseClass:e,widgetFullName:e}),o?(n.each(o._childConstructors,function(t,i){var r=i.prototype;n.widget(r.namespace+"."+r.widgetName,u,i._proto)}),delete o._childConstructors):i._childConstructors.push(u),n.widget.bridge(t,u)},n.widget.extend=function(r){for(var o=i.call(arguments,1),u=0,s=o.length,f,e;u<s;u++)for(f in o[u])e=o[u][f],o[u].hasOwnProperty(f)&&e!==t&&(r[f]=n.isPlainObject(e)?n.widget.extend({},r[f],e):e);return r},n.widget.bridge=function(r,u){var f=u.prototype.widgetFullName;n.fn[r]=function(e){var h=typeof e=="string",o=i.call(arguments,1),s=this;return e=!h&&o.length?n.widget.extend.apply(null,[e].concat(o)):e,h?this.each(function(){var i,u=n.data(this,f);return u?!n.isFunction(u[e])||e.charAt(0)==="_"?n.error("no such method '"+e+"' for "+r+" widget instance"):(i=u[e].apply(u,o),i!==u&&i!==t?(s=i&&i.jquery?s.pushStack(i.get()):i,!1):void 0):n.error("cannot call methods on "+r+" prior to initialization; attempted to call method '"+e+"'")}):this.each(function(){var t=n.data(this,f);t?t.option(e||{})._init():new u(e,this)}),s}},n.Widget=function(){},n.Widget._childConstructors=[],n.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(t,i){i=n(i||this.defaultElement||this)[0],this.element=n(i),this.uuid=r++,this.eventNamespace="."+this.widgetName+this.uuid,this.options=n.widget.extend({},this.options,this._getCreateOptions(),t),this.bindings=n(),this.hoverable=n(),this.focusable=n(),i!==this&&(n.data(i,this.widgetName,this),n.data(i,this.widgetFullName,this),this._on({remove:"destroy"}),this.document=n(i.style?i.ownerDocument:i.document||i),this.window=n(this.document[0].defaultView||this.document[0].parentWindow)),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:n.noop,_getCreateEventData:n.noop,_create:n.noop,_init:n.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData(n.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:n.noop,widget:function(){return this.element},option:function(i,r){var o=i,u,f,e;if(arguments.length===0)return n.widget.extend({},this.options);if(typeof i=="string")if(o={},u=i.split("."),i=u.shift(),u.length){for(f=o[i]=n.widget.extend({},this.options[i]),e=0;e<u.length-1;e++)f[u[e]]=f[u[e]]||{},f=f[u[e]];if(i=u.pop(),r===t)return f[i]===t?null:f[i];f[i]=r}else{if(r===t)return this.options[i]===t?null:this.options[i];o[i]=r}return this._setOptions(o),this},_setOptions:function(n){var t;for(t in n)this._setOption(t,n[t]);return this},_setOption:function(n,t){return this.options[n]=t,n==="disabled"&&(this.widget().toggleClass(this.widgetFullName+"-disabled ui-state-disabled",!!t).attr("aria-disabled",t),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")),this},enable:function(){return this._setOption("disabled",!1)},disable:function(){return this._setOption("disabled",!0)},_on:function(t,i){i?(t=n(t),this.bindings=this.bindings.add(t)):(i=t,t=this.element);var r=this;n.each(i,function(i,u){function f(){if(r.options.disabled!==!0&&!n(this).hasClass("ui-state-disabled"))return(typeof u=="string"?r[u]:u).apply(r,arguments)}typeof u!="string"&&(f.guid=u.guid=u.guid||f.guid||n.guid++);var e=i.match(/^(\w+)\s*(.*)$/),o=e[1]+r.eventNamespace,s=e[2];s?r.widget().delegate(s,o,f):t.bind(o,f)})},_off:function(n,t){t=(t||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,n.unbind(t).undelegate(t)},_delay:function(n,t){function r(){return(typeof n=="string"?i[n]:n).apply(i,arguments)}var i=this;return setTimeout(r,t||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){n(t.currentTarget).addClass("ui-state-hover")},mouseleave:function(t){n(t.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){n(t.currentTarget).addClass("ui-state-focus")},focusout:function(t){n(t.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(t,i,r){var u,f,e=this.options[t];if(r=r||{},i=n.Event(i),i.type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),i.target=this.element[0],f=i.originalEvent,f)for(u in f)u in i||(i[u]=f[u]);return this.element.trigger(i,r),!(n.isFunction(e)&&e.apply(this.element[0],[i].concat(r))===!1||i.isDefaultPrevented())}},n.each({show:"fadeIn",hide:"fadeOut"},function(t,i){n.Widget.prototype["_"+t]=function(r,u,f){typeof u=="string"&&(u={effect:u});var o,e=u?u===!0||typeof u=="number"?i:u.effect||i:t;u=u||{},typeof u=="number"&&(u={duration:u}),o=!n.isEmptyObject(u),u.complete=f,u.delay&&r.delay(u.delay),o&&n.effects&&(n.effects.effect[e]||n.uiBackCompat!==!1&&n.effects[e])?r[t](u):e!==t&&r[e]?r[e](u.duration,u.easing,f):r.queue(function(i){n(this)[t](),f&&f.call(r[0]),i()})}}),n.uiBackCompat!==!1&&(n.Widget.prototype._getCreateOptions=function(){return n.metadata&&n.metadata.get(this.element[0])[this.widgetName]})}(n),function(n,t){n.widget("mobile.widget",{_createWidget:function(){n.Widget.prototype._createWidget.apply(this,arguments),this._trigger("init")},_getCreateOptions:function(){var r=this.element,i={};return n.each(this.options,function(n){var u=r.jqmData(n.replace(/[A-Z]/g,function(n){return"-"+n.toLowerCase()}));u!==t&&(i[n]=u)}),i},enhanceWithin:function(t,i){this.enhance(n(this.options.initSelector,n(t)),i)},enhance:function(t,i){var u,f,r=n(t),e=this;r=n.mobile.enhanceable(r),i&&r.length&&(u=n.mobile.closestPageData(r),f=u&&u.keepNativeSelector()||"",r=r.not(f)),r[this.widgetName]()},raise:function(n){throw"Widget ["+this.widgetName+"]: "+n;}})}(n),function(n,t){n.extend(n.mobile,{loadingMessageTextVisible:r,loadingMessageTheme:r,loadingMessage:r,showPageLoadingMsg:function(t,i,r){n.mobile.loading("show",t,i,r)},hidePageLoadingMsg:function(){n.mobile.loading("hide")},loading:function(){this.loaderWidget.loader.apply(this.loaderWidget,arguments)}});var u="ui-loader",f=n("html"),i=n(t);n.widget("mobile.loader",{options:{theme:"a",textVisible:!1,html:"",text:"loading"},defaultHtml:"<div class='"+u+"'><span class='ui-icon ui-icon-loading'><\/span><h1><\/h1><\/div>",fakeFixLoader:function(){var t=n("."+n.mobile.activeBtnClass).first();this.element.css({top:n.support.scrollTop&&i.scrollTop()+i.height()/2||t.length&&t.offset().top||100})},checkLoaderPosition:function(){var t=this.element.offset(),r=i.scrollTop(),u=n.mobile.getScreenHeight();(t.top<r||t.top-r>u)&&(this.element.addClass("ui-loader-fakefix"),this.fakeFixLoader(),i.unbind("scroll",this.checkLoaderPosition).bind("scroll",n.proxy(this.fakeFixLoader,this)))},resetHtml:function(){this.element.html(n(this.defaultHtml).html())},show:function(t,e,o){var h,c,l,s;this.resetHtml(),n.type(t)==="object"?(s=n.extend({},this.options,t),t=s.theme||n.mobile.loadingMessageTheme):(s=this.options,t=t||n.mobile.loadingMessageTheme||s.theme),c=e||n.mobile.loadingMessage||s.text,f.addClass("ui-loading"),(n.mobile.loadingMessage!==!1||s.html)&&(h=n.mobile.loadingMessageTextVisible!==r?n.mobile.loadingMessageTextVisible:s.textVisible,this.element.attr("class",u+" ui-corner-all ui-body-"+t+" ui-loader-"+(h||e||t.text?"verbose":"default")+(s.textonly||o?" ui-loader-textonly":"")),s.html?this.element.html(s.html):this.element.find("h1").text(c),this.element.appendTo(n.mobile.pageContainer),this.checkLoaderPosition(),i.bind("scroll",n.proxy(this.checkLoaderPosition,this)))},hide:function(){f.removeClass("ui-loading"),n.mobile.loadingMessage&&this.element.removeClass("ui-loader-fakefix"),n(t).unbind("scroll",this.fakeFixLoader),n(t).unbind("scroll",this.checkLoaderPosition)}}),i.bind("pagecontainercreate",function(){n.mobile.loaderWidget=n.mobile.loaderWidget||n(n.mobile.loader.prototype.defaultHtml).loader()})}(n,this),function(n,t,i,r){function h(n){while(n&&typeof n.originalEvent!="undefined")n=n.originalEvent;return n}function vt(t,i){var u=t.type,e,o,l,f,s,a,v,c,y;if(t=n.Event(t),t.type=i,e=t.originalEvent,o=n.event.props,u.search(/^(mouse|click)/)>-1&&(o=gt),e)for(v=o.length,f;v;)f=o[--v],t[f]=e[f];if(u.search(/mouse(down|up)|click/)>-1&&!t.which&&(t.which=1),u.search(/^touch/)!==-1&&(l=h(e),u=l.touches,s=l.changedTouches,a=u&&u.length?u[0]:s&&s.length?s[0]:r,a))for(c=0,y=ct.length;c<y;c++)f=ct[c],t[f]=a[f];return t}function v(t){for(var i={},r,u;t;){r=n.data(t,o);for(u in r)r[u]&&(i[u]=i.hasVirtualBinding=!0);t=t.parentNode}return i}function yt(t,i){for(var r;t;){if(r=n.data(t,o),r&&(!i||r[i]))return t;t=t.parentNode}return null}function pt(){l=!1}function tt(){l=!0}function wt(){s=0,y.length=0,d=!1,tt()}function bt(){pt()}function w(){it(),c=setTimeout(function(){c=0,wt()},n.vmouse.resetTimerDuration)}function it(){c&&(clearTimeout(c),c=0)}function f(t,i,r){var u;return(r&&r[t]||!r&&yt(i.target,t))&&(u=vt(i,t),n(i.target).trigger(u)),u}function rt(t){var r=n.data(t.target,b),i;d||s&&s===r||(i=f("v"+t.type,t),i&&(i.isDefaultPrevented()&&t.preventDefault(),i.isPropagationStopped()&&t.stopPropagation(),i.isImmediatePropagationStopped()&&t.stopImmediatePropagation()))}function ut(t){var o=h(t).touches,r,i,u;o&&o.length===1&&(r=t.target,i=v(r),i.hasVirtualBinding&&(s=ni++,n.data(r,b,s),it(),bt(),e=!1,u=h(t).touches[0],lt=u.pageX,at=u.pageY,f("vmouseover",t,i),f("vmousedown",t,i)))}function ft(n){l||(e||f("vmousecancel",n,v(n.target)),e=!0,w())}function et(t){if(!l){var i=h(t).touches[0],o=e,r=n.vmouse.moveDistanceThreshold,u=v(t.target);e=e||Math.abs(i.pageX-lt)>r||Math.abs(i.pageY-at)>r,e&&!o&&f("vmousecancel",t,u),f("vmousemove",t,u),w()}}function ot(n){var t,i,r;l||(tt(),t=v(n.target),f("vmouseup",n,t),e||(r=f("vclick",n,t),r&&r.isDefaultPrevented()&&(i=h(n).changedTouches[0],y.push({touchID:s,x:i.clientX,y:i.clientY}),d=!0)),f("vmouseout",n,t),e=!1,w())}function st(t){var i=n.data(t,o),r;if(i)for(r in i)if(i[r])return!0;return!1}function ht(){}function kt(t){var i=t.substr(1);return{setup:function(){st(this)||n.data(this,o,{});var e=n.data(this,o);e[t]=!0,u[t]=(u[t]||0)+1,u[t]===1&&p.bind(i,rt),n(this).bind(i,ht),g&&(u.touchstart=(u.touchstart||0)+1,u.touchstart===1&&p.bind("touchstart",ut).bind("touchend",ot).bind("touchmove",et).bind("scroll",ft))},teardown:function(){--u[t],u[t]||p.unbind(i,rt),g&&(--u.touchstart,u.touchstart||p.unbind("touchstart",ut).unbind("touchmove",et).unbind("touchend",ot).unbind("scroll",ft));var e=n(this),s=n.data(this,o);s&&(s[t]=!1),e.unbind(i,ht),st(this)||e.removeData(o)}}}var o="virtualMouseBindings",b="virtualTouchID",k="vmouseover vmousedown vmousemove vmouseup vclick vmouseout vmousecancel".split(" "),ct="clientX clientY pageX pageY screenX screenY".split(" "),dt=n.event.mouseHooks?n.event.mouseHooks.props:[],gt=n.event.props.concat(dt),u={},c=0,lt=0,at=0,e=!1,y=[],d=!1,l=!1,g="addEventListener"in i,p=n(i),ni=1,s=0,nt,a;for(n.vmouse={moveDistanceThreshold:10,clickDistanceThreshold:10,resetTimerDuration:1500},a=0;a<k.length;a++)n.event.special[k[a]]=kt(k[a]);g&&i.addEventListener("click",function(t){var f=y.length,e=t.target,o,s,i,r,u,h;if(f)for(o=t.clientX,s=t.clientY,nt=n.vmouse.clickDistanceThreshold,i=e;i;){for(r=0;r<f;r++)if(u=y[r],h=0,i===e&&Math.abs(u.x-o)<nt&&Math.abs(u.y-s)<nt||n.data(i,b)===u.touchID){t.preventDefault(),t.stopPropagation();return}i=i.parentNode}},!0)}(n,t,i),function(n){var r={touch:"ontouchend"in i};n.mobile=n.mobile||{},n.mobile.support=n.mobile.support||{},n.extend(n.support,r),n.extend(n.mobile.support,r)}(n),function(n,t,r){function u(t,i,r){var u=r.type;r.type=i,n.event.handle.call(t,r),r.type=u}n.each("touchstart touchmove touchend tap taphold swipe swipeleft swiperight scrollstart scrollstop".split(" "),function(t,i){n.fn[i]=function(n){return n?this.bind(i,n):this.trigger(i)},n.attrFn&&(n.attrFn[i]=!0)});var f=n.mobile.support.touch,o="touchmove scroll",s=f?"touchstart":"mousedown",h=f?"touchend":"mouseup",e=f?"touchmove":"mousemove";n.event.special.scrollstart={enabled:!0,setup:function(){function i(n,i){t=i,u(r,t?"scrollstart":"scrollstop",n)}var r=this,e=n(r),t,f;e.bind(o,function(r){n.event.special.scrollstart.enabled&&(t||i(r,!0),clearTimeout(f),f=setTimeout(function(){i(r,!1)},50))})}},n.event.special.tap={tapholdThreshold:750,setup:function(){var t=this,r=n(t);r.bind("vmousedown",function(f){function e(){clearTimeout(c)}function o(){e(),r.unbind("vclick",s).unbind("vmouseup",e),n(i).unbind("vmousecancel",o)}function s(n){o(),h===n.target&&u(t,"tap",n)}if(f.which&&f.which!==1)return!1;var h=f.target,l=f.originalEvent,c;r.bind("vmouseup",e).bind("vclick",s),n(i).bind("vmousecancel",o),c=setTimeout(function(){u(t,"taphold",n.Event("taphold",{target:h}))},n.event.special.tap.tapholdThreshold)})}},n.event.special.swipe={scrollSupressionThreshold:30,durationThreshold:1e3,horizontalDistanceThreshold:30,verticalDistanceThreshold:75,setup:function(){var i=this,t=n(i);t.bind(s,function(i){function o(t){if(u){var i=t.originalEvent.touches?t.originalEvent.touches[0]:t;f={time:+new Date,coords:[i.pageX,i.pageY]},Math.abs(u.coords[0]-f.coords[0])>n.event.special.swipe.scrollSupressionThreshold&&t.preventDefault()}}var s=i.originalEvent.touches?i.originalEvent.touches[0]:i,u={time:+new Date,coords:[s.pageX,s.pageY],origin:n(i.target)},f;t.bind(e,o).one(h,function(){t.unbind(e,o),u&&f&&f.time-u.time<n.event.special.swipe.durationThreshold&&Math.abs(u.coords[0]-f.coords[0])>n.event.special.swipe.horizontalDistanceThreshold&&Math.abs(u.coords[1]-f.coords[1])<n.event.special.swipe.verticalDistanceThreshold&&u.origin.trigger("swipe").trigger(u.coords[0]>f.coords[0]?"swipeleft":"swiperight"),u=f=r})})}},n.each({scrollstop:"scrollstart",taphold:"tap",swipeleft:"swipe",swiperight:"swipe"},function(t,i){n.event.special[t]={setup:function(){n(this).bind(i,n.noop)}}})}(n,this),function(n){n.extend(n.support,{orientation:"orientation"in t&&"onorientationchange"in t})}(n),function(n){n.event.special.throttledresize={setup:function(){n(this).bind("resize",t)},teardown:function(){n(this).unbind("resize",t)}};var f=250,t=function(){r=+new Date,u=r-e,u>=f?(e=r,n(this).trigger("throttledresize")):(i&&clearTimeout(i),i=setTimeout(t,f-u))},e=0,i,r,u}(n),function(n,t){function c(){var n=u();n!==e&&(e=n,f.trigger(r))}var f=n(t),r="orientationchange",y,u,e,o,s,h={0:!0,180:!0};if(n.support.orientation){var l=t.innerWidth||n(t).width(),a=t.innerHeight||n(t).height(),v=50;o=l>a&&l-a>v,s=h[t.orientation],(o&&s||!o&&!s)&&(h={"-90":!0,90:!0})}n.event.special.orientationchange=n.extend({},n.event.special.orientationchange,{setup:function(){if(n.support.orientation&&!n.event.special.orientationchange.disabled)return!1;e=u(),f.bind("throttledresize",c)},teardown:function(){if(n.support.orientation&&!n.event.special.orientationchange.disabled)return!1;f.unbind("throttledresize",c)},add:function(n){var t=n.handler;n.handler=function(n){return n.orientation=u(),t.apply(this,arguments)}}}),n.event.special.orientationchange.orientation=u=function(){var r=!0,u=i.documentElement;return r=n.support.orientation?h[t.orientation]:u&&u.clientWidth/u.clientHeight<1.1,r?"portrait":"landscape"},n.fn[r]=function(n){return n?this.bind(r,n):this.trigger(r)},n.attrFn&&(n.attrFn[r]=!0)}(n,this),function(n){var f=n(t),u=n("html");n.mobile.media=function(){var t={},r=n("<div id='jquery-mediatest'><\/div>"),f=n("<body>").append(r);return function(n){if(!(n in t)){var e=i.createElement("style"),o="@media "+n+" { #jquery-mediatest { position:absolute; } }";e.type="text/css",e.styleSheet?e.styleSheet.cssText=o:e.appendChild(i.createTextNode(o)),u.prepend(f).prepend(e),t[n]=r.css("position")==="absolute",f.add(e).remove()}return t[n]}}()}(n),function(n,r){function u(n){var t=n.charAt(0).toUpperCase()+n.substr(1),i=(n+" "+e.join(t+" ")+t).split(" "),u;for(u in i)if(y[i[u]]!==r)return!0}function s(n,t,r){for(var f=i.createElement("div"),o=function(n){return n.charAt(0).toUpperCase()+n.substr(1)},c=function(n){return"-"+n.charAt(0).toLowerCase()+n.substr(1)+"-"},l=function(i){var r=c(i)+n+": "+t+";",u=o(i),e=u+o(n);f.setAttribute("style",r),f.style[e]&&(h=!0)},s=r?[r]:e,h,u=0;u<s.length;u++)l(s[u]);return!!h}function c(){var t="transform-3d";return s("perspective","10px","moz")||n.mobile.media("(-"+e.join("-"+t+"),(-")+"-"+t+"),("+t+")")}function l(){var r=location.protocol+"//"+location.host+location.pathname+"ui-dir/",t=n("head base"),i=null,u="",e,o;return t.length?u=t.attr("href"):t=i=n("<base>",{href:r}).appendTo("head"),e=n("<a href='testurl' />").prependTo(f),o=e[0].href,t[0].href=u||location.pathname,i&&i.remove(),o.indexOf(r)===0}function a(){var n=i.createElement("x"),r=i.documentElement,u=t.getComputedStyle,f;return"pointerEvents"in n.style?(n.style.pointerEvents="auto",n.style.pointerEvents="x",r.appendChild(n),f=u&&u(n,"").pointerEvents==="auto",r.removeChild(n),!!f):!1}function v(){var n=i.createElement("div");return typeof n.getBoundingClientRect!="undefined"}var f=n("<body>").prependTo("html"),y=f[0].style,e=["Webkit","Moz","O"],p="palmGetResource"in t,w=t.opera,h=t.operamini&&{}.toString.call(t.operamini)==="[object OperaMini]",b=t.blackberry&&!u("-webkit-transform"),o;n.extend(n.mobile,{browser:{}}),n.mobile.browser.ie=function(){var n=3,t=i.createElement("div"),r=t.all||[];do t.innerHTML="<!--[if gt IE "+ ++n+"]><br><![endif]-->";while(r[0]);return n>4?n:!n}(),n.extend(n.support,{cssTransitions:"WebKitTransitionEvent"in t||s("transition","height 100ms linear")&&!w,pushState:"pushState"in history&&"replaceState"in history,mediaquery:n.mobile.media("only all"),cssPseudoElement:!!u("content"),touchOverflow:!!u("overflowScrolling"),cssTransform3d:c(),boxShadow:!!u("boxShadow")&&!b,scrollTop:("pageXOffset"in t||"scrollTop"in i.documentElement||"scrollTop"in f[0])&&!p&&!h,dynamicBaseTag:l(),cssPointerEvents:a(),boundingRect:v()}),f.remove(),o=function(){var n=t.navigator.userAgent;return n.indexOf("Nokia")>-1&&(n.indexOf("Symbian/3")>-1||n.indexOf("Series60/5")>-1)&&n.indexOf("AppleWebKit")>-1&&n.match(/(BrowserNG|NokiaBrowser)\/7\.[0-3]/)}(),n.mobile.gradeA=function(){return(n.support.mediaquery||n.mobile.browser.ie&&n.mobile.browser.ie>=7)&&(n.support.boundingRect||n.fn.jquery.match(/1\.[0-7+]\.[0-9+]?/)!==null)},n.mobile.ajaxBlacklist=t.blackberry&&!t.WebKitPoint||h||o,o&&n(function(){n("head link[rel='stylesheet']").attr("rel","alternate stylesheet").attr("rel","stylesheet")}),n.support.boxShadow||n("html").addClass("ui-mobile-nosupport-boxshadow")}(n),function(n){n.widget("mobile.page",n.mobile.widget,{options:{theme:"c",domCache:!1,keepNativeDefault:":jqmData(role='none'), :jqmData(role='nojs')"},_create:function(){var n=this;if(n._trigger("beforecreate")===!1)return!1;n.element.attr("tabindex","0").addClass("ui-page ui-body-"+n.options.theme).bind("pagebeforehide",function(){n.removeContainerBackground()}).bind("pagebeforeshow",function(){n.setContainerBackground()})},removeContainerBackground:function(){n.mobile.pageContainer.removeClass("ui-overlay-"+n.mobile.getInheritedTheme(this.element.parent()))},setContainerBackground:function(t){this.options.theme&&n.mobile.pageContainer.addClass("ui-overlay-"+(t||this.options.theme))},keepNativeSelector:function(){var t=this.options,i=t.keepNative&&n.trim(t.keepNative);return i&&t.keepNative!==t.keepNativeDefault?[t.keepNative,t.keepNativeDefault].join(", "):t.keepNativeDefault}})}(n),function(n,t,r){function f(n){return n=n||location.href,"#"+n.replace(/^[^#]*#?(.*)$/,"$1")}var u="hashchange",e=i,o,h=n.event.special,c=e.documentMode,s="on"+u in t&&(c===r||c>7);n.fn[u]=function(n){return n?this.bind(u,n):this.trigger(u)},n.fn[u].delay=50,h[u]=n.extend(h[u],{setup:function(){if(s)return!1;n(o.start)},teardown:function(){if(s)return!1;n(o.stop)}}),o=function(){function c(){var r=f(),i=v(h);r!==h?(a(h=r,i),n(t).trigger(u)):i!==h&&(location.href=location.href.replace(/#.*/,"")+i),o=setTimeout(c,n.fn[u].delay)}var i={},o,h=f(),l=function(n){return n},a=l,v=l;return i.start=function(){o||c()},i.stop=function(){o&&clearTimeout(o),o=r},n.browser.msie&&!s&&function(){var t,r;i.start=function(){t||(r=n.fn[u].src,r=r&&r+f(),t=n('<iframe tabindex="-1" title="empty"/>').hide().one("load",function(){r||a(f()),c()}).attr("src",r||"javascript:0").insertAfter("body")[0].contentWindow,e.onpropertychange=function(){try{event.propertyName==="title"&&(t.document.title=e.title)}catch(n){}})},i.stop=l,v=function(){return f(t.location.href)},a=function(i,r){var f=t.document,o=n.fn[u].domain;i!==r&&(f.title=e.title,f.open(),o&&f.write('<script>document.domain="'+o+'"<\/script>'),f.close(),t.location.hash=i)}}(),i}()}(n,this),function(n,t,i){var r=function(r){return r===i&&(r=!0),function(i,u,f,e){var c=new n.Deferred,l=u?" reverse":"",k=n.mobile.urlHistory.getActive(),o=k.lastScroll||n.mobile.defaultHomeScroll,a=n.mobile.getScreenHeight(),d=n.mobile.maxTransitionWidth!==!1&&n(t).width()>n.mobile.maxTransitionWidth,s=!n.support.cssTransitions||d||!i||i==="none"||Math.max(n(t).scrollTop(),o)>n.mobile.getMaxScrollForTransition(),v=" ui-page-pre-in",y=function(){n.mobile.pageContainer.toggleClass("ui-mobile-viewport-transitioning viewport-"+i)},p=function(){n.event.special.scrollstart.enabled=!1,t.scrollTo(0,o),setTimeout(function(){n.event.special.scrollstart.enabled=!0},150)},w=function(){e.removeClass(n.mobile.activePageClass+" out in reverse "+i).height("")},g=function(){r?e.animationComplete(h):h(),e.height(a+n(t).scrollTop()).addClass(i+" out"+l)},h=function(){e&&r&&w(),nt()},nt=function(){f.css("z-index",-10),f.addClass(n.mobile.activePageClass+v),n.mobile.focusPage(f),f.height(a+o),p(),f.css("z-index",""),s||f.animationComplete(b),f.removeClass(v).addClass(i+" in"+l),s&&b()},b=function(){r||e&&w(),f.removeClass("out in reverse "+i).height(""),y(),n(t).scrollTop()!==o&&p(),c.resolve(i,u,f,e,!0)};return y(),e&&!s?g():h(),c.promise()}},u=r(),f=r(!1),e=function(){return n.mobile.getScreenHeight()*3};n.mobile.defaultTransitionHandler=u,n.mobile.transitionHandlers={"default":n.mobile.defaultTransitionHandler,sequential:u,simultaneous:f},n.mobile.transitionFallbacks={},n.mobile._maybeDegradeTransition=function(t){return t&&!n.support.cssTransform3d&&n.mobile.transitionFallbacks[t]&&(t=n.mobile.transitionFallbacks[t]),t},n.mobile.getMaxScrollForTransition=n.mobile.getMaxScrollForTransition||e}(n,this),function(n,r){function y(t){!l||l.closest("."+n.mobile.activePageClass).length&&!t||l.removeClass(n.mobile.activeBtnClass),l=null}function g(){a=!1,d.length>0&&n.mobile.changePage.apply(null,d.pop())}function ft(t,i,r,u){i&&i.data("page")._trigger("beforehide",null,{nextPage:t}),t.data("page")._trigger("beforeshow",null,{prevPage:i||n("")}),n.mobile.hidePageLoadingMsg(),r=n.mobile._maybeDegradeTransition(r);var e=n.mobile.transitionHandlers[r||"default"]||n.mobile.defaultTransitionHandler,f=e(r,u,t,i);return f.done(function(){i&&i.data("page")._trigger("hide",null,{nextPage:t}),t.data("page")._trigger("show",null,{prevPage:i||n("")})}),f}function nt(){var t=n("."+n.mobile.activePageClass),i=parseFloat(t.css("padding-top")),r=parseFloat(t.css("padding-bottom")),u=parseFloat(t.css("border-top-width")),f=parseFloat(t.css("border-bottom-width"));t.css("min-height",et()-i-r-u-f)}function k(t,i){i&&t.attr("data-"+n.mobile.ns+"role",i),t.page()}function tt(n){while(n){if(typeof n.nodeName=="string"&&n.nodeName.toLowerCase()==="a")break;n=n.parentNode}return n}function p(t){var i=n(t).closest(".ui-page").jqmData("url"),r=e.hrefNoHash;return i&&u.isPath(i)||(i=r),u.makeUrlAbsolute(i,r)}var c=n(t),ot=n("html"),it=n("head"),u={urlParseRE:/^(((([^:\/#\?]+:)?(?:(\/\/)((?:(([^:@\/#\?]+)(?:\:([^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?:\:([0-9]+))?))?)?)?((\/?(?:[^\/\?#]+\/+)*)([^\?#]*)))?(\?[^#]+)?)(#.*)?/,getLocation:function(n){var t=n?this.parseUrl(n):location,i=this.parseUrl(n||location.href).hash;return i=i==="#"?"":i,t.protocol+"//"+t.host+t.pathname+t.search+i},parseLocation:function(){return this.parseUrl(this.getLocation())},parseUrl:function(t){if(n.type(t)==="object")return t;var i=u.urlParseRE.exec(t||"")||[];return{href:i[0]||"",hrefNoHash:i[1]||"",hrefNoSearch:i[2]||"",domain:i[3]||"",protocol:i[4]||"",doubleSlash:i[5]||"",authority:i[6]||"",username:i[8]||"",password:i[9]||"",host:i[10]||"",hostname:i[11]||"",port:i[12]||"",pathname:i[13]||"",directory:i[14]||"",filename:i[15]||"",search:i[16]||"",hash:i[17]||""}},makePathAbsolute:function(n,t){var i,u,r,f;if(n&&n.charAt(0)==="/")return n;for(n=n||"",t=t?t.replace(/^\/|(\/[^\/]*|[^\/]+)$/g,""):"",i=t?t.split("/"):[],u=n.split("/"),r=0;r<u.length;r++){f=u[r];switch(f){case".":break;case"..":i.length&&i.pop();break;default:i.push(f)}}return"/"+i.join("/")},isSameDomain:function(n,t){return u.parseUrl(n).domain===u.parseUrl(t).domain},isRelativeUrl:function(n){return u.parseUrl(n).protocol===""},isAbsoluteUrl:function(n){return u.parseUrl(n).protocol!==""},makeUrlAbsolute:function(n,t){if(!u.isRelativeUrl(n))return n;t===r&&(t=e);var i=u.parseUrl(n),f=u.parseUrl(t),o=i.protocol||f.protocol,s=i.protocol?i.doubleSlash:i.doubleSlash||f.doubleSlash,h=i.authority||f.authority,c=i.pathname!=="",l=u.makePathAbsolute(i.pathname||f.filename,f.pathname),a=i.search||!c&&f.search||"",v=i.hash;return o+s+h+l+a+v},addSearchParams:function(t,i){var r=u.parseUrl(t),e=typeof i=="object"?n.param(i):i,f=r.search||"?";return r.hrefNoSearch+f+(f.charAt(f.length-1)!=="?"?"&":"")+e+(r.hash||"")},convertUrlToDataUrl:function(n){var i=u.parseUrl(n);return u.isEmbeddedPage(i)?i.hash.split(h)[0].replace(/^#/,""):u.isSameDomain(i,e)?i.hrefNoHash.replace(e.domain,"").split(h)[0]:t.decodeURIComponent(n)},get:function(n){return n===r&&(n=u.parseLocation().hash),u.stripHash(n).replace(/[^\/]*\.[^\/*]+$/,"")},getFilePath:function(t){var i="&"+n.mobile.subPageUrlKey;return t&&t.split(i)[0].split(h)[0]},set:function(n){location.hash=n},isPath:function(n){return/\//.test(n)},clean:function(n){return n.replace(e.domain,"")},stripHash:function(n){return n.replace(/^#/,"")},cleanHash:function(n){return u.stripHash(n.replace(/\?.*$/,"").replace(h,""))},isHashValid:function(n){return/^#[^#]+$/.test(n)},isExternal:function(n){var t=u.parseUrl(n);return t.protocol&&t.domain!==o.domain?!0:!1},hasProtocol:function(n){return/^(:?\w+:)/.test(n)},isFirstPageUrl:function(t){var i=u.parseUrl(u.makeUrlAbsolute(t,e)),h=i.hrefNoHash===o.hrefNoHash||rt&&i.hrefNoHash===e.hrefNoHash,f=n.mobile.firstPage,s=f&&f[0]?f[0].id:r;return h&&(!i.hash||i.hash==="#"||s&&i.hash.replace(/^#/,"")===s)},isEmbeddedPage:function(n){var t=u.parseUrl(n);return t.protocol!==""?t.hash&&(t.hrefNoHash===o.hrefNoHash||rt&&t.hrefNoHash===e.hrefNoHash):/^#/.test(t.href)},isPermittedCrossDomainRequest:function(t,i){return n.mobile.allowCrossDomainPages&&t.protocol==="file:"&&i.search(/^https?:/)!==-1}},l=null,f={stack:[],activeIndex:0,getActive:function(){return f.stack[f.activeIndex]},getPrev:function(){return f.stack[f.activeIndex-1]},getNext:function(){return f.stack[f.activeIndex+1]},addNew:function(n,t,i,r,u){f.getNext()&&f.clearForward(),f.stack.push({url:n,transition:t,title:i,pageUrl:r,role:u}),f.activeIndex=f.stack.length-1},clearForward:function(){f.stack=f.stack.slice(0,f.activeIndex+1)},directHashChange:function(t){var i,e,u,o=this.getActive();n.each(f.stack,function(n,r){decodeURIComponent(t.currentUrl)===decodeURIComponent(r.url)&&(i=n<f.activeIndex,e=!i,u=n)}),this.activeIndex=u!==r?u:this.activeIndex,i?(t.either||t.isBack)(!0):e&&(t.either||t.isForward)(!1)},ignoreNextHashChange:!1},st="[tabindex],a,button:visible,select:visible,input",d=[],a=!1,h="&ui-state=dialog",w=it.children("base"),o=u.parseLocation(),e=w.length?u.parseUrl(u.makeUrlAbsolute(w.attr("href"),o.href)):o,rt=o.hrefNoHash!==e.hrefNoHash,et=n.mobile.getScreenHeight,s=n.support.dynamicBaseTag?{element:w.length?w:n("<base>",{href:e.hrefNoHash}).prependTo(it),set:function(n){s.element.attr("href",u.makeUrlAbsolute(n,e))},reset:function(){s.element.attr("href",e.hrefNoHash)}}:r,v,ut,b;n.mobile.back=function(){var n=t.navigator;this.phonegapNavigationEnabled&&n&&n.app&&n.app.backHistory?n.app.backHistory():t.history.back()},n.mobile.focusPage=function(n){var t=n.find("[autofocus]"),i=n.find(".ui-title:eq(0)");if(t.length){t.focus();return}i.length?i.focus():n.focus()},v=!0,ut=function(){var t,i;v&&(t=n.mobile.urlHistory.getActive(),t&&(i=c.scrollTop(),t.lastScroll=i<n.mobile.minScrollBack?n.mobile.defaultHomeScroll:i))},b=function(){setTimeout(ut,100)},c.bind(n.support.pushState?"popstate":"hashchange",function(){v=!1}),c.one(n.support.pushState?"popstate":"hashchange",function(){v=!0}),c.one("pagecontainercreate",function(){n.mobile.pageContainer.bind("pagechange",function(){v=!0,c.unbind("scrollstop",b),c.bind("scrollstop",b)})}),c.bind("scrollstop",b),n.mobile._maybeDegradeTransition=n.mobile._maybeDegradeTransition||function(n){return n},n.fn.animationComplete=function(t){return n.support.cssTransitions?n(this).one("webkitAnimationEnd animationend",t):(setTimeout(t,0),n(this))},n.mobile.path=u,n.mobile.base=s,n.mobile.urlHistory=f,n.mobile.dialogHashKey=h,n.mobile.allowCrossDomainPages=!1,n.mobile.getDocumentUrl=function(t){return t?n.extend({},o):o.href},n.mobile.getDocumentBase=function(t){return t?n.extend({},e):e.href},n.mobile._bindPageRemove=function(){var t=n(this);!t.data("page").options.domCache&&t.is(":jqmData(external-page='true')")&&t.bind("pagehide.remove",function(){var t=n(this),i=new n.Event("pageremove");t.trigger(i),i.isDefaultPrevented()||t.removeWithDependents()})},n.mobile.loadPage=function(t,i){var l=n.Deferred(),f=n.extend({},n.mobile.loadPage.defaults,i),h=null,b=null,nt=function(){var t=n.mobile.activePage&&p(n.mobile.activePage);return t||e.hrefNoHash},c=u.makeUrlAbsolute(t,nt()),y,a,g,w;if(f.data&&f.type==="get"&&(c=u.addSearchParams(c,f.data),f.data=r),f.data&&f.type==="post"&&(f.reloadPage=!0),y=u.getFilePath(c),a=u.convertUrlToDataUrl(c),f.pageContainer=f.pageContainer||n.mobile.pageContainer,h=f.pageContainer.children("[data-"+n.mobile.ns+"url='"+a+"']"),h.length===0&&a&&!u.isPath(a)&&(h=f.pageContainer.children("#"+a).attr("data-"+n.mobile.ns+"url",a).jqmData("url",a)),h.length===0)if(n.mobile.firstPage&&u.isFirstPageUrl(y))n.mobile.firstPage.parent().length&&(h=n(n.mobile.firstPage));else if(u.isEmbeddedPage(y))return l.reject(c,i),l.promise();if(h.length){if(!f.reloadPage)return k(h,f.role),l.resolve(c,i,h),s&&!i.prefetch&&s.set(t),l.promise();b=h}var tt=f.pageContainer,d=new n.Event("pagebeforeload"),v={url:t,absUrl:c,dataUrl:a,deferred:l,options:f};return(tt.trigger(d,v),d.isDefaultPrevented())?l.promise():(f.showLoadMsg&&(g=setTimeout(function(){n.mobile.showPageLoadingMsg()},f.loadMsgDelay),w=function(){clearTimeout(g),n.mobile.hidePageLoadingMsg()}),s&&typeof i.prefetch=="undefined"&&s.reset(),!n.mobile.allowCrossDomainPages&&!u.isSameDomain(o,c)?l.reject(c,i):n.ajax({url:y,type:f.type,data:f.data,dataType:"html",success:function(r,e,o){var d=n("<div><\/div>"),p=r.match(/<title[^>]*>([^<]*)/)&&RegExp.$1,nt=new RegExp("(<[^>]+\\bdata-"+n.mobile.ns+"role=[\"']?page[\"']?[^>]*>)"),tt=new RegExp("\\bdata-"+n.mobile.ns+"url=[\"']?([^\"'>]*)[\"']?"),g;nt.test(r)&&RegExp.$1&&tt.test(RegExp.$1)&&RegExp.$1&&(t=y=u.getFilePath(n("<div>"+RegExp.$1+"<\/div>").text())),s&&typeof i.prefetch=="undefined"&&s.set(y),d.get(0).innerHTML=r,h=d.find(":jqmData(role='page'), :jqmData(role='dialog')").first(),h.length||(h=n("<div data-"+n.mobile.ns+"role='page'>"+r.split(/<\/?body[^>]*>/gmi)[1]+"<\/div>")),p&&!h.jqmData("title")&&(~p.indexOf("&")&&(p=n("<div>"+p+"<\/div>").text()),h.jqmData("title",p)),n.support.dynamicBaseTag||(g=u.get(y),h.find("[src], link[href], a[rel='external'], :jqmData(ajax='false'), a[target]").each(function(){var i=n(this).is("[href]")?"href":n(this).is("[src]")?"src":"action",t=n(this).attr(i);t=t.replace(location.protocol+"//"+location.host+location.pathname,""),/^(\w+:|#|\/)/.test(t)||n(this).attr(i,g+t)})),h.attr("data-"+n.mobile.ns+"url",u.convertUrlToDataUrl(y)).attr("data-"+n.mobile.ns+"external-page",!0).appendTo(f.pageContainer),h.one("pagecreate",n.mobile._bindPageRemove),k(h,f.role),c.indexOf("&"+n.mobile.subPageUrlKey)>-1&&(h=f.pageContainer.children("[data-"+n.mobile.ns+"url='"+a+"']")),f.showLoadMsg&&w(),v.xhr=o,v.textStatus=e,v.page=h,f.pageContainer.trigger("pageload",v),l.resolve(c,i,h,b)},error:function(t,r,e){s&&s.set(u.get()),v.xhr=t,v.textStatus=r,v.errorThrown=e;var o=new n.Event("pageloadfailed");(f.pageContainer.trigger(o,v),o.isDefaultPrevented())||(f.showLoadMsg&&(w(),n.mobile.showPageLoadingMsg(n.mobile.pageLoadErrorMessageTheme,n.mobile.pageLoadErrorMessage,!0),setTimeout(n.mobile.hidePageLoadingMsg,1500)),l.reject(c,i))}}),l.promise())},n.mobile.loadPage.defaults={type:"get",data:r,reloadPage:!1,role:r,showLoadMsg:!1,pageContainer:r,loadMsgDelay:50},n.mobile.changePage=function(t,e){var s,b,it;if(a){d.unshift(arguments);return}s=n.extend({},n.mobile.changePage.defaults,e),s.pageContainer=s.pageContainer||n.mobile.pageContainer,s.fromPage=s.fromPage||n.mobile.activePage;var nt=s.pageContainer,rt=new n.Event("pagebeforechange"),v={toPage:t,options:s};if(nt.trigger(rt,v),!rt.isDefaultPrevented()){if(t=v.toPage,a=!0,typeof t=="string"){n.mobile.loadPage(t,s).done(function(t,i,r,u){a=!1,i.duplicateCachedPage=u,n.mobile.changePage(r,i)}).fail(function(){y(!0),g(),s.pageContainer.trigger("pagechangefailed",v)});return}t[0]!==n.mobile.firstPage[0]||s.dataUrl||(s.dataUrl=o.hrefNoHash);var tt=s.fromPage,c=s.dataUrl&&u.convertUrlToDataUrl(s.dataUrl)||t.jqmData("url"),et=c,st=u.getFilePath(c),l=f.getActive(),ot=f.activeIndex===0,p=0,w=i.title,ut=s.role==="dialog"||t.jqmData("role")==="dialog";if(tt&&tt[0]===t[0]&&!s.allowSamePageTransition){a=!1,nt.trigger("pagechange",v),s.fromHashChange&&f.directHashChange({currentUrl:c,isBack:function(){},isForward:function(){}});return}k(t,s.role),s.fromHashChange&&f.directHashChange({currentUrl:c,isBack:function(){p=-1},isForward:function(){p=1}});try{i.activeElement&&i.activeElement.nodeName.toLowerCase()!=="body"?n(i.activeElement).blur():n("input:focus, textarea:focus, select:focus").blur()}catch(ht){}b=!1,ut&&l&&(l.url&&l.url.indexOf(h)>-1&&!n.mobile.activePage.is(".ui-dialog")&&(s.changeHash=!1,b=!0),c=(l.url||"")+(b?"":h),f.activeIndex===0&&c===f.initialDst&&(c+=h)),s.changeHash!==!1&&c&&(f.ignoreNextHashChange=!0,u.set(c)),it=l?t.jqmData("title")||t.children(":jqmData(role='header')").find(".ui-title").getEncodedText():w,!it||w!==i.title||(w=it),t.jqmData("title")||t.jqmData("title",w),s.transition=s.transition||(p&&!ot?l.transition:r)||(ut?n.mobile.defaultDialogTransition:n.mobile.defaultPageTransition),p||(b&&(f.activeIndex=Math.max(0,f.activeIndex-1)),f.addNew(c,s.transition,w,et,s.role)),i.title=f.getActive().title,n.mobile.activePage=t,s.reverse=s.reverse||p<0,ft(t,tt,s.transition,s.reverse).done(function(i,r,u,f,e){y(),s.duplicateCachedPage&&s.duplicateCachedPage.remove(),e||n.mobile.focusPage(t),g(),nt.trigger("pagechange",v)})}},n.mobile.changePage.defaults={transition:r,reverse:!1,changeHash:!0,fromHashChange:!1,role:r,duplicateCachedPage:r,pageContainer:r,showLoadMsg:!0,dataUrl:r,fromPage:r,allowSamePageTransition:!1},n.mobile.navreadyDeferred=n.Deferred(),n.mobile._registerInternalEvents=function(){n(i).delegate("form","submit",function(t){var i=n(this);if(n.mobile.ajaxEnabled&&!i.is(":jqmData(ajax='false')")&&i.jqmHijackable().length){var f=i.attr("method"),s=i.attr("target"),r=i.attr("action");(r||(r=p(i),r===e.hrefNoHash&&(r=o.hrefNoSearch)),r=u.makeUrlAbsolute(r,p(i)),u.isExternal(r)&&!u.isPermittedCrossDomainRequest(o,r)||s)||(n.mobile.changePage(r,{type:f&&f.length&&f.toLowerCase()||"get",data:i.serialize(),transition:i.jqmData("transition"),reverse:i.jqmData("direction")==="reverse",reloadPage:!0}),t.preventDefault())}}),n(i).bind("vclick",function(t){if(!(t.which>1)&&n.mobile.linkBindingEnabled){var i=tt(t.target);n(i).jqmHijackable().length&&i&&u.parseUrl(i.getAttribute("href")||"#").hash!=="#"&&(y(!0),l=n(i).closest(".ui-btn").not(".ui-disabled"),l.addClass(n.mobile.activeBtnClass))}}),n(i).bind("click",function(i){var s,e,h,c,f,l,a;if(n.mobile.linkBindingEnabled&&(s=tt(i.target),e=n(s),s&&!(i.which>1)&&e.jqmHijackable().length)){if(h=function(){t.setTimeout(function(){y(!0)},200)},e.is(":jqmData(rel='back')"))return n.mobile.back(),!1;if(c=p(e),f=u.makeUrlAbsolute(e.attr("href")||"#",c),!n.mobile.ajaxEnabled&&!u.isEmbeddedPage(f)){h();return}if(f.search("#")!==-1){if(f=f.replace(/[^#]*#/,""),!f){i.preventDefault();return}f=u.isPath(f)?u.makeUrlAbsolute(f,c):u.makeUrlAbsolute("#"+f,o.hrefNoHash)}if(l=e.is("[rel='external']")||e.is(":jqmData(ajax='false')")||e.is("[target]"),a=l||u.isExternal(f)&&!u.isPermittedCrossDomainRequest(o,f),a){h();return}var v=e.jqmData("transition"),w=e.jqmData("direction")==="reverse"||e.jqmData("back"),b=e.attr("data-"+n.mobile.ns+"rel")||r;n.mobile.changePage(f,{transition:v,reverse:w,role:b,link:e}),i.preventDefault()}}),n(i).delegate(".ui-page","pageshow.prefetch",function(){var t=[];n(this).find("a:jqmData(prefetch)").each(function(){var r=n(this),i=r.attr("href");i&&n.inArray(i,t)===-1&&(t.push(i),n.mobile.loadPage(i,{role:r.attr("data-"+n.mobile.ns+"rel"),prefetch:!0}))})}),n.mobile._handleHashChange=function(i){var o=u.stripHash(i),l=n.mobile.urlHistory.stack.length===0?"none":r,c=new n.Event("navigate"),s={transition:l,changeHash:!1,fromHashChange:!0};if(0===f.stack.length&&(f.initialDst=o),n.mobile.pageContainer.trigger(c),!c.isDefaultPrevented()){if(!n.mobile.hashListeningEnabled||f.ignoreNextHashChange){f.ignoreNextHashChange=!1;return}if(f.stack.length>1&&o.indexOf(h)>-1&&f.initialDst!==o){if(!n.mobile.activePage.is(".ui-dialog")){f.directHashChange({currentUrl:o,isBack:function(){n.mobile.back()},isForward:function(){t.history.forward()}});return}f.directHashChange({currentUrl:o,either:function(t){var i=n.mobile.urlHistory.getActive();o=i.pageUrl,n.extend(s,{role:i.role,transition:i.transition,reverse:t})}})}o?(o=typeof o=="string"&&!u.isPath(o)?u.makeUrlAbsolute("#"+o,e):o,o===u.makeUrlAbsolute("#"+f.initialDst,e)&&f.stack.length&&f.stack[0].url!==f.initialDst.replace(h,"")&&(o=n.mobile.firstPage),n.mobile.changePage(o,s)):n.mobile.changePage(n.mobile.firstPage,s)}},c.bind("hashchange",function(){n.mobile._handleHashChange(u.parseLocation().hash)}),n(i).bind("pageshow",nt),n(t).bind("throttledresize",nt)},n.mobile.navreadyDeferred.done(function(){n.mobile._registerInternalEvents()})}(n),function(n,t){var f={},u=f,o=n(t),e=n.mobile.path.parseLocation(),s=n.Deferred(),h=n.Deferred();n(i).ready(n.proxy(h,"resolve")),n(i).one("mobileinit",n.proxy(s,"resolve")),n.extend(f,{initialFilePath:function(){return e.pathname+e.search}(),hashChangeTimeout:200,hashChangeEnableTimer:r,initialHref:e.hrefNoHash,state:function(){return{hash:n.mobile.path.parseLocation().hash||"#"+u.initialFilePath,title:i.title,initialHref:u.initialHref}},resetUIKeys:function(t){var u=n.mobile.dialogHashKey,i="&"+n.mobile.subPageUrlKey,r=t.indexOf(u);return r>-1?t=t.slice(0,r)+"#"+t.slice(r):t.indexOf(i)>-1&&(t=t.split(i).join("#"+i)),t},nextHashChangePrevented:function(t){n.mobile.urlHistory.ignoreNextHashChange=t,u.onHashChangeDisabled=t},onHashChange:function(){if(!u.onHashChangeDisabled){var f,o,r=n.mobile.path.parseLocation().hash,e=n.mobile.path.isPath(r),s=e?n.mobile.path.getLocation():n.mobile.getDocumentUrl();r=e?r.replace("#",""):r,o=u.state(),f=n.mobile.path.makeUrlAbsolute(r,s),e&&(f=u.resetUIKeys(f)),history.replaceState(o,i.title,f)}},onPopState:function(t){var i=t.originalEvent.state,r,f,e;i&&(clearTimeout(u.hashChangeEnableTimer),u.nextHashChangePrevented(!1),n.mobile._handleHashChange(i.hash),u.nextHashChangePrevented(!0),u.hashChangeEnableTimer=setTimeout(function(){u.nextHashChangePrevented(!1)},u.hashChangeTimeout))},init:function(){o.bind("hashchange",u.onHashChange),o.bind("popstate",u.onPopState),location.hash===""&&history.replaceState(u.state(),i.title,n.mobile.path.getLocation())}}),n.when(h,s,n.mobile.navreadyDeferred).done(function(){n.mobile.pushStateEnabled&&n.support.pushState&&f.init()})}(n,this),function(n){n.mobile.transitionFallbacks.flip="fade"}(n,this),function(n){n.mobile.transitionFallbacks.flow="fade"}(n,this),function(n){n.mobile.transitionFallbacks.pop="fade"}(n,this),function(n){n.mobile.transitionHandlers.slide=n.mobile.transitionHandlers.simultaneous,n.mobile.transitionFallbacks.slide="fade"}(n,this),function(n){n.mobile.transitionFallbacks.slidedown="fade"}(n,this),function(n){n.mobile.transitionFallbacks.slidefade="fade"}(n,this),function(n){n.mobile.transitionFallbacks.slideup="fade"}(n,this),function(n){n.mobile.transitionFallbacks.turn="fade"}(n,this),function(n){n.mobile.page.prototype.options.degradeInputs={color:!1,date:!1,datetime:!1,"datetime-local":!1,email:!1,month:!1,number:!1,range:"number",search:"text",tel:!1,time:!1,url:!1,week:!1},n(i).bind("pagecreate create",function(t){var i=n.mobile.closestPageData(n(t.target)),r;i&&(r=i.options,n(t.target).find("input").not(i.keepNativeSelector()).each(function(){var i=n(this),t=this.getAttribute("type"),e=r.degradeInputs[t]||"text";if(r.degradeInputs[t]){var u=n("<div>").html(i.clone()).html(),f=u.indexOf(" type=")>-1,o=f?/\s+type=["']?\w+['"]?/:/\/?>/,s=' type="'+e+'" data-'+n.mobile.ns+'type="'+t+'"'+(f?"":">");i.replaceWith(u.replace(o,s))}}))})}(n),function(n){n.widget("mobile.dialog",n.mobile.widget,{options:{closeBtnText:"Close",overlayTheme:"a",initSelector:":jqmData(role='dialog')"},_create:function(){var t=this,i=this.element,r=n("<a href='#' data-"+n.mobile.ns+"icon='delete' data-"+n.mobile.ns+"iconpos='notext'>"+this.options.closeBtnText+"<\/a>"),u=n("<div/>",{role:"dialog","class":"ui-dialog-contain ui-corner-all ui-overlay-shadow"});i.addClass("ui-dialog ui-overlay-"+this.options.overlayTheme),i.wrapInner(u).children().find(":jqmData(role='header')").first().prepend(r).end().end().children(":first-child").addClass("ui-corner-top").end().children(":last-child").addClass("ui-corner-bottom"),r.bind("click",function(){t.close()}),i.bind("vclick submit",function(t){var i=n(t.target).closest(t.type==="vclick"?"a":"form"),r;i.length&&!i.jqmData("transition")&&(r=n.mobile.urlHistory.getActive()||{},i.attr("data-"+n.mobile.ns+"transition",r.transition||n.mobile.defaultDialogTransition).attr("data-"+n.mobile.ns+"direction","reverse"))}).bind("pagehide",function(){n(this).find("."+n.mobile.activeBtnClass).not(".ui-slider-bg").removeClass(n.mobile.activeBtnClass)}).bind("pagebeforeshow",function(){t._isCloseable=!0,t.options.overlayTheme&&t.element.page("removeContainerBackground").page("setContainerBackground",t.options.overlayTheme)})},close:function(){var t;this._isCloseable&&(this._isCloseable=!1,n.mobile.hashListeningEnabled?n.mobile.back():(t=n.mobile.urlHistory.getPrev().url,n.mobile.path.isPath(t)||(t=n.mobile.path.makeUrlAbsolute("#"+t)),n.mobile.changePage(t,{changeHash:!1,fromHashChange:!0})))}}),n(i).delegate(n.mobile.dialog.prototype.options.initSelector,"pagecreate",function(){n.mobile.dialog.prototype.enhance(this)})}(n,this),function(n){n.mobile.page.prototype.options.backBtnText="Back",n.mobile.page.prototype.options.addBackBtn=!1,n.mobile.page.prototype.options.backBtnTheme=null,n.mobile.page.prototype.options.headerTheme="a",n.mobile.page.prototype.options.footerTheme="a",n.mobile.page.prototype.options.contentTheme=null,n(i).bind("pagecreate",function(t){var r=n(t.target),i=r.data("page").options,f=r.jqmData("role"),u=i.theme;n(":jqmData(role='header'), :jqmData(role='footer'), :jqmData(role='content')",r).jqmEnhanceable().each(function(){var t=n(this),e=t.jqmData("role"),l=t.jqmData("theme"),a=l||i.contentTheme||f==="dialog"&&u,o,s,h,v,c;t.addClass("ui-"+e),e==="header"||e==="footer"?(c=l||(e==="header"?i.headerTheme:i.footerTheme)||u,t.addClass("ui-bar-"+c).attr("role",e==="header"?"banner":"contentinfo"),e==="header"&&(o=t.children("a, button"),s=o.hasClass("ui-btn-left"),h=o.hasClass("ui-btn-right"),s=s||o.eq(0).not(".ui-btn-right").addClass("ui-btn-left").length,h=h||o.eq(1).addClass("ui-btn-right").length),i.addBackBtn&&e==="header"&&n(".ui-page").length>1&&r.jqmData("url")!==n.mobile.path.stripHash(location.hash)&&!s&&(v=n("<a href='javascript:void(0);' class='ui-btn-left' data-"+n.mobile.ns+"rel='back' data-"+n.mobile.ns+"icon='arrow-l'>"+i.backBtnText+"<\/a>").attr("data-"+n.mobile.ns+"theme",i.backBtnTheme||c).prependTo(t)),t.children("h1, h2, h3, h4, h5, h6").addClass("ui-title").attr({role:"heading","aria-level":"1"})):e==="content"&&(a&&t.addClass("ui-body-"+a),t.attr("role","main"))})})}(n),function(n){n.fn.fieldcontain=function(){return this.addClass("ui-field-contain ui-body ui-br").contents().filter(function(){return this.nodeType===3&&!/\S/.test(this.nodeValue)}).remove()},n(i).bind("pagecreate create",function(t){n(":jqmData(role='fieldcontain')",t.target).jqmEnhanceable().fieldcontain()})}(n),function(n){n.fn.grid=function(t){return this.each(function(){var f=n(this),s=n.extend({grid:null},t),r=f.children(),e={solo:1,a:2,b:3,c:4,d:5},u=s.grid,i,o;if(!u)if(r.length<=5)for(o in e)e[o]===r.length&&(u=o);else u="a",f.addClass("ui-grid-duo");i=e[u],f.addClass("ui-grid-"+u),r.filter(":nth-child("+i+"n+1)").addClass("ui-block-a"),i>1&&r.filter(":nth-child("+i+"n+2)").addClass("ui-block-b"),i>2&&r.filter(":nth-child("+i+"n+3)").addClass("ui-block-c"),i>3&&r.filter(":nth-child("+i+"n+4)").addClass("ui-block-d"),i>4&&r.filter(":nth-child("+i+"n+5)").addClass("ui-block-e")})}}(n),function(n){n(i).bind("pagecreate create",function(t){n(":jqmData(role='nojs')",t.target).addClass("ui-nojs")})}(n),function(n){n.mobile.behaviors.formReset={_handleFormReset:function(){this._on(this.element.closest("form"),{reset:function(){this._delay("_reset")}})}}}(n),function(n,t){function r(n){for(var t;n;){if(t=typeof n.className=="string"&&n.className+" ",t&&t.indexOf("ui-btn ")>-1&&t.indexOf("ui-disabled ")<0)break;n=n.parentNode}return n}n.fn.buttonMarkup=function(r){var p=this,b=function(t,i){s.setAttribute("data-"+n.mobile.ns+t,i),e.jqmData(t,i)},v;for(r=r&&n.type(r)==="object"?r:{},v=0;v<p.length;v++){var e=p.eq(v),s=e[0],f=n.extend({},n.fn.buttonMarkup.defaults,{icon:r.icon!==t?r.icon:e.jqmData("icon"),iconpos:r.iconpos!==t?r.iconpos:e.jqmData("iconpos"),theme:r.theme!==t?r.theme:e.jqmData("theme")||n.mobile.getInheritedTheme(e,"c"),inline:r.inline!==t?r.inline:e.jqmData("inline"),shadow:r.shadow!==t?r.shadow:e.jqmData("shadow"),corners:r.corners!==t?r.corners:e.jqmData("corners"),iconshadow:r.iconshadow!==t?r.iconshadow:e.jqmData("iconshadow"),mini:r.mini!==t?r.mini:e.jqmData("mini")},r),w="ui-btn-inner",k="ui-btn-text",h,y,c,a,l,o;for(n.each(f,b),e.jqmData("rel")==="popup"&&e.attr("href")&&(s.setAttribute("aria-haspopup",!0),s.setAttribute("aria-owns",s.getAttribute("href"))),o=n.data(s.tagName==="INPUT"||s.tagName==="BUTTON"?s.parentNode:s,"buttonElements"),o?(s=o.outer,e=n(s),c=o.inner,a=o.text,n(o.icon).remove(),o.icon=null):(c=i.createElement(f.wrapperEls),a=i.createElement(f.wrapperEls)),l=f.icon?i.createElement("span"):null,u&&!o&&u(),f.theme||(f.theme=n.mobile.getInheritedTheme(e,"c")),h="ui-btn ui-btn-up-"+f.theme,h+=f.shadow?" ui-shadow":"",h+=f.corners?" ui-btn-corner-all":"",f.mini!==t&&(h+=f.mini===!0?" ui-mini":" ui-fullsize"),f.inline!==t&&(h+=f.inline===!0?" ui-btn-inline":" ui-btn-block"),f.icon&&(f.icon="ui-icon-"+f.icon,f.iconpos=f.iconpos||"left",y="ui-icon "+f.icon,f.iconshadow&&(y+=" ui-icon-shadow")),f.iconpos&&(h+=" ui-btn-icon-"+f.iconpos,f.iconpos==="notext"&&!e.attr("title")&&e.attr("title",e.getEncodedText())),w+=f.corners?" ui-btn-corner-all":"",f.iconpos&&f.iconpos==="notext"&&!e.attr("title")&&e.attr("title",e.getEncodedText()),o&&e.removeClass(o.bcls||""),e.removeClass("ui-link").addClass(h),c.className=w,a.className=k,o||c.appendChild(a),l&&(l.className=y,o&&o.icon||(l.innerHTML="&#160;",c.appendChild(l)));s.firstChild&&!o;)a.appendChild(s.firstChild);o||s.appendChild(c),o={bcls:h,outer:s,inner:c,text:a,icon:l},n.data(s,"buttonElements",o),n.data(c,"buttonElements",o),n.data(a,"buttonElements",o),l&&n.data(l,"buttonElements",o)}return this},n.fn.buttonMarkup.defaults={corners:!0,shadow:!0,iconshadow:!0,wrapperEls:"span"};var u=function(){var e=n.mobile.buttonMarkup.hoverDelay,t,f;n(i).bind({"vmousedown vmousecancel vmouseup vmouseover vmouseout focus blur scrollstart":function(i){var u,o=n(r(i.target)),h=i.originalEvent&&/^touch/.test(i.originalEvent.type),s=i.type;o.length&&(u=o.attr("data-"+n.mobile.ns+"theme"),s==="vmousedown"?h?t=setTimeout(function(){o.removeClass("ui-btn-up-"+u).addClass("ui-btn-down-"+u)},e):o.removeClass("ui-btn-up-"+u).addClass("ui-btn-down-"+u):s==="vmousecancel"||s==="vmouseup"?o.removeClass("ui-btn-down-"+u).addClass("ui-btn-up-"+u):s==="vmouseover"||s==="focus"?h?f=setTimeout(function(){o.removeClass("ui-btn-up-"+u).addClass("ui-btn-hover-"+u)},e):o.removeClass("ui-btn-up-"+u).addClass("ui-btn-hover-"+u):(s==="vmouseout"||s==="blur"||s==="scrollstart")&&(o.removeClass("ui-btn-hover-"+u+" ui-btn-down-"+u).addClass("ui-btn-up-"+u),t&&clearTimeout(t),f&&clearTimeout(f)))},"focusin focus":function(t){n(r(t.target)).addClass(n.mobile.focusClass)},"focusout blur":function(t){n(r(t.target)).removeClass(n.mobile.focusClass)}}),u=null};n(i).bind("pagecreate create",function(t){n(":jqmData(role='button'), .ui-bar > a, .ui-header > a, .ui-footer > a, .ui-bar > :jqmData(role='controlgroup') > a",t.target).jqmEnhanceable().not("button, input, .ui-btn, :jqmData(role='none'), :jqmData(role='nojs')").buttonMarkup()})}(n),function(n,t){n.widget("mobile.collapsible",n.mobile.widget,{options:{expandCueText:" click to expand contents",collapseCueText:" click to collapse contents",collapsed:!0,heading:"h1,h2,h3,h4,h5,h6,legend",theme:null,contentTheme:null,inset:!0,mini:!1,initSelector:":jqmData(role='collapsible')"},_create:function(){var f=this.element,i=this.options,e=f.addClass("ui-collapsible"),r=f.children(i.heading).first(),s=f.jqmData("collapsed-icon")||i.collapsedIcon,h=f.jqmData("expanded-icon")||i.expandedIcon,o=e.wrapInner("<div class='ui-collapsible-content'><\/div>").children(".ui-collapsible-content"),u=f.closest(":jqmData(role='collapsible-set')").addClass("ui-collapsible-set");r.is("legend")&&(r=n("<div role='heading'>"+r.html()+"<\/div>").insertBefore(r),r.next().remove()),u.length?(i.theme||(i.theme=u.jqmData("theme")||n.mobile.getInheritedTheme(u,"c")),i.contentTheme||(i.contentTheme=u.jqmData("content-theme")),i.collapsedIcon||(i.collapsedIcon=u.jqmData("collapsed-icon")),i.expandedIcon||(i.expandedIcon=u.jqmData("expanded-icon")),i.iconpos||(i.iconpos=u.jqmData("iconpos")),i.inset=u.jqmData("inset")!==t?u.jqmData("inset"):!0,i.mini||(i.mini=u.jqmData("mini"))):i.theme||(i.theme=n.mobile.getInheritedTheme(f,"c")),!i.inset||e.addClass("ui-collapsible-inset"),o.addClass(i.contentTheme?"ui-body-"+i.contentTheme:""),s=f.jqmData("collapsed-icon")||i.collapsedIcon||"plus",h=f.jqmData("expanded-icon")||i.expandedIcon||"minus",r.insertBefore(o).addClass("ui-collapsible-heading").append("<span class='ui-collapsible-heading-status'><\/span>").wrapInner("<a href='#' class='ui-collapsible-heading-toggle'><\/a>").find("a").first().buttonMarkup({shadow:!1,corners:!1,iconpos:f.jqmData("iconpos")||i.iconpos||"left",icon:s,mini:i.mini,theme:i.theme}),!i.inset||r.find("a").first().add(".ui-btn-inner",f).addClass("ui-corner-top ui-corner-bottom"),e.bind("expand collapse",function(t){if(!t.isDefaultPrevented()){var c=n(this),f=t.type==="collapse",l=i.contentTheme;t.preventDefault(),r.toggleClass("ui-collapsible-heading-collapsed",f).find(".ui-collapsible-heading-status").text(f?i.expandCueText:i.collapseCueText).end().find(".ui-icon").toggleClass("ui-icon-"+h,!f).toggleClass("ui-icon-"+s,f||h===s).end().find("a").first().removeClass(n.mobile.activeBtnClass),c.toggleClass("ui-collapsible-collapsed",f),o.toggleClass("ui-collapsible-content-collapsed",f).attr("aria-hidden",f),l&&!!i.inset&&(!u.length||e.jqmData("collapsible-last"))&&(r.find("a").first().add(r.find(".ui-btn-inner")).toggleClass("ui-corner-bottom",f),o.toggleClass("ui-corner-bottom",!f)),o.trigger("updatelayout")}}).trigger(i.collapsed?"collapse":"expand"),r.bind("tap",function(){r.find("a").first().addClass(n.mobile.activeBtnClass)}).bind("click",function(n){var t=r.is(".ui-collapsible-heading-collapsed")?"expand":"collapse";e.trigger(t),n.preventDefault(),n.stopPropagation()})}}),n(i).bind("pagecreate create",function(t){n.mobile.collapsible.prototype.enhanceWithin(t.target)})}(n),function(n,t){n.widget("mobile.collapsibleset",n.mobile.widget,{options:{initSelector:":jqmData(role='collapsible-set')"},_create:function(){var r=this.element.addClass("ui-collapsible-set"),i=this.options;i.theme||(i.theme=n.mobile.getInheritedTheme(r,"c")),i.contentTheme||(i.contentTheme=r.jqmData("content-theme")),r.jqmData("inset")!==t&&(i.inset=r.jqmData("inset")),i.inset=i.inset!==t?i.inset:!0,r.jqmData("collapsiblebound")||r.jqmData("collapsiblebound",!0).bind("expand collapse",function(t){var u=t.type==="collapse",r=n(t.target).closest(".ui-collapsible"),f=r.data("collapsible");r.jqmData("collapsible-last")&&!!i.inset&&(r.find(".ui-collapsible-heading").first().find("a").first().toggleClass("ui-corner-bottom",u).find(".ui-btn-inner").toggleClass("ui-corner-bottom",u),r.find(".ui-collapsible-content").toggleClass("ui-corner-bottom",!u))}).bind("expand",function(t){var i=n(t.target).closest(".ui-collapsible");i.parent().is(":jqmData(role='collapsible-set')")&&i.siblings(".ui-collapsible").trigger("collapse")})},_init:function(){var n=this.element,t=n.children(":jqmData(role='collapsible')"),i=t.filter(":jqmData(collapsed='false')");this.refresh(),i.trigger("expand")},refresh:function(){var i=this.element,r=this.options,t=i.children(":jqmData(role='collapsible')");n.mobile.collapsible.prototype.enhance(t.not(".ui-collapsible")),r.inset&&(t.each(function(){n(this).jqmRemoveData("collapsible-last").find(".ui-collapsible-heading").find("a").first().removeClass("ui-corner-top ui-corner-bottom").find(".ui-btn-inner").removeClass("ui-corner-top ui-corner-bottom")}),t.first().find("a").first().addClass("ui-corner-top").find(".ui-btn-inner").addClass("ui-corner-top"),t.last().jqmData("collapsible-last",!0).find("a").first().addClass("ui-corner-bottom").find(".ui-btn-inner").addClass("ui-corner-bottom"))}}),n(i).bind("pagecreate create",function(t){n.mobile.collapsibleset.prototype.enhanceWithin(t.target)})}(n),function(n,t){n.widget("mobile.navbar",n.mobile.widget,{options:{iconpos:"top",grid:null,initSelector:":jqmData(role='navbar')"},_create:function(){var i=this.element,r=i.find("a"),u=r.filter(":jqmData(icon)").length?this.options.iconpos:t;i.addClass("ui-navbar ui-mini").attr("role","navigation").find("ul").jqmEnhanceable().grid({grid:this.options.grid}),r.buttonMarkup({corners:!1,shadow:!1,inline:!0,iconpos:u}),i.delegate("a","vclick",function(t){n(t.target).hasClass("ui-disabled")||(r.removeClass(n.mobile.activeBtnClass),n(this).addClass(n.mobile.activeBtnClass))}),i.closest(".ui-page").bind("pagebeforeshow",function(){r.filter(".ui-state-persist").addClass(n.mobile.activeBtnClass)})}}),n(i).bind("pagecreate create",function(t){n.mobile.navbar.prototype.enhanceWithin(t.target)})}(n),function(n){var r={};n.widget("mobile.listview",n.mobile.widget,{options:{theme:null,countTheme:"c",headerTheme:"b",dividerTheme:"b",icon:"arrow-r",splitIcon:"arrow-r",splitTheme:"b",inset:!1,initSelector:":jqmData(role='listview')"},_create:function(){var n=this,t="";t+=n.options.inset?" ui-listview-inset ui-corner-all ui-shadow ":"",n.element.addClass(function(n,i){return i+" ui-listview "+t}),n.refresh(!0)},_removeCorners:function(n,t){var i="ui-corner-top ui-corner-tr ui-corner-tl",r="ui-corner-bottom ui-corner-br ui-corner-bl";n=n.add(n.find(".ui-btn-inner, .ui-li-link-alt, .ui-li-thumb")),t==="top"?n.removeClass(i):t==="bottom"?n.removeClass(r):n.removeClass(i+" "+r)},_refreshCorners:function(n){var t,i,r,u;t=this.element.children("li"),i=n||t.filter(":visible").length===0?t.not(".ui-screen-hidden"):t.filter(":visible"),t.filter(".ui-li-last").removeClass("ui-li-last"),this.options.inset?(this._removeCorners(t),r=i.first().addClass("ui-corner-top"),r.add(r.find(".ui-btn-inner").not(".ui-li-link-alt span:first-child")).addClass("ui-corner-top").end().find(".ui-li-link-alt, .ui-li-link-alt span:first-child").addClass("ui-corner-tr").end().find(".ui-li-thumb").not(".ui-li-icon").addClass("ui-corner-tl"),u=i.last().addClass("ui-corner-bottom ui-li-last"),u.add(u.find(".ui-btn-inner")).find(".ui-li-link-alt").addClass("ui-corner-br").end().find(".ui-li-thumb").not(".ui-li-icon").addClass("ui-corner-bl")):i.last().addClass("ui-li-last"),n||this.element.trigger("updatelayout")},_findFirstElementByTagName:function(n,t,i,r){var u={};for(u[i]=u[r]=!0;n;){if(u[n.nodeName])return n;n=n[t]}return null},_getChildrenByTagName:function(t,i,r){var f=[],u={};for(u[i]=u[r]=!0,t=t.firstChild;t;)u[t.nodeName]&&f.push(t),t=t.nextSibling;return n(f)},_addThumbClasses:function(t){for(var i,u=t.length,r=0;r<u;r++)i=n(this._findFirstElementByTagName(t[r].firstChild,"nextSibling","img","IMG")),i.length&&(i.addClass("ui-li-thumb"),n(this._findFirstElementByTagName(i[0].parentNode,"parentNode","li","LI")).addClass(i.is(".ui-li-icon")?"ui-li-has-icon":"ui-li-has-thumb"))},refresh:function(t){var w,rt,k;this.parentPage=this.element.closest(".ui-page"),this._createSubPages();var o=this.options,f=this.element,st=this,ut=f.jqmData("dividertheme")||o.dividerTheme,ft=f.jqmData("splittheme"),et=f.jqmData("spliticon"),ot=f.jqmData("icon"),b=this._getChildrenByTagName(f[0],"li","LI"),y=!!n.nodeName(f[0],"ol"),h=!n.support.cssPseudoElement,e=f.attr("start"),c={},r,u,p,s,l,d,a,g,nt,tt,v,ht,ct,it;for(y&&h&&f.find(".ui-li-dec").remove(),y&&(e||e===0?h?a=parseFloat(e):(g=parseFloat(e)-1,f.css("counter-reset","listnumbering "+g)):h&&(a=1)),o.theme||(o.theme=n.mobile.getInheritedTheme(this.element,"c")),w=0,rt=b.length;w<rt;w++)r=b.eq(w),u="ui-li",(t||!r.hasClass("ui-li"))&&(p=r.jqmData("theme")||o.theme,s=this._getChildrenByTagName(r[0],"a","A"),k=r.jqmData("role")==="list-divider",s.length&&!k?(v=r.jqmData("icon"),r.buttonMarkup({wrapperEls:"div",shadow:!1,corners:!1,iconpos:"right",icon:s.length>1||v===!1?!1:v||ot||o.icon,theme:p}),v!==!1&&s.length===1&&r.addClass("ui-li-has-arrow"),s.first().removeClass("ui-link").addClass("ui-link-inherit"),s.length>1&&(u+=" ui-li-has-alt",l=s.last(),d=ft||l.jqmData("theme")||o.splitTheme,it=l.jqmData("icon"),l.appendTo(r).attr("title",l.getEncodedText()).addClass("ui-li-link-alt").empty().buttonMarkup({shadow:!1,corners:!1,theme:p,icon:!1,iconpos:"notext"}).find(".ui-btn-inner").append(n(i.createElement("span")).buttonMarkup({shadow:!0,corners:!0,theme:d,iconpos:"notext",icon:it||v||et||o.splitIcon})))):k?(u+=" ui-li-divider ui-bar-"+ut,r.attr("role","heading"),y&&(e||e===0?h?a=parseFloat(e):(nt=parseFloat(e)-1,r.css("counter-reset","listnumbering "+nt)):h&&(a=1))):u+=" ui-li-static ui-btn-up-"+p),y&&h&&u.indexOf("ui-li-divider")<0&&(tt=u.indexOf("ui-li-static")>0?r:r.find(".ui-link-inherit"),tt.addClass("ui-li-jsnumbering").prepend("<span class='ui-li-dec'>"+a+++". <\/span>")),c[u]||(c[u]=[]),c[u].push(r[0]);for(u in c)n(c[u]).addClass(u).children(".ui-btn-inner").addClass(u);f.find("h1, h2, h3, h4, h5, h6").addClass("ui-li-heading").end().find("p, dl").addClass("ui-li-desc").end().find(".ui-li-aside").each(function(){var t=n(this);t.prependTo(t.parent())}).end().find(".ui-li-count").each(function(){n(this).closest("li").addClass("ui-li-has-count")}).addClass("ui-btn-up-"+(f.jqmData("counttheme")||this.options.countTheme)+" ui-btn-corner-all"),this._addThumbClasses(b),this._addThumbClasses(f.find(".ui-link-inherit")),this._refreshCorners(t),this._trigger("afterrefresh")},_idStringEscape:function(n){return n.replace(/[^a-zA-Z0-9]/g,"-")},_createSubPages:function(){var u=this.element,i=u.closest(".ui-page"),f=i.jqmData("url"),e=f||i[0][n.expando],o=u.attr("id"),s=this.options,t="data-"+n.mobile.ns,a=this,h=i.find(":jqmData(role='footer')").jqmData("id"),c,l;typeof r[e]=="undefined"&&(r[e]=-1),o=o||++r[e],n(u.find("li>ul, li>ol").toArray().reverse()).each(function(i){var g=this,r=n(this),b=r.attr("id")||o+"-"+i,l=r.parent(),a=n(r.prevAll().toArray().reverse()),v=a.length?a:n("<span>"+n.trim(l.contents()[0].nodeValue)+"<\/span>"),y=v.first().getEncodedText(),p=(f||"")+"&"+n.mobile.subPageUrlKey+"="+b,k=r.jqmData("theme")||s.theme,d=r.jqmData("counttheme")||u.jqmData("counttheme")||s.countTheme,w,e;c=!0,w=r.detach().wrap("<div "+t+"role='page' "+t+"url='"+p+"' "+t+"theme='"+k+"' "+t+"count-theme='"+d+"'><div "+t+"role='content'><\/div><\/div>").parent().before("<div "+t+"role='header' "+t+"theme='"+s.headerTheme+"'><div class='ui-title'>"+y+"<\/div><\/div>").after(h?n("<div "+t+"role='footer' "+t+"id='"+h+"'>"):"").parent().appendTo(n.mobile.pageContainer),w.page(),e=l.find("a:first"),e.length||(e=n("<a/>").html(v||y).prependTo(l.empty())),e.attr("href","#"+p)}).listview(),c&&i.is(":jqmData(external-page='true')")&&i.data("page").options.domCache===!1&&(l=function(t,r){var o=r.nextPage,u,e=new n.Event("pageremove");r.nextPage&&(u=o.jqmData("url"),u.indexOf(f+"&"+n.mobile.subPageUrlKey)!==0&&(a.childPages().remove(),i.trigger(e),e.isDefaultPrevented()||i.removeWithDependents()))},i.unbind("pagehide.remove").bind("pagehide.remove",l))},childPages:function(){var t=this.parentPage.jqmData("url");return n(":jqmData(url^='"+t+"&"+n.mobile.subPageUrlKey+"')")}}),n(i).bind("pagecreate create",function(t){n.mobile.listview.prototype.enhanceWithin(t.target)})}(n),function(n){n.mobile.listview.prototype.options.autodividers=!1,n.mobile.listview.prototype.options.autodividersSelector=function(t){var i=n.trim(t.text())||null;return i?(i=i.slice(0,1).toUpperCase(),i):null},n(i).delegate("ul,ol","listviewcreate",function(){var t=n(this),r=t.data("listview"),f,u;r&&r.options.autodividers&&(f=function(){var s,h,f,u,e,o;for(t.find("li:jqmData(role='list-divider')").remove(),s=t.find("li"),h=null,e=0;e<s.length;e++)f=s[e],u=r.options.autodividersSelector(n(f)),u&&h!==u&&(o=i.createElement("li"),o.appendChild(i.createTextNode(u)),o.setAttribute("data-"+n.mobile.ns+"role","list-divider"),f.parentNode.insertBefore(o,f)),h=u},u=function(){t.unbind("listviewafterrefresh",u),f(),r.refresh(),t.bind("listviewafterrefresh",u)},u())})}(n),function(n,t){n.widget("mobile.checkboxradio",n.mobile.widget,{options:{theme:null,mini:!1,initSelector:"input[type='checkbox'],input[type='radio']"},_create:function(){var f=this,r=this.element,o=this.options,c=function(n,t){return n.jqmData(t)||n.closest("form, fieldset").jqmData(t)},l=n(r).closest("label"),e=l.length?l:n(r).closest("form, fieldset, :jqmData(role='page'), :jqmData(role='dialog')").find("label").filter("[for='"+r[0].id+"']").first(),u=r[0].type,y=c(r,"mini")||o.mini,a=u+"-on",s=u+"-off",v=r.parents(":jqmData(type='horizontal')").length?t:s,p=c(r,"iconpos"),w=v?"":" "+n.mobile.activeBtnClass,b="ui-"+a+w,k="ui-"+s,d="ui-icon-"+a,g="ui-icon-"+s,h;(u==="checkbox"||u==="radio")&&(n.extend(this,{label:e,inputtype:u,checkedClass:b,uncheckedClass:k,checkedicon:d,uncheckedicon:g}),o.theme||(o.theme=n.mobile.getInheritedTheme(this.element,"c")),e.buttonMarkup({theme:o.theme,icon:v,shadow:!1,mini:y,iconpos:p}),h=i.createElement("div"),h.className="ui-"+u,r.add(e).wrapAll(h),e.bind({vmouseover:function(t){n(this).parent().is(".ui-disabled")&&t.stopPropagation()},vclick:function(n){if(r.is(":disabled")){n.preventDefault();return}return f._cacheVals(),r.prop("checked",u==="radio"&&!0||!r.prop("checked")),r.triggerHandler("click"),f._getInputSet().not(r).prop("checked",!1),f._updateAll(),!1}}),r.bind({vmousedown:function(){f._cacheVals()},vclick:function(){var t=n(this);t.is(":checked")?(t.prop("checked",!0),f._getInputSet().not(t).prop("checked",!1)):t.prop("checked",!1),f._updateAll()},focus:function(){e.addClass(n.mobile.focusClass)},blur:function(){e.removeClass(n.mobile.focusClass)}}),this._handleFormReset&&this._handleFormReset(),this.refresh())},_cacheVals:function(){this._getInputSet().each(function(){n(this).jqmData("cacheVal",this.checked)})},_getInputSet:function(){return this.inputtype==="checkbox"?this.element:this.element.closest("form, fieldset, :jqmData(role='page'), :jqmData(role='dialog')").find("input[name='"+this.element[0].name+"'][type='"+this.inputtype+"']")},_updateAll:function(){var t=this;this._getInputSet().each(function(){var i=n(this);(this.checked||t.inputtype==="checkbox")&&i.trigger("change")}).checkboxradio("refresh")},_reset:function(){this.refresh()},refresh:function(){var t=this.element[0],n=this.label,i=n.find(".ui-icon");t.checked?(n.addClass(this.checkedClass).removeClass(this.uncheckedClass),i.addClass(this.checkedicon).removeClass(this.uncheckedicon)):(n.removeClass(this.checkedClass).addClass(this.uncheckedClass),i.removeClass(this.checkedicon).addClass(this.uncheckedicon)),t.disabled?this.disable():this.enable()},disable:function(){this.element.prop("disabled",!0).parent().addClass("ui-disabled")},enable:function(){this.element.prop("disabled",!1).parent().removeClass("ui-disabled")}}),n.widget("mobile.checkboxradio",n.mobile.checkboxradio,n.mobile.behaviors.formReset),n(i).bind("pagecreate create",function(t){n.mobile.checkboxradio.prototype.enhanceWithin(t.target,!0)})}(n),function(n,t){n.widget("mobile.button",n.mobile.widget,{options:{theme:null,icon:null,iconpos:null,corners:!0,shadow:!0,iconshadow:!0,initSelector:"button, [type='button'], [type='submit'], [type='reset']"},_create:function(){var r=this.element,o,u=this.options,s,h,c=u.inline||r.jqmData("inline"),l=u.mini||r.jqmData("mini"),f="",e;if(r[0].tagName==="A"){r.hasClass("ui-btn")||r.buttonMarkup();return}this.options.theme||(this.options.theme=n.mobile.getInheritedTheme(this.element,"c")),!~r[0].className.indexOf("ui-btn-left")||(f="ui-btn-left"),!~r[0].className.indexOf("ui-btn-right")||(f="ui-btn-right"),(r.attr("type")==="submit"||r.attr("type")==="reset")&&(f?f+=" ui-submit":f="ui-submit"),n("label[for='"+r.attr("id")+"']").addClass("ui-submit"),this.button=n("<div><\/div>")[r.html()?"html":"text"](r.html()||r.val()).insertBefore(r).buttonMarkup({theme:u.theme,icon:u.icon,iconpos:u.iconpos,inline:c,corners:u.corners,shadow:u.shadow,iconshadow:u.iconshadow,mini:l}).addClass(f).append(r.addClass("ui-btn-hidden")),o=this.button,s=r.attr("type"),h=r.attr("name"),s!=="button"&&s!=="reset"&&h&&r.bind("vclick",function(){e===t&&(e=n("<input>",{type:"hidden",name:r.attr("name"),value:r.attr("value")}).insertBefore(r),n(i).one("submit",function(){e.remove(),e=t}))}),r.bind({focus:function(){o.addClass(n.mobile.focusClass)},blur:function(){o.removeClass(n.mobile.focusClass)}}),this.refresh()},enable:function(){return this.element.attr("disabled",!1),this.button.removeClass("ui-disabled").attr("aria-disabled",!1),this._setOption("disabled",!1)},disable:function(){return this.element.attr("disabled",!0),this.button.addClass("ui-disabled").attr("aria-disabled",!0),this._setOption("disabled",!0)},refresh:function(){var t=this.element;t.prop("disabled")?this.disable():this.enable(),n(this.button.data("buttonElements").text)[t.html()?"html":"text"](t.html()||t.val())}}),n(i).bind("pagecreate create",function(t){n.mobile.button.prototype.enhanceWithin(t.target,!0)})}(n),function(n){n.fn.controlgroup=function(t){function i(n,t){n.removeClass("ui-btn-corner-all ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-controlgroup-last ui-shadow").eq(0).addClass(t[0]).end().last().addClass(t[1]).addClass("ui-controlgroup-last")}return this.each(function(){var r=n(this),u=n.extend({direction:r.jqmData("type")||"vertical",shadow:!1,excludeInvisible:!0,mini:r.jqmData("mini")},t),f=r.children("legend"),e=r.children(".ui-controlgroup-label"),o=r.children(".ui-controlgroup-controls"),s=u.direction==="horizontal"?["ui-corner-left","ui-corner-right"]:["ui-corner-top","ui-corner-bottom"],h=r.find("input").first().attr("type");o.length&&o.contents().unwrap(),r.wrapInner("<div class='ui-controlgroup-controls'><\/div>"),f.length?(n("<div role='heading' class='ui-controlgroup-label'>"+f.html()+"<\/div>").insertBefore(r.children(0)),f.remove()):e.length&&r.prepend(e),r.addClass("ui-corner-all ui-controlgroup ui-controlgroup-"+u.direction),i(r.find(".ui-btn"+(u.excludeInvisible?":visible":"")).not(".ui-slider-handle"),s),i(r.find(".ui-btn-inner"),s),u.shadow&&r.addClass("ui-shadow"),u.mini&&r.addClass("ui-mini")})}}(n),function(n){n(i).bind("pagecreate create",function(t){n(t.target).find("a").jqmEnhanceable().not(".ui-btn, .ui-link-inherit, :jqmData(role='none'), :jqmData(role='nojs')").addClass("ui-link")})}(n),function(n,r){function f(n,t,i,r){var u=r;return u=n<t?i+(n-t)/2:Math.min(Math.max(i,r-t/2),i+n-t),u}function u(){var i=n(t);return{x:i.scrollLeft(),y:i.scrollTop(),cx:t.innerWidth||i.width(),cy:t.innerHeight||i.height()}}n.widget("mobile.popup",n.mobile.widget,{options:{theme:null,overlayTheme:null,shadow:!0,corners:!0,transition:"none",positionTo:"origin",tolerance:null,initSelector:":jqmData(role='popup')",closeLinkSelector:"a:jqmData(rel='back')",closeLinkEvents:"click.popup",navigateEvents:"navigate.popup",closeEvents:"navigate.popup pagebeforechange.popup",history:!n.mobile.browser.ie},_eatEventAndClose:function(n){return n.preventDefault(),n.stopImmediatePropagation(),this.close(),!1},_resizeScreen:function(){var n=this._ui.container.outerHeight(!0);this._ui.screen.removeAttr("style"),n>this._ui.screen.height()&&this._ui.screen.height(n)},_handleWindowKeyUp:function(t){if(this._isOpen&&t.keyCode===n.mobile.keyCode.ESCAPE)return this._eatEventAndClose(t)},_expectResizeEvent:function(){var t=u();if(this._resizeData){if(t.x===this._resizeData.winCoords.x&&t.y===this._resizeData.winCoords.y&&t.cx===this._resizeData.winCoords.cx&&t.cy===this._resizeData.winCoords.cy)return!1;clearTimeout(this._resizeData.timeoutId)}return this._resizeData={timeoutId:setTimeout(n.proxy(this,"_resizeTimeout"),200),winCoords:t},!0},_resizeTimeout:function(){this._isOpen?this._expectResizeEvent()||(this._ui.container.hasClass("ui-popup-hidden")&&(this._trigger("beforeposition"),this._ui.container.removeClass("ui-popup-hidden").offset(this._placementCoords(this._desiredCoords(r,r,"window")))),this._resizeScreen(),this._resizeData=null,this._orientationchangeInProgress=!1):(this._resizeData=null,this._orientationchangeInProgress=!1)},_handleWindowResize:function(){this._isOpen&&(this._expectResizeEvent()||this._orientationchangeInProgress)&&!this._ui.container.hasClass("ui-popup-hidden")&&this._ui.container.addClass("ui-popup-hidden").removeAttr("style")},_handleWindowOrientationchange:function(){!this._orientationchangeInProgress&&this._isOpen&&(this._expectResizeEvent(),this._orientationchangeInProgress=!0)},_create:function(){var i={screen:n("<div class='ui-screen-hidden ui-popup-screen'><\/div>"),placeholder:n("<div style='display: none;'><!-- placeholder --><\/div>"),container:n("<div class='ui-popup-container ui-popup-hidden'><\/div>")},u=this.element.closest(".ui-page"),f=this.element.attr("id"),e=this;this.options.history=this.options.history&&n.mobile.ajaxEnabled&&n.mobile.hashListeningEnabled,u.length===0&&(u=n("body")),this.options.container=this.options.container||n.mobile.pageContainer,u.append(i.screen),i.container.insertAfter(i.screen),i.placeholder.insertAfter(this.element),f&&(i.screen.attr("id",f+"-screen"),i.container.attr("id",f+"-popup"),i.placeholder.html("<!-- placeholder for "+f+" -->")),i.container.append(this.element),this.element.addClass("ui-popup"),n.extend(this,{_scrollTop:0,_page:u,_ui:i,_fallbackTransition:"",_currentTransition:!1,_prereqs:null,_isOpen:!1,_tolerance:null,_resizeData:null,_orientationchangeInProgress:!1,_globalHandlers:[{src:n(t),handler:{orientationchange:n.proxy(this,"_handleWindowOrientationchange"),resize:n.proxy(this,"_handleWindowResize"),keyup:n.proxy(this,"_handleWindowKeyUp")}}]}),n.each(this.options,function(n,t){e.options[n]=r,e._setOption(n,t,!0)}),i.screen.bind("vclick",n.proxy(this,"_eatEventAndClose")),n.each(this._globalHandlers,function(n,t){t.src.bind(t.handler)})},_applyTheme:function(n,t,i){for(var f=(n.attr("class")||"").split(" "),o=!0,r=null,u,e=String(t);f.length>0;){if(r=f.pop(),u=new RegExp("^ui-"+i+"-([a-z])$").exec(r),u&&u.length>1){r=u[1];break}r=null}t!==r&&(n.removeClass("ui-"+i+"-"+r),t!==null&&t!=="none"&&n.addClass("ui-"+i+"-"+e))},_setTheme:function(n){this._applyTheme(this.element,n,"body")},_setOverlayTheme:function(n){this._applyTheme(this._ui.screen,n,"overlay"),this._isOpen&&this._ui.screen.addClass("in")},_setShadow:function(n){this.element.toggleClass("ui-overlay-shadow",n)},_setCorners:function(n){this.element.toggleClass("ui-corner-all",n)},_applyTransition:function(t){this._ui.container.removeClass(this._fallbackTransition),t&&t!=="none"&&(this._fallbackTransition=n.mobile._maybeDegradeTransition(t),this._fallbackTransition==="none"&&(this._fallbackTransition=""),this._ui.container.addClass(this._fallbackTransition))},_setTransition:function(n){this._currentTransition||this._applyTransition(n)},_setTolerance:function(t){var r={t:30,r:15,b:30,l:15},i;if(t){i=String(t).split(","),n.each(i,function(n,t){i[n]=parseInt(t,10)});switch(i.length){case 1:isNaN(i[0])||(r.t=r.r=r.b=r.l=i[0]);break;case 2:isNaN(i[0])||(r.t=r.b=i[0]),isNaN(i[1])||(r.l=r.r=i[1]);break;case 4:isNaN(i[0])||(r.t=i[0]),isNaN(i[1])||(r.r=i[1]),isNaN(i[2])||(r.b=i[2]),isNaN(i[3])||(r.l=i[3])}}this._tolerance=r},_setOption:function(t,i){var u,f="_set"+t.charAt(0).toUpperCase()+t.slice(1);this[f]!==r&&this[f](i),u=["initSelector","closeLinkSelector","closeLinkEvents","navigateEvents","closeEvents","history","container"],n.mobile.widget.prototype._setOption.apply(this,arguments),n.inArray(t,u)===-1&&this.element.attr("data-"+(n.mobile.ns||"")+t.replace(/([A-Z])/,"-$1").toLowerCase(),i)},_placementCoords:function(n){var o=u(),r={x:this._tolerance.l,y:o.y+this._tolerance.t,cx:o.cx-this._tolerance.l-this._tolerance.r,cy:o.cy-this._tolerance.t-this._tolerance.b},e,t;this._ui.container.css("max-width",r.cx),e={cx:this._ui.container.outerWidth(!0),cy:this._ui.container.outerHeight(!0)},t={x:f(r.cx,e.cx,r.x,n.x),y:f(r.cy,e.cy,r.y,n.y)},t.y=Math.max(0,t.y);var s=i.documentElement,h=i.body,c=Math.max(s.clientHeight,h.scrollHeight,h.offsetHeight,s.scrollHeight,s.offsetHeight);return t.y-=Math.min(t.y,Math.max(0,t.y+e.cy-c)),{left:t.x,top:t.y}},_createPrereqs:function(t,i,r){var f=this,u;u={screen:n.Deferred(),container:n.Deferred()},u.screen.then(function(){u===f._prereqs&&t()}),u.container.then(function(){u===f._prereqs&&i()}),n.when(u.screen,u.container).done(function(){u===f._prereqs&&(f._prereqs=null,r())}),f._prereqs=u},_animate:function(t){if(this._ui.screen.removeClass(t.classToRemove).addClass(t.screenClassToAdd),t.prereqs.screen.resolve(),t.transition&&t.transition!=="none"&&(t.applyTransition&&this._applyTransition(t.transition),this._fallbackTransition)){this._ui.container.animationComplete(n.proxy(t.prereqs.container,"resolve")).addClass(t.containerClassToAdd).removeClass(t.classToRemove);return}this._ui.container.removeClass(t.classToRemove),t.prereqs.container.resolve()},_desiredCoords:function(t,i,r){var f=null,o,e=u();if(r&&r!=="origin")if(r==="window")t=e.cx/2+e.x,i=e.cy/2+e.y;else{try{f=n(r)}catch(s){f=null}f&&(f.filter(":visible"),f.length===0&&(f=null))}return f&&(o=f.offset(),t=o.left+f.outerWidth()/2,i=o.top+f.outerHeight()/2),(n.type(t)!=="number"||isNaN(t))&&(t=e.cx/2+e.x),(n.type(i)!=="number"||isNaN(i))&&(i=e.cy/2+e.y),{x:t,y:i}},_openPrereqsComplete:function(){var n=this;n._ui.container.addClass("ui-popup-active"),n._isOpen=!0,n._resizeScreen(),setTimeout(function(){n._ui.container.attr("tabindex","0").focus(),n._expectResizeEvent(),n._trigger("afteropen")})},_open:function(i){var u,r,f=function(){var o=t,n=navigator.userAgent,r=n.match(/AppleWebKit\/([0-9\.]+)/),u=!!r&&r[1],i=n.match(/Android (\d+(?:\.\d+))/),f=!!i&&i[1],e=n.indexOf("Chrome")>-1;return i!==null&&f==="4.0"&&u&&u>534.13&&!e?!0:!1}();i=i||{},r=i.transition||this.options.transition,this._trigger("beforeposition"),u=this._placementCoords(this._desiredCoords(i.x,i.y,i.positionTo||this.options.positionTo||"origin")),this._createPrereqs(n.noop,n.noop,n.proxy(this,"_openPrereqsComplete")),r?(this._currentTransition=r,this._applyTransition(r)):r=this.options.transition,this.options.theme||this._setTheme(this._page.jqmData("theme")||n.mobile.getInheritedTheme(this._page,"c")),this._ui.screen.removeClass("ui-screen-hidden"),this._ui.container.removeClass("ui-popup-hidden").offset(u),this.options.overlayTheme&&f&&this.element.closest(".ui-page").addClass("ui-popup-open"),this._animate({additionalCondition:!0,transition:r,classToRemove:"",screenClassToAdd:"in",containerClassToAdd:"in",applyTransition:!1,prereqs:this._prereqs})},_closePrereqScreen:function(){this._ui.screen.removeClass("out").addClass("ui-screen-hidden")},_closePrereqContainer:function(){this._ui.container.removeClass("reverse out").addClass("ui-popup-hidden").removeAttr("style")},_closePrereqsDone:function(){var t=this,i=t.options;t._ui.container.removeAttr("tabindex"),i.container.unbind(i.closeEvents),t.element.undelegate(i.closeLinkSelector,i.closeLinkEvents),n.mobile.popup.active=r,t._trigger("afterclose")},_close:function(t){this._ui.container.removeClass("ui-popup-active"),this._page.removeClass("ui-popup-open"),this._isOpen=!1,this._createPrereqs(n.proxy(this,"_closePrereqScreen"),n.proxy(this,"_closePrereqContainer"),n.proxy(this,"_closePrereqsDone")),this._animate({additionalCondition:this._ui.screen.hasClass("in"),transition:t?"none":this._currentTransition||this.options.transition,classToRemove:"in",screenClassToAdd:"out",containerClassToAdd:"reverse out",applyTransition:!0,prereqs:this._prereqs})},_unenhance:function(){var t=this;t._setTheme("none"),t.element.detach().insertAfter(t._ui.placeholder).removeClass("ui-popup ui-overlay-shadow ui-corner-all"),t._ui.screen.remove(),t._ui.container.remove(),t._ui.placeholder.remove(),n.each(t._globalHandlers,function(t,i){n.each(i.handler,function(n,t){i.src.unbind(n,t)})})},_destroy:function(){n.mobile.popup.active===this?(this.element.one("popupafterclose",n.proxy(this,"_unenhance")),this.close()):this._unenhance()},_closePopup:function(i,r){var u,f;if(t.scrollTo(0,this._scrollTop),i.type==="pagebeforechange"&&r){u=typeof r.toPage=="string"?r.toPage:r.toPage.jqmData("url"),u=n.mobile.path.parseUrl(u),f=u.pathname+u.search+u.hash,this._myUrl!==f?(this.options.container.unbind(this.options.closeEvents),this._close(!0)):(this.close(),i.preventDefault());return}this._close()},_bindContainerClose:function(){var t=this;t.options.container.one(t.options.closeEvents,n.proxy(t,"_closePopup"))},open:function(i){var u=this,e=this.options,f,s,c,h,l,o;if(!n.mobile.popup.active){if(n.mobile.popup.active=this,this._scrollTop=n(t).scrollTop(),!e.history){u._open(i),u._bindContainerClose(),u.element.delegate(e.closeLinkSelector,e.closeLinkEvents,function(){return u._close(),!1});return}if(s=n.mobile.dialogHashKey,c=n.mobile.activePage,h=c.is(".ui-dialog"),this._myUrl=f=n.mobile.urlHistory.getActive().url,l=f.indexOf(s)>-1&&!h,o=n.mobile.urlHistory,l){u._open(i),u._bindContainerClose();return}f+=s,o.activeIndex===0&&f===o.initialDst&&(f+=s),e.container.one(e.navigateEvents,function(n){n.preventDefault(),u._open(i),u._bindContainerClose()}),o.ignoreNextHashChange=h,o.addNew(f,r,r,r,"dialog"),n.mobile.path.set(f)}},close:function(){n.mobile.popup.active&&(this._scrollTop=n(t).scrollTop(),this.options.history?n.mobile.back():this._close())}}),n.mobile.popup.handleLink=function(t){var r=t.closest(":jqmData(role='page')"),f=r.length===0?n("body"):r,u=n(n.mobile.path.parseUrl(t.attr("href")).hash,f[0]),i;u.data("popup")&&(i=t.offset(),u.popup("open",{x:i.left+t.outerWidth()/2,y:i.top+t.outerHeight()/2,transition:t.jqmData("transition"),positionTo:t.jqmData("position-to"),link:t})),setTimeout(function(){var i=t.parent().parent();i.hasClass("ui-li")&&(t=i.parent()),t.removeClass(n.mobile.activeBtnClass)},300)},n(i).bind("pagebeforechange",function(t,i){i.options.role==="popup"&&(n.mobile.popup.handleLink(i.options.link),t.preventDefault())}),n(i).bind("pagecreate create",function(t){n.mobile.popup.prototype.enhanceWithin(t.target,!0)})}(n),function(n){var t=n("meta[name=viewport]"),i=t.attr("content"),u=i+",maximum-scale=1, user-scalable=no",f=i+",maximum-scale=10, user-scalable=yes",r=/(user-scalable[\s]*=[\s]*no)|(maximum-scale[\s]*=[\s]*1)[$,\s]/.test(i);n.mobile.zoom=n.extend({},{enabled:!r,locked:!1,disable:function(i){r||n.mobile.zoom.locked||(t.attr("content",u),n.mobile.zoom.enabled=!1,n.mobile.zoom.locked=i||!1)},enable:function(i){r||n.mobile.zoom.locked&&i!==!0||(t.attr("content",f),n.mobile.zoom.enabled=!0,n.mobile.zoom.locked=!1)},restore:function(){r||(t.attr("content",i),n.mobile.zoom.enabled=!0)}})}(n),function(n){n.widget("mobile.textinput",n.mobile.widget,{options:{theme:null,mini:!1,preventFocusZoom:/iPhone|iPad|iPod/.test(navigator.platform)&&navigator.userAgent.indexOf("AppleWebKit")>-1,initSelector:"input[type='text'], input[type='search'], :jqmData(type='search'), input[type='number'], :jqmData(type='number'), input[type='password'], input[type='email'], input[type='url'], input[type='tel'], textarea, input[type='time'], input[type='date'], input[type='month'], input[type='week'], input[type='datetime'], input[type='datetime-local'], input[type='color'], input:not([type])",clearSearchButtonText:"clear text",disabled:!1},_create:function(){function o(){setTimeout(function(){e.toggleClass("ui-input-clear-hidden",!r.val())},0)}var y=this,r=this.element,u=this.options,s=u.theme||n.mobile.getInheritedTheme(this.element,"c"),h=" ui-body-"+s,c=u.mini?" ui-mini":"",f,e,l,a,v;n("label[for='"+r.attr("id")+"']").addClass("ui-input-text"),f=r.addClass("ui-input-text ui-body-"+s),typeof r[0].autocorrect!="undefined"&&!n.support.touchOverflow&&(r[0].setAttribute("autocorrect","off"),r[0].setAttribute("autocomplete","off")),r.is("[type='search'],:jqmData(type='search')")?(f=r.wrap("<div class='ui-input-search ui-shadow-inset ui-btn-corner-all ui-btn-shadow ui-icon-searchfield"+h+c+"'><\/div>").parent(),e=n("<a href='#' class='ui-input-clear' title='"+u.clearSearchButtonText+"'>"+u.clearSearchButtonText+"<\/a>").bind("click",function(n){r.val("").focus().trigger("change"),e.addClass("ui-input-clear-hidden"),n.preventDefault()}).appendTo(f).buttonMarkup({icon:"delete",iconpos:"notext",corners:!0,shadow:!0,mini:u.mini}),o(),r.bind("paste cut keyup focus change blur",o)):r.addClass("ui-corner-all ui-shadow-inset"+h+c),r.focus(function(){f.addClass(n.mobile.focusClass)}).blur(function(){f.removeClass(n.mobile.focusClass)}).bind("focus",function(){u.preventFocusZoom&&n.mobile.zoom.disable(!0)}).bind("blur",function(){u.preventFocusZoom&&n.mobile.zoom.enable(!0)}),r.is("textarea")&&(l=15,a=100,this._keyup=function(){var n=r[0].scrollHeight,t=r[0].clientHeight;t<n&&r.height(n+l)},r.keyup(function(){clearTimeout(v),v=setTimeout(y._keyup,a)}),this._on(n(i),{pagechange:"_keyup"}),n.trim(r.val())&&this._on(n(t),{load:"_keyup"})),r.attr("disabled")&&this.disable()},disable:function(){var n;return n=this.element.attr("disabled",!0).is("[type='search'], :jqmData(type='search')")?this.element.parent():this.element,n.addClass("ui-disabled"),this._setOption("disabled",!0)},enable:function(){var n;return n=this.element.attr("disabled",!1).is("[type='search'], :jqmData(type='search')")?this.element.parent():this.element,n.removeClass("ui-disabled"),this._setOption("disabled",!1)}}),n(i).bind("pagecreate create",function(t){n.mobile.textinput.prototype.enhanceWithin(t.target,!0)})}(n),function(n){n.mobile.listview.prototype.options.filter=!1,n.mobile.listview.prototype.options.filterPlaceholder="Filter items...",n.mobile.listview.prototype.options.filterTheme="c";var r=function(n,t){return n.toString().toLowerCase().indexOf(t)===-1};n.mobile.listview.prototype.options.filterCallback=r,n(i).delegate("ul, ol","listviewcreate",function(){var i=n(this),t=i.data("listview"),u,f;t.options.filter&&(u=n("<form>",{"class":"ui-listview-filter ui-bar-"+t.options.filterTheme,role:"search"}).submit(function(n){n.preventDefault(),f.blur()}),f=n("<input>",{placeholder:t.options.filterPlaceholder}).attr("data-"+n.mobile.ns+"type","search").jqmData("lastval","").bind("keyup change",function(){var h=n(this),e=this.value.toLowerCase(),u=null,c=h.jqmData("lastval")+"",s=!1,l="",f,a=t.options.filterCallback!==r,o;if(t._trigger("beforefilter","beforefilter",{input:this}),h.jqmData("lastval",e),u=a||e.length<c.length||e.indexOf(c)!==0?i.children():i.children(":not(.ui-screen-hidden)"),e){for(o=u.length-1;o>=0;o--)f=n(u[o]),l=f.jqmData("filtertext")||f.text(),f.is("li:jqmData(role=list-divider)")?(f.toggleClass("ui-filter-hidequeue",!s),s=!1):t.options.filterCallback(l,e,f)?f.toggleClass("ui-filter-hidequeue",!0):s=!0;u.filter(":not(.ui-filter-hidequeue)").toggleClass("ui-screen-hidden",!1),u.filter(".ui-filter-hidequeue").toggleClass("ui-screen-hidden",!0).toggleClass("ui-filter-hidequeue",!1)}else u.toggleClass("ui-screen-hidden",!1);t._refreshCorners()}).appendTo(u).textinput(),t.options.inset&&u.addClass("ui-listview-filter-inset"),u.bind("submit",function(){return!1}).insertBefore(i))})}(n),function(n,r){n.widget("mobile.slider",n.mobile.widget,{options:{theme:null,trackTheme:null,disabled:!1,initSelector:"input[type='range'], :jqmData(type='range'), :jqmData(role='slider')",mini:!1},_create:function(){var u=this,f=this.element,b=n.mobile.getInheritedTheme(f,"c"),et=this.options.theme||b,k=this.options.trackTheme||b,e=f[0].nodeName.toLowerCase(),ot=e==="select"?"ui-slider-switch":"",d=f.attr("id"),g=n("[for='"+d+"']"),nt=g.attr("id")||d+"-label",st=g.attr("id",nt),s=function(){return e==="input"?parseFloat(f.val()):f[0].selectedIndex},tt=e==="input"?parseFloat(f.attr("min")):0,it=e==="input"?parseFloat(f.attr("max")):f.find("option").length-1,rt=t.parseFloat(f.attr("step")||1),ht=this.options.inline||f.jqmData("inline")===!0?" ui-slider-inline":"",ct=this.options.mini||f.jqmData("mini")?" ui-slider-mini":"",a=i.createElement("a"),l=n(a),h=i.createElement("div"),o=n(h),lt=f.jqmData("highlight")&&e!=="select"?function(){var t=i.createElement("div");return t.className="ui-slider-bg "+n.mobile.activeBtnClass+" ui-btn-corner-all",n(t).prependTo(o)}():!1,w,v,y,ut,c,ft;if(this._type=e,a.setAttribute("href","#"),h.setAttribute("role","application"),h.className=["ui-slider ",ot," ui-btn-down-",k," ui-btn-corner-all",ht,ct].join(""),a.className="ui-slider-handle",h.appendChild(a),l.buttonMarkup({corners:!0,theme:et,shadow:!0}).attr({role:"slider","aria-valuemin":tt,"aria-valuemax":it,"aria-valuenow":s(),"aria-valuetext":s(),title:s(),"aria-labelledby":nt}),n.extend(this,{slider:o,handle:l,valuebg:lt,dragging:!1,beforeStart:null,userModified:!1,mouseMoved:!1}),e==="select"){for(v=i.createElement("div"),v.className="ui-slider-inneroffset",y=0,ut=h.childNodes.length;y<ut;y++)v.appendChild(h.childNodes[y]);for(h.appendChild(v),l.addClass("ui-slider-handle-snapping"),w=f.find("option"),c=0,ft=w.length;c<ft;c++){var at=c?"a":"b",vt=c?" "+n.mobile.activeBtnClass:" ui-btn-down-"+k,yt=i.createElement("div"),p=i.createElement("span");p.className=["ui-slider-label ui-slider-label-",at,vt," ui-btn-corner-all"].join(""),p.setAttribute("role","img"),p.appendChild(i.createTextNode(w[c].innerHTML)),n(p).prependTo(o)}u._labels=n(".ui-slider-label",o)}st.addClass("ui-slider"),f.addClass(e==="input"?"ui-slider-input":"ui-slider-switch").change(function(){u.mouseMoved||u.refresh(s(),!0)}).keyup(function(){u.refresh(s(),!0,!0)}).blur(function(){u.refresh(s(),!0)}),this._preventDocumentDrag=function(n){if(u.dragging&&!u.options.disabled)return u.mouseMoved=!0,e==="select"&&l.removeClass("ui-slider-handle-snapping"),u.refresh(n),u.userModified=u.beforeStart!==f[0].selectedIndex,!1},this._on(n(i),{vmousemove:this._preventDocumentDrag}),f.bind("vmouseup",n.proxy(u._checkedRefresh,u)),o.bind("vmousedown",function(n){return u.options.disabled?!1:(u.dragging=!0,u.userModified=!1,u.mouseMoved=!1,e==="select"&&(u.beforeStart=f[0].selectedIndex),u.refresh(n),u._trigger("start"),!1)}).bind("vclick",!1),this._sliderMouseUp=function(){if(u.dragging)return u.dragging=!1,e==="select"&&(l.addClass("ui-slider-handle-snapping"),u.mouseMoved?u.userModified?u.refresh(u.beforeStart===0?1:0):u.refresh(u.beforeStart):u.refresh(u.beforeStart===0?1:0)),u.mouseMoved=!1,u._trigger("stop"),!1},this._on(o.add(i),{vmouseup:this._sliderMouseUp}),o.insertAfter(f),e==="select"&&this.handle.bind({focus:function(){o.addClass(n.mobile.focusClass)},blur:function(){o.removeClass(n.mobile.focusClass)}}),this.handle.bind({vmousedown:function(){n(this).focus()},vclick:!1,keydown:function(t){var i=s();if(!u.options.disabled){switch(t.keyCode){case n.mobile.keyCode.HOME:case n.mobile.keyCode.END:case n.mobile.keyCode.PAGE_UP:case n.mobile.keyCode.PAGE_DOWN:case n.mobile.keyCode.UP:case n.mobile.keyCode.RIGHT:case n.mobile.keyCode.DOWN:case n.mobile.keyCode.LEFT:t.preventDefault(),u._keySliding||(u._keySliding=!0,n(this).addClass("ui-state-active"))}switch(t.keyCode){case n.mobile.keyCode.HOME:u.refresh(tt);break;case n.mobile.keyCode.END:u.refresh(it);break;case n.mobile.keyCode.PAGE_UP:case n.mobile.keyCode.UP:case n.mobile.keyCode.RIGHT:u.refresh(i+rt);break;case n.mobile.keyCode.PAGE_DOWN:case n.mobile.keyCode.DOWN:case n.mobile.keyCode.LEFT:u.refresh(i-rt)}}},keyup:function(){u._keySliding&&(u._keySliding=!1,n(this).removeClass("ui-state-active"))}}),this._handleFormReset&&this._handleFormReset(),this.refresh(r,r,!0)},_checkedRefresh:function(){this.value!=this._value()&&this.refresh(this._value())},_value:function(){return this._type==="input"?parseFloat(this.element.val()):this.element[0].selectedIndex},_reset:function(){this.refresh(r,!1,!0)},refresh:function(t,i,r){var l,v,a;(this.options.disabled||this.element.attr("disabled"))&&this.disable(),this.value=this._value();var f=this.element,e,o=f[0].nodeName.toLowerCase(),s=o==="input"?parseFloat(f.attr("min")):0,h=o==="input"?parseFloat(f.attr("max")):f.find("option").length-1,c=o==="input"&&parseFloat(f.attr("step"))>0?parseFloat(f.attr("step")):1;if(typeof t=="object"){if(l=t,v=8,!this.dragging||l.pageX<this.slider.offset().left-v||l.pageX>this.slider.offset().left+this.slider.width()+v)return;e=Math.round((l.pageX-this.slider.offset().left)/this.slider.width()*100)}else t==null&&(t=o==="input"?parseFloat(f.val()||0):f[0].selectedIndex),e=(parseFloat(t)-s)/(h-s)*100;if(!isNaN(e)){e<0&&(e=0),e>100&&(e=100);var u=e/100*(h-s)+s,y=(u-s)%c,w=u-y;if(Math.abs(y)*2>=c&&(w+=y>0?c:-c),u=parseFloat(w.toFixed(5)),u<s&&(u=s),u>h&&(u=h),this.handle.css("left",e+"%"),this.handle.attr({"aria-valuenow":o==="input"?u:f.find("option").eq(u).attr("value"),"aria-valuetext":o==="input"?u:f.find("option").eq(u).getEncodedText(),title:o==="input"?u:f.find("option").eq(u).getEncodedText()}),this.valuebg&&this.valuebg.css("width",e+"%"),this._labels){var p=this.handle.width()/this.slider.width()*100,b=e&&p+(100-p)*e/100,k=e===100?0:Math.min(p+100-b,100);this._labels.each(function(){var t=n(this).is(".ui-slider-label-a");n(this).width((t?b:k)+"%")})}r||(a=!1,o==="input"?(a=f.val()!==u,f.val(u)):(a=f[0].selectedIndex!==u,f[0].selectedIndex=u),!i&&a&&f.trigger("change"))}},enable:function(){return this.element.attr("disabled",!1),this.slider.removeClass("ui-disabled").attr("aria-disabled",!1),this._setOption("disabled",!1)},disable:function(){return this.element.attr("disabled",!0),this.slider.addClass("ui-disabled").attr("aria-disabled",!0),this._setOption("disabled",!0)}}),n.widget("mobile.slider",n.mobile.slider,n.mobile.behaviors.formReset),n.widget("mobile.slider",n.mobile.slider,{widgetEventPrefix:"slide"}),n(i).bind("pagecreate create",function(t){n.mobile.slider.prototype.enhanceWithin(t.target,!0)})}(n),function(n){n.widget("mobile.selectmenu",n.mobile.widget,{options:{theme:null,disabled:!1,icon:"arrow-d",iconpos:"right",inline:!1,corners:!0,shadow:!0,iconshadow:!0,overlayTheme:"a",hidePlaceholderMenuItems:!0,closeText:"Close",nativeMenu:!0,preventFocusZoom:/iPhone|iPad|iPod/.test(navigator.platform)&&navigator.userAgent.indexOf("AppleWebKit")>-1,initSelector:"select:not( :jqmData(role='slider') )",mini:!1},_button:function(){return n("<div/>")},_setDisabled:function(n){return this.element.attr("disabled",n),this.button.attr("aria-disabled",n),this._setOption("disabled",n)},_focusButton:function(){var n=this;setTimeout(function(){n.button.focus()},40)},_selectOptions:function(){return this.select.find("option")},_preExtension:function(){var t="";~this.element[0].className.indexOf("ui-btn-left")&&(t=" ui-btn-left"),!~this.element[0].className.indexOf("ui-btn-right")||(t=" ui-btn-right"),this.select=this.element.wrap("<div class='ui-select"+t+"'>"),this.selectID=this.select.attr("id"),this.label=n("label[for='"+this.selectID+"']").addClass("ui-select"),this.isMultiple=this.select[0].multiple,this.options.theme||(this.options.theme=n.mobile.getInheritedTheme(this.select,"c"))},_destroy:function(){var n=this.element.parents(".ui-select");n.length>0&&(this.element.insertAfter(n),n.remove())},_create:function(){this._preExtension(),this._trigger("beforeCreate"),this.button=this._button();var u=this,i=this.options,f=i.inline||this.select.jqmData("inline"),e=i.mini||this.select.jqmData("mini"),o=i.icon?i.iconpos||this.select.jqmData("iconpos"):!1,s=this.select[0].selectedIndex===-1?0:this.select[0].selectedIndex,r=this.button.insertBefore(this.select).buttonMarkup({theme:i.theme,icon:i.icon,iconpos:o,inline:f,corners:i.corners,shadow:i.shadow,iconshadow:i.iconshadow,mini:e});this.setButtonText(),i.nativeMenu&&t.opera&&t.opera.version&&r.addClass("ui-select-nativeonly"),this.isMultiple&&(this.buttonCount=n("<span>").addClass("ui-li-count ui-btn-up-c ui-btn-corner-all").hide().appendTo(r.addClass("ui-li-has-count"))),(i.disabled||this.element.attr("disabled"))&&this.disable(),this.select.change(function(){u.refresh()}),this._handleFormReset&&this._handleFormReset(),this.build()},build:function(){var t=this;this.select.appendTo(t.button).bind("vmousedown",function(){t.button.addClass(n.mobile.activeBtnClass)}).bind("focus",function(){t.button.addClass(n.mobile.focusClass)}).bind("blur",function(){t.button.removeClass(n.mobile.focusClass)}).bind("focus vmouseover",function(){t.button.trigger("vmouseover")}).bind("vmousemove",function(){t.button.removeClass(n.mobile.activeBtnClass)}).bind("change blur vmouseout",function(){t.button.trigger("vmouseout").removeClass(n.mobile.activeBtnClass)}).bind("change blur",function(){t.button.removeClass("ui-btn-down-"+t.options.theme)}),t.button.bind("vmousedown",function(){t.options.preventFocusZoom&&n.mobile.zoom.disable(!0)}),t.label.bind("click focus",function(){t.options.preventFocusZoom&&n.mobile.zoom.disable(!0)}),t.select.bind("focus",function(){t.options.preventFocusZoom&&n.mobile.zoom.disable(!0)}),t.button.bind("mouseup",function(){t.options.preventFocusZoom&&setTimeout(function(){n.mobile.zoom.enable(!0)},0)}),t.select.bind("blur",function(){t.options.preventFocusZoom&&n.mobile.zoom.enable(!0)})},selected:function(){return this._selectOptions().filter(":selected")},selectedIndices:function(){var n=this;return this.selected().map(function(){return n._selectOptions().index(this)}).get()},setButtonText:function(){var u=this,t=this.selected(),r=this.placeholder,f=n(i.createElement("span"));this.button.find(".ui-btn-text").html(function(){return r=t.length?t.map(function(){return n(this).text()}).get().join(", "):u.placeholder,f.text(r).addClass(u.select.attr("class")).addClass(t.attr("class"))})},setButtonCount:function(){var n=this.selected();this.isMultiple&&this.buttonCount[n.length>1?"show":"hide"]().text(n.length)},_reset:function(){this.refresh()},refresh:function(){this.setButtonText(),this.setButtonCount()},open:n.noop,close:n.noop,disable:function(){this._setDisabled(!0),this.button.addClass("ui-disabled")},enable:function(){this._setDisabled(!1),this.button.removeClass("ui-disabled")}}),n.widget("mobile.selectmenu",n.mobile.selectmenu,n.mobile.behaviors.formReset),n(i).bind("pagecreate create",function(t){n.mobile.selectmenu.prototype.enhanceWithin(t.target,!0)})}(n),function(n,r){var u=function(u){var nt=u.select,v=u._destroy,f=u.selectID,h=u.label,y=u.select.closest(".ui-page"),p=u._selectOptions(),w=u.isMultiple=u.select[0].multiple,c=f+"-button",l=f+"-menu",e=n("<div data-"+n.mobile.ns+"role='dialog' data-"+n.mobile.ns+"theme='"+u.options.theme+"' data-"+n.mobile.ns+"overlay-theme='"+u.options.overlayTheme+"'><div data-"+n.mobile.ns+"role='header'><div class='ui-title'>"+h.getEncodedText()+"<\/div><\/div><div data-"+n.mobile.ns+"role='content'><\/div><\/div>"),o=n("<div>",{"class":"ui-selectmenu"}).insertAfter(u.select).popup({theme:u.options.overlayTheme}),b=n("<ul>",{"class":"ui-selectmenu-list",id:l,role:"listbox","aria-labelledby":c}).attr("data-"+n.mobile.ns+"theme",u.options.theme).appendTo(o),s=n("<div>",{"class":"ui-header ui-bar-"+u.options.theme}).prependTo(o),k=n("<h1>",{"class":"ui-title"}).appendTo(s),d,g,a;u.isMultiple&&(a=n("<a>",{text:u.options.closeText,href:"#","class":"ui-btn-left"}).attr("data-"+n.mobile.ns+"iconpos","notext").attr("data-"+n.mobile.ns+"icon","delete").appendTo(s).buttonMarkup()),n.extend(u,{select:u.select,selectID:f,buttonId:c,menuId:l,thisPage:y,menuPage:e,label:h,selectOptions:p,isMultiple:w,theme:u.options.theme,listbox:o,list:b,header:s,headerTitle:k,headerClose:a,menuPageContent:d,menuPageClose:g,placeholder:"",build:function(){var t=this;t.refresh(),t._origTabIndex===r&&(t._origTabIndex=t.select.attr("tabindex"),t._origTabIndex===r&&(t._origTabIndex=!1)),t.select.attr("tabindex","-1").focus(function(){n(this).blur(),t.button.focus()}),t.button.bind("vclick keydown",function(i){(i.type==="vclick"||i.keyCode&&(i.keyCode===n.mobile.keyCode.ENTER||i.keyCode===n.mobile.keyCode.SPACE))&&(t.open(),i.preventDefault())}),t.list.attr("role","listbox").bind("focusin",function(t){n(t.target).attr("tabindex","0").trigger("vmouseover")}).bind("focusout",function(t){n(t.target).attr("tabindex","-1").trigger("vmouseout")}).delegate("li:not(.ui-disabled, .ui-li-divider)","click",function(i){var e=t.select[0].selectedIndex,f=t.list.find("li:not(.ui-li-divider)").index(this),r=t._selectOptions().eq(f)[0];r.selected=t.isMultiple?!r.selected:!0,t.isMultiple&&n(this).find(".ui-icon").toggleClass("ui-icon-checkbox-on",r.selected).toggleClass("ui-icon-checkbox-off",!r.selected),(t.isMultiple||e!==f)&&t.select.trigger("change"),t.isMultiple?t.list.find("li:not(.ui-li-divider)").eq(f).addClass("ui-btn-down-"+u.options.theme).find("a").first().focus():t.close(),i.preventDefault()}).keydown(function(t){var f=n(t.target),e=f.closest("li"),i,r;switch(t.keyCode){case 38:return i=e.prev().not(".ui-selectmenu-placeholder"),i.is(".ui-li-divider")&&(i=i.prev()),i.length&&(f.blur().attr("tabindex","-1"),i.addClass("ui-btn-down-"+u.options.theme).find("a").first().focus()),!1;case 40:return r=e.next(),r.is(".ui-li-divider")&&(r=r.next()),r.length&&(f.blur().attr("tabindex","-1"),r.addClass("ui-btn-down-"+u.options.theme).find("a").first().focus()),!1;case 13:case 32:return f.trigger("click"),!1}}),t.menuPage.bind("pagehide",function(){t.list.appendTo(t.listbox),t._focusButton(),n.mobile._bindPageRemove.call(t.thisPage)}),t.listbox.bind("popupafterclose",function(){t.close()}),t.isMultiple&&t.headerClose.click(function(){if(t.menuType==="overlay")return t.close(),!1}),t.thisPage.addDependents(this.menuPage)},_isRebuildRequired:function(){var n=this.list.find("li"),t=this._selectOptions();return t.text()!==n.text()},selected:function(){return this._selectOptions().filter(":selected:not( :jqmData(placeholder='true') )")},refresh:function(t){var r=this,f=this.element,e=this.isMultiple,u;(t||this._isRebuildRequired())&&r._buildList(),u=this.selectedIndices(),r.setButtonText(),r.setButtonCount(),r.list.find("li:not(.ui-li-divider)").removeClass(n.mobile.activeBtnClass).attr("aria-selected",!1).each(function(t){if(n.inArray(t,u)>-1){var i=n(this);i.attr("aria-selected",!0),r.isMultiple?i.find(".ui-icon").removeClass("ui-icon-checkbox-off").addClass("ui-icon-checkbox-on"):i.is(".ui-selectmenu-placeholder")?i.next().addClass(n.mobile.activeBtnClass):i.addClass(n.mobile.activeBtnClass)}})},close:function(){if(!this.options.disabled&&this.isOpen){var t=this;t.menuType==="page"?n.mobile.back():(t.listbox.popup("close"),t.list.appendTo(t.listbox),t._focusButton()),t.isOpen=!1}},open:function(){function f(){var t=i.list.find("."+n.mobile.activeBtnClass+" a");t.length===0&&(t=i.list.find("li.ui-btn:not( :jqmData(placeholder='true') ) a")),t.first().focus().closest("li").addClass("ui-btn-down-"+u.options.theme)}if(!this.options.disabled){var i=this,r=n(t),o=i.list.parent(),c=o.outerHeight(),a=o.outerWidth(),v=n("."+n.mobile.activePageClass),l=r.scrollTop(),s=i.button.offset().top,h=r.height(),y=r.width();i.button.addClass(n.mobile.activeBtnClass),setTimeout(function(){i.button.removeClass(n.mobile.activeBtnClass)},300),c>h-80||!n.support.scrollTop?(i.menuPage.appendTo(n.mobile.pageContainer).page(),i.menuPageContent=e.find(".ui-content"),i.menuPageClose=e.find(".ui-header a"),i.thisPage.unbind("pagehide.remove"),l===0&&s>h&&i.thisPage.one("pagehide",function(){n(this).jqmData("lastScroll",s)}),i.menuPage.one("pageshow",function(){f(),i.isOpen=!0}).one("pagehide",function(){i.isOpen=!1}),i.menuType="page",i.menuPageContent.append(i.list),i.menuPage.find("div .ui-title").text(i.label.text()),n.mobile.changePage(i.menuPage,{transition:n.mobile.defaultDialogTransition})):(i.menuType="overlay",i.listbox.one("popupafteropen",f).popup("open",{x:i.button.offset().left+i.button.outerWidth()/2,y:i.button.offset().top+i.button.outerHeight()/2}),i.isOpen=!0)}},_buildList:function(){var r=this,nt=this.options,l=this.placeholder,b=!0,ot=[],st=[],tt=r.isMultiple?"checkbox-off":"false",e,c,f,t;r.list.empty().filter(".ui-listview").listview("destroy");var k=r.select.find("option"),it=k.length,rt=this.select[0],o="data-"+n.mobile.ns,ut=o+"option-index",ft=o+"icon",et=o+"role",a=o+"placeholder",v=i.createDocumentFragment(),y=!1,d;for(e=0;e<it;e++,y=!1){var u=k[e],g=n(u),p=u.parentNode,s=g.text(),h=i.createElement("a"),w=[];h.setAttribute("href","#"),h.appendChild(i.createTextNode(s)),p!==rt&&p.nodeName.toLowerCase()==="optgroup"&&(c=p.getAttribute("label"),c!==d&&(f=i.createElement("li"),f.setAttribute(et,"list-divider"),f.setAttribute("role","option"),f.setAttribute("tabindex","-1"),f.appendChild(i.createTextNode(c)),v.appendChild(f),d=c)),b&&(!u.getAttribute("value")||s.length===0||g.jqmData("placeholder"))&&(b=!1,y=!0,u.hasAttribute(a)||(this._removePlaceholderAttr=!0),u.setAttribute(a,!0),nt.hidePlaceholderMenuItems&&w.push("ui-selectmenu-placeholder"),l!==s&&(l=r.placeholder=s)),t=i.createElement("li"),u.disabled&&(w.push("ui-disabled"),t.setAttribute("aria-disabled",!0)),t.setAttribute(ut,e),t.setAttribute(ft,tt),y&&t.setAttribute(a,!0),t.className=w.join(" "),t.setAttribute("role","option"),h.setAttribute("tabindex","-1"),t.appendChild(h),v.appendChild(t)}r.list[0].appendChild(v),!this.isMultiple&&!l.length?this.header.hide():this.headerTitle.text(this.placeholder),r.list.listview()},_button:function(){return n("<a>",{href:"#",role:"button",id:this.buttonId,"aria-haspopup":"true","aria-owns":this.menuId})},_destroy:function(){this.close(),this._origTabIndex!==r&&(this._origTabIndex!==!1?this.select.attr("tabindex",this._origTabIndex):this.select.removeAttr("tabindex")),this._removePlaceholderAttr&&this._selectOptions().removeAttr("data-"+n.mobile.ns+"placeholder"),this.listbox.remove(),v.apply(this,arguments)}})};n(i).bind("selectmenubeforecreate",function(t){var i=n(t.target).data("selectmenu");i.options.nativeMenu||i.element.parents(":jqmData(role='popup')").length!==0||u(i)})}(n),function(n){n.widget("mobile.fixedtoolbar",n.mobile.widget,{options:{visibleOnPageShow:!0,disablePageZoom:!0,transition:"slide",fullscreen:!1,tapToggle:!0,tapToggleBlacklist:"a, button, input, select, textarea, .ui-header-fixed, .ui-footer-fixed, .ui-popup",hideDuringFocus:"input, textarea, select",updatePagePadding:!0,trackPersistentToolbars:!0,supportBlacklist:function(){var f=t,n=navigator.userAgent,r=navigator.platform,e=n.match(/AppleWebKit\/([0-9]+)/),i=!!e&&e[1],o=n.match(/Fennec\/([0-9]+)/),s=!!o&&o[1],u=n.match(/Opera Mobi\/([0-9]+)/),h=!!u&&u[1];return(r.indexOf("iPhone")>-1||r.indexOf("iPad")>-1||r.indexOf("iPod")>-1)&&i&&i<534||f.operamini&&{}.toString.call(f.operamini)==="[object OperaMini]"||u&&h<7458||n.indexOf("Android")>-1&&i&&i<533||s&&s<6||"palmGetResource"in t&&i&&i<534||n.indexOf("MeeGo")>-1&&n.indexOf("NokiaBrowser/8.5.0")>-1?!0:!1},initSelector:":jqmData(position='fixed')"},_create:function(){var n=this,r=n.options,t=n.element,i=t.is(":jqmData(role='header')")?"header":"footer",u=t.closest(".ui-page");if(r.supportBlacklist()){n.destroy();return}t.addClass("ui-"+i+"-fixed"),r.fullscreen?(t.addClass("ui-"+i+"-fullscreen"),u.addClass("ui-page-"+i+"-fullscreen")):u.addClass("ui-page-"+i+"-fixed"),n._addTransitionClass(),n._bindPageEvents(),n._bindToggleHandlers()},_addTransitionClass:function(){var n=this.options.transition;n&&n!=="none"&&(n==="slide"&&(n=this.element.is(".ui-header")?"slidedown":"slideup"),this.element.addClass(n))},_bindPageEvents:function(){var i=this,r=i.options,u=i.element;u.closest(".ui-page").bind("pagebeforeshow",function(){r.disablePageZoom&&n.mobile.zoom.disable(!0),r.visibleOnPageShow||i.hide(!0)}).bind("webkitAnimationStart animationstart updatelayout",function(){var n=this;r.updatePagePadding&&i.updatePagePadding(n)}).bind("pageshow",function(){var u=this;i.updatePagePadding(u),r.updatePagePadding&&n(t).bind("throttledresize."+i.widgetName,function(){i.updatePagePadding(u)})}).bind("pagebeforehide",function(u,f){if(r.disablePageZoom&&n.mobile.zoom.enable(!0),r.updatePagePadding&&n(t).unbind("throttledresize."+i.widgetName),r.trackPersistentToolbars){var s=n(".ui-footer-fixed:jqmData(id)",this),h=n(".ui-header-fixed:jqmData(id)",this),e=s.length&&f.nextPage&&n(".ui-footer-fixed:jqmData(id='"+s.jqmData("id")+"')",f.nextPage)||n(),o=h.length&&f.nextPage&&n(".ui-header-fixed:jqmData(id='"+h.jqmData("id")+"')",f.nextPage)||n();(e.length||o.length)&&(e.add(o).appendTo(n.mobile.pageContainer),f.nextPage.one("pageshow",function(){e.add(o).appendTo(this)}))}})},_visible:!0,updatePagePadding:function(t){var i=this.element,r=i.is(".ui-header");this.options.fullscreen||(t=t||i.closest(".ui-page"),n(t).css("padding-"+(r?"top":"bottom"),i.outerHeight()))},_useTransition:function(i){var o=n(t),r=this.element,u=o.scrollTop(),f=r.height(),s=r.closest(".ui-page").height(),h=n.mobile.getScreenHeight(),e=r.is(":jqmData(role='header')")?"header":"footer";return!i&&(this.options.transition&&this.options.transition!=="none"&&(e==="header"&&!this.options.fullscreen&&u>f||e==="footer"&&!this.options.fullscreen&&u+h<s-f)||this.options.fullscreen)},show:function(n){var t="ui-fixed-hidden",i=this.element;this._useTransition(n)?i.removeClass("out "+t).addClass("in"):i.removeClass(t),this._visible=!0},hide:function(n){var r="ui-fixed-hidden",t=this.element,i="out"+(this.options.transition==="slide"?" reverse":"");this._useTransition(n)?t.addClass(i).removeClass("in").animationComplete(function(){t.addClass(r).removeClass(i)}):t.addClass(r).removeClass(i),this._visible=!1},toggle:function(){this[this._visible?"hide":"show"]()},_bindToggleHandlers:function(){var t=this,i=t.options,r=t.element;r.closest(".ui-page").bind("vclick",function(r){i.tapToggle&&!n(r.target).closest(i.tapToggleBlacklist).length&&t.toggle()}).bind("focusin focusout",function(r){screen.width<500&&n(r.target).is(i.hideDuringFocus)&&!n(r.target).closest(".ui-header-fixed, .ui-footer-fixed").length&&t[r.type==="focusin"&&t._visible?"hide":"show"]()})},_destroy:function(){var n=this.element,t=n.is(".ui-header");n.closest(".ui-page").css("padding-"+(t?"top":"bottom"),""),n.removeClass("ui-header-fixed ui-footer-fixed ui-header-fullscreen ui-footer-fullscreen in out fade slidedown slideup ui-fixed-hidden"),n.closest(".ui-page").removeClass("ui-page-header-fixed ui-page-footer-fixed ui-page-header-fullscreen ui-page-footer-fullscreen")}}),n(i).bind("pagecreate create",function(t){n(t.target).jqmData("fullscreen")&&n(n.mobile.fixedtoolbar.prototype.options.initSelector,t.target).not(":jqmData(fullscreen)").jqmData("fullscreen",!0),n.mobile.fixedtoolbar.prototype.enhanceWithin(t.target)})}(n),function(n,t){function s(n){o=n.originalEvent,r=o.accelerationIncludingGravity,u=Math.abs(r.x),f=Math.abs(r.y),e=Math.abs(r.z),!t.orientation&&(u>7||(e>6&&f<8||e<8&&f>6)&&u>5)?i.enabled&&i.disable():i.enabled||i.enable()}if(/iPhone|iPad|iPod/.test(navigator.platform)&&navigator.userAgent.indexOf("AppleWebKit")>-1){var i=n.mobile.zoom,o,u,f,e,r;n(t).bind("orientationchange.iosorientationfix",i.enable).bind("devicemotion.iosorientationfix",s)}}(n,this),function(n,t){function f(){e.removeClass("ui-mobile-rendering")}var e=n("html"),o=n("head"),u=n(t);(n(t.document).trigger("mobileinit"),n.mobile.gradeA())&&(n.mobile.ajaxBlacklist&&(n.mobile.ajaxEnabled=!1),e.addClass("ui-mobile ui-mobile-rendering"),setTimeout(f,5e3),n.extend(n.mobile,{initializePage:function(){var t=n(":jqmData(role='page'), :jqmData(role='dialog')"),r=n.mobile.path.parseLocation().hash.replace("#",""),e=i.getElementById(r);t.length||(t=n("body").wrapInner("<div data-"+n.mobile.ns+"role='page'><\/div>").children(0)),t.each(function(){var t=n(this);t.jqmData("url")||t.attr("data-"+n.mobile.ns+"url",t.attr("id")||location.pathname+location.search)}),n.mobile.firstPage=t.first(),n.mobile.pageContainer=t.first().parent().addClass("ui-mobile-viewport"),u.trigger("pagecontainercreate"),n.mobile.showPageLoadingMsg(),f(),!n.mobile.hashListeningEnabled||!n.mobile.path.isHashValid(location.hash)||!n(e).is(':jqmData(role="page")')&&!n.mobile.path.isPath(r)&&r!==n.mobile.dialogHashKey?(n.mobile.path.isHashValid(location.hash)&&(n.mobile.urlHistory.initialDst=r.replace("#","")),n.mobile.changePage(n.mobile.firstPage,{transition:"none",reverse:!0,changeHash:!1,fromHashChange:!0})):u.trigger("hashchange",[!0])}}),n.mobile.navreadyDeferred.resolve(),n(function(){t.scrollTo(0,1),n.mobile.defaultHomeScroll=!n.support.scrollTop||n(t).scrollTop()===1?0:1,n.fn.controlgroup&&n(i).bind("pagecreate create",function(t){n(":jqmData(role='controlgroup')",t.target).jqmEnhanceable().controlgroup({excludeInvisible:!1})}),n.mobile.autoInitializePage&&n.mobile.initializePage(),u.load(n.mobile.silentScroll),n.support.cssPointerEvents||n(i).delegate(".ui-disabled","vclick",function(n){n.preventDefault(),n.stopImmediatePropagation()})}))}(n,this)})