// www.PressDisplay.com
// © 2003-2008 NewspaperDirect, Inc. All rights reserved.

WinBorder=function(win,type,zIndex,onResizingCompleteHandler,additionalTarget){var t=this;pdcore.addToDispose(t);t.win=win;t.type=type;t.cursor=pdcore.cursors[type+"_resize"];t.doDrag=t[type+"_doDrag"];var elm=t.elm=pdcore.createElm(win,"DIV");elm.parent=t;elm.style.cursor=t.cursor;elm.className="win_"+type+"_border";pdcore.setZ(elm,(zIndex?zIndex:0));t.onResizingCompleteHandler=onResizingCompleteHandler;t.onBeforeResize=new pdcore.events.delegate();t.onResizing=new pdcore.events.delegate();if(additionalTarget){t.additionalTarget=additionalTarget;t.additionalTarget.parent=t;}
Drag.turnOnDrag(elm,t.dragStart,t.dragGo,t.dragStop);if(t.additionalTarget)
Drag.turnOnDrag(t.additionalTarget,t.dragStart,t.dragGo,t.dragStop);}
WinBorder.prototype={n_doDrag:function(t,dX,dY){dY=Math.min(dY,t.max_dy);var y=t.m_y+dY;var h=t.m_h-dY;t.onResizing.fire({x:t.m_x,y:y,w:t.m_w,h:h,dy:dY,dh:-dY});pdcore.setY(t.win,y);pdcore.setH(t.win,h);},ne_doDrag:function(t,dX,dY){dX=Math.max(dX,-t.max_dx);dY=Math.min(dY,t.max_dy);var y=t.m_y+dY;var w=t.m_w+dX;var h=t.m_h-dY;t.onResizing.fire({x:t.m_x,y:y,w:w,h:h,dy:dY,dw:dX,dh:-dY});pdcore.setY(t.win,y);pdcore.setSize(t.win,w,h);},e_doDrag:function(t,dX,dY){dX=Math.max(dX,-t.max_dx);var w=t.m_w+dX;t.onResizing.fire({x:t.m_x,y:t.m_y,w:w,h:t.m_h,dw:dX});pdcore.setW(t.win,w);},se_doDrag:function(t,dX,dY){dX=Math.max(dX,-t.max_dx);dY=Math.max(dY,-t.max_dy);var w=t.m_w+dX;var h=t.m_h+dY;t.onResizing.fire({x:t.m_x,y:t.m_y,w:w,h:h,dw:dX,dh:dY});pdcore.setSize(t.win,w,h);},s_doDrag:function(t,dX,dY){dY=Math.max(dY,-t.max_dy);var h=t.m_h+dY;t.onResizing.fire({x:t.m_x,y:t.m_y,w:t.m_w,h:h,dh:dY});pdcore.setH(t.win,h);},sw_doDrag:function(t,dX,dY){dX=Math.min(dX,t.max_dx);dY=Math.max(dY,-t.max_dy);var x=t.m_x+dX;var w=t.m_w-dX;var h=t.m_h+dY;t.onResizing.fire({x:x,y:t.m_y,w:w,h:h,dx:dX,dw:-dX,dh:dY});pdcore.setX(t.win,x);pdcore.setSize(t.win,w,h);},w_doDrag:function(t,dX,dY){dX=Math.min(dX,t.max_dx);var x=t.m_x+dX;var w=t.m_w-dX;t.onResizing.fire({x:x,y:t.m_y,w:w,h:t.m_h,dx:dX,dw:-dX});pdcore.setX(t.win,x);pdcore.setW(t.win,w);},nw_doDrag:function(t,dX,dY){dX=Math.min(dX,t.max_dx);dY=Math.min(dY,t.max_dy);var x=t.m_x+dX;var y=t.m_y+dY;var w=t.m_w-dX;var h=t.m_h-dY;t.onResizing.fire({x:x,y:y,w:w,h:h,dx:dX,dy:dY,dw:-dX,dh:-dY});pdcore.moveTo(t.win,x,y);pdcore.setSize(t.win,w,h);},dragStart:function(eX,eY,target){var t=target.parent;t.onBeforeResize.fire();document.body.style.cursor=t.cursor;t.m_x=pdcore.getX(t.win);t.m_y=pdcore.getY(t.win);t.m_w=pdcore.getW(t.win);t.m_h=pdcore.getH(t.win);t.max_dx=Math.max(0,t.m_w-100);t.max_dy=Math.max(0,t.m_h-100);},dragGo:function(eX,eY,dX,dY,target){var t=target.parent;document.body.style.cursor=t.cursor;t.doDrag(t,dX,dY);},dragStop:function(eX,eY,dX,dY,target){document.body.style.cursor="auto";var t=target.parent;if(t.onResizingCompleteHandler)t.onResizingCompleteHandler();},unload:function(){var t=this;if(t.elm){t.elm.parent=null;t.elm=null;}
if(t.additionalTarget){t.additionalTarget.parent=null;t.additionalTarget=null;}
t.onBeforeResize=null;t.onResizing=null;}}
Button=function(id,container,state,images,titles,onclickhandler,tag,tooltips,onmouseoverhandler,onmouseouthandler,imageSize,ihelp,ihelpgroup){if(arguments.length==0)
return this;var t=this;pdcore.addToDispose(t);t.images=images;t.titles=titles;t.tag=tag;if(id){t.img=pdcore.getElm(id);}else{t.img=pdcore.createElm(container,"IMG");if(imageSize)
pdcore.setSize(t.img,imageSize[0],imageSize[1]);}
t.img.button=t;if(!pdcore.isNull(tooltips)&&typeof(TooltipManager)!="undefined"){t.tooltips=tooltips;TooltipManager.registerElm(t.img);}
else t.tooltips=null;if(!pdcore.isNull(ihelp)&&typeof(InteractiveHelpManager)!="undefined"){t.ihelp=ihelp;InteractiveHelpManager.registerElm(t.img,(ihelpgroup?ihelpgroup:0));}
else t.ihelp=null;t.active=false;if(onclickhandler){t.active=true;t.img.onclickhandler=onclickhandler;t.img.onclick=t.elm_onclick;}
if(onmouseoverhandler){t.img.onmouseoverhandler=onmouseoverhandler;t.img.onmouseover=t.elm_onmouseover;}
if(onmouseouthandler){t.img.onmouseouthandler=onmouseouthandler;t.img.onmouseout=t.elm_onmouseout;}
t.setState((state?state:0));}
Button.prototype={unload:function(){var img=this.img;if(img){this.img=null;img.onmouseover=img.onmouseoverhandler=null;img.onmouseout=img.onmouseouthandler=null;img.onclick=img.onclickhandler=null;img.button=null;}
this.tag=null;},setState:function(state,disabled){var t=this;if(t.active){t.disabled=disabled;t.img.style.cursor=(disabled?"":pdcore.cursors.hand);}
state=(state?Math.min(state,t.images.length-1):0)
t.state=state;t.img.src=pdcore.getImageUrl(t.images[state]);if(t.titles){t.img.alt=(state<t.titles.length?t.titles[state]:t.titles[0])
t.img.title=t.img.alt;}
if(t.tooltips!=null)
t.img.setAttribute("tooltipId",(state<t.tooltips.length?t.tooltips[state]:t.tooltips[0]));if(t.ihelp!=null)
t.img.setAttribute("ihelpId",(state<t.ihelp.length?t.ihelp[state]:t.ihelp[0]));},getState:function(){return this.state;},setVisibility:function(visible){if(visible)
pdcore.show(this.img);else
pdcore.hide(this.img);},elm_onmouseover:function(){this.button.onevent(this.onmouseoverhandler,this);},elm_onmouseout:function(){this.button.onevent(this.onmouseouthandler,this);},elm_onclick:function(){this.button.onevent(this.onclickhandler,this);},onevent:function(handler,img){try{if(pdcore.isStr(handler))
eval(handler);else
handler(this);if(this.tooltips!=null&&typeof(TooltipManager)!="undefined")
TooltipManager.showTooltip(img);}catch(E){};}}
LinkButton=function(container,state,classes,tooltips,onclickhandler,onmouseoverhandler,onmouseouthandler,tag,ihelp,ihelpgroup){var t=this;pdcore.addToDispose(t);t.classes=classes;t.tag=tag;t.img=pdcore.createElm(container,"a");t.img.href="javascript:;"
t.img.innerHTML="<span>abs</span>";t.img.button=t;if(!pdcore.isNull(tooltips)&&typeof(TooltipManager)!="undefined"){t.tooltips=tooltips;TooltipManager.registerElm(t.img);}
else t.tooltips=null;if(!pdcore.isNull(ihelp)&&typeof(InteractiveHelpManager)!="undefined"){t.ihelp=ihelp;InteractiveHelpManager.registerElm(t.img,(ihelpgroup?ihelpgroup:0));}
else t.ihelp=null;t.active=false;if(onclickhandler){t.active=true;t.img.onclickhandler=onclickhandler;t.img.onclick=t.elm_onclick;}
if(onmouseoverhandler){t.img.onmouseoverhandler=onmouseoverhandler;t.img.onmouseover=t.elm_onmouseover;}
if(onmouseouthandler){t.img.onmouseouthandler=onmouseouthandler;t.img.onmouseout=t.elm_onmouseout;}
t.setState((state?state:0));}
LinkButton.prototype=new Button();LinkButton.prototype.setState=function(state,disabled){var t=this;if(t.active){t.disabled=disabled;t.img.style.cursor=(disabled?"":pdcore.cursors.hand);}
state=(state?Math.min(state,t.classes.length-1):0)
t.state=state;t.img.className=t.classes[state];if(t.tooltips!=null)
t.img.setAttribute("tooltipId",(state<t.tooltips.length?t.tooltips[state]:t.tooltips[0]));if(t.ihelp!=null)
t.img.setAttribute("ihelpId",(state<t.ihelp.length?t.ihelp[state]:t.ihelp[0]));}
UIUtils={pendingToHideElms:[],asyncHideTimeout:300,hideAsync:function(elm){if(!elm)return;var t=UIUtils;elm.pending2hide_time=new Date().getTime()+t.asyncHideTimeout;var emptyIdx=-1;var elms=t.pendingToHideElms;for(var i=elms.length-1;i>=0;i--){var item=elms[i];if(item){if(item==elm){t.checkHideAsyncTimer();return;}}else emptyIdx=i;}
if(emptyIdx>=0)
elms[emptyIdx]=elm;else
elms.push(elm);t.checkHideAsyncTimer();},cancelHideAsync:function(elm){if(!elm)return;var elms=UIUtils.pendingToHideElms;for(var i=elms.length-1;i>=0;i--){if(elms[i]==elm){elms[i]=null;return;}}},checkHideAsyncTimer:function(){if(!this.asyncHideTimer)
this.asyncHideTimer=setTimeout(this.checkHideAsyncFunc,50);},checkHideAsyncFunc:function(){var t=UIUtils;var elms=t.pendingToHideElms;var activeElms=0;var now=new Date().getTime();var elms=UIUtils.pendingToHideElms;for(var i=elms.length-1;i>=0;i--){var item=elms[i];if(item){if(item.pending2hide_time<=now){try{item.style.visibility="hidden";if(item.onhidden)
item.onhidden();}catch(E){}
elms[i]=null;}else{activeElms++;}}}
if(activeElms>0)
t.asyncHideTimer=setTimeout(t.checkHideAsyncFunc,50);else
t.asyncHideTimer=null;}}
UIAnimation={active:true,frm:null,currentElm:null,init:function(){pdcore.addToDispose(UIAnimation);},unload:function(){var t=UIAnimation;t.finishLastAnimation();t.frm=null;t.currentElm=null;},isActive:function(){return this.active;},finishLastAnimation:function(){AnimationPlayer.finish();return true;},getAnimationFrame:function(){if(!this.frm){this.frm=pdcore.createElm(null,"DIV","absolute");this.frm.id="UIAnimation_AnimationFrame";this.frm.style.border="solid 1px #000000";this.frm.style.overflow="hidden";}
return this.frm;},prepareAnimationFrame:function(x,y,w,h,display,zIndex,opacity){if(arguments.length>0){var elm=this.getAnimationFrame();pdcore.moveTo(elm,x,y);pdcore.setSize(elm,w,h);pdcore.setZ(elm,zIndex);if(!pdcore.isNull(display))
pdcore.setStyleVal(elm,"display",(display?"":"none"));}},coverAnimationFrame:function(elm,display,zIndex,opacity){this.prepareAnimationFrame(elm.offsetLeft,elm.offsetTop,elm.offsetWidth,elm.offsetHeight,display,zIndex,opacity);},hideAnimationFrame:function(){pdcore.hide(UIAnimation.frm);},playAnimation:function(animation){AnimationPlayer.play(animation,null);return true;},createAnimation:function(parent,name,targetElm,duration,fps){var def={AnimationName:name};if(targetElm){var elmId;if(pdcore.isStr(targetElm)){elmId=targetElm;}else{if(pdcore.isStr(targetElm.id)){elmId=targetElm.id;}else{var idx=0;var a="UIAnimation_"+(new Date().getTime());elmId=a;while(true){if(!document.getElementById(elmId))
break;elmId=a+(idx++).toString();}
targetElm.id=elmId;}}
def.AnimationTarget=elmId;}
if(duration)
def.Duration=duration;if(fps)
def.Fps=fps;if(parent){if(!parent.AnimationChildren)
parent.AnimationChildren=[];parent.AnimationChildren.push(def);}
return def;},createSequenceAnimation:function(parent,targetElm,duration,fps){return this.createAnimation(parent,"Sequence",targetElm,duration,fps);},createParallelAnimation:function(parent,targetElm,duration,fps){return this.createAnimation(parent,"Parallel",targetElm,duration,fps);},createMoveAnimation:function(parent,horizontal,vertical,targetElm,duration,fps){var def=this.createAnimation(parent,"Move",targetElm,duration,fps);def.Horizontal=horizontal;def.Vertical=vertical;return def;},createResizeAnimation:function(parent,width,height,targetElm,duration,fps){var def=this.createAnimation(parent,"Resize",targetElm,duration,fps);def.Width=width;def.Height=height;return def;},createFadeInAnimation:function(parent,targetElm,duration,fps){return this.createAnimation(parent,"FadeIn",targetElm,duration,fps);},createFadeOutAnimation:function(parent,targetElm,duration,fps){return this.createAnimation(parent,"FadeOut",targetElm,duration,fps);},createScriptAnimation:function(parent,script,targetElm,duration,fps){var animationName=(typeof(script)=="string"?"scriptAction":"scriptAction2");var def=this.createAnimation(parent,animationName,targetElm,duration,fps);def.Script=script;return def;},createAnimationObjectAndPlay:function(def,onEndedCallback){try{AnimationPlayer.play(def,onEndedCallback);return true}catch(E){}
return false;},showElmFade:function(elm,duration,fps){try{var t=this;if(!t.active||!elm)return false;fps=fps||25;duration=duration||1.2;t.finishLastAnimation();t.currentElm=elm;var a=t.createFadeInAnimation(null,elm,duration,fps);pdcore.setOpacity(elm,0);pdcore.show(elm);return t.createAnimationObjectAndPlay(a,t._finishHideCurrentElmFade);}catch(E){}
return false;},hideElmFade:function(elm,duration,fps){try{var t=this;if(!t.active||!elm)return false;fps=fps||25;duration=duration||0.2;t.finishLastAnimation();t.currentElm=elm;var a=t.createFadeOutAnimation(null,elm,duration,fps);return t.createAnimationObjectAndPlay(a,t._finishShowCurrentElmFade);}catch(E){}
return false;},showElm:function(elm,duration,fps,startLeft,startTop,finishLeft,finishTop,zIndex,enableFadeIn,hasText){if(pdcore.isNullAny(elm,startLeft,startTop,finishLeft,finishTop))
return false;try{var t=this;if(!t.active)return false;t.finishLastAnimation();fps=fps||25;duration=duration||0.2;t.currentElm=elm;t.currentElm._uianimation_finishTop=finishTop;t.currentElm._uianimation_finishLeft=finishLeft;var width=elm.offsetWidth;var height=elm.offsetHeight;t.prepareAnimationFrame(startLeft,startTop,1,1,true,zIndex);var mainAnimation=t.createSequenceAnimation();var parallelAnimation=t.createParallelAnimation(mainAnimation,t.getAnimationFrame(),duration,fps);t.createMoveAnimation(parallelAnimation,(finishLeft-startLeft),(finishTop-startTop));t.createResizeAnimation(parallelAnimation,width,height);if(enableFadeIn&&(!hasText||!pdcore.isIE7)){try{pdcore.setOpacity(elm,0);t.createScriptAnimation(mainAnimation,t._finishShowCurrentElm);t.createFadeInAnimation(mainAnimation,elm,duration,fps);}catch(E){}}
return t.createAnimationObjectAndPlay(mainAnimation,t._finishShowCurrentElm);}catch(E){}
return false;},hideElm:function(elm,duration,fps,start_x,start_y,dx,dy){if(!elm||!pdcore.isVisible(elm))
return false;try{var t=this;if(!t.active)
return false;t.finishLastAnimation();fps=fps||25;duration=duration||0.2;if(pdcore.isNullAll(start_x,start_y)){t.coverAnimationFrame(elm,true);}
else{var x=(pdcore.isNull(start_x)?pdcore.getGlobalX(elm):start_x);var y=(pdcore.isNull(start_y)?pdcore.getGlobalY(elm):start_y);var w=pdcore.getW(elm);var h=pdcore.getH(elm);t.prepareAnimationFrame(x,y,w,h,true);}
var mainAnimation;if(pdcore.isNullAny(dx,dy)){mainAnimation=UIAnimation.createResizeAnimation(null,8,4,t.getAnimationFrame(),duration,fps);}
else{mainAnimation=t.createSequenceAnimation();var parallelAnimation=t.createParallelAnimation(mainAnimation,t.getAnimationFrame(),duration,fps);t.createMoveAnimation(parallelAnimation,dx,dy);t.createResizeAnimation(parallelAnimation,8,4);}
elm.style.display='none';return t.createAnimationObjectAndPlay(mainAnimation,t.hideAnimationFrame);}catch(E){}
return false;},_finishShowCurrentElm:function(){var t=UIAnimation;try{var e=t.currentElm;pdcore.moveTo(e,e._uianimation_finishLeft,e._uianimation_finishTop);pdcore.show(e);}catch(E){}
t.hideAnimationFrame();},_finishShowCurrentElmFade:function(){var t=UIAnimation;try{pdcore.setOpacity(t.currentElm,1);}catch(E){}
t.hideAnimationFrame();},_finishHideCurrentElmFade:function(){var t=UIAnimation;try{pdcore.hide(t.currentElm);pdcore.setOpacity(t.currentElm,1);}catch(E){}
t.hideAnimationFrame();}}
UIAnimation.init();AnimationTimer=function(fps,duration,target,startFun,doFun,finishFun){var t=this;t.target=target;t.startFun=startFun;t.doFun=doFun;t.finishFun=finishFun;t.active=false;t.set_times(fps,duration);t.doCallback=pdcore.getCallback4Timer(t,t._do);t.finishCallback=pdcore.getCallback4Timer(t,t.finish);pdcore.addToDispose(t);}
AnimationTimer.prototype={dispose:function(){var t=this;t.target=null;t.startFun=null;t.doFun=null;t.finishFun=null;t.doCallback=null;t.finishCallback=null;},set_times:function(fps,duration){var t=this;t.fps=fps||25;t.duration=duration||2000;t.intreval=1000/t.fps;t.timerIntreval=Math.max(t.intreval/2,10);t.frames=Math.ceil(t.duration/t.intreval);},set_frames:function(frames){var t=this;t.frames=frames;t.intreval=t.duration/frames;t.timerIntreval=Math.max(t.intreval/2,10);},set_callbacks:function(target,startFun,doFun,finishFun){this.target=target;this.startFun=startFun;this.doFun=doFun;this.finishFun=finishFun;},start:function(){var t=this;t.finish();t.active=true;if(t.startFun)
try{t.startFun.call(t.target);}catch(E){}
t.frame=0;t.startTime=new Date().getTime();t.timer=setInterval(t.doCallback,t.timerIntreval);},finish:function(doNotCallCallback){var t=this;if(t.active){t._stop();if(doNotCallCallback!=true){try{t.doFun.call(t.target,100,t.frames,t.frames,1);}catch(E){}
if(t.finishFun)
try{t.finishFun.call(t.target);}catch(E){}}
t.active=false;return true;}
return false;},_stop:function(){var t=this;if(t.timer){clearInterval(t.timer);t.timer=undefined;}},_do:function(){var t=this,elapsed=new Date().getTime()-t.startTime,frame=Math.ceil(elapsed/t.intreval);if(frame>t.frame){t.frame=frame=Math.min(frame,t.frames);var scale=frame/t.frames;try{t.doFun.call(t.target,100*scale,frame,t.frames,scale);}catch(E){}
if(frame>=t.frames){t._stop();setTimeout(t.finishCallback,1);}}}}
AnimationPlayer={play:function(def,finishCallback){this.finish();this.finishCallback=finishCallback;if(def.AnimationName=="Sequence"){this.root=def;this.items=def.AnimationChildren;}else{this.root=def;this.items=[def];}
this.idx=0;this.aborting=false;this._playNext();},finish:function(){if(this.items){this.aborting=true;if(this.timer)
this.timer.finish(false);this._clean(this.root);this.root=null;this.items=null;this.finishCallback=null;}},_clean:function(def){if(def){def._parent=def._do=def._elm=null;if(def.AnimationChildren)
for(var i=0;i<def.AnimationChildren.length;)
this._clean(def.AnimationChildren[i++]);}},_getTarget:function(def){for(var p=def;!!p;p=p._parent){if(p._elm)return p._elm;else if(p.AnimationTarget){p._elm=pdcore.getElm(p.AnimationTarget);return p._elm;}}
return null;},_getFps:function(def,defaultVal){for(var p=def;!!p;p=p._parent)
if(p.Fps)return p.Fps;return defaultVal;},_getDuration:function(def,defaultVal){for(var p=def;!!p;p=p._parent)
if(p.Duration){return p.Duration*1000;}
return defaultVal;},_prepare:function(def,parent){def._parent=(parent==def?null:parent);def._elm=this._getTarget(def);var name=def.AnimationName;if(def._elm){switch(name){case"Move":def._x=def._elm.offsetLeft;def._dx=def.Horizontal||0;def._y=def._elm.offsetTop;def._dy=def.Vertical||0;if(def._dy&&def._dx)
def._do=this._doMove;else if(def._dx)
def._do=this._doMoveX;else if(def._dy)
def._do=this._doMoveY;else def._do=null;return;case"Resize":def._w=def._elm.offsetWidth;def._dw=(def.Width||0)-def._w;def._h=def._elm.offsetHeight;def._dh=(def.Height||0)-def._h;if(def.Height&&def.Width)
def._do=this._doResize;else if(def.Height)
def._do=this._doResizeH;else if(def.Width)
def._do=this._doResizeW;else def._do=null;return;case"FadeIn":def._start=pdcore.getOpacity(def._elm);def._delta=Math.max(0,1.0-def._start);def._do=this._doFade;return;case"FadeOut":def._start=pdcore.getOpacity(def._elm);def._delta=-def._start;def._do=this._doFade;return;}}
if(name=="Parallel"){def._childInited=false;def._do=this._doParallel;}else if(name=="scriptAction"||name=="scriptAction2"){def._isScript=true;def._isScriptExecuted=false;def._do=this._doScript;}},_playNext:function(){if(this.idx>=this.items.length){if(this.finishCallback)
try{this.finishCallback();}catch(E){}
return;}
var item=this.item=this.items[this.idx];this._prepare(item,this.root);if(this.aborting||item._isScript){try{item._do(100,0,0,1);}catch(E){}
this.idx++;this._playNext();}else{if(!this.timer)
this.timer=new AnimationTimer(0,0,this,this._onTimerStart,this._onTimer,this._onTimerDone);this.timer.set_times(this._getFps(item,25),this._getDuration(item,0.2));this.timer.start();}},_onTimerStart:function(){},_onTimer:function(percent,frame,frames,scale){try{this.item._do(percent,frame,frames,scale);}catch(E){}},_onTimerDone:function(){this.idx++;this._playNext();},_doParallel:function(a,b,c,scale){var items=this.AnimationChildren;if(!this._childInited){this._childInited=true;for(var i=0;i<items.length;i++)
AnimationPlayer._prepare(items[i],this);}
for(var i=0,l=items.length;i<l;)
try{items[i++]._do(a,b,c,scale)}catch(E){}},_doFade:function(a,b,c,scale){pdcore.setOpacity(this._elm,this._start+this._delta*scale);},_doResize:function(a,b,c,scale){AnimationPlayer._doResizeW.call(this,a,b,c,scale);AnimationPlayer._doResizeH.call(this,a,b,c,scale);},_doResizeW:function(a,b,c,scale){pdcore.setSize(this._elm,this._w+this._dw*scale,null);},_doResizeH:function(a,b,c,scale){pdcore.setSize(this._elm,null,this._h+this._dh*scale);},_doMove:function(a,b,c,scale){AnimationPlayer._doMoveX.call(this,a,b,c,scale);AnimationPlayer._doMoveY.call(this,a,b,c,scale);},_doMoveX:function(a,b,c,scale){pdcore.setX(this._elm,this._x+this._dx*scale);},_doMoveY:function(a,b,c,scale){pdcore.setY(this._elm,this._y+this._dy*scale);},_doScript:function(a,b,c,scale){if(!this._isScriptExecuted){this._isScriptExecuted=true;try{if(typeof(this.Script)=="string")
eval(this.Script);else this.Script();}catch(E){}}}}
Scroll=function(name,container,panel){if(name==null){if(!Scroll.objects)
Scroll.objects=0;Scroll.objects++;name="Scroll_"+Scroll.objects;}
var t=this;t.name=name;t.container=pdcore._getElm(container);t.panel=pdcore._getElm(panel);t.visible=true;t.autoMovePanel=true;t.autoAutoScroll=false;t.enableFadding=false;t.zIndex=0;t.zIndex4onmouseover=0;pdcore.addToDispose(t);}
Scroll.prototype={set_enable:function(value){this.visible=value;this.update();},set_verticaleScrollTopOffset:function(value){this.verticaleScrollTopOffset=value;this.update();},set_verticaleScrollLeftOffset:function(value){this.verticaleScrollLeftOffset=value;this.update();},set_onpanelmovingcallback:function(value){this.onmovingcallback=value;},set_onpanelmovedcallback:function(value){this.onmovedcallback=value;},set_autoMovePanel:function(value){this.autoMovePanel=value;},set_autoAutoScroll:function(value){this.autoAutoScroll=value;},set_enableFadding:function(value){this.enableFadding=value;},set_zIndex:function(value){this.zIndex=value;if(this.zIndex4onmouseover<value)
this.zIndex4onmouseover=value;pdcore.setZ(this.scrolls,value);},set_zIndex4mouseover:function(value){this.zIndex4onmouseover=value;},get_VerticalArrowDelta:function(){return this.vertical_arrow_delta},get_HorizontalArrowDelta:function(){return this.horizontal_arrow_delta},unload:function(){var t=this;t.onmovingcallback=null;t.onmovedcallback=null;t.scroll_horizontal=null;t.scroll_horizontal_base=null;t.scroll_horizontal_lev=null;t.scroll_horizontal_left=null;t.scroll_horizontal_right=null;t.scroll_vertical=null;t.scroll_vertical_base=null;t.scroll_vertical_lev=null;t.scroll_vertical_top=null;t.scroll_vertical_bottom=null;t.scrolls=null;},attach:function(){var t=this;var name=t.name;t.scroll_horizontal=pdcore.getElm(name+"scroll_horizontal");t.scroll_horizontal_base=pdcore.getElm(name+"scroll_horizontal_base");t.scroll_horizontal_lev=pdcore.getElm(name+"scroll_horizontal_lev");t.scroll_vertical=pdcore.getElm(name+"scroll_vertical");t.scroll_vertical_base=pdcore.getElm(name+"scroll_vertical_base");t.scroll_vertical_lev=pdcore.getElm(name+"scroll_vertical_lev");t.scrolls=[t.scroll_horizontal,t.scroll_vertical];t.scroll_horizontal_left=pdcore.getElm(name+"scroll_horizontal_left");t.scroll_horizontal_right=pdcore.getElm(name+"scroll_horizontal_right");t.scroll_vertical_top=pdcore.getElm(name+"scroll_vertical_top");t.scroll_vertical_bottom=pdcore.getElm(name+"scroll_vertical_bottom");pdcore.events.addEvent(window,"resize",pdcore.getCallbackRef(t,t._window_resize));new Scroll.Arrow(t,t.scroll_horizontal_left,"horizontalMoveBy","get_HorizontalArrowDelta",-1);new Scroll.Arrow(t,t.scroll_horizontal_right,"horizontalMoveBy","get_HorizontalArrowDelta",1);new Scroll.Arrow(t,t.scroll_vertical_top,"verticalMoveBy","get_VerticalArrowDelta",-1);new Scroll.Arrow(t,t.scroll_vertical_bottom,"verticalMoveBy","get_VerticalArrowDelta",1);var dragStartCallback=pdcore.getCallbackRef(t,t.scrollLevDragStart);var dragStopCallback=pdcore.getCallbackRef(t,t.scrollLevDragStop);Drag.turnOnDrag(t.scroll_horizontal_lev,dragStartCallback,pdcore.getCallbackRef(t,t.horizontalLevDragGo),dragStopCallback);Drag.turnOnDrag(t.scroll_vertical_lev,dragStartCallback,pdcore.getCallbackRef(t,t.verticalLevDragGo),dragStopCallback);pdcore.events.addEvent(t.scroll_horizontal_base,"mouseup",pdcore.getCallbackRef(t,t.horizontalClick));pdcore.events.addEvent(this.scroll_vertical_base,"mouseup",pdcore.getCallbackRef(t,t.verticalClick));t._addEvents([t.scroll_vertical,t.scroll_horizontal],"dblclick",t.emptyEventHandler);t._addEvents([t.scroll_vertical_base,t.scroll_horizontal_base,],"mousedown",t.emptyEventHandler);t._addEvents([t.scroll_vertical,t.scroll_horizontal],"mouseover",pdcore.getCallbackRef(t,t.scrollOnMouseOver));t._addEvents([t.scroll_vertical,t.scroll_horizontal],"mouseout",pdcore.getCallbackRef(t,t.scrollOnMouseOut));if(t.autoAutoScroll){pdcore.events.addOnMouseWheelEvent(window.document,pdcore.getCallbackRef(t,t.onmousewheel));pdcore.events.subscribeToKeyDownEvent(t);}
t.update();},_window_resize:function(){var t=this;var w=pdcore.bodyWidth();var h=pdcore.bodyHeight();if(w!=t._bodyWidth||h!=t._bodyHeight){t._bodyWidth=w;t._bodyHeight=h;t.update();}},_addEvents:function(targets,name,callback){for(var i=targets.length-1;i>=0;i--)
pdcore.events.addEvent(targets[i],name,callback);},create:function(){var name=this.name;var imgHtml='<img src="'+pdcore.getImageUrl("1x1.gif")+'">';var a=['<div id="'+name+'scroll_horizontal" class="scrl_h" style="width:100%; bottom:0px; left:0px;">','<div id="'+name+'scroll_horizontal_base" class="scrl_h_base" style="background-color:Transparent;">','<table id="'+name+'scroll_horizontal_lev"  class="scrl_h_lev" style="width:50px; left:30px;" cellpadding="0" cellspacing="0">','<tr><td class="scrl_h_lev_l">'+imgHtml+'</td><td class="scrl_h_lev_c">'+imgHtml+'</td><td class="scrl_h_lev_r">'+imgHtml+'</td></tr>','</table>','<div id="'+name+'scroll_horizontal_left" class="scrl_h_left">'+imgHtml+'</div>','<div id="'+name+'scroll_horizontal_right" class="scrl_h_right">'+imgHtml+'</div>','</div></div>','<div id="'+name+'scroll_vertical"  class="scrl_v" style="height:100%; top:0px; right:0px;">','<div id="'+name+'scroll_vertical_base" class="scrl_v_base">','<table id="'+name+'scroll_vertical_lev" class="scrl_v_lev" cellpadding="0" cellspacing="0" style="height:190px; top:70px;">','<tr><td class="scrl_v_lev_t">'+imgHtml+'</td></tr>','<tr><td class="scrl_v_lev_c">'+imgHtml+'</td></tr>','<tr><td class="scrl_v_lev_b">'+imgHtml+'</td></tr>','</table>','<div id="'+name+'scroll_vertical_top" class="scrl_v_up">'+imgHtml+'</div>','<div id="'+name+'scroll_vertical_bottom" class="scrl_v_down">'+imgHtml+'</div>','</div></div>'];var tempElm=pdcore.createElm(document.body);tempElm.innerHTML=a.join('');pdcore.changeParentNode(pdcore.getElm(name+'scroll_horizontal'),this.container);pdcore.changeParentNode(pdcore.getElm(name+'scroll_vertical'),this.container);document.body.removeChild(tempElm);this.attach();this.oncreated();},onmousewheel:function(evt){if(this.visible&&this.autoAutoScroll){evt=pdcore.events.getEvt(evt);var step=(pdcore.events.getMouseWheelDirection(evt)<0?-20:20),dx=0,dy=0;if(evt.shiftKey||evt.altKey)
dx=step;else
dy=step;if(this.moveBy(dx,dy))
return pdcore.events.preventBubble(evt);}},onkeydown:function(evt,char_code,shift,ctrl,alt){if(this.visible&&this.autoAutoScroll){var step=(shift||ctrl?40:10);var dx,dy;dx=dy=0;switch(char_code){case 37:dx=-step;break;case 38:dy=-step;break;case 39:dx=step;break;case 40:dy=step;break;}
if(this.moveBy(dx,dy))
return pdcore.events.preventBubble(evt);}},moveBy:function(dx,dy){var res=false;if(this.visible){if(dx){if(this.scroll_horizontal&&pdcore.isVisible(this.scroll_horizontal)){this.horizontalMoveBy(dx);res=true;}}
if(dy){if(this.scroll_vertical&&pdcore.isVisible(this.scroll_vertical)){this.verticalMoveBy(dy);res=true;}}}
return res;},update:function(){var t=this;if(!t.scroll_vertical||!t.scroll_horizontal)
return;var hVisible,vVisible;if(!t.visible){hVisible=vVisible=false;}else{var p=t.panel,px=p.offsetLeft,py=p.offsetTop,pw=p.offsetWidth,ph=p.offsetHeight,c=t.container,w=c.offsetWidth,h=c.offsetHeight,hEnabled=pw>w,vEnabled=ph>h;hVisible=hEnabled;vVisible=vEnabled;t.scroll_horizontal.style.display=(hVisible?"":"none");t.scroll_vertical.style.display=(vVisible?"":"none");var scroll_w=(vVisible?t.scroll_vertical.offsetWidth:2);var scroll_h=(hVisible?t.scroll_horizontal.offsetHeight:2);if(vVisible){var verticaleScrollTopOffset=t.verticaleScrollTopOffset||0,verticaleScrollLeftOffset=t.verticaleScrollLeftOffset||0;var _h=h-scroll_h-verticaleScrollTopOffset;if(_h<=0){vVisible=false;}else{t.scroll_vertical.style.top=verticaleScrollTopOffset;t.scroll_vertical.style.height=_h;t.vertical_min=t.scroll_vertical_top.offsetTop+t.scroll_vertical_top.offsetHeight;t.vertical_max=t.scroll_vertical_bottom.offsetTop;var scrollspot=t.vertical_max-t.vertical_min,levminsize=Math.min(30,scrollspot),frames=ph/h,levsize=Math.max(scrollspot/frames,levminsize);t.scroll_vertical_lev.style.height=levsize;t.vertical_max-=t.scroll_vertical_lev.offsetHeight;t.vertical_size=scrollspot=t.vertical_max-t.vertical_min;var levpos;if(py>=0){levpos=t.vertical_min;}else{levpos=t.vertical_min+Math.min(t.vertical_max,-1*py*scrollspot/(ph-h));}
t.scroll_vertical_lev.style.top=levpos;t.vertical_arrow_delta=0.1*levsize;t.vertical_baseclick_delta=0.9*levsize;}}
if(hVisible){var _w=w-scroll_w;if(_w<=0){hVisible=false;}else{t.scroll_horizontal.style.width=_w;t.horizontal_min=t.scroll_horizontal_left.offsetLeft+t.scroll_horizontal_left.offsetWidth;t.horizontal_max=t.scroll_horizontal_right.offsetLeft;var levsize;var scrollspot=t.horizontal_max-t.horizontal_min;var levminsize=Math.min(30,scrollspot);var frames=pw/w;levsize=Math.max(scrollspot/frames,levminsize);t.scroll_horizontal_lev.style.width=levsize;t.horizontal_max-=t.scroll_horizontal_lev.offsetWidth;t.horizontal_size=scrollspot=t.horizontal_max-t.horizontal_min;var levpos;if(px>=0){levpos=t.horizontal_min;}else{levpos=t.horizontal_min+Math.min(t.horizontal_max,-1*px*scrollspot/(pw-w));}
pdcore.setX(t.scroll_horizontal_lev,levpos);t.horizontal_arrow_delta=0.1*levsize;t.horizontal_baseclick_delta=0.9*levsize;}}}
pdcore.setValIf(t.scroll_horizontal.style,"display",hVisible?"":"none");pdcore.setValIf(t.scroll_vertical.style,"display",vVisible?"":"none");},horizontalMoveBy:function(dx){var res=true;var x=this.scroll_horizontal_lev.offsetLeft+dx;if(x<this.horizontal_min){x=this.horizontal_min;res=false;}else if(x>this.horizontal_max){x=this.horizontal_max;res=false;}
pdcore.setX(this.scroll_horizontal_lev,x);if(this.autoMovePanel){var scale=(x-this.horizontal_min)/this.horizontal_size;pdcore.setX(this.panel,-1*scale*(this.panel.offsetWidth-this.container.offsetWidth));}
this._onmoving();return res;},verticalMoveBy:function(dy){var res=true;var y=this.scroll_vertical_lev.offsetTop+dy;if(y<this.vertical_min){y=this.vertical_min;res=false;}else if(y>this.vertical_max){y=this.vertical_max;res=false;}
pdcore.setY(this.scroll_vertical_lev,y);if(this.autoMovePanel){var scale=(y-this.vertical_min)/this.vertical_size;pdcore.setY(this.panel,-1*scale*(this.panel.offsetHeight-this.container.offsetHeight));}
this._onmoving();return res;},_onmoving:function(){if(this.onmovingcallback){try{this.onmovingcallback();}catch(E){}}
if(!this.inDrag&&this.onmovedcallback){try{this.onmovedcallback();}catch(E){}}},scrollLevDragStart:function(){this.inDrag=true;},scrollLevDragStop:function(eX,eY,dX,dY,elm,event){this.inDrag=false;if(this.onmovedcallback)
try{this.onmovedcallback();}catch(E){}
if(this.pendingMouseOut)
this.scrollOnMouseOut(event);},horizontalLevDragGo:function(eX,eY,dX,dY,t,e,dx,dy){this.horizontalMoveBy(dx);},verticalLevDragGo:function(eX,eY,dX,dY,t,e,dx,dy){this.verticalMoveBy(dy);},horizontalClick:function(evt){if(!Drag.inDrag){var lev=this.scroll_horizontal_lev;if(lev!=pdcore.events.getTarget(evt)){var levLeft=lev.offsetLeft;var levRight=levLeft+lev.offsetWidth;var evtX=pdcore.events.getOffsetXY(evt)[0];if(evtX<levLeft||evtX>levRight){this.horizontalMoveBy((evtX>levLeft?1:-1)*this.horizontal_baseclick_delta);}}
return pdcore.events.preventBubble(evt);}},verticalClick:function(evt){if(!Drag.inDrag){var lev=this.scroll_vertical_lev;if(lev!=pdcore.events.getTarget(evt)){var levTop=lev.offsetTop;var levBottom=levTop+lev.offsetHeight;var evtY=pdcore.events.getOffsetXY(evt)[1];if(evtY<levTop||evtY>levBottom){this.verticalMoveBy((evtY>levTop?1:-1)*this.vertical_baseclick_delta);}}
return pdcore.events.preventBubble(evt);}},scrollOnMouseOver:function(evt){var t=this;t.pendingMouseOut=false;if(t._parentNodeZIndex==undefined)
t._parentNodeZIndex=pdcore.getZ(t.scroll_horizontal.parentNode);pdcore.setZ(t.scroll_horizontal.parentNode,t.zIndex4onmouseover);pdcore.setZ(t.scrolls,t.zIndex4onmouseover);if(t.enableFadding){pdcore.setOpacity(t.scrolls,1);return pdcore.events.preventBubble(evt);}},scrollOnMouseOut:function(evt){var t=this;if(!t.inDrag){if(t._parentNodeZIndex)
pdcore.setZ(t.scroll_horizontal.parentNode,t._parentNodeZIndex);pdcore.setZ(t.scrolls,t.zIndex);if(t.enableFadding){pdcore.setOpacity(t.scrolls,0.5);return pdcore.events.preventBubble(evt);}}else
t.pendingMouseOut=true;},oncreated:function(){var t=this;pdcore.setZ(t.scrolls,t.zIndex);if(t.enableFadding)
pdcore.setOpacity(t.scrolls,1);},emptyEventHandler:function(evt){return pdcore.events.preventBubble(evt);}}
Scroll.Arrow=function(parent,elm,moveFunName,getDeltaFuncName,direction){var t=this;t.parent=parent;t.moveFunName=moveFunName;t.getDeltaFuncName=getDeltaFuncName;t.direction=direction;var evts=pdcore.events,leaveCallback=pdcore.getCallbackRef(t,t.onMouseLeave);evts.addEvent(elm,"mousedown",pdcore.getCallbackRef(t,t.onMouseDown));evts.addEvent(elm,"mouseup",pdcore.getCallbackRef(t,t.onMouseUp));evts.addEvent(elm,"mouseleave",leaveCallback);evts.addEvent(elm,"mouseout",leaveCallback);}
Scroll.Arrow.prototype={setTimer:function(){this.unsetTimer();try{if(!this._timerCallback)
this._timerCallback=pdcore.getCallbackRef(this,this.doMove);this._timer=setInterval(this._timerCallback,100);}catch(E){}},unsetTimer:function(){if(this._timer){try{clearInterval(this._timer);}catch(E){}
this._timer=0;}},doMove:function(){if(!this.parent[this.moveFunName](this.delta))
this.unsetTimer();},onMouseDown:function(evt){this.delta=this.direction*this.parent[this.getDeltaFuncName]();this.setTimer();return pdcore.events.preventBubble(evt);},onMouseUp:function(evt){this.unsetTimer();if(!Drag.inDrag){this.doMove();return pdcore.events.preventBubble(evt);}},onMouseLeave:function(evt){this.unsetTimer();}}