var widgets=[];var identifiersToStringLocalizations=[];var Widget=Class.create({initialize:function(f,a,b,e,d,c){if(f){this.instanceID=f;this.widgetPath=a;this.sharedPath=b;this.sitePath=e;this.preferences=d;this.runningInApp=(c===undefined)?false:c;this.onloadReceived=false;if(this.preferences&&this.runningInApp==true){this.preferences.widget=this;setTransparentGifURL(this.sharedPath.stringByAppendingPathComponent("None.gif"))}this.div().widget=this;window[f]=this;widgets.push(this);widgets[f]=this;if(!this.constructor.instances){this.constructor.instances=new Array()}this.constructor.instances.push(this)}},div:function(){var a=this.instanceID;if(arguments.length==1){a=this.instanceID+"-"+arguments[0]}return $(a)},onload:function(){this.onloadReceived=true},onunload:function(){},didBecomeSelected:function(){},didBecomeDeselected:function(){},didBeginEditing:function(){},didEndEditing:function(){},setNeedsDisplay:function(){},preferenceForKey:function(a){var b;if(this.preferences){b=this.preferences[a]}return b},initializeDefaultPreferences:function(b){var a=this;$H(b).each(function(c){if(a.preferenceForKey(c.key)===undefined){a.setPreferenceForKey(c.value,c.key,false)}})},setPreferenceForKey:function(c,b,a){if(this.runningInApp){if(a===undefined){a=true}if((a==false)&&this.preferences.disableUndoRegistration){this.preferences.disableUndoRegistration()}this.preferences[b]=c;if((a==false)&&this.preferences.enableUndoRegistration){this.preferences.enableUndoRegistration()}}else{this.preferences[b]=c;this.changedPreferenceForKey(b)}},changedPreferenceForKey:function(a){},postNotificationWithNameAndUserInfo:function(b,a){if(window.NotificationCenter!==undefined){NotificationCenter.postNotification(new IWNotification(b,null,a))}},sizeWillChange:function(){},sizeDidChange:function(){},widgetWidth:function(){var a=this.div();if(a){return a.offsetWidth}else{return null}},widgetHeight:function(){var a=this.div();if(a){return a.offsetHeight}else{return null}},getInstanceId:function(b){var a=this.instanceID+"-"+b;if(arguments.length==2){a+=("$"+arguments[1])}return a},getElementById:function(b){var a=this.getInstanceId.apply(this,arguments);return $(a)},localizedString:function(a){return LocalizedString(this.widgetIdentifier,a)},showView:function(c){var a=this.m_views[c];if((a!=this.m_currentView)&&(a!=this.m_futureView)){this.m_futureView=a;if(this.m_fadeAnimation){this.m_fadeAnimation.stop()}var b=this.m_currentView;this.m_currentView=a;var d=this.m_currentView;this.m_futureView=null;this.m_fadeAnimation=new SimpleAnimation(function(){delete this.m_fadeAnimation}.bind(this));this.m_fadeAnimation.pre=function(){if(b){b.ensureDiv().setStyle({zIndex:0,opacity:1})}if(d){d.ensureDiv().setStyle({zIndex:1,opacity:0});d.show();d.render()}};this.m_fadeAnimation.post=function(){!b||b.hide();!d||d.ensureDiv().setStyle({zIndex:"",opacity:1});!d||!d.doneFadingIn||d.doneFadingIn()};this.m_fadeAnimation.update=function(e){!d||d.ensureDiv().setOpacity(e);!b||b.ensureDiv().setOpacity(1-e)}.bind(this);this.m_fadeAnimation.start()}}});Widget.onload=function(){for(var a=0;a<widgets.length;a++){widgets[a].onload()}};Widget.onunload=function(){for(var a=0;a<widgets.length;a++){widgets[a].onunload()}};function RegisterWidgetStrings(b,a){identifiersToStringLocalizations[b]=a}function LocalizedString(b,a){var c=undefined;var d=identifiersToStringLocalizations[b];if(d===undefined){iWLog("warning: no localizations for widget "+b+", (key:"+a+")")}else{c=d[a]}if(c===undefined){iWLog("warning: couldn't find a localization for '"+a+"' for widget "+b);c=a}return c}function WriteLocalizedString(b,a){document.write(LocalizedString(b,a))}var JSONFeedRendererWidget=Class.create(Widget,{initialize:function($super,f,a,b,e,d,c){if(f){$super(f,a,b,e,d,c)}},changedPreferenceForKey:function(key){try{var value=this.preferenceForKey(key);if(key=="sfr-shadow"){if(value!=null){this.sfrShadow=eval(value)}else{this.sfrShadow=null}this.renderFeedItems("sfr-shadow")}if(key=="sfr-stroke"){if(value!==null){this.sfrStroke=eval(value)}else{this.sfrStroke=null}this.invalidateFeedItems("sfr-stroke")}if(key=="sfr-reflection"){if(value!==null){this.sfrReflection=eval(value)}else{this.sfrReflection=null}this.invalidateFeedItems("sfr-reflection")}}catch(e){iWLog("JSONFeedRendererWidget: exception");debugPrintException(e)}},invalidateFeedItems:function(a){trace("invalidateFeedItems(%s)",a);if(this.pendingRender!==null){clearTimeout(this.pendingRender)}this.pendingRender=setTimeout(function(){this.pendingRender=null;this.renderFeedItems(a)}.bind(this),50)},rerenderImage:function(c,j,h,i,f,d,g,b){c.update();if(i){c.strokeApplied=false;c.reflectionApplied=false;c.shadowApplied=false;c.setStyle({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});c.style.position="relative";j.style.position="relative";var e=h||transparentGifURL();var a=IWCreateImage(e);a.load(function(o,m,k,l,n){var p=this.croppingDivForImage(o,f,d);k.appendChild(p);if(l){l()}if(o.sourceURL()!==transparentGifURL()){this.applyEffects(k)}if(n){n()}}.bind(this,a,j,c,g,b))}},croppingDivForImage:function(e,f,b){var c=function(k,j,l){if(j=="Square"){return new IWSize(l,l)}else{if(j=="Landscape"){return new IWSize(l,l*(3/4))}else{if(j=="Portrait"){return new IWSize(l,l*(4/3))}else{var m=l/k.width;return k.scale(m,m,true)}}}};var i=null;if(e.loaded()){var g=$(document.createElement("img"));g.src=e.sourceURL();var a=e.naturalSize();i=$(document.createElement("div"));i.appendChild(g);var h=function(n){if(n){a=new IWSize(n.width,n.height)}var l=c(a,f,b);var k=l.width/a.width;if(a.aspectRatio()>l.aspectRatio()){k=l.height/a.height}var j=a.scale(k);var m=new IWPoint(Math.abs(j.width-l.width)/2,Math.abs(j.height-l.height)/2);g.setStyle({width:px(j.width),height:px(j.height),marginLeft:px(-m.x),marginTop:px(-m.y),position:"relative"});i.setStyle({width:px(l.width),height:px(l.height),overflow:"hidden",position:"relative"});i.className="crop"};if(windowsInternetExplorer&&effectiveBrowserVersion<7&&g.src.indexOf(transparentGifURL())!=-1){var d=new Image();d.src=g.originalSrc;if(d.complete){h(d)}else{d.onload=h.bind(null,d)}}else{h(null)}}return i},applyEffects:function(c){if(this.sfrShadow||this.sfrReflection||this.sfrStroke){if((c.offsetWidth===undefined)||(c.offsetHeight===undefined)||(c.offsetWidth===0)||(c.offsetHeight===0)){setTimeout(JSONFeedRendererWidget.prototype.applyEffects.bind(this,c),0);return}if(this.sfrStroke&&(c.strokeApplied==false)){this.sfrStroke.applyToElement(c);c.strokeApplied=true}if(this.sfrReflection&&(c.reflectionApplied==false)){this.sfrReflection.applyToElement(c);c.reflectionApplied=true}if(this.sfrShadow&&(!this.disableShadows)&&(c.shadowApplied==false)){this.sfrShadow.applyToElement(c);c.shadowApplied=true}if(this.runningInApp&&(window.webKitVersion<=419)&&this.preferences.setNeedsDisplay){this.preferences.setNeedsDisplay()}}if(windowsInternetExplorer){var a=c.select(".crop");var b=a[a.length-1];if(b){b.onclick=function(){var d=c.parentNode;var e=locationHRef();while(d&&(d.tagName!="A")){d=d.parentNode}if(d){e=d.href}window.location=e};b.onmouseover=function(){this.style.cursor="pointer"}}}},summaryExcerpt:function(b,c){var d=document.createElement("div");d.innerHTML=b;if(c>0){var a=new HTMLTextModel(d);a.truncateAroundPosition(c,"...")}else{if(c===0){d.innerHTML=""}}return d.innerHTML}});var PrefMarkupWidget=Class.create(Widget,{initialize:function($super,f,a,b,e,d,c){if(f){$super(f,a,b,e,d,c)}},onload:function(){if(!this.runningInApp){this.setUpSubDocumentOnLoad()}},setUpSubDocumentOnLoad:function(){var a=this;var b=this.getElementById("frame");if(b){setTimeout(function(){a.loadedSubDocument()},250)}},loadedSubDocument:function(){var b=this.getElementById("frame");var c=b.contentWindow||b.contentDocument;if(c.document){c=c.document}if(c.body){this.fixTargetOnElements(c,"a");this.fixTargetOnElements(c,"form")}else{var a=this;setTimeout(function(){a.loadedSubDocument()},250)}},fixTargetOnElements:function(e,b){var c=e.getElementsByTagName(b);for(var a=0;a<c.length;a++){var d=c[a].target;if(d===undefined||d==""){c[a].target="_top"}}}});function IWScrollbar(a){}IWScrollbar.prototype._init=function(){var b=null;var a=null;this._track=$(document.createElement("div"));b=this._track.style;b.height="100%";b.width="100%";this.scrollbar.appendChild(this._track);a=$(document.createElement("div"));a.style.position="absolute";this._setObjectStart(a,0);this._track.appendChild(a);a=$(document.createElement("div"));a.style.position="absolute";this._track.appendChild(a);a=$(document.createElement("div"));a.style.position="absolute";windowsInternetExplorer||this._setObjectEnd(a,0);this._track.appendChild(a);this._thumb=$(document.createElement("div"));b=this._thumb.style;b.position="absolute";this._setObjectSize(this._thumb,this.minThumbSize);this._track.appendChild(this._thumb);a=$(document.createElement("div"));a.style.position="absolute";this._setObjectStart(a,0);this._thumb.appendChild(a);a=$(document.createElement("div"));a.style.position="absolute";this._thumb.appendChild(a);a=$(document.createElement("div"));a.style.position="absolute";windowsInternetExplorer||this._setObjectEnd(a,0);this._thumb.appendChild(a);this.setSize(this.size);this.setTrackStart(this.trackStartPath,this.trackStartLength);this.setTrackMiddle(this.trackMiddlePath);this.setTrackEnd(this.trackEndPath,this.trackEndLength);this.setThumbStart(this.thumbStartPath,this.thumbStartLength);this.setThumbMiddle(this.thumbMiddlePath);this.setThumbEnd(this.thumbEndPath,this.thumbEndLength);this._thumb.style.display="none";Event.observe(this._track,"mousedown",this._mousedownTrackHandler,false);Event.observe(this._thumb,"mousedown",this._mousedownThumbHandler,false)};IWScrollbar.prototype.remove=function(){this.scrollbar.removeChild(this._track)};IWScrollbar.prototype._captureEvent=function(a){a.stopPropagation();a.preventDefault()};IWScrollbar.prototype._mousedownThumb=function(a){Event.observe(document,"mousemove",this._mousemoveThumbHandler,true);Event.observe(document,"mouseup",this._mouseupThumbHandler,true);Event.observe(document,"mouseover",this._captureEventHandler,true);Event.observe(document,"mouseout",this._captureEventHandler,true);this._thumbStart_temp=this._getMousePosition(a);this._scroll_thumbStartPos=this._getThumbStartPos();a.stopPropagation();a.preventDefault()};IWScrollbar.prototype._mousemoveThumb=function(b){var c=this._getMousePosition(b)-this._thumbStart_temp;var a=this._scroll_thumbStartPos+c;this.scrollTo(this._contentPositionForThumbPosition(a));b.stopPropagation();b.preventDefault()};IWScrollbar.prototype._mouseupThumb=function(a){Event.stopObserving(document,"mousemove",this._mousemoveThumbHandler,true);Event.stopObserving(document,"mouseup",this._mouseupThumbHandler,true);Event.stopObserving(document,"mouseover",this._captureEventHandler,true);Event.stopObserving(document,"mouseout",this._captureEventHandler,true);delete this._thumbStart_temp;delete this._scroll_thumbStartPos;a.stopPropagation();a.preventDefault()};IWScrollbar.prototype._mousedownTrack=function(a){this._track_mouse_temp=this._getMousePosition(a)-this._trackOffset;if(a.altKey){this.scrollTo(this._contentPositionForThumbPosition(this._track_mouse_temp-(this._thumbLength/2)));delete this._track_mouse_temp}else{this._track_scrolling=true;Event.observe(this._track,"mousemove",this._mousemoveTrackHandler,true);Event.observe(this._track,"mouseover",this._mouseoverTrackHandler,true);Event.observe(this._track,"mouseout",this._mouseoutTrackHandler,true);Event.observe(document,"mouseup",this._mouseupTrackHandler,true);this._trackScrollOnePage(this);this._track_timer=setInterval(this._trackScrollDelay,500,this)}a.stopPropagation();a.preventDefault()};IWScrollbar.prototype._trackScrollDelay=function(a){if(!a._track_scrolling){return}clearInterval(a._track_timer);a._trackScrollOnePage(a);a._track_timer=setInterval(a._trackScrollOnePage,150,a)};IWScrollbar.prototype._mousemoveTrack=function(a){this._track_mouse_temp=this._getMousePosition(a)-this._trackOffset;a.stopPropagation();a.preventDefault()};IWScrollbar.prototype._mouseoverTrack=function(a){this._track_mouse_temp=this._getMousePosition(a)-this._trackOffset;this._track_scrolling=true;a.stopPropagation();a.preventDefault()};IWScrollbar.prototype._mouseoutTrack=function(a){this._track_scrolling=false;a.stopPropagation();a.preventDefault()};IWScrollbar.prototype._mouseupTrack=function(a){clearInterval(this._track_timer);Event.stopObserving(this._track,"mousemove",this._mousemoveTrackHandler,true);Event.stopObserving(this._track,"mouseover",this._mouseoverTrackHandler,true);Event.stopObserving(this._track,"mouseout",this._mouseoutTrackHandler,true);Event.stopObserving(document,"mouseup",this._mouseupTrackHandler,true);delete this._track_mouse_temp;delete this._track_scrolling;delete this._track_timer;a.stopPropagation();a.preventDefault()};IWScrollbar.prototype._trackScrollOnePage=function(a){if(!a._track_scrolling){return}var b=Math.round(a._trackLength*a._getViewToContentRatio());if(a._track_mouse_temp<a._thumbStart){a.scrollByThumbDelta(-b)}else{if(a._track_mouse_temp>(a._thumbStart+a._thumbLength)){a.scrollByThumbDelta(b)}}};IWScrollbar.prototype.setScrollArea=function(a){if(this.scrollarea){Event.stopObserving(this.scrollbar,"mousewheel",this.scrollarea._mousewheelScrollHandler,true);Event.stopObserving(this.scrollbar,"DOMMouseScroll",this.scrollarea._mousewheelScrollHandler,true)}this.scrollarea=a;Event.observe(this.scrollbar,"mousewheel",this.scrollarea._mousewheelScrollHandler,true);Event.observe(this.scrollbar,"DOMMouseScroll",this.scrollarea._mousewheelScrollHandler,true)};IWScrollbar.prototype.refresh=function(){this._trackOffset=this._computeTrackOffset();this._trackLength=this._computeTrackLength();var a=this._getViewToContentRatio();if(a>=1||!this._canScroll()){if(this.autohide){this.hide()}this._thumb.style.display="none";this.scrollbar.style.appleDashboardRegion="none"}else{this._thumbLength=Math.max(Math.round(this._trackLength*a),this.minThumbSize);this._numScrollablePixels=this._trackLength-this._thumbLength-(2*this.padding);this._setObjectLength(this._thumb,this._thumbLength);if(windowsInternetExplorer){this._setObjectStart(this._thumb.down().next(),this.thumbStartLength);this._setObjectLength(this._thumb.down().next(),this._thumbLength-this.thumbStartLength-this.thumbEndLength);this._setObjectStart(this._thumb.down().next(1),this._thumbLength-this.thumbEndLength);this._setObjectLength(this._thumb.down().next(1),this.thumbEndLength);if(!this.fixedUpIEPNGBGs){fixupIEPNGBGsInTree(this._track);Event.stopObserving(this._track,"mousedown",this._mousedownTrackHandler);Event.stopObserving(this._thumb,"mousedown",this._mousedownThumbHandler);Event.observe(this._track,"mousedown",this._mousedownTrackHandler);Event.observe(this._thumb,"mousedown",this._mousedownThumbHandler);this.fixedUpIEPNGBGs=true}}this._thumb.style.display="block";this.scrollbar.style.appleDashboardRegion="dashboard-region(control rectangle)";this.show()}this.verticalHasScrolled();this.horizontalHasScrolled()};IWScrollbar.prototype.setAutohide=function(a){this.autohide=a;if(this._getViewToContentRatio()>=1&&a){this.hide()}else{this.show()}};IWScrollbar.prototype.hide=function(){this._track.style.display="none";this.hidden=true};IWScrollbar.prototype.show=function(){this._track.style.display="block";this.hidden=false};IWScrollbar.prototype.setSize=function(a){this.size=a;this._setObjectSize(this.scrollbar,a);this._setObjectSize(this._track.down().next(),a);this._setObjectSize(this._thumb.down().next(),a)};IWScrollbar.prototype.setTrackStart=function(a,c){this.trackStartPath=a;this.trackStartLength=c;var b=this._track.down();b.style.background="url("+a+")no-repeat top left";this._setObjectLength(b,c);this._setObjectSize(b,this.size);this._setObjectStart(this._track.down().next(),c)};IWScrollbar.prototype.setTrackMiddle=function(a){this.trackMiddlePath=a;this._track.down().next().style.background="url("+a+")"+this._repeatType+" top left"};IWScrollbar.prototype.setTrackEnd=function(a,c){this.trackEndPath=a;this.trackEndLength=c;var b=this._track.down().next(1);b.style.background="url("+a+")no-repeat top left";this._setObjectLength(b,c);this._setObjectSize(b,this.size);windowsInternetExplorer||this._setObjectEnd(this._track.down().next(),c)};IWScrollbar.prototype.setThumbStart=function(a,c){this.thumbStartPath=a;this.thumbStartLength=c;var b=this._thumb.down();b.style.background="url("+a+")no-repeat top left";this._setObjectLength(b,c);this._setObjectSize(b,this.size);this._setObjectStart(this._thumb.down().next(),c)};IWScrollbar.prototype.setThumbMiddle=function(a){this.thumbMiddlePath=a;this._thumb.down().next().style.background="url("+a+")"+this._repeatType+" top left"};IWScrollbar.prototype.setThumbEnd=function(a,c){this.thumbEndPath=a;this.thumbEndLength=c;var b=this._thumb.down().next(1);b.style.background="url("+a+")no-repeat top left";this._setObjectLength(b,c);this._setObjectSize(b,this.size);windowsInternetExplorer||this._setObjectEnd(this._thumb.down().next(),c)};IWScrollbar.prototype._contentPositionForThumbPosition=function(a){if(this._getViewToContentRatio()>=1){return 0}else{return(a-this.padding)*((this._getContentLength()-this._getViewLength())/this._numScrollablePixels)}};IWScrollbar.prototype._thumbPositionForContentPosition=function(b){if(this._getViewToContentRatio()>=1){return this.padding}else{var a=this.padding+(b/((this._getContentLength()-this._getViewLength())/this._numScrollablePixels));if(isNaN(a)){a=0}return a}};IWScrollbar.prototype.scrollByThumbDelta=function(a){if(a==0){return}this.scrollTo(this._contentPositionForThumbPosition(this._thumbStart+a))};function IWVerticalScrollbar(b){this.scrollarea=null;this.scrollbar=$(b);this.minThumbSize=28;this.padding=-1;this.autohide=true;this.hidden=true;this.size=19;this.trackStartPath=transparentGifURL();this.trackStartLength=18;this.trackMiddlePath=transparentGifURL();this.trackEndPath=transparentGifURL();this.trackEndLength=18;this.thumbStartPath=transparentGifURL();this.thumbStartLength=9;this.thumbMiddlePath=transparentGifURL();this.thumbEndPath=transparentGifURL();this.thumbEndLength=9;this._track=null;this._thumb=null;this._trackOffset=0;this._trackLength=0;this._numScrollablePixels=0;this._thumbLength=0;this._repeatType="repeat-y";this._thumbStart=this.padding;var a=this;this._captureEventHandler=function(c){a._captureEvent(c)};this._mousedownThumbHandler=function(c){a._mousedownThumb(c)};this._mousemoveThumbHandler=function(c){a._mousemoveThumb(c)};this._mouseupThumbHandler=function(c){a._mouseupThumb(c)};this._mousedownTrackHandler=function(c){a._mousedownTrack(c)};this._mousemoveTrackHandler=function(c){a._mousemoveTrack(c)};this._mouseoverTrackHandler=function(c){a._mouseoverTrack(c)};this._mouseoutTrackHandler=function(c){a._mouseoutTrack(c)};this._mouseupTrackHandler=function(c){a._mouseupTrack(c)};this._init()}IWVerticalScrollbar.prototype=new IWScrollbar(null);IWVerticalScrollbar.prototype.scrollTo=function(a){this.scrollarea.verticalScrollTo(a)};IWVerticalScrollbar.prototype._setObjectSize=function(a,b){a.style.width=b+"px"};IWVerticalScrollbar.prototype._setObjectLength=function(a,b){a.style.height=b+"px"};IWVerticalScrollbar.prototype._setObjectStart=function(a,b){a.style.top=b+"px"};IWVerticalScrollbar.prototype._setObjectEnd=function(b,a){b.style.bottom=a+"px"};IWVerticalScrollbar.prototype._getMousePosition=function(a){if(a!=undefined){return Event.pointerY(a)}else{return 0}};IWVerticalScrollbar.prototype._getThumbStartPos=function(){return this._thumb.offsetTop};IWVerticalScrollbar.prototype._computeTrackOffset=function(){var b=this.scrollbar;var a=0;while(b.offsetParent){a+=b.offsetTop;b=b.offsetParent}return a};IWVerticalScrollbar.prototype._computeTrackLength=function(){return this.scrollbar.offsetHeight};IWVerticalScrollbar.prototype._getViewToContentRatio=function(){return this.scrollarea.viewToContentHeightRatio};IWVerticalScrollbar.prototype._getContentLength=function(){return this.scrollarea.content.scrollHeight};IWVerticalScrollbar.prototype._getViewLength=function(){return this.scrollarea.viewHeight};IWVerticalScrollbar.prototype._canScroll=function(){return this.scrollarea.scrollsVertically};IWVerticalScrollbar.prototype.verticalHasScrolled=function(){var a=this._thumbPositionForContentPosition(this.scrollarea.content.scrollTop);this._thumbStart=a;this._thumb.style.top=a+"px"};IWVerticalScrollbar.prototype.horizontalHasScrolled=function(){};function IWHorizontalScrollbar(b){this.scrollarea=null;this.scrollbar=$(b);this.minThumbSize=28;this.padding=-1;this.autohide=true;this.hidden=true;this.size=19;this.trackStartPath=transparentGifURL();this.trackStartLength=18;this.trackMiddlePath=transparentGifURL();this.trackEndPath=transparentGifURL();this.trackEndLength=18;this.thumbStartPath=transparentGifURL();this.thumbStartLength=9;this.thumbMiddlePath=transparentGifURL();this.thumbEndPath=transparentGifURL();this.thumbEndLength=9;this._track=null;this._thumb=null;this._trackOffset=0;this._trackLength=0;this._numScrollablePixels=0;this._thumbLength=0;this._repeatType="repeat-x";this._thumbStart=this.padding;var a=this;this._captureEventHandler=function(c){a._captureEvent(c)};this._mousedownThumbHandler=function(c){a._mousedownThumb(c)};this._mousemoveThumbHandler=function(c){a._mousemoveThumb(c)};this._mouseupThumbHandler=function(c){a._mouseupThumb(c)};this._mousedownTrackHandler=function(c){a._mousedownTrack(c)};this._mousemoveTrackHandler=function(c){a._mousemoveTrack(c)};this._mouseoverTrackHandler=function(c){a._mouseoverTrack(c)};this._mouseoutTrackHandler=function(c){a._mouseoutTrack(c)};this._mouseupTrackHandler=function(c){a._mouseupTrack(c)};this._init()}IWHorizontalScrollbar.prototype=new IWScrollbar(null);IWHorizontalScrollbar.prototype.scrollTo=function(a){this.scrollarea.horizontalScrollTo(a)};IWHorizontalScrollbar.prototype._setObjectSize=function(a,b){a.style.height=b+"px"};IWHorizontalScrollbar.prototype._setObjectLength=function(a,b){a.style.width=b+"px"};IWHorizontalScrollbar.prototype._setObjectStart=function(a,b){a.style.left=b+"px"};IWHorizontalScrollbar.prototype._setObjectEnd=function(b,a){b.style.right=a+"px"};IWHorizontalScrollbar.prototype._getMousePosition=function(a){if(a!=undefined){return Event.pointerX(a)}else{return 0}};IWHorizontalScrollbar.prototype._getThumbStartPos=function(){return this._thumb.offsetLeft};IWHorizontalScrollbar.prototype._computeTrackOffset=function(){var b=this.scrollbar;var a=0;while(b.offsetParent){a+=b.offsetLeft;b=b.offsetParent}return a};IWHorizontalScrollbar.prototype._computeTrackLength=function(){return this.scrollbar.offsetWidth};IWHorizontalScrollbar.prototype._getViewToContentRatio=function(){return this.scrollarea.viewToContentWidthRatio};IWHorizontalScrollbar.prototype._getContentLength=function(){return this.scrollarea.content.scrollWidth};IWHorizontalScrollbar.prototype._getViewLength=function(){return this.scrollarea.viewWidth};IWHorizontalScrollbar.prototype._canScroll=function(){return this.scrollarea.scrollsHorizontally};IWHorizontalScrollbar.prototype.verticalHasScrolled=function(){};IWHorizontalScrollbar.prototype.horizontalHasScrolled=function(){var a=this._thumbPositionForContentPosition(this.scrollarea.content.scrollLeft);this._thumbStart=a;this._thumb.style.left=a+"px"};function IWScrollArea(d){this.content=$(d);this.scrollsVertically=true;this.scrollsHorizontally=true;this.singlepressScrollPixels=10;this.viewHeight=0;this.viewToContentHeightRatio=1;this.viewWidth=0;this.viewToContentWidthRatio=1;this._scrollbars=new Array();var a=this;this._refreshHandler=function(){a.refresh()};this._keyPressedHandler=function(){a.keyPressed(event)};this._mousewheelScrollHandler=function(c){a.mousewheelScroll(c)};this.content.style.overflow="hidden";this.content.scrollTop=0;this.content.scrollLeft=0;Event.observe(this.content,"mousewheel",this._mousewheelScrollHandler,true);Event.observe(this.content,"DOMMouseScroll",this._mousewheelScrollHandler,true);this.refresh();var e=arguments.length;for(var b=1;b<e;++b){this.addScrollbar(arguments[b])}}IWScrollArea.prototype.addScrollbar=function(a){a.setScrollArea(this);this._scrollbars.push(a);a.refresh()};IWScrollArea.prototype.removeScrollbar=function(e){var b=this._scrollbars;var d=b.length;for(var a=0;a<d;++a){if(b[a]==e){b.splice(a,1);break}}};IWScrollArea.prototype.remove=function(){Event.stopObserving(this.content,"mousewheel",this._mousewheelScrollHandler,true);Event.stopObserving(this.content,"DOMMouseScroll",this._mousewheelScrollHandler,true);var b=this._scrollbars;var d=b.length;for(var a=0;a<d;++a){b[a].setScrollArea(null)}};IWScrollArea.prototype.refresh=function(){this.viewHeight=this.content.offsetHeight;this.viewWidth=this.content.offsetWidth;if(this.content.scrollHeight>this.viewHeight){this.viewToContentHeightRatio=this.viewHeight/this.content.scrollHeight;this.verticalScrollTo(this.content.scrollTop)}else{this.viewToContentHeightRatio=1;this.verticalScrollTo(0)}if(this.content.scrollWidth>this.viewWidth){this.viewToContentWidthRatio=this.viewWidth/this.content.scrollWidth;this.horizontalScrollTo(this.content.scrollLeft)}else{this.viewToContentWidthRatio=1;this.horizontalScrollTo(0)}var b=this._scrollbars;var d=b.length;for(var a=0;a<d;++a){b[a].refresh()}};IWScrollArea.prototype.focus=function(){Event.observe(document,"keypress",this._keyPressedHandler,true)};IWScrollArea.prototype.blur=function(){Event.stopObserving(document,"keypress",this._keyPressedHandler,true)};IWScrollArea.prototype.reveal=function(b){var d=0;var c=b;do{d+=c.offsetTop;c=c.offsetParent}while(c&&c!=this.content);var a=0;c=b;do{a+=c.offsetLeft;c=c.offsetParent}while(c&&c!=this.content);this.verticalScrollTo(d);this.horizontalScrollTo(a)};IWScrollArea.prototype.verticalScrollTo=function(e){if(!this.scrollsVertically){return}var a=this.content.scrollHeight-this.viewHeight;if(e<0){e=0}else{if(e>a){e=a}}this.content.scrollTop=e;var d=this._scrollbars;var f=d.length;for(var b=0;b<f;++b){d[b].verticalHasScrolled()}};IWScrollArea.prototype.horizontalScrollTo=function(f){if(!this.scrollsHorizontally){return}var b=this.content_width-this.viewWidth;if(f<0){f=0}else{if(f>b){f=b}}this.content.scrollLeft=f;var d=this._scrollbars;var e=d.length;for(var a=0;a<e;++a){d[a].horizontalHasScrolled()}};IWScrollArea.prototype.keyPressed=function(a){var b=true;if(a.altKey){return}if(a.shiftKey){return}switch(a.keyIdentifier){case"Home":this.verticalScrollTo(0);break;case"End":this.verticalScrollTo(this.content.scrollHeight-this.viewHeight);break;case"Up":this.verticalScrollTo(this.content.scrollTop-this.singlepressScrollPixels);break;case"Down":this.verticalScrollTo(this.content.scrollTop+this.singlepressScrollPixels);break;case"PageUp":this.verticalScrollTo(this.content.scrollTop-this.viewHeight);break;case"PageDown":this.verticalScrollTo(this.content.scrollTop+this.viewHeight);break;case"Left":this.horizontalScrollTo(this.content.scrollLeft-this.singlepressScrollPixels);break;case"Right":this.horizontalScrollTo(this.content.scrollLeft+this.singlepressScrollPixels);break;default:b=false}if(b){a.stopPropagation();a.preventDefault()}};IWScrollArea.prototype.mousewheelScroll=function(a){var b=a.wheelDelta?(a.wheelDelta/120*this.singlepressScrollPixels):(a.detail/-2*this.singlepressScrollPixels);this.verticalScrollTo(this.content.scrollTop-b);a.stopPropagation();a.preventDefault()};var View=Class.create({initialize:function(a,b){this.m_widget=a;this.m_parentDiv=b;this.m_divInstanceId=this.m_divId;this.hide()},ensureDiv:function(){var a=this.m_widget.div(this.m_divInstanceId);if(!a){a=new Element("div",{id:this.m_widget.getInstanceId(this.m_divInstanceId)});a.addClassName(this.m_divClass);this.m_parentDiv.appendChild(a)}return $(a)},hide:function(){this.ensureDiv().hide()},show:function(){this.ensureDiv().show()},render:function(){},resize:function(){}});var StatusView=Class.create(View,{initialize:function($super,a,b){$super(a,b);this.render();this.hide()},render:function(){var b="<table class='StatusMessageTable'><tr><td>";if(this.badgeImage){b+=imgMarkup(this.m_widget.widgetPath+"/"+this.badgeImage,"","id='"+this.p_badgeImgId()+"'","")}b+="</td></tr></table>";if(this.upperRightBadgeWidth&&this.upperRightBadgeHeight){var a=(this.upperRightBadge)?(this.m_widget.widgetPath+"/"+this.upperRightBadge):transparentGifURL();b+=imgMarkup(a,"","class='StatusUpperRightBadge' width='"+this.upperRightBadgeWidth+"' height='"+this.upperRightBadgeHeight+"' ","")}var c=this.m_widget.sharedPath.stringByAppendingPathComponent("Translucent-Overlay.png");b+=imgMarkup(c,"position: absolute; top: 0; left: 0;","id='"+this.p_overlayImgId()+"' width='700' height='286' ","");if(this.statusMessageKey){b+="<div id='"+this.p_statusMessageBlockId()+"' class='StatusMessageBlock' ><span>"+this.m_widget.localizedString(this.statusMessageKey)+"</span></div>"}this.ensureDiv().update(b);this.resize()},resize:function(){var b=(this.runningInApp)?window.innerWidth:this.m_widget.div().offsetWidth;var i=(this.runningInApp)?window.innerHeight:this.m_widget.div().offsetHeight;if(this.badgeImage){var n=$(this.p_badgeImgId());var e=new IWSize(this.badgeImageWidth,this.badgeImageHeight);if((e.width>b)||(e.height>i)){var h=new IWSize(b,i);e=e.scaleToFit(h)}n.width=e.width;n.height=e.height}var k=700;var c=286;var j=Math.max(b,k);var o=c;var g=Math.min(((i/2)-c),0);var p=Math.min(((b/2)-(k/2)),0);var l=$(this.p_overlayImgId());l.width=j;l.height=o;l.setStyle({left:px(p),top:px(g)});var m=$(this.p_statusMessageBlockId());if(m){var a=px(Math.max(((b-m.offsetWidth)/2),0));var d={left:a};if(this.statusMessageVerticallyCentered){var f=px(Math.max(((i-m.offsetHeight)/2),0));d.top=f}m.setStyle(d)}if(this.footerView){this.footerView.resize()}},doneFadingIn:function(){this.m_widget.setPreferenceForKey(true,"x-viewDoneFadingIn",false)},p_badgeImgId:function(){return this.m_widget.getInstanceId(this.m_divId+"-badge")},p_overlayImgId:function(){return this.m_widget.getInstanceId(this.m_divId+"-overlay")},p_statusMessageBlockId:function(){return this.m_widget.getInstanceId(this.m_divId+"-messageBlock")}});
