//>>built
define("dojox/app/widgets/scrollable","dojo/_base/kernel,dojo/_base/connect,dojo/_base/event,dojo/_base/lang,dojo/_base/window,dojo/dom-class,dojo/dom-construct,dojo/dom-style,dojo/_base/sniff,dojo/ready".split(","),function(l,m,r,s,g,j,n,k,i,t){var f=s.getObject("dojox.mobile",!0),l=function(p){this.fixedFooterHeight=this.fixedHeaderHeight=0;this.isLocalFooter=!1;this.scrollBar=!0;this.scrollDir="v";this.weight=0.6;this.fadeScrollBar=!0;this.disableFlashScrollBar=!1;this.threshold=4;this.constraint=
!0;this.touchNode=null;this.propagatable=!0;this.dirLock=!1;this.height="";this.scrollType=0;this.init=function(a){if(a)for(var c in a)a.hasOwnProperty(c)&&(this[c]=("domNode"==c||"containerNode"==c)&&"string"==typeof a[c]?g.doc.getElementById(a[c]):a[c]);this.touchNode=this.touchNode||this.containerNode;this._v=-1!=this.scrollDir.indexOf("v");this._h=-1!=this.scrollDir.indexOf("h");this._f="f"==this.scrollDir;this._ch=[];this._ch.push(m.connect(this.touchNode,i("touch")?"ontouchstart":"onmousedown",
this,"onTouchStart"));if(i("webkit"))if(this._useTopLeft=this.scrollType?2===this.scrollType:3>i("android"))this._ch.push(m.connect(this.domNode,"webkitTransitionEnd",this,"onFlickAnimationEnd")),this._ch.push(m.connect(this.domNode,"webkitTransitionStart",this,"onFlickAnimationStart"));else{this._ch.push(m.connect(this.domNode,"webkitAnimationEnd",this,"onFlickAnimationEnd"));this._ch.push(m.connect(this.domNode,"webkitAnimationStart",this,"onFlickAnimationStart"));for(a=0;3>a;a++)this.setKeyframes(null,
null,a);f.hasTranslate3d&&k.set(this.containerNode,"webkitTransform","translate3d(0,0,0)")}this._speed={x:0,y:0};this._appFooterHeight=0;var b=this;t(function(){b.flashScrollBar()})};this.isTopLevel=function(){return!0};this.cleanup=function(){if(this._ch){for(var a=0;a<this._ch.length;a++)m.disconnect(this._ch[a]);this._ch=null}};this.findDisp=function(a){if(!a.parentNode)return null;for(var c=a.parentNode.childNodes,b=0;b<c.length;b++){var e=c[b];if(1===e.nodeType&&j.contains(e,"mblView")&&"none"!==
e.style.display)return e}return a};this.getScreenSize=function(){return{h:g.global.innerHeight||g.doc.documentElement.clientHeight||g.doc.documentElement.offsetHeight,w:g.global.innerWidth||g.doc.documentElement.clientWidth||g.doc.documentElement.offsetWidth}};this.resize=function(a){if(a)this.domNode.style.height=a.h+"px",this.domNode.style.width=a.w+"px",this.domNode.style.left=a.l+"px",this.domNode.style.top=a.t+"px";else if(a=this.domNode.offsetParent){this.domNode.style.height="0px";var c=a.getBoundingClientRect(),
b=this.domNode.getBoundingClientRect(),c=c.bottom-this._appFooterHeight;dh=b.bottom>=c?screenHeight-a.offsetTop:c-b.bottom;a=Math.max(this.domNode.scrollHeight,this.containerNode.scrollHeight);a=(a?Math.min(a,dh):dh)+"px";if("-"!==a.charAt(0))this.domNode.style.height=a}this.onTouchEnd()};this.onFlickAnimationStart=function(a){r.stop(a)};this.onFlickAnimationEnd=function(a){var c=a&&a.animationName;if(c&&-1===c.indexOf("scrollableViewScroll2"))if(-1!==c.indexOf("scrollableViewScroll0"))this._scrollBarNodeV&&
j.remove(this._scrollBarNodeV,"mblScrollableScrollTo0");else if(-1!==c.indexOf("scrollableViewScroll1"))this._scrollBarNodeH&&j.remove(this._scrollBarNodeH,"mblScrollableScrollTo1");else{if(this._scrollBarNodeV)this._scrollBarNodeV.className="";if(this._scrollBarNodeH)this._scrollBarNodeH.className=""}else{if(this._useTopLeft&&(c=a.target,c===this._scrollBarV||c===this._scrollBarH)){a="mblScrollableScrollTo"+(c===this._scrollBarV?"0":"1");j.contains(c,a)?j.remove(c,a):c.className="";return}a&&a.srcElement&&
r.stop(a);this.stopAnimation();if(this._bounce){var b=this,e=b._bounce;setTimeout(function(){b.slideTo(e,0.3,"ease-out")},0);b._bounce=void 0}else this.hideScrollBar(),this.removeCover()}};this.isFormElement=function(a){if(a&&1!==a.nodeType)a=a.parentNode;if(!a||1!==a.nodeType)return!1;a=a.tagName;return"SELECT"===a||"INPUT"===a||"TEXTAREA"===a||"BUTTON"===a};this.onTouchStart=function(a){if(!(this.disableTouchScroll||this._conn&&500>(new Date).getTime()-this.startTime)){if(!this._conn)this._conn=
[],this._conn.push(m.connect(g.doc,i("touch")?"ontouchmove":"onmousemove",this,"onTouchMove")),this._conn.push(m.connect(g.doc,i("touch")?"ontouchend":"onmouseup",this,"onTouchEnd"));this._aborted=!1;if(j.contains(this.containerNode,"mblScrollableScrollTo2"))this.abort();else{if(this._scrollBarNodeV)this._scrollBarNodeV.className="";if(this._scrollBarNodeH)this._scrollBarNodeH.className=""}this.touchStartX=a.touches?a.touches[0].pageX:a.clientX;this.touchStartY=a.touches?a.touches[0].pageY:a.clientY;
this.startTime=(new Date).getTime();this.startPos=this.getPos();this._dim=this.getDim();this._time=[0];this._posX=[this.touchStartX];this._posY=[this.touchStartY];this._locked=!1;this.isFormElement(a.target)||(this.propagatable?a.preventDefault():r.stop(a))}};this.onTouchMove=function(a){if(!this._locked){var c=a.touches?a.touches[0].pageX:a.clientX,a=a.touches?a.touches[0].pageY:a.clientY,b=c-this.touchStartX,e=a-this.touchStartY,d={x:this.startPos.x+b,y:this.startPos.y+e},h=this._dim,b=Math.abs(b),
e=Math.abs(e);if(1==this._time.length){if(this.dirLock&&(this._v&&!this._h&&b>=this.threshold&&b>=e||(this._h||this._f)&&!this._v&&e>=this.threshold&&e>=b)){this._locked=!0;return}if(this._v&&Math.abs(e)<this.threshold||(this._h||this._f)&&Math.abs(b)<this.threshold)return;this.addCover();this.showScrollBar()}b=this.weight;if(this._v&&this.constraint)if(0<d.y)d.y=Math.round(d.y*b);else if(d.y<-h.o.h)d.y=h.c.h<h.d.h?Math.round(d.y*b):-h.o.h-Math.round((-h.o.h-d.y)*b);if((this._h||this._f)&&this.constraint)if(0<
d.x)d.x=Math.round(d.x*b);else if(d.x<-h.o.w)d.x=h.c.w<h.d.w?Math.round(d.x*b):-h.o.w-Math.round((-h.o.w-d.x)*b);this.scrollTo(d);d=this._time.length;if(2<=d){var o,f;this._v&&!this._h?(o=this._posY[d-1]-this._posY[d-2],f=a-this._posY[d-1]):!this._v&&this._h&&(o=this._posX[d-1]-this._posX[d-2],f=c-this._posX[d-1]);if(0>o*f)this._time=[this._time[d-1]],this._posX=[this._posX[d-1]],this._posY=[this._posY[d-1]],d=1}10==d&&(this._time.shift(),this._posX.shift(),this._posY.shift());this._time.push((new Date).getTime()-
this.startTime);this._posX.push(c);this._posY.push(a)}};this.onTouchEnd=function(a){if(!this._locked){var c=this._speed={x:0,y:0},b=this._dim,e=this.getPos(),d={};if(a){if(!this._conn)return;for(c=0;c<this._conn.length;c++)m.disconnect(this._conn[c]);this._conn=null;var c=this._time.length,h=!1;this._aborted||(1>=c?h=!0:2==c&&4>Math.abs(this._posY[1]-this._posY[0])&&i("touch")&&(h=!0));if(h){this.hideScrollBar();this.removeCover();if(i("touch")&&!this.isFormElement(a.target)){var o=a.target;if(1!=
o.nodeType)o=o.parentNode;var f=g.doc.createEvent("MouseEvents");f.initMouseEvent("click",!0,!0,g.global,1,a.screenX,a.screenY,a.clientX,a.clientY);setTimeout(function(){o.dispatchEvent(f)},0)}return}c=this._speed=this.getSpeed()}else{if(0==e.x&&0==e.y)return;b=this.getDim()}if(this._v)d.y=e.y+c.y;if(this._h||this._f)d.x=e.x+c.x;if(!1!==this.adjustDestination(d,e,b))if("v"==this.scrollDir&&b.c.h<b.d.h)this.slideTo({y:0},0.3,"ease-out");else if("h"==this.scrollDir&&b.c.w<b.d.w)this.slideTo({x:0},0.3,
"ease-out");else if(this._v&&this._h&&b.c.h<b.d.h&&b.c.w<b.d.w)this.slideTo({x:0,y:0},0.3,"ease-out");else{var k,h="ease-out",j={};if(this._v&&this.constraint)if(0<d.y)0<e.y?(k=0.3,d.y=0):(d.y=Math.min(d.y,20),h="linear",j.y=0);else if(-c.y>b.o.h- -e.y)e.y<-b.o.h?(k=0.3,d.y=b.c.h<=b.d.h?0:-b.o.h):(d.y=Math.max(d.y,-b.o.h-20),h="linear",j.y=-b.o.h);if((this._h||this._f)&&this.constraint)if(0<d.x)0<e.x?(k=0.3,d.x=0):(d.x=Math.min(d.x,20),h="linear",j.x=0);else if(-c.x>b.o.w- -e.x)e.x<-b.o.w?(k=0.3,
d.x=b.c.w<=b.d.w?0:-b.o.w):(d.x=Math.max(d.x,-b.o.w-20),h="linear",j.x=-b.o.w);this._bounce=void 0!==j.x||void 0!==j.y?j:void 0;if(void 0===k){var l,n;if(this._v&&this._h)n=Math.sqrt(c.x*c.x+c.y*c.y),l=Math.sqrt(Math.pow(d.y-e.y,2)+Math.pow(d.x-e.x,2));else if(this._v)n=c.y,l=d.y-e.y;else if(this._h)n=c.x,l=d.x-e.x;if(0===l&&!a)return;k=0!==n?Math.abs(l/n):0.01}this.slideTo(d,k,h)}}};this.adjustDestination=function(){return!0};this.abort=function(){this.scrollTo(this.getPos());this.stopAnimation();
this._aborted=!0};this.stopAnimation=function(){j.remove(this.containerNode,"mblScrollableScrollTo2");if(this._scrollBarV)this._scrollBarV.className="";if(this._scrollBarH)this._scrollBarH.className="";if(this._useTopLeft){this.containerNode.style.webkitTransition="";if(this._scrollBarV)this._scrollBarV.style.webkitTransition="";if(this._scrollBarH)this._scrollBarH.style.webkitTransition=""}};this.scrollIntoView=function(a,c,b){if(this._v){for(var e=this.containerNode,d=this.getDim().d.h,h=0,f=a;f!==
e;f=f.offsetParent){if(!f||"BODY"===f.tagName)return;h+=f.offsetTop}a=c?Math.max(d-e.offsetHeight,-h):Math.min(0,d-h-a.offsetHeight);b&&"number"===typeof b?this.slideTo({y:a},b,"ease-out"):this.scrollTo({y:a})}};this.getSpeed=function(){var a=0,c=0,b=this._time.length;if(2<=b&&500>(new Date).getTime()-this.startTime-this._time[b-1])var a=this._posX[b-(3<b?2:1)]-this._posX[0<=b-6?b-6:0],e=this._time[b-(3<b?2:1)]-this._time[0<=b-6?b-6:0],c=this.calcSpeed(this._posY[b-(3<b?2:1)]-this._posY[0<=b-6?b-
6:0],e),a=this.calcSpeed(a,e);return{x:a,y:c}};this.calcSpeed=function(a,c){return 4*Math.round(100*(a/c))};this.scrollTo=function(a,c,b){b=(b||this.containerNode).style;if(i("webkit"))if(this._useTopLeft){b.webkitTransition="";if(this._v)b.top=a.y+"px";if(this._h||this._f)b.left=a.x+"px"}else b.webkitTransform=this.makeTranslateStr(a);else{if(this._v)b.top=a.y+"px";if(this._h||this._f)b.left=a.x+"px"}c||this.scrollScrollBarTo(this.calcScrollBarPos(a))};this.slideTo=function(a,c,b){this._runSlideAnimation(this.getPos(),
a,c,b,this.containerNode,2);this.slideScrollBarTo(a,c,b)};this.makeTranslateStr=function(a){var c=this._v&&"number"==typeof a.y?a.y+"px":"0px",a=(this._h||this._f)&&"number"==typeof a.x?a.x+"px":"0px";return f.hasTranslate3d?"translate3d("+a+","+c+",0px)":"translate("+a+","+c+")"};this.getPos=function(){if(i("webkit")){var a=g.doc.defaultView.getComputedStyle(this.containerNode,"");if(this._useTopLeft)return{x:parseInt(a.left)||0,y:parseInt(a.top)||0};return(a=a["-webkit-transform"])&&0===a.indexOf("matrix")?
(a=a.split(/[,\s\)]+/),{y:a[5]-0,x:a[4]-0}):{x:0,y:0}}return{y:parseInt(this.containerNode.style.top)||0,x:this.containerNode.offsetLeft}};this.getDim=function(){var a={};a.c={h:this.containerNode.offsetHeight,w:this.containerNode.offsetWidth};a.v={h:this.domNode.offsetHeight+this._appFooterHeight,w:this.domNode.offsetWidth};a.d={h:a.v.h-this.fixedHeaderHeight-this.fixedFooterHeight,w:a.v.w};a.o={h:a.c.h-a.v.h+this.fixedHeaderHeight+this.fixedFooterHeight,w:a.c.w-a.v.w};return a};this.showScrollBar=
function(){if(this.scrollBar){var a=this._dim;if(!("v"==this.scrollDir&&a.c.h<=a.d.h||"h"==this.scrollDir&&a.c.w<=a.d.w))if(!this._v||!this._h||!(a.c.h<=a.d.h&&a.c.w<=a.d.w)){a=function(a,b){var e=a["_scrollBarNode"+b];if(!e){var e=n.create("div",null,a.domNode),d={position:"absolute",overflow:"hidden"};"V"==b?(d.right="2px",d.width="5px"):(d.bottom=(a.isLocalFooter?a.fixedFooterHeight:0)+2+"px",d.height="5px");k.set(e,d);e.className="mblScrollBarWrapper";a["_scrollBarWrapper"+b]=e;e=n.create("div",
null,e);k.set(e,{opacity:0.6,position:"absolute",backgroundColor:"#606060",fontSize:"1px",webkitBorderRadius:"2px",MozBorderRadius:"2px",webkitTransformOrigin:"0 0",zIndex:2147483647});k.set(e,"V"==b?{width:"5px"}:{height:"5px"});a["_scrollBarNode"+b]=e}return e};if(this._v&&!this._scrollBarV)this._scrollBarV=a(this,"V");if(this._h&&!this._scrollBarH)this._scrollBarH=a(this,"H");this.resetScrollBar()}}};this.hideScrollBar=function(){if(this.fadeScrollBar&&i("webkit")&&!f._fadeRule){var a=n.create("style",
null,g.doc.getElementsByTagName("head")[0]);a.textContent=".mblScrollableFadeScrollBar{  -webkit-animation-duration: 1s;  -webkit-animation-name: scrollableViewFadeScrollBar;}@-webkit-keyframes scrollableViewFadeScrollBar{  from { opacity: 0.6; }  to { opacity: 0; }}";f._fadeRule=a.sheet.cssRules[1]}if(this.scrollBar){a=function(a,b){k.set(a,{opacity:0,webkitAnimationDuration:""});if(!b._useTopLeft||!i("android"))a.className="mblScrollableFadeScrollBar"};if(this._scrollBarV)a(this._scrollBarV,this),
this._scrollBarV=null;if(this._scrollBarH)a(this._scrollBarH,this),this._scrollBarH=null}};this.calcScrollBarPos=function(a){var c={},b=this._dim,e=function(a,b,c,e,f){c=Math.round((e-b-8)/(e-f)*c);c<-b+5&&(c=-b+5);c>a-5&&(c=a-5);return c};if("number"==typeof a.y&&this._scrollBarV)c.y=e(this._scrollBarWrapperV.offsetHeight,this._scrollBarV.offsetHeight,a.y,b.d.h,b.c.h);if("number"==typeof a.x&&this._scrollBarH)c.x=e(this._scrollBarWrapperH.offsetWidth,this._scrollBarH.offsetWidth,a.x,b.d.w,b.c.w);
return c};this.scrollScrollBarTo=function(a){if(this.scrollBar){if(this._v&&this._scrollBarV&&"number"==typeof a.y)i("webkit")?this._useTopLeft?k.set(this._scrollBarV,{webkitTransition:"",top:a.y+"px"}):this._scrollBarV.style.webkitTransform=this.makeTranslateStr({y:a.y}):this._scrollBarV.style.top=a.y+"px";if(this._h&&this._scrollBarH&&"number"==typeof a.x)i("webkit")?this._useTopLeft?k.set(this._scrollBarH,{webkitTransition:"",left:a.x+"px"}):this._scrollBarH.style.webkitTransform=this.makeTranslateStr({x:a.x}):
this._scrollBarH.style.left=a.x+"px"}};this.slideScrollBarTo=function(a,c,b){if(this.scrollBar){var e=this.calcScrollBarPos(this.getPos()),a=this.calcScrollBarPos(a);this._v&&this._scrollBarV&&this._runSlideAnimation({y:e.y},{y:a.y},c,b,this._scrollBarV,0);this._h&&this._scrollBarH&&this._runSlideAnimation({x:e.x},{x:a.x},c,b,this._scrollBarH,1)}};this._runSlideAnimation=function(a,c,b,e,d,f){i("webkit")?this._useTopLeft?(k.set(d,{webkitTransitionProperty:"top, left",webkitTransitionDuration:b+"s",
webkitTransitionTimingFunction:e}),setTimeout(function(){k.set(d,{top:(c.y||0)+"px",left:(c.x||0)+"px"})},0),j.add(d,"mblScrollableScrollTo"+f)):(this.setKeyframes(a,c,f),k.set(d,{webkitAnimationDuration:b+"s",webkitAnimationTimingFunction:e}),j.add(d,"mblScrollableScrollTo"+f),2==f?this.scrollTo(c,!0,d):this.scrollScrollBarTo(c)):p.fx&&p.fx.easing&&b?(a=p.fx.slideTo({node:d,duration:1E3*b,left:c.x,top:c.y,easing:"ease-out"==e?p.fx.easing.quadOut:p.fx.easing.linear}).play(),2==f&&m.connect(a,"onEnd",
this,"onFlickAnimationEnd")):2==f?(this.scrollTo(c,!1,d),this.onFlickAnimationEnd()):this.scrollScrollBarTo(c)};this.resetScrollBar=function(){var a=function(a,c,d,f,g,i){if(c){var j={};j[i?"top":"left"]=g+4+"px";g=0>=d-8?1:d-8;j[i?"height":"width"]=g+"px";k.set(a,j);a=Math.round(d*d/f);a=Math.min(Math.max(a-8,5),g);c.style[i?"height":"width"]=a+"px";k.set(c,{opacity:0.6})}},c=this.getDim();a(this._scrollBarWrapperV,this._scrollBarV,c.d.h,c.c.h,this.fixedHeaderHeight,!0);a(this._scrollBarWrapperH,
this._scrollBarH,c.d.w,c.c.w,0);this.createMask()};this.createMask=function(){if(i("webkit")){var a;if(this._scrollBarWrapperV){var c=this._scrollBarWrapperV.offsetHeight;a=g.doc.getCSSCanvasContext("2d","scrollBarMaskV",5,c);a.fillStyle="rgba(0,0,0,0.5)";a.fillRect(1,0,3,2);a.fillRect(0,1,5,1);a.fillRect(0,c-2,5,1);a.fillRect(1,c-1,3,2);a.fillStyle="rgb(0,0,0)";a.fillRect(0,2,5,c-4);this._scrollBarWrapperV.style.webkitMaskImage="-webkit-canvas(scrollBarMaskV)"}if(this._scrollBarWrapperH)c=this._scrollBarWrapperH.offsetWidth,
a=g.doc.getCSSCanvasContext("2d","scrollBarMaskH",c,5),a.fillStyle="rgba(0,0,0,0.5)",a.fillRect(0,1,2,3),a.fillRect(1,0,1,5),a.fillRect(c-2,0,1,5),a.fillRect(c-1,1,2,3),a.fillStyle="rgb(0,0,0)",a.fillRect(2,0,c-4,5),this._scrollBarWrapperH.style.webkitMaskImage="-webkit-canvas(scrollBarMaskH)"}};this.flashScrollBar=function(){if(!this.disableFlashScrollBar&&this.domNode&&(this._dim=this.getDim(),!(0>=this._dim.d.h))){this.showScrollBar();var a=this;setTimeout(function(){a.hideScrollBar()},300)}};
this.addCover=function(){if(!i("touch")&&!this.noCover)f._cover?f._cover.style.display="":(f._cover=n.create("div",null,g.doc.body),f._cover.className="mblScrollableCover",k.set(f._cover,{backgroundColor:"#ffff00",opacity:0,position:"absolute",top:"0px",left:"0px",width:"100%",height:"100%",zIndex:2147483647}),this._ch.push(m.connect(f._cover,i("touch")?"ontouchstart":"onmousedown",this,"onTouchEnd"))),this.setSelectable(f._cover,!1),this.setSelectable(this.domNode,!1)};this.removeCover=function(){if(!i("touch")&&
f._cover)f._cover.style.display="none",this.setSelectable(f._cover,!0),this.setSelectable(this.domNode,!0)};this.setKeyframes=function(a,c,b){if(!f._rule)f._rule=[];if(!f._rule[b]){var e=n.create("style",null,g.doc.getElementsByTagName("head")[0]);e.textContent=".mblScrollableScrollTo"+b+"{-webkit-animation-name: scrollableViewScroll"+b+";}@-webkit-keyframes scrollableViewScroll"+b+"{}";f._rule[b]=e.sheet.cssRules[1]}if(b=f._rule[b])if(a&&(b.deleteRule("from"),b.insertRule("from { -webkit-transform: "+
this.makeTranslateStr(a)+"; }")),c){if(void 0===c.x)c.x=a.x;if(void 0===c.y)c.y=a.y;b.deleteRule("to");b.insertRule("to { -webkit-transform: "+this.makeTranslateStr(c)+"; }")}};this.setSelectable=function(a,c){a.style.KhtmlUserSelect=c?"auto":"none";a.style.MozUserSelect=c?"":"none";a.onselectstart=c?null:function(){return!1};if(i("ie")){a.unselectable=c?"":"on";for(var b=a.getElementsByTagName("*"),e=0;e<b.length;e++)b[e].unselectable=c?"":"on"}};if(i("webkit")){var q=g.doc.createElement("div");
q.style.webkitTransform="translate3d(0px,1px,0px)";g.doc.documentElement.appendChild(q);var l=g.doc.defaultView.getComputedStyle(q,"")["-webkit-transform"];f.hasTranslate3d=l&&0===l.indexOf("matrix");g.doc.documentElement.removeChild(q)}if(!f.disableResizeAll)f.disableResizeAll=!0};return f.scrollable=l});