(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){(function(n,t,r){var f={},u,e;n.mobile=n.extend({},{version:"1.2.0",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},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:f,nsNormalize:function(t){if(t)return f[t]||(f[t]=n.camelCase(n.mobile.ns+t))},getInheritedTheme:function(n,t){for(var i=n[0],f="",e=/ui-(bar|body|overlay)-([a-z])\b/,r,u;i;){if(r=i.className||"",r&&(u=e.exec(r))&&(f=u[2]))break;i=i.parentNode}return f||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 s,f,r,h,e,u,o;if(!n.mobile.ignoreContentEnabled)return t;for(s=t.length,f=n(),u=0;u<s;u++){for(h=t.eq(u),e=!1,r=t[u];r;){if(o=r.getAttribute?r.getAttribute("data-"+n.mobile.ns+i):"",o==="false"){e=!0;break}r=r.parentNode}e||(f=f.add(h))}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)},u=n.find,e=/:jqmData\(([^)]*)\)/g,n.find=function(t,i,r,f){return t=t.replace(e,"[data-"+(n.mobile.ns||"")+"$1]"),u.call(this,t,i,r,f)},n.extend(n.find,u),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){var f=n(t),u=n("html");n.mobile.media=function(){var t={},f=n("<div id='jquery-mediatest'></div>"),r=n("<body>").append(f);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(r).prepend(e),t[n]=f.css("position")==="absolute",r.add(e).remove()}return t[n]}}()}(n),function(n){n.extend(n.support,{orientation:"orientation"in t&&"onorientationchange"in t})}(n),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,r){function f(n){var u=n.charAt(0).toUpperCase()+n.substr(1),i=(n+" "+o.join(u+" ")+u).split(" "),t;for(t in i)if(b[i[t]]!==r)return!0}function h(n,t,r){for(var h=i.createElement("div"),s=function(n){return n.charAt(0).toUpperCase()+n.substr(1)},l=function(n){return"-"+n.charAt(0).toLowerCase()+n.substr(1)+"-"},c=function(i){var f=l(i)+n+": "+t+";",u=s(i),r=u+s(n);h.setAttribute("style",f),!h.style[r]||(e=!0)},f=r?[r]:o,e,u=0;u<f.length;u++)c(f[u]);return!!e}function y(){var t="transform-3d";return h("perspective","10px","moz")||n.mobile.media("(-"+o.join("-"+t+"),(-")+"-"+t+"),("+t+")")}function p(){var e=location.protocol+"//"+location.host+location.pathname+"ui-dir/",t=n("head base"),i=null,o="",r,f;return t.length?o=t.attr("href"):t=i=n("<base>",{href:e}).appendTo("head"),r=n("<a href='testurl' />").prependTo(u),f=r[0].href,t[0].href=o||location.pathname,i&&i.remove(),f.indexOf(e)===0}function w(){var n=i.createElement("x"),f=i.documentElement,u=t.getComputedStyle,r;return"pointerEvents"in n.style?(n.style.pointerEvents="auto",n.style.pointerEvents="x",f.appendChild(n),r=u&&u(n,"").pointerEvents==="auto",f.removeChild(n),!!r):!1}function l(){var n=i.createElement("div");return typeof n.getBoundingClientRect!="undefined"}var u=n("<body>").prependTo("html"),b=u[0].style,o=["Webkit","Moz","O"],v="palmGetResource"in t,c=t.opera,s=t.operamini&&{}.toString.call(t.operamini)==="[object OperaMini]",a=t.blackberry&&!f("-webkit-transform"),e;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||h("transition","height 100ms linear")&&!c,pushState:"pushState"in history&&"replaceState"in history,mediaquery:n.mobile.media("only all"),cssPseudoElement:!!f("content"),touchOverflow:!!f("overflowScrolling"),cssTransform3d:y(),boxShadow:!!f("boxShadow")&&!a,scrollTop:("pageXOffset"in t||"scrollTop"in i.documentElement||"scrollTop"in u[0])&&!v&&!s,dynamicBaseTag:p(),cssPointerEvents:w(),boundingRect:l()}),u.remove(),e=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||s||e,e&&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,t,i,r){function a(n){while(n&&typeof n.originalEvent!="undefined")n=n.originalEvent;return n}function ni(t,i){var f=t.type,s,h,l,u,e,v,c,o,y;if(t=n.Event(t),t.type=i,s=t.originalEvent,h=n.event.props,f.search(/^(mouse|click)/)>-1&&(h=gt),s)for(c=h.length,u;c;)u=h[--c],t[u]=s[u];if(f.search(/mouse(down|up)|click/)>-1&&!t.which&&(t.which=1),f.search(/^touch/)!==-1&&(l=a(s),f=l.touches,e=l.changedTouches,v=f&&f.length?f[0]:e&&e.length?e[0]:r,v))for(o=0,y=it.length;o<y;o++)u=it[o],t[u]=v[u];return t}function y(t){for(var u={},r,i;t;){r=n.data(t,o);for(i in r)r[i]&&(u[i]=u.hasVirtualBinding=!0);t=t.parentNode}return u}function bt(t,i){for(var r;t;){if(r=n.data(t,o),r&&(!i||r[i]))return t;t=t.parentNode}return null}function dt(){h=!1}function at(){h=!0}function kt(){s=0,p.length=0,nt=!1,at()}function wt(){dt()}function k(){st(),l=setTimeout(function(){l=0,kt()},n.vmouse.resetTimerDuration)}function st(){l&&(clearTimeout(l),l=0)}function e(t,i,r){var u;return(r&&r[t]||!r&&bt(i.target,t))&&(u=ni(i,t),n(i.target).trigger(u)),u}function ht(t){var r=n.data(t.target,b),i;nt||s&&s===r||(i=e("v"+t.type,t),i&&(i.isDefaultPrevented()&&t.preventDefault(),i.isPropagationStopped()&&t.stopPropagation(),i.isImmediatePropagationStopped()&&t.stopImmediatePropagation()))}function ct(t){var o=a(t).touches,u,i,r;o&&o.length===1&&(u=t.target,i=y(u),i.hasVirtualBinding&&(s=vt++,n.data(u,b,s),st(),wt(),f=!1,r=a(t).touches[0],rt=r.pageX,ut=r.pageY,e("vmouseover",t,i),e("vmousedown",t,i)))}function ft(n){h||(f||e("vmousecancel",n,y(n.target)),f=!0,k())}function et(t){if(!h){var u=a(t).touches[0],o=f,i=n.vmouse.moveDistanceThreshold,r=y(t.target);f=f||Math.abs(u.pageX-rt)>i||Math.abs(u.pageY-ut)>i,f&&!o&&e("vmousecancel",t,r),e("vmousemove",t,r),k()}}function ot(n){var t,r,i;h||(at(),t=y(n.target),e("vmouseup",n,t),f||(i=e("vclick",n,t),i&&i.isDefaultPrevented()&&(r=a(n).changedTouches[0],p.push({touchID:s,x:r.clientX,y:r.clientY}),nt=!0)),e("vmouseout",n,t),f=!1,k())}function lt(t){var i=n.data(t,o),r;if(i)for(r in i)if(i[r])return!0;return!1}function tt(){}function yt(t){var i=t.substr(1);return{setup:function(){lt(this)||n.data(this,o,{});var e=n.data(this,o);e[t]=!0,u[t]=(u[t]||0)+1,u[t]===1&&v.bind(i,ht),n(this).bind(i,tt),g&&(u.touchstart=(u.touchstart||0)+1,u.touchstart===1&&v.bind("touchstart",ct).bind("touchend",ot).bind("touchmove",et).bind("scroll",ft))},teardown:function(){--u[t],u[t]||v.unbind(i,ht),g&&(--u.touchstart,u.touchstart||v.unbind("touchstart",ct).unbind("touchmove",et).unbind("touchend",ot).unbind("scroll",ft));var s=n(this),e=n.data(this,o);e&&(e[t]=!1),s.unbind(i,tt),lt(this)||s.removeData(o)}}}var o="virtualMouseBindings",b="virtualTouchID",w="vmouseover vmousedown vmousemove vmouseup vclick vmouseout vmousecancel".split(" "),it="clientX clientY pageX pageY screenX screenY".split(" "),pt=n.event.mouseHooks?n.event.mouseHooks.props:[],gt=n.event.props.concat(pt),u={},l=0,rt=0,ut=0,f=!1,p=[],nt=!1,h=!1,g="addEventListener"in i,v=n(i),vt=1,s=0,d,c;for(n.vmouse={moveDistanceThreshold:10,clickDistanceThreshold:10,resetTimerDuration:1500},c=0;c<w.length;c++)n.event.special[w[c]]=yt(w[c]);g&&i.addEventListener("click",function(t){var e=p.length,o=t.target,s,f,i,u,r,h;if(e)for(s=t.clientX,f=t.clientY,d=n.vmouse.clickDistanceThreshold,i=o;i;){for(u=0;u<e;u++)if(r=p[u],h=0,i===o&&Math.abs(r.x-s)<d&&Math.abs(r.y-f)<d||n.data(i,b)===r.touchID){t.preventDefault(),t.stopPropagation();return}i=i.parentNode}},!0)}(n,t,i),function(n,t,r){function f(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 u=n.mobile.support.touch,h="touchmove scroll",o=u?"touchstart":"mousedown",s=u?"touchend":"mouseup",e=u?"touchmove":"mousemove";n.event.special.scrollstart={enabled:!0,setup:function(){function r(n,i){t=i,f(u,t?"scrollstart":"scrollstop",n)}var u=this,e=n(u),t,i;e.bind(h,function(u){n.event.special.scrollstart.enabled&&(t||r(u,!0),clearTimeout(i),i=setTimeout(function(){r(u,!1)},50))})}},n.event.special.tap={tapholdThreshold:750,setup:function(){var r=this,t=n(r);t.bind("vmousedown",function(u){function o(){clearTimeout(s)}function e(){o(),t.unbind("vclick",c).unbind("vmouseup",o),n(i).unbind("vmousecancel",e)}function c(n){e(),h===n.target&&f(r,"tap",n)}if(u.which&&u.which!==1)return!1;var h=u.target,l=u.originalEvent,s;t.bind("vmouseup",o).bind("vclick",c),n(i).bind("vmousecancel",e),s=setTimeout(function(){f(r,"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(o,function(i){function h(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 o=i.originalEvent.touches?i.originalEvent.touches[0]:i,u={time:+new Date,coords:[o.pageX,o.pageY],origin:n(i.target)},f;t.bind(e,h).one(s,function(){t.unbind(e,h),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.mobile&&(n.mobile.autoInitializePage=!1)}(jQuery),function(n){var t=n.mobile.support.touch,f="touchmove scroll",u=t?"touchstart":"mousedown",r=t?"touchend":"mouseup",i=t?"touchmove":"mousemove";n.event.special.swipeupdown={scrollSupressionThreshold:30,durationThreshold:1e3,verticalDistanceThreshold:30,horizontalDistanceThreshold:75,setup:function(){var f=this,t=n(f);t.bind(u,function(u){function o(t){if(f){var i=t.originalEvent.touches?t.originalEvent.touches[0]:t;e={time:+new Date,coords:[i.pageX,i.pageY]},Math.abs(f.coords[1]-e.coords[1])>n.event.special.swipeupdown.scrollSupressionThreshold&&t.preventDefault()}}var s=u.originalEvent.touches?u.originalEvent.touches[0]:u,f={time:+new Date,coords:[s.pageX,s.pageY],origin:n(u.target)},e;t.bind(i,o).one(r,function(){t.unbind(i,o),f&&e&&e.time-f.time<n.event.special.swipeupdown.durationThreshold&&Math.abs(f.coords[0]-e.coords[0])<n.event.special.swipeupdown.horizontalDistanceThreshold&&Math.abs(f.coords[1]-e.coords[1])>n.event.special.swipeupdown.verticalDistanceThreshold&&f.origin.trigger("swipeupdown").trigger(f.coords[1]>e.coords[1]?"swipeup":"swipedown"),f=e=undefined})})}},n.each({swipedown:"swipeupdown",swipeup:"swipeupdown"},function(t,i){n.event.special[t]={setup:function(){n(this).bind(i,n.noop)}},n.fn[t]=function(n){return n?this.bind(t,n):this.trigger(t)}})}(jQuery)