﻿Sys.UI.IDragSource=function(){}
Sys.UI.IDragSource.prototype={get_dragDataType:function(){throw Error.notImplemented();},getDragData:function(){throw Error.notImplemented();},get_dragMode:function(){throw Error.notImplemented();},onDragStart:function(){throw Error.notImplemented();},onDrag:function(){throw Error.notImplemented();},onDragEnd:function(){throw Error.notImplemented();}}
Sys.UI.IDragSource.registerInterface('Sys.UI.IDragSource');Sys.UI.IDropTarget=function(){}
Sys.UI.IDropTarget.prototype={get_dropTargetElement:function(){throw Error.notImplemented();},canDrop:function(){throw Error.notImplemented();},drop:function(){throw Error.notImplemented();},onDragEnterTarget:function(){throw Error.notImplemented();},onDragLeaveTarget:function(){throw Error.notImplemented();},onDragInTarget:function(){throw Error.notImplemented();}}
Sys.UI.IDropTarget.registerInterface('Sys.UI.IDropTarget');Sys.UI.DragMode=function(){throw Error.invalidOperation();}
Sys.UI.DragMode.prototype={Copy:0,Move:1}
Sys.UI.DragMode.registerEnum('Sys.UI.DragMode');Sys.UI.DragDropEventArgs=function(dragMode,dragDataType,dragData){this._dragMode=dragMode;this._dataType=dragDataType;this._data=dragData;}
Sys.UI.DragDropEventArgs.prototype={get_dragMode:function(){return this._dragMode||null;},get_dragDataType:function(){return this._dataType||null;},get_dragData:function(){return this._data||null;}}
Sys.UI.DragDropEventArgs.registerClass('Sys.UI.DragDropEventArgs');Sys.UI._DragDropManager=function(){this._instance=null;this._events=null;}
Sys.UI._DragDropManager.prototype={add_dragStart:function(handler){this.get_events().addHandler('dragStart',handler);},remove_dragStart:function(handler){this.get_events().removeHandler('dragStart',handler);},get_events:function(){if(!this._events){this._events=new Sys.EventHandlerList();} return this._events;},add_dragStop:function(handler){this.get_events().addHandler('dragStop',handler);},remove_dragStop:function(handler){this.get_events().removeHandler('dragStop',handler);},_getInstance:function(){if(!this._instance){if(Sys.Browser.isIE){this._instance=new Sys.UI.IEDragDropManager();} else{this._instance=new Sys.UI.GenericDragDropManager();} this._instance.initialize();this._instance.add_dragStart(Function.createDelegate(this,this._raiseDragStart));this._instance.add_dragStop(Function.createDelegate(this,this._raiseDragStop));} return this._instance;},startDragDrop:function Sys$UI$_DragDropManager$startDragDrop(dragSource,dragVisual,context){this._getInstance().startDragDrop(dragSource,dragVisual,context);},registerDropTarget:function(target){this._getInstance().registerDropTarget(target);},unregisterDropTarget:function(target){this._getInstance().unregisterDropTarget(target);},dispose:function(){delete this._events;},_raiseDragStart:function(sender,eventArgs){var handler=this.get_events().getHandler('dragStart');if(handler){handler(this,eventArgs);}},_raiseDragStop:function(sender,eventArgs){var handler=this.get_events().getHandler('dragStop');if(handler){handler(this,eventArgs);}}}
Sys.UI._DragDropManager.registerClass('Sys.UI._DragDropManager');Sys.UI.DragDropManager=new Sys.UI._DragDropManager();Sys.UI.IEDragDropManager=function(){Sys.UI.IEDragDropManager.initializeBase(this);this._dropTargets=null;this._radius=10;this._activeDragVisual=null;this._activeContext=null;this._activeDragSource=null;this._underlyingTarget=null;this._oldOffset=null;this._potentialTarget=null;this._isDragging=false;this._mouseUpHandler=null;this._documentMouseMoveHandler=null;this._documentDragOverHandler=null;this._dragStartHandler=null;this._mouseMoveHandler=null;this._dragEnterHandler=null;this._dragLeaveHandler=null;this._dragOverHandler=null;this._dropHandler=null;}
Sys.UI.IEDragDropManager.prototype={add_dragStart:function(handler){this.get_events().addHandler("dragStart",handler);},remove_dragStart:function(handler){this.get_events().removeHandler("dragStart",handler);},add_dragStop:function(handler){this.get_events().addHandler("dragStop",handler);},remove_dragStop:function(handler){this.get_events().removeHandler("dragStop",handler);},initialize:function(){Sys.UI.IEDragDropManager.callBaseMethod(this,'initialize');this._mouseUpHandler=Function.createDelegate(this,this._onMouseUp);this._documentMouseMoveHandler=Function.createDelegate(this,this._onDocumentMouseMove);this._documentDragOverHandler=Function.createDelegate(this,this._onDocumentDragOver);this._dragStartHandler=Function.createDelegate(this,this._onDragStart);this._mouseMoveHandler=Function.createDelegate(this,this._onMouseMove);this._dragEnterHandler=Function.createDelegate(this,this._onDragEnter);this._dragLeaveHandler=Function.createDelegate(this,this._onDragLeave);this._dragOverHandler=Function.createDelegate(this,this._onDragOver);this._dropHandler=Function.createDelegate(this,this._onDrop);},dispose:function(){if(this._dropTargets){for(var i=0;i<this._dropTargets;i++){this.unregisterDropTarget(this._dropTargets[i]);} this._dropTargets=null;} Sys.UI.IEDragDropManager.callBaseMethod(this,'dispose');},startDragDrop:function Sys$UI$IEDragDropManager$startDragDrop(dragSource,dragVisual,context){var ev=window._event;if(this._isDragging){return;} this._underlyingTarget=null;this._activeDragSource=dragSource;this._activeDragVisual=dragVisual;this._activeContext=context;var mousePosition={x:ev.clientX,y:ev.clientY};dragVisual.originalPosition=dragVisual.style.position;dragVisual.style.position="absolute";document._lastPosition=mousePosition;dragVisual.startingPoint=mousePosition;var scrollOffset=this.getScrollOffset(dragVisual,true);dragVisual.startingPoint=this.addPoints(dragVisual.startingPoint,scrollOffset);if(dragVisual.style.position=="absolute"){dragVisual.startingPoint=this.subtractPoints(dragVisual.startingPoint,$common.getLocation(dragVisual));} else{var left=parseInt(dragVisual.style.left);var top=parseInt(dragVisual.style.top);if(isNaN(left))left="0";if(isNaN(top))top="0";dragVisual.startingPoint=this.subtractPoints(dragVisual.startingPoint,{x:left,y:top});} this._prepareForDomChanges();dragSource.onDragStart();var eventArgs=new Sys.UI.DragDropEventArgs(dragSource.get_dragMode(),dragSource.get_dragDataType(),dragSource.getDragData(context));var handler=this.get_events().getHandler('dragStart');if(handler)handler(this,eventArgs);this._recoverFromDomChanges();this._wireEvents();this._drag(true);},_stopDragDrop:function(cancelled){var ev=window._event;if(this._activeDragSource!=null){this._unwireEvents();if(!cancelled){cancelled=(this._underlyingTarget==null);} if(!cancelled&&this._underlyingTarget!=null){this._underlyingTarget.drop(this._activeDragSource.get_dragMode(),this._activeDragSource.get_dragDataType(),this._activeDragSource.getDragData(this._activeContext));} this._activeDragSource.onDragEnd(cancelled);var handler=this.get_events().getHandler('dragStop');if(handler)handler(this,Sys.EventArgs.Empty);this._activeDragVisual.style.position=this._activeDragVisual.originalPosition;this._activeDragSource=null;this._activeContext=null;this._activeDragVisual=null;this._isDragging=false;this._potentialTarget=null;ev.preventDefault();}},_drag:function Sys$UI$IEDragDropManager$_drag(isInitialDrag){var ev=window._event;var mousePosition={x:ev.clientX,y:ev.clientY};document._lastPosition=mousePosition;var scrollOffset=this.getScrollOffset(this._activeDragVisual,true);var position=this.addPoints(this.subtractPoints(mousePosition,this._activeDragVisual.startingPoint),scrollOffset);if(!isInitialDrag&&parseInt(this._activeDragVisual.style.left)==position.x&&parseInt(this._activeDragVisual.style.top)==position.y){return;} $common.setLocation(this._activeDragVisual,position);this._prepareForDomChanges();this._activeDragSource.onDrag();this._recoverFromDomChanges();this._potentialTarget=this._findPotentialTarget(this._activeDragSource,this._activeDragVisual);var movedToOtherTarget=(this._potentialTarget!=this._underlyingTarget||this._potentialTarget==null);if(movedToOtherTarget&&this._underlyingTarget!=null){this._leaveTarget(this._activeDragSource,this._underlyingTarget);} if(this._potentialTarget!=null){if(movedToOtherTarget){this._underlyingTarget=this._potentialTarget;this._enterTarget(this._activeDragSource,this._underlyingTarget);} else{this._moveInTarget(this._activeDragSource,this._underlyingTarget);}} else{this._underlyingTarget=null;}},_wireEvents:function(){$addHandler(document,"mouseup",this._mouseUpHandler);$addHandler(document,"mousemove",this._documentMouseMoveHandler);$addHandler(document.body,"dragover",this._documentDragOverHandler);$addHandler(this._activeDragVisual,"dragstart",this._dragStartHandler);$addHandler(this._activeDragVisual,"dragend",this._mouseUpHandler);$addHandler(this._activeDragVisual,"drag",this._mouseMoveHandler);},_unwireEvents:function(){$removeHandler(this._activeDragVisual,"drag",this._mouseMoveHandler);$removeHandler(this._activeDragVisual,"dragend",this._mouseUpHandler);$removeHandler(this._activeDragVisual,"dragstart",this._dragStartHandler);$removeHandler(document.body,"dragover",this._documentDragOverHandler);$removeHandler(document,"mousemove",this._documentMouseMoveHandler);$removeHandler(document,"mouseup",this._mouseUpHandler);},registerDropTarget:function(dropTarget){if(this._dropTargets==null){this._dropTargets=[];} Array.add(this._dropTargets,dropTarget);this._wireDropTargetEvents(dropTarget);},unregisterDropTarget:function(dropTarget){this._unwireDropTargetEvents(dropTarget);if(this._dropTargets){Array.remove(this._dropTargets,dropTarget);}},_wireDropTargetEvents:function(dropTarget){var associatedElement=dropTarget.get_dropTargetElement();associatedElement._dropTarget=dropTarget;$addHandler(associatedElement,"dragenter",this._dragEnterHandler);$addHandler(associatedElement,"dragleave",this._dragLeaveHandler);$addHandler(associatedElement,"dragover",this._dragOverHandler);$addHandler(associatedElement,"drop",this._dropHandler);},_unwireDropTargetEvents:function(dropTarget){var associatedElement=dropTarget.get_dropTargetElement();if(associatedElement._dropTarget){associatedElement._dropTarget=null;$removeHandler(associatedElement,"dragenter",this._dragEnterHandler);$removeHandler(associatedElement,"dragleave",this._dragLeaveHandler);$removeHandler(associatedElement,"dragover",this._dragOverHandler);$removeHandler(associatedElement,"drop",this._dropHandler);}},_onDragStart:function(ev){window._event=ev;document.selection.empty();var dt=ev.dataTransfer;if(!dt&&ev.rawEvent)dt=ev.rawEvent.dataTransfer;var dataType=this._activeDragSource.get_dragDataType().toLowerCase();var data=this._activeDragSource.getDragData(this._activeContext);if(data){if(dataType!="text"&&dataType!="url"){dataType="text";if(data.innerHTML!=null){data=data.innerHTML;}} dt.effectAllowed="move";dt.setData(dataType,data.toString());}},_onMouseUp:function(ev){window._event=ev;this._stopDragDrop(false);},_onDocumentMouseMove:function Sys$UI$IEDragDropManager$_onDocumentMouseMove(ev){window._event=ev;this._dragDrop();},_onDocumentDragOver:function(ev){window._event=ev;if(this._potentialTarget)ev.preventDefault();},_onMouseMove:function Sys$UI$IEDragDropManager$_onMouseMove(ev){window._event=ev;this._drag();},_onDragEnter:function(ev){window._event=ev;if(this._isDragging){ev.preventDefault();} else{var dataObjects=Sys.UI.IEDragDropManager._getDataObjectsForDropTarget(this._getDropTarget(ev.target));for(var i=0;i<dataObjects.length;i++){this._dropTarget.onDragEnterTarget(Sys.UI.DragMode.Copy,dataObjects[i].type,dataObjects[i].value);}}},_onDragLeave:function(ev){window._event=ev;if(this._isDragging){ev.preventDefault();} else{var dataObjects=Sys.UI.IEDragDropManager._getDataObjectsForDropTarget(this._getDropTarget(ev.target));for(var i=0;i<dataObjects.length;i++){this._dropTarget.onDragLeaveTarget(Sys.UI.DragMode.Copy,dataObjects[i].type,dataObjects[i].value);}}},_onDragOver:function(ev){window._event=ev;if(this._isDragging){ev.preventDefault();} else{var dataObjects=Sys.UI.IEDragDropManager._getDataObjectsForDropTarget(this._getDropTarget(ev.target));for(var i=0;i<dataObjects.length;i++){this._dropTarget.onDragInTarget(Sys.UI.DragMode.Copy,dataObjects[i].type,dataObjects[i].value);}}},_onDrop:function(ev){window._event=ev;if(!this._isDragging){var dataObjects=Sys.UI.IEDragDropManager._getDataObjectsForDropTarget(this._getDropTarget(ev.target));for(var i=0;i<dataObjects.length;i++){this._dropTarget.drop(Sys.UI.DragMode.Copy,dataObjects[i].type,dataObjects[i].value);}} ev.preventDefault();},_getDropTarget:function(element){while(element){if(element._dropTarget!=null){return element._dropTarget;} element=element.parentNode;} return null;},_dragDrop:function Sys$UI$IEDragDropManager$_dragDrop(){if(this._isDragging){return;} this._isDragging=true;this._activeDragVisual.dragDrop();document.selection.empty();},_moveInTarget:function(dragSource,dropTarget){this._prepareForDomChanges();dropTarget.onDragInTarget(dragSource.get_dragMode(),dragSource.get_dragDataType(),dragSource.getDragData(this._activeContext));this._recoverFromDomChanges();},_enterTarget:function(dragSource,dropTarget){this._prepareForDomChanges();dropTarget.onDragEnterTarget(dragSource.get_dragMode(),dragSource.get_dragDataType(),dragSource.getDragData(this._activeContext));this._recoverFromDomChanges();},_leaveTarget:function(dragSource,dropTarget){this._prepareForDomChanges();dropTarget.onDragLeaveTarget(dragSource.get_dragMode(),dragSource.get_dragDataType(),dragSource.getDragData(this._activeContext));this._recoverFromDomChanges();},_findPotentialTarget:function Sys$UI$IEDragDropManager$_findPotentialTarget(dragSource,dragVisual){var ev=window._event;if(this._dropTargets==null){return null;} var type=dragSource.get_dragDataType();var mode=dragSource.get_dragMode();var data=dragSource.getDragData(this._activeContext);var scrollOffset=this.getScrollOffset(document.body,true);var x=ev.clientX+scrollOffset.x;var y=ev.clientY+scrollOffset.y;var cursorRect={x:x-this._radius,y:y-this._radius,width:this._radius*2,height:this._radius*2};var targetRect;for(var i=0;i<this._dropTargets.length;i++){targetRect=$common.getBounds(this._dropTargets[i].get_dropTargetElement());if($common.overlaps(cursorRect,targetRect)&&this._dropTargets[i].canDrop(mode,type,data)){return this._dropTargets[i];}} return null;},_prepareForDomChanges:function(){this._oldOffset=$common.getLocation(this._activeDragVisual);},_recoverFromDomChanges:function(){var newOffset=$common.getLocation(this._activeDragVisual);if(this._oldOffset.x!=newOffset.x||this._oldOffset.y!=newOffset.y){this._activeDragVisual.startingPoint=this.subtractPoints(this._activeDragVisual.startingPoint,this.subtractPoints(this._oldOffset,newOffset));scrollOffset=this.getScrollOffset(this._activeDragVisual,true);var position=this.addPoints(this.subtractPoints(document._lastPosition,this._activeDragVisual.startingPoint),scrollOffset);$common.setLocation(this._activeDragVisual,position);}},addPoints:function(p1,p2){return{x:p1.x+p2.x,y:p1.y+p2.y};},subtractPoints:function(p1,p2){return{x:p1.x-p2.x,y:p1.y-p2.y};},getScrollOffset:function(element,recursive){var left=element.scrollLeft;var top=element.scrollTop;if(recursive){var parent=element.parentNode;while(parent!=null&&parent.scrollLeft!=null){left+=parent.scrollLeft;top+=parent.scrollTop;if(parent==document.body&&(left!=0&&top!=0))break;parent=parent.parentNode;}} return{x:left,y:top};},getBrowserRectangle:function(){var width=window.innerWidth;var height=window.innerHeight;if(width==null){width=document.body.clientWidth;} if(height==null){height=document.body.clientHeight;} return{x:0,y:0,width:width,height:height};},getNextSibling:function(item){for(item=item.nextSibling;item!=null;item=item.nextSibling){if(item.innerHTML!=null){return item;}} return null;},hasParent:function(element){return(element.parentNode!=null&&element.parentNode.tagName!=null);}}
Sys.UI.IEDragDropManager.registerClass('Sys.UI.IEDragDropManager',Sys.Component);Sys.UI.IEDragDropManager._getDataObjectsForDropTarget=function(dropTarget){if(dropTarget==null){return[];} var ev=window._event;var dataObjects=[];var dataTypes=["URL","Text"];var data;for(var i=0;i<dataTypes.length;i++){var dt=ev.dataTransfer;if(!dt&&ev.rawEvent)dt=ev.rawEvent.dataTransfer;data=dt.getData(dataTypes[i]);if(dropTarget.canDrop(Sys.UI.DragMode.Copy,dataTypes[i],data)){if(data){Array.add(dataObjects,{type:dataTypes[i],value:data});}}} return dataObjects;}
Sys.UI.GenericDragDropManager=function(){Sys.UI.GenericDragDropManager.initializeBase(this);this._dropTargets=null;this._scrollEdgeConst=40;this._scrollByConst=10;this._scroller=null;this._scrollDeltaX=0;this._scrollDeltaY=0;this._activeDragVisual=null;this._activeContext=null;this._activeDragSource=null;this._oldOffset=null;this._potentialTarget=null;this._mouseUpHandler=null;this._mouseMoveHandler=null;this._keyPressHandler=null;this._scrollerTickHandler=null;}
Sys.UI.GenericDragDropManager.prototype={initialize:function(){Sys.UI.GenericDragDropManager.callBaseMethod(this,"initialize");this._mouseUpHandler=Function.createDelegate(this,this._onMouseUp);this._mouseMoveHandler=Function.createDelegate(this,this._onMouseMove);this._keyPressHandler=Function.createDelegate(this,this._onKeyPress);this._scrollerTickHandler=Function.createDelegate(this,this._onScrollerTick);if(Sys.Browser.isSafari){Sys.UI.GenericDragDropManager.__loadSafariCompatLayer(this);} this._scroller=new Sys.Timer();this._scroller.set_interval(10);this._scroller.add_tick(this._scrollerTickHandler);},startDragDrop:function(dragSource,dragVisual,context){this._activeDragSource=dragSource;this._activeDragVisual=dragVisual;this._activeContext=context;Sys.UI.GenericDragDropManager.callBaseMethod(this,"startDragDrop",[dragSource,dragVisual,context]);},_stopDragDrop:function(cancelled){this._scroller.set_enabled(false);Sys.UI.GenericDragDropManager.callBaseMethod(this,"_stopDragDrop",[cancelled]);},_drag:function(isInitialDrag){Sys.UI.GenericDragDropManager.callBaseMethod(this,"_drag",[isInitialDrag]);this._autoScroll();},_wireEvents:function(){$addHandler(document,"mouseup",this._mouseUpHandler);$addHandler(document,"mousemove",this._mouseMoveHandler);$addHandler(document,"keypress",this._keyPressHandler);},_unwireEvents:function(){$removeHandler(document,"keypress",this._keyPressHandler);$removeHandler(document,"mousemove",this._mouseMoveHandler);$removeHandler(document,"mouseup",this._mouseUpHandler);},_wireDropTargetEvents:function(dropTarget){},_unwireDropTargetEvents:function(dropTarget){},_onMouseUp:function(e){window._event=e;this._stopDragDrop(false);},_onMouseMove:function(e){window._event=e;this._drag();},_onKeyPress:function(e){window._event=e;var k=e.keyCode?e.keyCode:e.rawEvent.keyCode;if(k==27){this._stopDragDrop(true);}},_autoScroll:function(){var ev=window._event;var browserRect=this.getBrowserRectangle();if(browserRect.width>0){this._scrollDeltaX=this._scrollDeltaY=0;if(ev.clientX<browserRect.x+this._scrollEdgeConst)this._scrollDeltaX=-this._scrollByConst;else if(ev.clientX>browserRect.width-this._scrollEdgeConst)this._scrollDeltaX=this._scrollByConst;if(ev.clientY<browserRect.y+this._scrollEdgeConst)this._scrollDeltaY=-this._scrollByConst;else if(ev.clientY>browserRect.height-this._scrollEdgeConst)this._scrollDeltaY=this._scrollByConst;if(this._scrollDeltaX!=0||this._scrollDeltaY!=0){this._scroller.set_enabled(true);} else{this._scroller.set_enabled(false);}}},_onScrollerTick:function(){var oldLeft=document.body.scrollLeft;var oldTop=document.body.scrollTop;window.scrollBy(this._scrollDeltaX,this._scrollDeltaY);var newLeft=document.body.scrollLeft;var newTop=document.body.scrollTop;var dragVisual=this._activeDragVisual;var position={x:parseInt(dragVisual.style.left)+(newLeft-oldLeft),y:parseInt(dragVisual.style.top)+(newTop-oldTop)};$common.setLocation(dragVisual,position);}}
Sys.UI.GenericDragDropManager.registerClass('Sys.UI.GenericDragDropManager',Sys.UI.IEDragDropManager);if(Sys.Browser.isSafari){Sys.UI.GenericDragDropManager.__loadSafariCompatLayer=function(ddm){ddm._getScrollOffset=ddm.getScrollOffset;ddm.getScrollOffset=function(element,recursive){return{x:0,y:0};};ddm._getBrowserRectangle=ddm.getBrowserRectangle;ddm.getBrowserRectangle=function(){var browserRect=ddm._getBrowserRectangle();var offset=ddm._getScrollOffset(document.body,true);return{x:browserRect.x+offset.x,y:browserRect.y+offset.y,width:browserRect.width+offset.x,height:browserRect.height+offset.y};};}}
Sys.UI.Controls.DragDropBehavior=function(element){Sys.UI.Controls.DragDropBehavior.initializeBase(this,[element]);this._handle=null;this._mouseDownHandler=Function.createDelegate(this,this._doMouseDown);this._selectstartHandler=Function.createDelegate(this,this._onSelectStart);this._selectstartPending=false;this._dragVisual=null;this._dropFocus=null;}
Sys.UI.Controls.DragDropBehavior.prototype={initialize:function(){Sys.UI.Controls.DragDropBehavior.callBaseMethod(this,'initialize');this._init();Sys.UI.DragDropManager.registerDropTarget(this);},dispose:function(){if(this._mouseDownHandler){var handle=this.get_handle();$common.removeMouseDownHandler(handle,this._mouseDownHandler);this._mouseDownHandler=null;} this._handle=null;this._dragVisual=null;this._dropFocus=null;Sys.UI.DragDropManager.unregisterDropTarget(this);Sys.UI.Controls.DragDropBehavior.callBaseMethod(this,'dispose');},get_handle:function(){var answer=this._handle;return answer?answer:this.get_element();},set_handle:function(value){if(this._handle!=null){$common.removeMouseDownHandler(this._handle,this._mouseDownHandler);} this._handle=value;this._init();},_init:function(){var handle=this.get_handle();$common.addMouseDownHandler(handle,this._mouseDownHandler);},_doMouseDown:function Sys$UI$Controls$DragDropBehavior$_doMouseDown(e){window._event=e;e.preventDefault();if(!this._dragVisual){this._dragVisual=this._createDragVisual();} this._initDragVisual();if(!this._selectstartPending){$common.addSelectStartHandler(document,this._selectstartHandler);this._selectstartPending=true;} Sys.UI.DragDropManager.startDragDrop(this,this._dragVisual,null);},_onSelectStart:function(e){e.preventDefault();},_createDragVisual:function(){var div=$common.createDiv();var style=div.style;style.border="1px solid red";style.backgroundColor="#FFF4FB";Sys.UI.DomElement.setOpacity(div,50);document.body.appendChild(div);return div;},_initDragVisual:function(){var div=this._dragVisual;var element=this.get_element();var r=Sys.UI.DomElement.getBounds(element);$common.setPosition(div,r.x,r.y,r.width,r.height);div.style.zIndex=Sys.Application.getActiveFormZIndex()+2;$common.setDisplay(div,true);},_setDropFocus:function(visible){var div=this._dropFocus;if(!div){div=this._dropFocus=$common.createDiv();var style=div.style;style.border="1px dashed blue";Sys.UI.DomElement.setOpacity(div,50);document.body.appendChild(div);} var element=this.get_element();var r=Sys.UI.DomElement.getBounds(element);var sizeOffset=-1;$common.setPosition(div,r.x,r.y,r.width+sizeOffset,r.height+sizeOffset);div.style.zIndex=Sys.Application.getActiveFormZIndex()+1;$common.setDisplay(div,visible);},get_dragDataType:function(){return'HTML';},getDragData:function(context){return this;},get_dragMode:function(){return Sys.UI.DragMode.Move;},onDragStart:function(){},onDrag:function(){},onDragEnd:function(cancelled){$common.setDisplay(this._dragVisual,false);if(this._selectstartPending){$common.removeSelectStartHandler(document,this._selectstartHandler);this._selectstartPending=false;}},get_dropTargetElement:function(){return this.get_element();},canDrop:function(dragMode,dataType,data){return dataType=='HTML'&&this.doGetCanDrop(data);},doGetCanDrop:function(sender){return true;},drop:function(dragMode,dataType,data){var sender=data;if(sender!=this){this._setDropFocus(false);this.doDrop(sender);}},doDrop:function(sender){var senderElement=sender.get_element();element=this.get_element();element.parentNode.insertBefore(senderElement,element);},onDragEnterTarget:function(dragMode,dataType,data){if(data!=this){this._setDropFocus(true);}},onDragLeaveTarget:function(dragMode,dataType,data){if(data!=this){this._setDropFocus(false);}},onDragInTarget:function(dragMode,dataType,data){}}
Sys.UI.Controls.DragDropBehavior.registerClass('Sys.UI.Controls.DragDropBehavior',Sys.UI.Behavior,Sys.UI.IDragSource,Sys.UI.IDropTarget);Sys.UI.DomHelper=function(){var tempTableEl=null;var tableRe=/^table|tbody|tr|td$/i;var ieTable=function(depth,s,h,e){tempTableEl.innerHTML=[s,h,e].join('');var i=-1,el=tempTableEl;while(++i<depth){el=el.firstChild;} return el;};var ts='<table>',te='</table>',tbs=ts+'<tbody>',tbe='</tbody>'+te,trs=tbs+'<tr>',tre='</tr>'+tbe;var insertIntoTable=function(tag,where,el,html){if(!tempTableEl){tempTableEl=document.createElement('div');} var node;var before=null;if(tag=='td'){if(where=='afterbegin'||where=='beforeend'){return;} if(where=='beforebegin'){before=el;el=el.parentNode;} else{before=el.nextSibling;el=el.parentNode;} node=ieTable(4,trs,html,tre);} else if(tag=='tr'){if(where=='beforebegin'){before=el;el=el.parentNode;node=ieTable(3,tbs,html,tbe);} else if(where=='afterend'){before=el.nextSibling;el=el.parentNode;node=ieTable(3,tbs,html,tbe);} else{if(where=='afterbegin'){before=el.firstChild;} node=ieTable(4,trs,html,tre);}} else if(tag=='tbody'){if(where=='beforebegin'){before=el;el=el.parentNode;node=ieTable(2,ts,html,te);} else if(where=='afterend'){before=el.nextSibling;el=el.parentNode;node=ieTable(2,ts,html,te);} else{if(where=='afterbegin'){before=el.firstChild;} node=ieTable(3,tbs,html,tbe);}} else{if(where=='beforebegin'||where=='afterend'){return;} if(where=='afterbegin'){before=el.firstChild;} node=ieTable(2,ts,html,te);} el.insertBefore(node,before);return node;};return{insertHtml:function(where,el,html){where=where.toLowerCase();if(el.insertAdjacentHTML){if(tableRe.test(el.tagName)){var rs;if(rs=insertIntoTable(el.tagName.toLowerCase(),where,el,html)){return rs;}} switch(where){case"beforebegin":el.insertAdjacentHTML('BeforeBegin',html);return el.previousSibling;case"afterbegin":el.insertAdjacentHTML('AfterBegin',html);return el.firstChild;case"beforeend":el.insertAdjacentHTML('BeforeEnd',html);return el.lastChild;case"afterend":el.insertAdjacentHTML('AfterEnd',html);return el.nextSibling;} throw'Illegal insertion point -> "'+where+'"';} var range=el.ownerDocument.createRange();var frag;switch(where){case"beforebegin":range.setStartBefore(el);frag=range.createContextualFragment(html);el.parentNode.insertBefore(frag,el);return el.previousSibling;case"afterbegin":if(el.firstChild){range.setStartBefore(el.firstChild);frag=range.createContextualFragment(html);el.insertBefore(frag,el.firstChild);return el.firstChild;}else{el.innerHTML=html;return el.firstChild;} case"beforeend":if(el.lastChild){range.setStartAfter(el.lastChild);frag=range.createContextualFragment(html);el.appendChild(frag);return el.lastChild;}else{el.innerHTML=html;return el.lastChild;} case"afterend":range.setStartAfter(el);frag=range.createContextualFragment(html);el.parentNode.insertBefore(frag,el.nextSibling);return el.nextSibling;} throw'Illegal insertion point -> "'+where+'"';}};}();function _setDetailVisible(div,element,visible){var style=div.style;style.backgroundRepeat="no-repeat";style.backgroundPosition="2px 2px";if(visible){element.style.display="";style.backgroundImage="url("+__skinBaseURI+"content/collapse.gif)";} else{element.style.display="none";style.backgroundImage="url("+__skinBaseURI+"content/expand.gif)";}}
function _toggle(div,id){var element=$get(id);_setDetailVisible(div,element,element.style.display=="none");}
Type.registerNamespace('Carpa.Web.Script');Carpa.Web.Script.ContentService=function(){Carpa.Web.Script.ContentService.initializeBase(this);}
Carpa.Web.Script.ContentService.prototype={get_path:function(){return $getRootURI()+"Carpa.Web/Carpa.Web.Script.ContentService.ajax";},ListViewAddRow:function(clientId,scriptPath,requestParams,rowData,fullUpdate,succeededCallback,failedCallback,userContext){return this._invoke('ListViewAddRow',{clientId:clientId,scriptPath:scriptPath,requestParams:requestParams,rowData:rowData,fullUpdate:fullUpdate},succeededCallback,failedCallback,userContext);},ListViewModifyRow:function(clientId,scriptPath,requestParams,rowData,fullUpdate,succeededCallback,failedCallback,userContext){return this._invoke('ListViewModifyRow',{clientId:clientId,scriptPath:scriptPath,requestParams:requestParams,rowData:rowData,fullUpdate:fullUpdate},succeededCallback,failedCallback,userContext);},ListViewExecuteRowCommand:function(clientId,scriptPath,requestParams,keyValue,command,rowData,fullUpdate,succeededCallback,failedCallback,userContext){return this._invoke('ListViewExecuteRowCommand',{clientId:clientId,scriptPath:scriptPath,requestParams:requestParams,keyValue:keyValue,command:command,rowData:rowData,fullUpdate:fullUpdate},succeededCallback,failedCallback,userContext);},ListViewDeleteRow:function(clientId,scriptPath,requestParams,keyValue,fullUpdate,otherParams,succeededCallback,failedCallback,userContext){return this._invoke('ListViewDeleteRow',{clientId:clientId,scriptPath:scriptPath,requestParams:requestParams,keyValue:keyValue,fullUpdate:fullUpdate,otherParams:otherParams},succeededCallback,failedCallback,userContext);},ListViewUpdatePage:function(clientId,scriptPath,requestParams,queryParams,pageIndex,succeededCallback,failedCallback,userContext){return this._invoke('ListViewUpdatePage',{clientId:clientId,scriptPath:scriptPath,requestParams:requestParams,queryParams:queryParams,pageIndex:pageIndex},succeededCallback,failedCallback,userContext);},CustomViewUpdateBody:function(clientId,scriptPath,requestParams,succeededCallback,failedCallback,userContext){return this._invoke('CustomViewUpdateBody',{clientId:clientId,scriptPath:scriptPath,requestParams:requestParams},succeededCallback,failedCallback,userContext);}}
Carpa.Web.Script.ContentService.registerClass('Carpa.Web.Script.ContentService',Sys.Net.WebServiceProxy);Type.registerNamespace('Sys.Content.Controls');Sys.Content.Controls.LinkButton=function(element){Sys.Content.Controls.LinkButton.initializeBase(this,[element]);this._requireMouseOver=true;this._requireMouseOut=true;this._requireClick=true;this._hintMenu=null;}
Sys.Content.Controls.LinkButton.prototype={initialize:function(){Sys.Content.Controls.LinkButton.callBaseMethod(this,'initialize');},dispose:function(){Sys.Content.Controls.LinkButton.callBaseMethod(this,'dispose');},get_text:function(){var element=this.get_element();return element?element.innerHTML:null;},set_text:function(value){var element=this.get_element();if(element){element.innerHTML=value;}},get_hintMenu:function(){return this._hintMenu;},set_hintMenu:function(value){this._hintMenu=value;},doClick:function Sys$UI$Controls$LinkButton$doClick(e){Sys.Content.Controls.LinkButton.callBaseMethod(this,'doClick',[e]);if(e){e.cancel();}},get_params:function(){var params={};var inputs=this.get_element().getElementsByTagName("INPUT");for(var i=0,count=inputs.length;i<count;i++){var input=inputs[i];params[input.name]=input.value;} return params;},doMouseOver:function(e){this._showHintMenu(e,true);},doMouseOut:function(e){this._showHintMenu(e,false);},_showHintMenu:function(e,visible){var hintMenuId=this.get_hintMenu();if(hintMenuId){var hintMenu=this.get_form()[hintMenuId];if(hintMenu){if(visible){var element=this.get_element();var p=Sys.UI.DomElement.getLocation(element);var x=p.x;var y=p.y+element.offsetHeight;hintMenu.show(e,element,x,y);} else{hintMenu.hide();}}}}}
Sys.Content.Controls.LinkButton.registerClass('Sys.Content.Controls.LinkButton',Sys.UI.Controls.Container);Sys.Content.Controls.ListViewEditEventArgs=function(rowIndex,key){Sys.Content.Controls.ListViewEditEventArgs.initializeBase(this);this._rowIndex=rowIndex;this._key=key;this._command=null;this._params=null;}
Sys.Content.Controls.ListViewEditEventArgs.prototype={get_key:function(){return this._key;},get_rowIndex:function(){return this._rowIndex;},get_command:function(){return this._command;},get_params:function(){return this._params;}}
Sys.Content.Controls.ListViewEditEventArgs.registerClass('Sys.Content.Controls.ListViewEditEventArgs',Sys.CancelEventArgs);Sys.Content.Controls.ListViewClickEventArgs=function(rowIndex,key,cellIndex){Sys.Content.Controls.ListViewClickEventArgs.initializeBase(this,[rowIndex,key]);this._cellIndex=cellIndex;}
Sys.Content.Controls.ListViewClickEventArgs.prototype={get_cellIndex:function(){return this._cellIndex;}}
Sys.Content.Controls.ListViewClickEventArgs.registerClass('Sys.Content.Controls.ListViewClickEventArgs',Sys.Content.Controls.ListViewEditEventArgs);Sys.Content.Controls.ListViewChangeEventArgs=function(rowIndex,fullUpdate){Sys.Content.Controls.ListViewChangeEventArgs.initializeBase(this);this._rowIndex=rowIndex;this._fullUpdate=fullUpdate;}
Sys.Content.Controls.ListViewChangeEventArgs.prototype={get_rowIndex:function(){return this._rowIndex;},get_fullUpdate:function(){return this._fullUpdate;}}
Sys.Content.Controls.ListViewChangeEventArgs.registerClass('Sys.Content.Controls.ListViewChangeEventArgs',Sys.EventArgs);Sys.Content.Controls.CustomView=function(element){Sys.Content.Controls.CustomView.initializeBase(this,[element]);this._contentService=null;}
Sys.Content.Controls.CustomView.prototype={initialize:function(){Sys.Content.Controls.CustomView.callBaseMethod(this,'initialize');},dispose:function(){this._contentService=null;Sys.Content.Controls.CustomView.callBaseMethod(this,'dispose');},_getContentService:function(){if(!this._contentService){this._contentService=new Carpa.Web.Script.ContentService();} return this._contentService;},refresh:function(){var service=this._getContentService();var form=this.get_form();service.CustomViewUpdateBody(this.get_id(),form.get_scriptPath(),form.get_params(),Function.createDelegate(this,function(result){this.doUpdateBody(result);}));},doUpdateBody:function(html){}}
Sys.Content.Controls.CustomView.registerClass('Sys.Content.Controls.CustomView',Sys.UI.Control);Sys.Content.Controls.CustomListView=function(element){Sys.Content.Controls.CustomListView.initializeBase(this,[element]);this._table=null;this._rows=null;this._pagerId=null;this._dataField=null;}
Sys.Content.Controls.CustomListView.prototype={initialize:function(){Sys.Content.Controls.CustomListView.callBaseMethod(this,'initialize');this.doInitRows();},dispose:function(){this.doClearRows();Sys.Content.Controls.CustomListView.callBaseMethod(this,'dispose');},get_dataField:function(){return this._dataField;},set_dataField:function(value){this._dataField=value;},doInitRows:function(){this._table=$common.getFirstChildByTagName(this.get_element(),"table");this._rows=$common.getTableBody(this._table);$common.addClickHandler(this._rows,this._rowsClick,this);$common.addDblClickHandler(this._rows,this._rowsDblClick,this);},doClearRows:function(){if(this._rows){$clearHandlers(this._rows);this._rows=null;} this._table=null;},doUpdateBody:function(html){if(!this._rows)return;this.doClearRows();this.get_element().innerHTML=html;this.doInitRows();},get_rowCount:function Sys$Content$Controls$GridView$get_rowCount(){return this._rows?this._rows.childNodes.length:0;},getRow:function Sys$Content$Controls$GridView$getRow(rowIndex){this._checkRowIndex(rowIndex);return this.doGetRow(rowIndex);},doGetRow:function(rowIndex){return this._rows.childNodes[rowIndex];},getRowDataKeyValue:function(rowIndex){var row=this.getRow(rowIndex);return this._getRowKeyValue(row);},_getRowKeyValue:function(row){var key=this.findRowKeyValue(row);if(!key){throw Error.invalidOperation("没有设置 DataKeyField，行取不到 _key 属性");} return key;},findRowKeyValue:function(row){return row.getAttribute("_key");},_checkRowIndex:function Sys$Content$Controls$GridView$_checkRowIndex(rowIndex){var count=this.get_rowCount();if(rowIndex<0||rowIndex>=count){throw Error.invalidOperation(String.format("行索引范围应为 [0-{0}]",count-1));}},appendRowData:function(rowData,fullUpdate,onSuccess){this.insertRowData(-1,rowData,fullUpdate,onSuccess);},insertRowData:function(rowIndex,rowData,fullUpdate,onSuccess){var rowCount=this.get_rowCount();if(rowIndex>=0&&rowCount>0){this._checkRowIndex(rowIndex);} var rows=this._rows;var service=this._getContentService();var pager=this.findPager();if(typeof(fullUpdate)==="undefined"||pager){fullUpdate=false;} var form=this.get_form();service.ListViewAddRow(this.get_id(),form.get_scriptPath(),form.get_params(),rowData,fullUpdate,Function.createDelegate(this,function(result){if(!fullUpdate){if(!pager){if(rowCount==0){Sys.UI.DomHelper.insertHtml("afterbegin",rows,result);} else if(rowIndex<0){Sys.UI.DomHelper.insertHtml("afterend",rows.childNodes[rowCount-1],result);} else{Sys.UI.DomHelper.insertHtml("beforebegin",rows.childNodes[rowIndex],result);} this.doInserted();} else{pager.refresh(null,onSuccess);}} else{this.doUpdateBody(result);} if(onSuccess&&!pager){onSuccess(this);}}));},doInserted:function(){},doModified:function(){},doDeleted:function(){},modifyRowData:function(rowIndex,rowData,fullUpdate,onSuccess){this._checkRowIndex(rowIndex);var service=this._getContentService();if(typeof(fullUpdate)==="undefined"){fullUpdate=false;} var form=this.get_form();service.ListViewModifyRow(this.get_id(),form.get_scriptPath(),form.get_params(),rowData,fullUpdate,Function.createDelegate(this,function(result){this._modifyRow(rowIndex,result,fullUpdate,onSuccess);}));},_modifyRow:function(rowIndex,result,fullUpdate,onSuccess){var row=this.doGetRow(rowIndex);var pager=null;if(!fullUpdate){this._doClearControls(row,true);Sys.UI.DomHelper.insertHtml("beforebegin",row,result);$removeNode(row);this.doModified();} else{this._doClearControls(this.get_element(),false);var pager=this.findPager();if(!pager){this.doUpdateBody(result);} else{pager.reloadPage(null,onSuccess);}} if(!pager&&onSuccess){onSuccess(this);} var eventArgs=new Sys.Content.Controls.ListViewChangeEventArgs(rowIndex,fullUpdate);this._doChange(eventArgs);},_doClearControls:function(parentElement,clear){if(clear){var control=parentElement.control;if(control){control.dispose();} var behaviors=parentElement._behaviors;if(behaviors){var count=behaviors.length;for(var i=count-1;i>=0;i--){var behavior=behaviors[i];behavior.dispose();}}} var childNodes=parentElement.childNodes;for(var i=0,count=childNodes.length;i<count;i++){var element=childNodes[i];this._doClearControls(element,true);}},executeRowCommand:function(rowIndex,key,command,rowData,fullUpdate,onSuccess){this._checkRowIndex(rowIndex);var service=this._getContentService();if(typeof(fullUpdate)==="undefined"){fullUpdate=false;} var form=this.get_form();service.ListViewExecuteRowCommand(this.get_id(),form.get_scriptPath(),form.get_params(),key,command,rowData,fullUpdate,Function.createDelegate(this,function(result){this._modifyRow(rowIndex,result,fullUpdate,onSuccess);}));},deleteRowData:function(rowIndex,key,fullUpdate,params,onSuccess){var row=this.doGetRow(rowIndex);if(!row)return;var service=this._getContentService();var pager=this.findPager();if(typeof(fullUpdate)==="undefined"||pager){fullUpdate=false;} if(typeof(params)==="undefined"){params=null;} if(key==null){this._doDelete(false,row,pager,null,onSuccess);} else{var form=this.get_form();service.ListViewDeleteRow(this.get_id(),form.get_scriptPath(),form.get_params(),key,fullUpdate,params,Function.createDelegate(this,function(result){this._doDelete(fullUpdate,row,pager,result,onSuccess);}));}},_doDelete:function(fullUpdate,row,pager,body,onSuccess){if(!fullUpdate){if(!pager){$removeNode(row);this.doDeleted();} else{var rowCount=this.get_rowCount();if(rowCount>=2){pager.reloadPage(null,onSuccess);} else{var pageIndex=pager.get_pageIndex();if(pageIndex>0){pageIndex--;} pager.reloadPage(pageIndex,onSuccess);}}} else{this.doUpdateBody(body);} if(onSuccess&&!pager){onSuccess(this);}},internalGetEventTargetRow:function(answer){while(true){if(answer==document.body){return null;} var isRow=answer.getAttribute("_isRow");if(isRow){return isRow?answer:null;} else if(answer.parentNode){answer=answer.parentNode;} else{return null;}}},_getEventTargetRow:function(e){return this.internalGetEventTargetRow(e.target);},getRowIndex:function(row){return Array.indexOf(this._rows.childNodes,row);},_rowsClick:function Sys$Content$Controls$CustomListView$_rowsClick(e){var row=this._getEventTargetRow(e);if(row){var key=this.findRowKeyValue(row);var rowIndex=this.getRowIndex(row);if(rowIndex<0){if(row.tagName=="TD"){rowIndex=this.getRowIndex(row.parentNode);} else{return;}} this.doRowClick(e,rowIndex,key,row);var element=e.target;var command=element.getAttribute("_command");if(!command&&element.parentNode){element=element.parentNode;command=element.getAttribute("_command");} if(command){var eventArgs=new Sys.Content.Controls.ListViewEditEventArgs(rowIndex,key);var params={};var inputs=element.getElementsByTagName("INPUT");for(var i=0,count=inputs.length;i<count;i++){var input=inputs[i];params[input.name]=input.value;} eventArgs._command=command;eventArgs._params=params;switch(command){case"Modify":this._doRowModify(eventArgs);break;case"Delete":this._doRowDelete(eventArgs);break;default:this._doRowCommand(eventArgs);break;}}}},doRowClick:function(e,rowIndex,key,row){},_rowsDblClick:function Sys$Content$Controls$CustomListView$_rowsDblClick(e){var row=this._getEventTargetRow(e);if(row){var key=this.findRowKeyValue(row);var rowIndex=this.getRowIndex(row);if(rowIndex<0){if(row.tagName=="TD"){rowIndex=this.getRowIndex(row.parentNode);} else{return;}} this.doRowDblClick(e,rowIndex,key,row);}},doRowDblClick:function(e,rowIndex,key,row){},add_rowModify:function(handler){this.get_events().addHandler("rowModify",handler);},remove_rowModify:function(handler){this.get_events().removeHandler("rowModify",handler);},_doRowModify:function(eventArgs){var handler=this.get_events().getHandler("rowModify");if(handler){handler(this,eventArgs);}},add_rowDelete:function(handler){this.get_events().addHandler("rowDelete",handler);},remove_rowDelete:function(handler){this.get_events().removeHandler("rowDelete",handler);},_doRowDelete:function(eventArgs){var handler=this.get_events().getHandler("rowDelete");if(handler){handler(this,eventArgs);}},add_rowCommand:function(handler){this.get_events().addHandler("rowCommand",handler);},remove_rowCommand:function(handler){this.get_events().removeHandler("rowCommand",handler);},_doRowCommand:function(eventArgs){var handler=this.get_events().getHandler("rowCommand");if(handler){handler(this,eventArgs);}},get_pagerId:function(){return this._pagerId;},set_pagerId:function(value){this._pagerId=value;},findPager:function(){var pagerId=this.get_pagerId();return pagerId?this.get_form()[pagerId]:null;},get_pager:function(){var pager=this.findPager();if(!pager){throw Error.invalidOperation("找不到默认Pager："+this.get_pagerId());} return pager;},doPageBeforeChanged:function(oldPageIndex){},doPageChanged:function(newPageIndex){},add_change:function(handler){this.get_events().addHandler("_change",handler);},remove_change:function(handler){this.get_events().removeHandler("_change",handler);},_doChange:function(eventArgs){var handler=this.get_events().getHandler("_change");if(handler){handler(this,eventArgs);}},getDetailView:function(rowIndex){var id=this.get_id()+"_view_"+rowIndex;var view=$find(id);if(!view){throw Error.invalidOperation("明细视图 "+id+" 不存在");} return view;}}
Sys.Content.Controls.CustomListView.registerClass('Sys.Content.Controls.CustomListView',Sys.Content.Controls.CustomView);Sys.Content.Controls.GridViewClickEventArgs=function(rowIndex,columnIndex,key,dataField,value){Sys.Content.Controls.GridViewClickEventArgs.initializeBase(this);this._rowIndex=rowIndex;this._columnIndex=columnIndex;this._key=key;this._dataField=dataField;this._value=value;}
Sys.Content.Controls.GridViewClickEventArgs.prototype={get_rowIndex:function(){return this._rowIndex;},get_columnIndex:function(){return this._columnIndex;},get_key:function(){return this._key;},get_dataField:function(){return this._dataField;},get_value:function(){return this._value;}}
Sys.Content.Controls.GridViewClickEventArgs.registerClass('Sys.Content.Controls.GridViewClickEventArgs',Sys.EventArgs);Sys.Content.Controls.GridViewColumnCommandEventArgs=function(columnIndex,dataField,command){Sys.Content.Controls.GridViewColumnCommandEventArgs.initializeBase(this);this._columnIndex=columnIndex;this._dataField=dataField;this._command=command;}
Sys.Content.Controls.GridViewColumnCommandEventArgs.prototype={get_columnIndex:function(){return this._columnIndex;},get_dataField:function(){return this._dataField;},get_command:function(){return this._command;}}
Sys.Content.Controls.GridViewColumnCommandEventArgs.registerClass('Sys.Content.Controls.GridViewColumnCommandEventArgs',Sys.EventArgs);Sys.Content.Controls.GridView=function(element){Sys.Content.Controls.GridView.initializeBase(this,[element]);this._floatHintColumnIndices=null;this._showHeader=false;this._floatHint=null;this._columnNames=[];this._columnVisibles=null;this._checkBoxColumnIndices=null;this._radioButtonColumnIndex=-1;this._commandColumnIndex=-1;this._rowNoColumnTextFormat=null;this._hintMenus=null;this._pageSelectedRowIndices=null;this._masterView=null;this._masterRowIndex=null;}
Sys.Content.Controls.GridView.prototype={initialize:function(){Sys.Content.Controls.GridView.callBaseMethod(this,'initialize');},dispose:function(){this._masterView=null;if(this._floatHint){this._floatHint.dispose();this._floatHint=null;} this._columnNames=null;this._columnVisibles=null;this._pageSelectedRowIndices=null;Sys.Content.Controls.GridView.callBaseMethod(this,'dispose');},get_showHeader:function(){return this._showHeader;},set_showHeader:function(value){this._showHeader=value;},get_columnNames:function(){return this._columnNames;},set_columnNames:function(value){this._columnNames=value;},getColumnDataField:function(columnIndex){var columnNames=this.get_columnNames();return columnNames&&columnIndex>=0&&columnIndex<columnNames.length?columnNames[columnIndex]:null;},get_floatHintColumnIndices:function(){return this._floatHintColumnIndices;},set_floatHintColumnIndices:function(value){this._floatHintColumnIndices=value;},get_checkBoxColumnIndices:function(){return this._checkBoxColumnIndices;},set_checkBoxColumnIndices:function(value){this._checkBoxColumnIndices=value;},get_radioButtonColumnIndex:function(){return this._radioButtonColumnIndex;},set_radioButtonColumnIndex:function(value){this._radioButtonColumnIndex=value;},get_commandColumnIndex:function(){return this._commandColumnIndex;},set_commandColumnIndex:function(value){this._commandColumnIndex=value;},get_rowNoColumnTextFormat:function(){return this._rowNoColumnTextFormat;},set_rowNoColumnTextFormat:function(value){this._rowNoColumnTextFormat=value;},get_hintMenus:function(){return this._hintMenus;},set_hintMenus:function(value){this._hintMenus=value;},doInitRows:function(){Sys.Content.Controls.GridView.callBaseMethod(this,'doInitRows');if(this.get_showHeader()){this._headerRow=$common.getTableHeader(this._table).firstChild;$common.addClickHandler(this._headerRow,this._headerRowClick,this);} this._initCommandColumn(true);this._initFloatHint(true);this._initHintMenus(true);},doClearRows:function(){Sys.Content.Controls.GridView.callBaseMethod(this,'doClearRows');if(this._headerRow){$clearHandlers(this._headerRow);this._headerRow=null;} this._initCommandColumn(false);this._initFloatHint(false);this._initHintMenus(false);},_headerRowClick:function(e){var element=e.target;var command=element.getAttribute("_command");if(!command&&element.parentNode){element=element.parentNode;command=element.getAttribute("_command");} if(command){var cell=element.parentNode.parentNode;var columnIndex=Array.indexOf(this._headerRow.childNodes,cell);var dataField=this.getColumnDataField(columnIndex);var eventArgs=new Sys.Content.Controls.GridViewColumnCommandEventArgs(columnIndex,dataField,command);this._doColumnCommand(eventArgs);}},get_columnCommandsVisible:function(){var headerRow=this._headerRow;if(headerRow){for(var i=0,columnCount=headerRow.childNodes.length;i<columnCount;i++){var td=headerRow.childNodes[i];var commands=$common.getFirstChildByTagName(td,"span");if(commands){return Sys.UI.DomElement.getVisible(commands);}}} return false;},set_columnCommandsVisible:function(value){var headerRow=this._headerRow;if(headerRow){for(var i=0,columnCount=headerRow.childNodes.length;i<columnCount;i++){var td=headerRow.childNodes[i];var commands=$common.getFirstChildByTagName(td,"span");if(commands){Sys.UI.DomElement.setVisible(commands,value);}}} return false;},add_columnCommand:function(handler){this.get_events().addHandler("columnCommand",handler);},remove_columnCommand:function(handler){this.get_events().removeHandler("columnCommand",handler);},_doColumnCommand:function(eventArgs){var handler=this.get_events().getHandler("columnCommand");if(handler){handler(this,eventArgs);}},_getFirstRowIndex:function(){return this.get_showHeader()?1:0;},get_recordCount:function(){return this.get_rowCount();},_refreshRowNoColumn:function(){var textFormat=this.get_rowNoColumnTextFormat();if(!textFormat)return;var rows=this._rows;for(var i=0,count=this.get_rowCount();i<count;i++){var row=rows.childNodes[i];var rowNo=String.format(textFormat,i+1);row.childNodes[0].innerHTML=rowNo;}},doInserted:function(){this._refreshRowNoColumn();this._checkExpandMasterRow();},doModified:function(){this._refreshRowNoColumn();},doDeleted:function(){this._refreshRowNoColumn();},_checkExpandMasterRow:function(){var masterView=this._masterView;var masterRowIndex=this._masterRowIndex;if(masterView&&masterRowIndex>=0){var row=masterView.getRow(masterRowIndex);var div=row.firstChild.firstChild;var row2=masterView.doGetRow(masterRowIndex+1);_setDetailVisible(div,row2,true);}},_initCommandColumn:function(init){var commandColumnIndex=this.get_commandColumnIndex();var table=this._table;if(commandColumnIndex<0||!table)return;if(init){$common.addMouseOverHandler(table,this._rowsMouseOver,this);$common.addMouseOutHandler(table,this._rowsMouseOut,this);} else{$clearHandlers(table);}},_rowsMouseOver:function(e){this._setCommandColumnVisible(e,true);},_rowsMouseOut:function(e){this._setCommandColumnVisible(e,false);},_setCommandColumnVisible:function(e,visible){var row=this._getEventTargetRow(e);var columnIndex=this.get_commandColumnIndex();if(row&&columnIndex>=0){var div=row.childNodes[columnIndex].firstChild;Sys.UI.DomElement.setVisible(div,visible);}},_initHintMenus:function(init){var rows=this._rows;var hintMenus=this.get_hintMenus();if(!hintMenus||!rows)return;var rowCount=this.get_rowCount();for(var i=0;i<rowCount;i++){var row=rows.childNodes[i];for(var indexStr in hintMenus){var index=parseInt(indexStr);var td=row.childNodes[index];var link=$common.getFirstChildByTagName(td,"a");if(link){if(init){$common.addMouseOverHandler(link,this._cellHintMenuMouseOver,this);$common.addMouseOutHandler(link,this._cellHintMenuMouseOut,this);link._hintMenu=hintMenus[indexStr];} else{link._hintMenu=null;$clearHandlers(td);}}}}},_initFloatHint:function(init){var rows=this._rows;var indices=this._floatHintColumnIndices;if(!indices||!rows)return;if(!this._floatHint){this._floatHint=new Sys.Content.Controls.FloatHint();this._floatHint.initialize();} var rowCount=this.get_rowCount();var baseId=this.get_id()+"_row";for(var i=0;i<rowCount;i++){var row=rows.childNodes[i];for(var j=0,count=indices.length;j<count;j++){var index=indices[j];var td=row.childNodes[index];if(init){$common.addMouseOverHandler(td,this._cellFloatHintMouseOver,this);$common.addMouseOutHandler(td,this._cellFloatHintMouseOut,this);$common.addMouseMoveHandler(td,this._cellFloatHintMouseMove,this);var id=baseId+i+"_"+index+"_hint";td._hintElement=$get(id);} else{td._hintElement=null;$clearHandlers(td);}}}},_getEventTargetCell:function(e){var answer=e.target;while(true){if(answer.tagName=="TD"){return answer;} else if(answer.parentNode){answer=answer.parentNode;} else{return null;}}},_startFloatHint:function(e){var td=this._getEventTargetCell(e);if(td){var hintElement=td._hintElement;if(hintElement){var floatHint=this._floatHint;floatHint.set_element(hintElement);return floatHint;}} return null;},_cellFloatHintMouseOver:function(e){var floatHint=this._startFloatHint(e);if(floatHint){floatHint.show(e);}},_cellFloatHintMouseOut:function(e){var floatHint=this._startFloatHint(e);if(floatHint){floatHint.hide();}},_cellFloatHintMouseMove:function(e){var floatHint=this._startFloatHint(e);if(floatHint){floatHint.move(e);}},_cellHintMenuMouseOver:function(e){this._showHintMenu(e,true);},_cellHintMenuMouseOut:function(e){this._showHintMenu(e,false);},_getEventTargetLink:function(e){var answer=e.target;while(true){if(answer._hintMenu){return answer;} else if(answer!=document.body&&answer.parentNode){answer=answer.parentNode;} else{return null;}}},_showHintMenu:function(e,visible){var link=this._getEventTargetLink(e);if(!link)return;var hintMenuId=link._hintMenu;if(hintMenuId){var hintMenu=this.get_form()[hintMenuId];if(hintMenu){if(visible){Sys.UI.DomElement.setOpacity(hintMenu.get_element(),90);hintMenu.set_owner(this);var p=Sys.UI.DomElement.getLocation(link);var pScroll=window.getClientScrollPosition();var x=e.clientX+pScroll.x;var y=p.y;hintMenu.show(e,link,x,y);} else{hintMenu.hide();}}}},_getCheckBox:function(rowIndex,columnIndex){if(typeof(columnIndex)==="undefined"){columnIndex=this._getRowDefaultCheckBoxColumnIndex();} if(columnIndex<0){throw Error.invalidOperation("该 GridView 没有加 CheckBoxColumn");} var row=this.getRow(rowIndex);var cell=row.childNodes[columnIndex];var input=$common.getFirstChildByTagName(cell,"input");if(!input){throw Error.invalidOperation("找不到 CheckBoxColumn 中的控件");} return input;},getRowChecked:function(rowIndex){var checkBox=this._getCheckBox(rowIndex);return checkBox.checked;},setRowChecked:function(rowIndex,value){var checkBox=this._getCheckBox(rowIndex);checkBox.checked=value;},getRowColumnChecked:function(rowIndex,columnIndex){var checkBox=this._getCheckBox(rowIndex,columnIndex);return checkBox.checked;},setRowColumnChecked:function(rowIndex,columnIndex,value){var checkBox=this._getCheckBox(rowIndex,columnIndex);checkBox.checked=value;},_getRadioButton:function(rowIndex){var radioButtonColumnIndex=this.get_radioButtonColumnIndex();if(radioButtonColumnIndex<0){throw Error.invalidOperation("该 GridView 没有加 RadioButtonColumn");} var row=this.getRow(rowIndex);var cell=row.childNodes[radioButtonColumnIndex];var input=$common.getFirstChildByTagName(cell,"input");if(!input){throw Error.invalidOperation("找不到 RadioButtonColumn 中的控件");} return input;},get_selectedRowIndex:function(){var rowCount=this.get_rowCount();for(i=0;i<rowCount;i++){var radioButton=this._getRadioButton(i);if(radioButton.checked){return i;}} return-1;},set_selectedRowIndex:function(rowIndex){var radioButton=this._getRadioButton(rowIndex);radioButton.checked=true;},_getColumnIndexByName:function(name){if(name){name=name.toLowerCase();var names=this._columnNames;for(var i=0,count=names.length;i<count;i++){var columnName=names[i];if(columnName&&columnName.toLowerCase()==name){return i;}}} throw Error.invalidOperation(String.format("找不到列 {0} 的索引",name));},getColumnVisible:function(columnName){return this.getColumnVisibleByIndex(this._getColumnIndexByName(columnName));},setColumnVisible:function(columnName,value){this.setColumnVisibleByIndex(this._getColumnIndexByName(columnName),value);},getRowDataValue:function(rowIndex,dataField){var row=this.getRow(rowIndex);return row.getAttribute("_"+dataField);},setRowDataValue:function(rowIndex,dataField,value){var row=this.getRow(rowIndex);return row.setAttribute("_"+dataField,value);},getRowCell:function(rowIndex,columnName){var row=this.getRow(rowIndex);var columnIndex=this._getColumnIndexByName(columnName);return row.childNodes[columnIndex];},getRowCellText:function(rowIndex,columnName){var cell=this.getRowCell(rowIndex,columnName);return cell.innerHTML;},setRowCellText:function(rowIndex,columnName,value){var cell=this.getRowCell(rowIndex,columnName);cell.innerHTML=value;},getColumnVisibleByIndex:function(columnIndex){if(!this._columnVisibles)return true;var answer=this._columnVisibles[columnIndex];return typeof(answer)==="undefined"?true:answer;},_checkColumnIndex:function(row,columnIndex){var columnCount=row.childNodes.length;if(columnIndex<0||columnIndex>=columnCount){throw Error.invalidOperation(String.format("列索引范围应为 [0-{0}]",columnCount-1));}},setColumnVisibleByIndex:function(columnIndex,value){if(this.get_showHeader()){var thead=$common.getFirstChildByTagName(this._table,"thead");var row=thead.firstChild;this._checkColumnIndex(row,columnIndex);var cell=row.childNodes[columnIndex];$common.setDisplay(cell,value);} var rowCount=this.get_rowCount();if(rowCount>0){var rows=this._rows;this._checkColumnIndex(rows.childNodes[0],columnIndex);for(var i=0;i<rowCount;i++){var row=rows.childNodes[i];var cell=row.childNodes[columnIndex];$common.setDisplay(cell,value);}} if(!this._columnVisibles){this._columnVisibles=[];} this._columnVisibles[columnIndex]=value;},doPageBeforeChanged:function(oldPageIndex){if(this._radioButtonColumnIndex<0)return;if(!this._pageSelectedRowIndices){this._pageSelectedRowIndices=[];} var pageSelectedRowIndices=this._pageSelectedRowIndices;var selectedIndex=this.get_selectedRowIndex();pageSelectedRowIndices[oldPageIndex]=selectedIndex;if(selectedIndex>=0){for(var pageIndex in pageSelectedRowIndices){if(parseInt(pageIndex)!=oldPageIndex){pageSelectedRowIndices[pageIndex]=-1;}}}},doPageChanged:function(newPageIndex){if(this._radioButtonColumnIndex<0)return;if(this._pageSelectedRowIndices){var selectedRowIndex=this._pageSelectedRowIndices[newPageIndex];if(selectedRowIndex>=0&&selectedRowIndex<this.get_recordCount()){this.set_selectedRowIndex(selectedRowIndex);}}},_getRowRadioButton:function(row){var inputIndex=this._radioButtonColumnIndex;return inputIndex>=0?this._getRowColumnFirstElement(row,inputIndex):null;},_getRowDefaultCheckBoxColumnIndex:function(row){var checkBoxColumnIndices=this.get_checkBoxColumnIndices();return checkBoxColumnIndices&&checkBoxColumnIndices.length==1?checkBoxColumnIndices[0]:-1;},_getRowDefaultCheckBox:function(row){var inputIndex=this._getRowDefaultCheckBoxColumnIndex();return inputIndex>=0?this._getRowColumnFirstElement(row,inputIndex):null;},_getRowColumnFirstElement:function(row,columnIndex){return row.childNodes[columnIndex].firstChild;},doRowClick:function Sys$Content$Controls$GridView$doRowClick(e,rowIndex,key,row){var input=null;var element=e.target;if(element.tagName=="INPUT"){input=element;} else if(element.tagName!="A"){var row=this.getRow(rowIndex);var input=this._getRowRadioButton(row);if(input){if(!input.checked){input.checked=true;}} else{input=this._getRowDefaultCheckBox(row);if(input){input.checked=!input.checked;}}} if(input){var cell=input.parentNode;var columnIndex=Array.indexOf(row.childNodes,cell);var dataField=this.getColumnDataField(columnIndex);var eventArgs=new Sys.Content.Controls.GridViewClickEventArgs(rowIndex,columnIndex,key,dataField,input.checked);if(input.type=="checkbox"){this._doCheckBoxClick(eventArgs);} else if(input.type=="radio"){this._doRadioButtonClick(eventArgs);}}},add_checkBoxClick:function(handler){this.get_events().addHandler("checkBoxClick",handler);},remove_checkBoxClick:function(handler){this.get_events().removeHandler("checkBoxClick",handler);},_doCheckBoxClick:function(eventArgs){var handler=this.get_events().getHandler("checkBoxClick");if(handler){handler(this,eventArgs);}},add_radioButtonClick:function(handler){this.get_events().addHandler("radioButtonClick",handler);},remove_radioButtonClick:function(handler){this.get_events().removeHandler("radioButtonClick",handler);},_doRadioButtonClick:function(eventArgs){var handler=this.get_events().getHandler("radioButtonClick");if(handler){handler(this,eventArgs);}},getDetailView:function(rowIndex){var row=this.getRow(rowIndex);row=this.doGetRow(rowIndex+1);if(row){var div=row.firstChild.firstChild;var detailView=$find(div.id);if(detailView&&!detailView._masterView){detailView._masterView=this;detailView._masterRowIndex=rowIndex;} return detailView;} return null;}}
Sys.Content.Controls.GridView.registerClass('Sys.Content.Controls.GridView',Sys.Content.Controls.CustomListView);Sys.Content.Controls.ListView=function(element){Sys.Content.Controls.ListView.initializeBase(this,[element]);}
Sys.Content.Controls.ListView.prototype={initialize:function(){Sys.Content.Controls.ListView.callBaseMethod(this,'initialize');},dispose:function(){Sys.Content.Controls.ListView.callBaseMethod(this,'dispose');},doRowClick:function Sys$Content$Controls$ListView$doRowClick(e,rowIndex,key,row){var handler=this.get_events().getHandler("rowClick");if(handler){var eventArgs=new Sys.Content.Controls.ListViewClickEventArgs(rowIndex,key,this._getCellIndex(rowIndex,row));handler(this,eventArgs);}},_getCellIndex:function(rowIndex,cell){var row=this.getRow(rowIndex);return Array.indexOf(row.childNodes,cell);},getRowCell:function(rowIndex,cellIndex){var row=this.getRow(rowIndex);return row.childNodes[cellIndex];},_getRowHiddenElement:function(rowIndex,cellIndex,dataField){var cell=this.getRowCell(rowIndex,cellIndex);var inputs=cell.getElementsByTagName("INPUT");for(var i=0,count=inputs.length;i<count;i++){var input=inputs[i];if(input.name==dataField){return input;}} return null;},getRowDataValue:function(rowIndex,cellIndex,dataField){var element=this._getRowHiddenElement(rowIndex,cellIndex,dataField);return element?element.value:null;},setRowDataValue:function(rowIndex,cellIndex,dataField,value){var element=this._getRowHiddenElement(rowIndex,cellIndex,dataField);if(element){element.value=value;}},add_rowClick:function(handler){this.get_events().addHandler("rowClick",handler);},remove_rowClick:function(handler){this.get_events().removeHandler("rowClick",handler);},doRowDblClick:function(e,rowIndex,key,row){var handler=this.get_events().getHandler("rowDblClick");if(handler){var eventArgs=new Sys.Content.Controls.ListViewClickEventArgs(rowIndex,key,this._getCellIndex(rowIndex,row));handler(this,eventArgs);}},add_rowDblClick:function(handler){this.get_events().addHandler("rowDblClick",handler);},remove_rowDblClick:function(handler){this.get_events().removeHandler("rowDblClick",handler);}}
Sys.Content.Controls.ListView.registerClass('Sys.Content.Controls.ListView',Sys.Content.Controls.CustomListView);Sys.Content.Controls.ContentPager=function(element){Sys.Content.Controls.ContentPager.initializeBase(this,[element]);this._requireClick=true;this._target=null;this._contentService=null;this._loading=false;this._queryParams=null;this._queryParams0=null;this._pageIndex=0;}
Sys.Content.Controls.ContentPager.prototype={initialize:function(){Sys.Content.Controls.ContentPager.callBaseMethod(this,'initialize');this._contentService=new Carpa.Web.Script.ContentService();},dispose:function(){this._contentService=null;this._queryParams=null;this._queryParams0=null;Sys.Content.Controls.ContentPager.callBaseMethod(this,'dispose');},get_target:function(){return this._target;},set_target:function(value){this._target=value;},get_queryParams:function(){return this._queryParams;},set_queryParams:function(value){this._queryParams=value;this._queryParams0=value;},get_pageIndex:function(){return this._pageIndex;},_getTargetControl:function(){var target=this.get_target();var answer=$find(target);if(!answer){throw Error.invalidOperation("找不到Pager的目标："+target);} return answer;},refresh:function(queryParams,onSuccess){var newQueryParams=null;if(this._queryParams0&&queryParams){newQueryParams=Object.clone(this._queryParams0);Object.copyTo(queryParams,newQueryParams);} else if(queryParams){newQueryParams=queryParams;} this._hasSummaryLoaded=false;if(newQueryParams){this._queryParams=newQueryParams;} this.reloadPage(0,onSuccess);},reloadPage:function(pageIndex,onSuccess){if(typeof(pageIndex)==="undefined"||pageIndex==null){pageIndex=this._pageIndex;} this._reloadPage(pageIndex,onSuccess);},_reloadPage:function(pageIndex,onSuccess){var targetControl=this._getTargetControl();targetControl.doPageBeforeChanged(this._pageIndex);this._pageIndex=pageIndex;$common.showLoading(targetControl.get_element());var successHandler=Function.createDelegate(this,!onSuccess?this._loaded:function(result){this._loaded(result);onSuccess(targetControl,result[2]);});var form=this.get_form();this._contentService.ListViewUpdatePage(this.get_target(),form.get_scriptPath(),form.get_params(),this._queryParams,pageIndex,successHandler,Function.createDelegate(this,this._failed));},doClick:function Sys$UI$Controls$ContentPager$doClick(e){Sys.Content.Controls.ContentPager.callBaseMethod(this,'doClick',[e]);if(this._loading)return;var str=e.target.getAttribute("_pageIndex");if(str){var pageIndex=parseInt(str);if(pageIndex>=0){this._reloadPage(pageIndex);}} e.cancel();},_loaded:function(result){var targetControl=this._getTargetControl();targetControl.doUpdateBody(result[0]);var pagerElement=this.get_element();pagerElement.innerHTML=result[1];var element=targetControl.get_element();var elementParent=element.parentNode;if(elementParent==document.body){if(document.body.scrollTop>0){document.body.scrollTop=0;} else if(document.body.parentNode.scrollTop>0){document.body.parentNode.scrollTop=0;}} targetControl.doPageChanged(this._pageIndex);$common.hideLoading();this._loading=false;},_failed:function(error){$common.hideLoading();this._loading=false;alert(Sys.Net.WebServiceProxy.formatWebServiceFailedServerError(error.get_message()));}}
Sys.Content.Controls.ContentPager.registerClass('Sys.Content.Controls.ContentPager',Sys.UI.Controls.NoFocusContainer);Sys.Content.Controls.FloatHint=function(element){this._element=element;this._shadowArray=null;}
Sys.Content.Controls.FloatHint.prototype={initialize:function(){},dispose:function(){if(this._shadowArray){for(var i=0;i<this._shadowArray.length;i++){var shadow=this._shadowArray[i];if(shadow){shadow.style.visibility="hidden";$removeNode(shadow);this._shadowArray[i]=null;}} delete this._shadowArray;}},get_element:function(){return this._element;},set_element:function(value){this._element=value;},_setVisible:function(visible,e,x,y){var element=this._element;if(visible){if(!this._shadowArray){this._shadowArray=new Array(3);for(var i=0;i<3;i++){var shadow=$common.createShadow();document.body.appendChild(shadow);this._shadowArray[i]=shadow;}} if(element.parentNode!=document.body){document.body.appendChild(element);} this._setPosition(element,e,x,y);} else{this._hideHintShadow()} Sys.UI.DomElement.setVisible(element,visible);},show:function(e,x,y){this._setVisible(true,e,x,y);},hide:function(){this._setVisible(false);},_setPosition:function(element,e,x,y){var pScroll=window.getClientScrollPosition();if(typeof(x)==="undefined"){x=e.clientX+5+pScroll.x;} if(typeof(y)==="undefined"){y=e.clientY+5+pScroll.y;} Sys.UI.DomElement.setLocation(element,x,y);element.style.zIndex=Sys.Application.getActiveFormZIndex()+3;for(var i=2;i>=0;i--){var shadow=this._shadowArray[i];$common.setPosition(shadow,x+(1+i),y+(1+i),element.offsetWidth,element.offsetHeight);var style=shadow.style;style.zIndex=element.style.zIndex-1;style.visibility="visible";}},_setHintShadowVisible:function(visibie){if(!this._shadowArray)return;for(var i=0;i<this._shadowArray.length;i++){if(this._shadowArray[i]!=null){this._shadowArray[i].style.visibility=visibie?"visible":"hidden";}}},_hideHintShadow:function(){this._setHintShadowVisible(false);},move:function(e){var element=this._element;if(element&&element.style.visibility=='visible'){this._setPosition(element,e);}}}
Sys.Content.Controls.FloatHint.registerClass('Sys.Content.Controls.FloatHint');Sys.Content.Controls.FloatHintLink=function(element){Sys.Content.Controls.FloatHintLink.initializeBase(this,[element]);this._requireMouseOver=true;this._requireMouseOut=true;this._requireClick=true;this._floatHint=null;}
Sys.Content.Controls.FloatHintLink.prototype={initialize:function(){Sys.Content.Controls.FloatHintLink.callBaseMethod(this,'initialize');$common.addMouseMoveHandler(this.get_element(),this._mouseMove,this);this._floatHint=new Sys.Content.Controls.FloatHint($get(this.get_hintId()));this._floatHint.initialize();},dispose:function(){if(this._floatHint){this._floatHint.dispose();this._floatHint=null;} Sys.Content.Controls.FloatHintLink.callBaseMethod(this,'dispose');},get_text:function(){var element=this.get_element();return element?element.innerHTML:null;},set_text:function(value){var element=this.get_element();if(element){element.innerHTML=value;}},get_hintId:function(){return this._hintId;},set_hintId:function(value){this._hintId=value;},doMouseOver:function(e){this._floatHint.show(e);},_mouseMove:function(e){this._floatHint.move(e);},doMouseOut:function(e){this._floatHint.hide();}}
Sys.Content.Controls.FloatHintLink.registerClass('Sys.Content.Controls.FloatHintLink',Sys.UI.Controls.Container);Sys.Content.Controls.Block=function(element){Sys.Content.Controls.Block.initializeBase(this,[element]);this._requireClick=true;}
Sys.Content.Controls.Block.prototype={}
Sys.Content.Controls.Block.registerClass('Sys.Content.Controls.Block',Sys.UI.Controls.NoFocusContainer);Sys.Content.Controls.Panel=function(element){Sys.Content.Controls.Panel.initializeBase(this,[element]);this._tabsTable=null;this._activeTabIndex=0;this._tabCssClass=null;this._activeTabCssClass=null;this._activateOnHover=true;}
Sys.Content.Controls.Panel.prototype={initialize:function(){Sys.Content.Controls.Panel.callBaseMethod(this,'initialize');var tabsTable=this._tabsTable=$get(this.get_id()+"_tabs");if(tabsTable){$common.addClickHandler(this._tabsTable,this._tabsClick,this);if(this.get_activateOnHover()){$common.addMouseOverHandler(this._tabsTable,this._tabsClick,this);}}},dispose:function(){if(this._tabsTable){$clearHandlers(this._tabsTable);this._tabsTable=null;} Sys.Content.Controls.Panel.callBaseMethod(this,'dispose');},get_activeTabIndex:function(){return this._activeTabIndex;},set_activeTabIndex:function(value){if(!this.get_isInitialized()){this._activeTabIndex=value;} else if(value!=this._activeTabIndex){if(this._activeTabIndex>=0){this._setTabSelected(this._activeTabIndex,false);} this._activeTabIndex=value;this._setTabSelected(value,true);}},get_tabCssClass:function(){return this._tabCssClass;},set_tabCssClass:function(value){this._tabCssClass=value;},get_activeTabCssClass:function(){return this._activeTabCssClass;},set_activeTabCssClass:function(value){this._activeTabCssClass=value;},get_activateOnHover:function(){return this._activateOnHover;},set_activateOnHover:function(value){this._activateOnHover=value;},_setTabSelected:function(index,active){var idPrefix=this.get_id();var tabButton=$get(idPrefix+"_tabButton"+index);tabButton.className=active?this.get_activeTabCssClass():this.get_tabCssClass();var tabBody=$get(idPrefix+"_tabBody"+index);Sys.UI.DomElement.setVisible(tabBody,active);},_tabsClick:function(e){var element=e.target;if(element.tagName=="DIV"){element=element.parentNode;} if(element.tagName=="TD"){var row=$common.getTableFirstRow(this._tabsTable);var index=Array.indexOf(row.childNodes,element);if(index>=0){this.set_activeTabIndex(index);}}}}
Sys.Content.Controls.Panel.registerClass('Sys.Content.Controls.Panel',Sys.UI.Controls.NoFocusContainer);Sys.Content.Controls.HintMenu=function(element){Sys.Content.Controls.HintMenu.initializeBase(this,[element]);this._requireMouseOver=true;this._requireMouseOut=true;this._requireClick=true;this._owner=null;this._lastRow=null;this._normalItemCssClass=null;this._activeItemCssClass=null;}
Sys.Content.Controls.HintMenu.prototype={initialize:function(){Sys.Content.Controls.HintMenu.callBaseMethod(this,'initialize');},dispose:function(){this._owner=null;this._lastRow=null;this._parentNode=null;Sys.Content.Controls.HintMenu.callBaseMethod(this,'dispose');},get_normalItemCssClass:function(){return this._normalItemCssClass;},set_normalItemCssClass:function(value){this._normalItemCssClass=value;},get_activeItemCssClass:function(){return this._activeItemCssClass;},set_activeItemCssClass:function(value){this._activeItemCssClass=value;},get_owner:function(){return this._owner;},set_owner:function(value){this._owner=value;},_getEventTargetRow:function(e){var cell=e.target;if(cell==this.get_element()){return null;} else if(cell.tagName=="TD"){return cell.parentNode;} else if(cell.parentNode&&cell.parentNode.tagName=="TD"){return cell.parentNode.parentNode;} return null;},_getOwnerEventArgs:function(){var owner=this.get_owner();if(owner){var row=owner.internalGetEventTargetRow(this._parentNode);if(row){var rowIndex=owner.getRowIndex(row);var key=owner.findRowKeyValue(row);return new Sys.Content.Controls.ListViewEditEventArgs(rowIndex,key);}} return new Sys.CancelEventArgs();},doMouseOver:function(e){this._show();var row=this._getEventTargetRow(e);if(row){if(this._lastRow){this._setRowCssClass(this._lastRow,this.get_normalItemCssClass());} this._setRowCssClass(row,this.get_activeItemCssClass());this._lastRow=row;}},doMouseOut:function(e){this.hide();},_setRowCssClass:function(row,value){row.firstChild.className=value;},add_popup:function(handler){this.get_events().addHandler("popup",handler);},remove_popup:function(handler){this.get_events().removeHandler("popup",handler);},_doPopup:function(eventArgs){var handler=this.get_events().getHandler("popup");if(handler){handler(this,eventArgs);}},show:function(e,parentNode,x,y){this._parentNode=parentNode;var eventArgs=this._getOwnerEventArgs();this._doPopup(eventArgs);if(eventArgs.get_cancel()){return;} this._x=x;this._y=y;this._show();},_show:function(){var element=this.get_element();if(element.parentNode!=document.body){document.body.appendChild(element);} Sys.UI.DomElement.setLocation(element,this._x,this._y);this.set_visible(true);},hide:function(){this.set_visible(false);}}
Sys.Content.Controls.HintMenu.registerClass('Sys.Content.Controls.HintMenu',Sys.UI.Controls.Container);Sys.Content.Controls.HintMenuItem=function(element){Sys.Content.Controls.HintMenuItem.initializeBase(this,[element]);this._requireClick=true;}
Sys.Content.Controls.HintMenuItem.prototype={initialize:function(){Sys.Content.Controls.HintMenuItem.callBaseMethod(this,'initialize');},dispose:function(){Sys.Content.Controls.HintMenuItem.callBaseMethod(this,'dispose');},get_text:function(){var element=this.get_element();return element?element.firstChild.innerHTML:null;},set_text:function(value){var element=this.get_element();if(element){element.firstChild.innerHTML=value;}},_getHintMenu:function(e){var node=this.get_element().parentNode;while(true){if(node.control){return node.control;} else if(node.parentNode&&node.parentNode!=document.body){node=node.parentNode;} else{return null;}}},doClick:function Sys$Content$Controls$HintMenuItem$doClick(e){var hintMenu=this._getHintMenu();if(hintMenu){e=hintMenu._getOwnerEventArgs();hintMenu.hide();} Sys.Content.Controls.HintMenuItem.callBaseMethod(this,'doClick',[e]);}}
Sys.Content.Controls.HintMenuItem.registerClass('Sys.Content.Controls.HintMenuItem',Sys.UI.Controls.NoFocusContainer);Sys.Content.Controls.RollBlock=function(element){Sys.Content.Controls.RollBlock.initializeBase(this,[element]);this._requireMouseOver=true;this._requireMouseOut=true;this._isStop=false;this._direction=0;this._delayTime=1000;this._stepTime=100;this._step=1;}
Sys.Content.Controls.RollBlock.prototype={initialize:function(){Sys.Content.Controls.RollBlock.callBaseMethod(this,'initialize');this._initHandle=setTimeout(Function.createDelegate(this,this._initRoll),10);this._startRollHandler=Function.createDelegate(this,this._startRoll);this._rollHandler=Function.createDelegate(this,this._roll);},dispose:function(){if(this._delayHandle){clearTimeout(this._delayHandle);this._delayHandle=0;} if(this._rollHandle){clearTimeout(this._rollHandle);this._rollHandle=0;} this._startRollHandler=null;this._rollHandler=null;Sys.Content.Controls.RollBlock.callBaseMethod(this,'dispose');},get_direction:function(){return this._direction;},set_direction:function(value){this._direction=value;},get_delayTime:function(){return this._delayTime;},set_delayTime:function(value){this._delayTime=value;},get_stepTime:function(){return this._stepTime;},set_stepTime:function(value){this._stepTime=value;},get_step:function(){return this._step;},set_step:function(value){return this._step;},doMouseOver:function(e){this._isStop=true;},doMouseOut:function(e){this._isStop=false;},_initRoll:function(){this._initHandle=null;var element=this.get_element();this._contentWidth=element.scrollWidth;this._contentHeight=element.scrollHeight;this._width=element.offsetWidth;this._height=element.offsetHeight;var direction=this.get_direction();if(direction==0||direction==1){if(this._contentHeight<=this._height){return;} Sys.UI.DomHelper.insertHtml("beforeend",element,element.innerHTML);} else if(direction==2||direction==3){if(this._contentWidth<=this._width){return;} var table=$common.createTable();table.style.cursor="";var tbody=$common.createTBody();var tr=$common.createTr();var td1=$common.createTd();var childNodes=element.childNodes;for(var i=0,count=childNodes.length;i<count;i++){td1.appendChild(childNodes[i]);} tr.appendChild(td1);var td2=$common.createTd();td2.innerHTML=td1.innerHTML;tr.appendChild(td2);tbody.appendChild(tr);table.appendChild(tbody);element.appendChild(table);} this._scrollPos=0;if(direction==1){this._scrollPos=this._contentHeight;element.scrollTop=this._scrollPos;} else if(direction==3){this._scrollPos=this._contentWidth;element.scrollLeft=this._scrollPos;} this._delay();},_delay:function(){this._delayHandle=setTimeout(this._startRollHandler,this.get_delayTime());},_startRoll:function(){this._delayHandle=null;this._roll();},_roll:function(){this._rollHandle=null;var needDelay=false;if(!this._isStop){var element=this.get_element();switch(this.get_direction()){case 0:needDelay=this._doRollUp(element);break;case 1:needDelay=this._doRollDown(element);break;case 2:needDelay=this._doRollLeft(element);break;case 3:needDelay=this._doRollRight(element);break;}} if(!needDelay){this._rollHandle=setTimeout(this._rollHandler,this.get_stepTime());} else{this._delay();}},_doRollUp:function(element){this._scrollPos+=this.get_step();if(this._scrollPos==this._contentHeight){this._scrollPos=0;} element.scrollTop=this._scrollPos;return this._scrollPos%this._height==0;},_doRollDown:function(element){this._scrollPos-=this.get_step();if(this._scrollPos==0){this._scrollPos=this._contentHeight;} element.scrollTop=this._scrollPos;return(this._contentHeight-this._scrollPos)%this._height==0;},_doRollLeft:function(element){this._scrollPos+=this.get_step();if(this._scrollPos==this._contentWidth){this._scrollPos=0;} element.scrollLeft=this._scrollPos;return this._scrollPos%this._width==0;},_doRollRight:function(element){this._scrollPos-=this.get_step();if(this._scrollPos==0){this._scrollPos=this._contentWidth;} element.scrollLeft=this._scrollPos;return(this._contentWidth-this._scrollPos)%this._width==0;}}
Sys.Content.Controls.RollBlock.registerClass('Sys.Content.Controls.RollBlock',Sys.UI.Controls.Container);Sys.Content.Controls.MusicPlayer=function(element){Sys.Content.Controls.MusicPlayer.initializeBase(this,[element]);this._enabled=true;this._autoPlay=true;this._src=null;this._playerUrl=null;this._soundManager=null;this._debugMode=false;this._loaded=false;this._active=false;}
Sys.Content.Controls.MusicPlayer.prototype={initialize:function(){Sys.Content.Controls.MusicPlayer.callBaseMethod(this,'initialize');if(this.get_enabled()){this._init();}},dispose:function(){if(this._soundManager){this._soundManager.destruct();this._soundManager=null;} Sys.Content.Controls.MusicPlayer.callBaseMethod(this,'dispose');},_init:function(){var soundManager=this._soundManager=new SoundManager();soundManager.debugMode=this.get_debugMode();soundManager.defaultOptions.multiShot=true;soundManager.url=this.get_playerUrl();soundManager.onload=Function.createDelegate(this,this._doAutoPlay);soundManager.beginInit();},_doAutoPlay:function(){this._loaded=true;if(this.get_autoPlay()){this._doPlay();}},play:function(src){if(typeof(src)!="undefined"){this.set_src(src);} if(!this._loaded){this.set_autoPlay(true);return;} this._doPlay();},_doPlay:function(src){if(!this._soundManager)return;var src=this.get_src();if(src){this._soundManager.play(src,src);this._active=true;} else if(this._active){this.stop();}},stop:function(){if(this._soundManager&&this._active){this._soundManager.stop(this.get_src());this._active=false;}},get_enabled:function(){return this._enabled;},set_enabled:function(value){this._enabled=value;},get_debugMode:function(){return this._debugMode;},set_debugMode:function(value){this._debugMode=value;},get_autoPlay:function(){return this._autoPlay;},set_autoPlay:function(value){this._autoPlay=value;},get_playerUrl:function(){return this._playerUrl;},set_playerUrl:function(value){this._playerUrl=value;},get_src:function(){return this._src;},set_src:function(value){if(this._active){this.stop();} this._src=value;}}
Sys.Content.Controls.MusicPlayer.registerClass('Sys.Content.Controls.MusicPlayer',Sys.UI.Control);Sys.Content.Controls.HintBlock=function(element){Sys.Content.Controls.HintBlock.initializeBase(this,[element]);this._requireMouseOver=true;this._requireMouseOut=true;this._ownerId=null;this._ownerElement=null;this._popupLocation=0;this._popupOffsetX=0;this._popupOffsetY=0;}
Sys.Content.Controls.HintBlock.prototype={initialize:function(){Sys.Content.Controls.HintBlock.callBaseMethod(this,'initialize');},dispose:function(){Sys.Content.Controls.HintBlock.callBaseMethod(this,'dispose');var owner=this._ownerElement;if(owner){this._mouseOverHandler=null;this._mouseOutHandler=null;this._ownerElement=null;}},doFormInit:function(form){var owner=this._ownerElement=form.getElement(this.get_ownerId());this._mouseOverHandler=$common.addMouseOverHandler(owner,this._ownerMouseOver,this);this._mouseOutHandler=$common.addMouseOutHandler(owner,this._ownerMouseOut,this);},_ownerMouseOver:function(e){var element=this.get_element();if(element.parentNode!=document.body){document.body.appendChild(element);} var rPopup=$common.getBounds(element);var rOwner=$common.getBounds(this._ownerElement);var x,y;switch(this._popupLocation){case 0:x=rOwner.x;y=rOwner.y-rPopup.height+1;break;case 1:x=rOwner.x+rOwner.width-rPopup.width;y=rOwner.y-rPopup.height+1;break;case 2:x=rOwner.x;y=rOwner.y+rOwner.height-1;break;case 3:x=rOwner.x+rOwner.width-rPopup.width;y=rOwner.y+rOwner.height-1;break;case 4:x=rOwner.x-rPopup.width+1;y=rOwner.y;break;case 5:x=rOwner.x+rOwner.width-1;y=rOwner.y;break;case 6:x=rOwner.x-rPopup.width+1;y=rOwner.y+rOwner.height-rPopup.height;break;case 7:x=rOwner.x+rOwner.width-1;y=rOwner.y+rOwner.height-rPopup.height;break;} Sys.UI.DomElement.setLocation(element,x+this._popupOffsetX,y+this._popupOffsetY);this._setVisible(true);},_ownerMouseOut:function(e){this._setVisible(false);},doMouseOver:function(e){this._setVisible(true);},doMouseOut:function(e){var element=this.get_element();var target=e.target;if(target==element||target.parentNode==element){this._setVisible(false);}},get_visible:function(){var element=this.get_element();return element.style.visibility=='visible';},set_visible:function(value){this._setVisible(value);},_setVisible:function(visible){var element=this.get_element();element.style.visibility=visible?'visible':'hidden';},get_ownerId:function(){return this._ownerId;},set_ownerId:function(value){this._ownerId=value;},get_popupLocation:function(){return this._popupLocation;},set_popupLocation:function(value){this._popupLocation=value;},get_popupOffsetX:function(){return this._popupOffsetX;},set_popupOffsetX:function(value){this._popupOffsetX=value;},get_popupOffsetY:function(){return this._popupOffsetY;},set_popupOffsetY:function(value){this._popupOffsetY=value;}}
Sys.Content.Controls.HintBlock.registerClass('Sys.Content.Controls.HintBlock',Sys.UI.Controls.NoFocusContainer);Sys.Content.Controls.InstanceView=function(element){Sys.Content.Controls.InstanceView.initializeBase(this,[element]);}
Sys.Content.Controls.InstanceView.prototype={initialize:function(){Sys.Content.Controls.InstanceView.callBaseMethod(this,'initialize');},dispose:function(){Sys.Content.Controls.InstanceView.callBaseMethod(this,'dispose');},doUpdateBody:function(html){this.get_element().innerHTML=html;}}
Sys.Content.Controls.InstanceView.registerClass('Sys.Content.Controls.InstanceView',Sys.Content.Controls.CustomView);
if (typeof(Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();