function ObjectManager(){
var messageBindings=new Array();
this.objectList=new Array();
this.objectIndex=new Array();
this.valueList=new Array();
this.valueIndex=new Array();
this.controlList=new Array();
this.controlIndex=new Array();
this.registerObject=function(oN,objectPointer){
var objectID=messageBindings.length;
messageBindings[messageBindings.length]=new Array(oN,objectPointer);
this.objectList[oN]=objectPointer;
this.objectIndex[this.objectIndex.length]=oN;
return objectID;};
this.processEvent=function(e){
switch (e.type){
case 'click':
messageBindings[parseInt(e.cbeCurrentTarget.objectManagerId)][1].clickCallback(e);
break;
case 'mousedown':
messageBindings[parseInt(e.cbeCurrentTarget.objectManagerId)][1].mouseDownCallback(e);
break;
case 'mouseup':
messageBindings[parseInt(e.cbeCurrentTarget.objectManagerId)][1].mouseUpCallback(e);
break;
case 'mousemove':
messageBindings[parseInt(e.cbeCurrentTarget.objectManagerId)][1].mouseMoveCallback(e);
break;
case 'mouseover':
messageBindings[parseInt(e.cbeCurrentTarget.objectManagerId)][1].mouseOverCallback(e);
break;
case 'mouseout':
messageBindings[parseInt(e.cbeCurrentTarget.objectManagerId)][1].mouseOutCallback(e);
break;
case 'keypress':
messageBindings[parseInt(e.cbeCurrentTarget.objectManagerId)][1].keypressCallback(e);
break;
case 'keyup':
messageBindings[parseInt(e.cbeCurrentTarget.objectManagerId)][1].keyUpCallback(e);
break;
case 'keydown':
messageBindings[parseInt(e.cbeCurrentTarget.objectManagerId)][1].keyDownCallback(e);
break;
case 'drag':
messageBindings[parseInt(e.cbeCurrentTarget.objectManagerId)][1].dragCallback(e);
break;
case 'dragStart':
messageBindings[parseInt(e.cbeCurrentTarget.objectManagerId)][1].dragStartCallback(e);
break;
case 'dragEnd':
messageBindings[parseInt(e.cbeCurrentTarget.objectManagerId)][1].dragEndCallback(e);
break;}};
this.getGuiValueById=function(valueName){
switch (valueName){
case '_PAGEWIDTH_':
return document.cbe.width();
break;
case '_PAGEHEIGHT_':
return document.cbe.height();
break;
default:
return this.valueList[valueName];
break;}};
this.setGuiValue=function(valueName,nV){
this.valueList[valueName]=nV;
this.valueIndex[this.valueIndex.length]=valueName;
return this.valueList[valueName];};
this.listGuiValues=function(){
lS='<table border="1"><tr><td colspan="3" align="center">GUI values:</td></tr>';
lS=lS+'<tr><td>Index</td><td>Name</td><td>Value</td></tr>';
for (i=0; i<this.valueIndex.length; i++){
lS=lS+'<tr><td>'+i+'</td><td>'+this.valueIndex[i]+'</td><td>'+this.valueList[this.valueIndex[i]]+'</td></tr>';}
lS=lS + '</table>';
return (lS);};
this.listGuiWidgets=function(){
lS='<table border="1"><tr><td colspan="2" align="center">GUI Widgets:</td></tr>';
lS=lS+'<tr><td>Index</td><td>Name</td></tr>';
for (i=0; i<this.objectIndex.length; i++){
lS=lS+'<tr><td>'+i+'</td><td>'+this.objectIndex[i]+'</td></tr>';}
lS=lS + '</table>';
return (lS);};
this.listGuiControls=function(){
lS='<table border="1"><tr><td colspan="3" align="center">GUI Controls:</td></tr>';
lS=lS+'<tr><td>Index</td><td>Name</td><td>Type</td></tr>';
for (i=0; i<this.controlIndex.length; i++){
lS=lS+'<tr><td>'+i+'</td><td>'+this.controlIndex[i][0]+'</td><td>'+this.controlIndex[i][1]+'</td></tr>';}
lS=lS + '</table>';
return (lS);};
this.addControl=function(controlPointer,controlType,controlId){
switch (controlType){
case 'tab':
case 'radioButtonGroup':
case 'map':
case 'labelControl':
case 'queryControl':
case 'selectionControl':
this.controlList[controlId]=new Array(controlPointer,controlType);
this.controlIndex[this.controlIndex.length]=new Array(controlId,controlType);
break;
default:
alert('Object Manager Error:\nUnknown control type "'+controlType+'"\nControl id="'+controlId+'"');
break;}};
this.getControl=function(controlId){
if (this.controlList[controlId])
return this.controlList[controlId][0];
else
return null;};
this.getWidgetAttribute=function(widgetName,attributeName){
var widget=this.objectList[widgetName];
switch (attributeName){
case 'width':
return widget.width();
break;
case 'height':
return widget.height();
break;
case 'left':
case 'xpos':
return widget.left();
break;
case 'top':
case 'ypos':
return widget.top();
break;
case 'right':
return widget.left()+widget.width();
break;
case 'bottom':
return widget.top()+widget.height();
break;
case 'zpos':
return widget.zIndex;
break;
default:
return null;}};};
OBJECT_MANAGER=new ObjectManager();
function EVENT_LISTENER(e){
OBJECT_MANAGER.processEvent(e);};
document.getGuiWidgetById=function (oN){
return OBJECT_MANAGER.objectList[oN];};
document.getWidgetById=function (oN){
return (OBJECT_MANAGER.objectList[oN]);};
document.getGuiValueById=function (valueName){
return OBJECT_MANAGER.getGuiValueById(valueName);};
document.getGuiValue=function (valueName){
return OBJECT_MANAGER.getGuiValueById(valueName);};
document.getGuiControl=function (valueName){
return OBJECT_MANAGER.getControl(valueName);};
GuiWidget=function(newID,nP,nX,nY,nZ,nW,nH,nVi,nC){
if (arguments.length > 0)
this.init(newID,nP,nX,nY,nZ,nW,nH,nVi,nC);};
GuiWidget_onLoad=function(){
GuiWidget.ToolTip=document.cbe.createElement("DIV");
document.cbe.appendChild(GuiWidget.ToolTip);};
GuiWidget.prototype.init=function(newID,nP,nX,nY,nZ,nW,nH,nVi,nC){
this.id=newID;
this.styleClass=null;
this.parentElement=nP;
this.xPosition=nX;
this.yPosition=nY;
this.zIndex=nZ;
this.visibility=nVi;
this.element=document.cbe.createElement("DIV");
this.element.cbe.objectManagerId=OBJECT_MANAGER.registerObject(this.id,this);
if (this.parentElement==null){
document.cbe.appendChild(this.element);}
else{
this.parentElement.cbe.appendChild(this.element);}
this.setClass(nC);
this.element.id=this.id;
this.element.cbe.id=this.id;
this.element.cbe.moveTo(this.xPosition,this.yPosition);
this.element.cbe.resizeTo(nW,nH);
if (this.visibility)
this.element.cbe.show();
else
this.element.cbe.hide();};
GuiWidget.prototype.setVisibility=function(nVi){
this.visibility=nVi;
if (this.visibility)
this.element.cbe.show();
else
this.element.cbe.hide();};
GuiWidget.prototype.show=function(){
this.element.cbe.show();};
GuiWidget.prototype.hide=function(){
this.element.cbe.hide();};
GuiWidget.prototype.width=function(){
if (arguments.length > 0){
return this.element.cbe.resizeTo(arguments[0],this.element.cbe.height());}
return this.element.cbe.width();};
GuiWidget.prototype.height=function(){
if (arguments.length > 0){
return this.element.cbe.resizeTo(this.element.cbe.width(),arguments[0]);}
return this.element.cbe.height();};
GuiWidget.prototype.left=function(){
if (arguments.length > 0)
return this.element.cbe.left(arguments);
else
return this.element.cbe.left();};
GuiWidget.prototype.top=function(){
if (arguments.length > 0)
return this.element.cbe.top(arguments);
else
return this.element.cbe.top();};
GuiWidget.prototype.setLabel=function(newLabel){
this.label=newLabel;
this.element.cbe.innerHtml(newLabel);};
GuiWidget.prototype.setPosition=function(nX,nY){
this.xPosition=nX;
this.yPosition=nY;
this.element.cbe.moveTo(this.xPosition,this.yPosition);};
GuiWidget.prototype.setSize=function(nW,nH){
this.element.cbe.resizeTo(nW,nH);};
GuiWidget.prototype.resize=function (nW,nH){
this.element.cbe.resizeTo(nW,nH);
if (this.resizeEvent)
this.resizeEvent(nW,nH);};
GuiWidget.prototype.setClass=function (nC){
if (is.ie)
this.element.setAttribute("className",nC);
else
if (is.gecko)
this.element.setAttribute("class",nC);};
GuiWidget.prototype.innerHtml=function (newString){
this.element.cbe.innerHtml(newString);};
GuiWidget.prototype.mouseOverCallback=function(e){
if (this.mouseOver)
this.mouseOver(e);
if (this.mouseOverEvent)
this.mouseOverEvent(e);};
GuiWidget.prototype.clickCallback=function(e){
if (this.click)
this.click(e);
if (this.clickEvent)
this.clickEvent(e);};
GuiWidget.prototype.mouseOutCallback=function(e){
if (this.mouseOut)
this.mouseOut(e);
if (this.mouseOutEvent)
this.mouseOutEvent(e);};
GuiWidget.prototype.mouseDownCallback=function(e){
if (this.mouseDown)
this.mouseDown(e);
if (this.mouseDownEvent)
this.mouseDownEvent(e);};
GuiWidget.prototype.mouseMoveCallback=function(e){
GuiWidget.ToolTip.cbe.moveTo(e.clientX,e.clientY);
if (this.mouseMove)
this.mouseMove(e);
if (this.mouseMoveEvent)
this.mouseMoveEvent(e);};
GuiWidget.prototype.mouseUpCallback=function(e){
if (this.mouseUp)
this.mouseUp(e);
if (this.mouseUpEvent)
this.mouseUpEvent(e);};
GuiWidget.showTooltip=function(e,tooltipText){
GuiWidget.ToolTip.cbe.moveTo(e.clientX+GuiWidget.tooltipOffset[0],e.clientY+GuiWidget.tooltipOffset[1]);
GuiWidget.ToolTip.cbe.zIndex(255);
GuiWidget.ToolTip.cbe.innerHtml(tooltipText);
if (is.ie)
GuiWidget.ToolTip.setAttribute("className","tooltip");
else
if (is.gecko)
GuiWidget.ToolTip.setAttribute("class","tooltip");
GuiWidget.ToolTip.cbe.show();};
GuiWidget.hideTooltip=function(){
GuiWidget.ToolTip.cbe.hide();};
Panel=function(newID,nP,nX,nY,nZ,nW,nH,nVi,newStyleClass,enableDrag){
if (arguments.length > 0)
this.init(newID,nP,nX,nY,nZ,nW,nH,nVi,newStyleClass,enableDrag);};
Panel.prototype=new GuiWidget();
Panel.prototype.constructor=Panel;
Panel.superclass=GuiWidget.prototype;
Panel.prototype.init=function(newID,nP,nX,nY,nZ,nW,nH,nVi,nC,enableDrag){
Panel.superclass.init.call(this,newID,nP,nX,nY,nZ,nW,nH,nVi,nC);
if (enableDrag)
this.element.cbe.addEventListener('drag');
this.dragEnabled=enableDrag;};
ImagePanel=function(newID,nP,nX,nY,nZ,nW,nH,nVi,newImageSource,newScaleImage,newImageWidth,newImageHeight){
if (arguments.length > 0)
this.init(newID,nP,nX,nY,nZ,nW,nH,nVi,newImageSource,newScaleImage,newImageWidth,newImageHeight);};
ImagePanel.prototype=new GuiWidget();
ImagePanel.prototype.constructor=ImagePanel;
ImagePanel.superclass=GuiWidget.prototype;
ImagePanel.prototype.init=function(newID,nP,nX,nY,nZ,nW,nH,nVi,newImageSource,newScaleImage,newImageWidth,newImageHeight){
ImagePanel.superclass.init.call(this,newID,nP,nX,nY,nZ,nW,nH,nVi);
this.imageNode=document.cbe.createElement("IMG");
this.imageNode.src=newImageSource;
this.imageWidth=newImageWidth;
this.imageHeight=newImageHeight;
this.scaleImage=newScaleImage;
this.element.cbe.appendChild(this.imageNode);
if (this.scaleImage){
this.imageNode.cbe.height(this.height());
this.imageNode.cbe.width(this.width());
this.imageNode.cbe.moveTo(0,0); }
else{
this.centerImage(); }
this.imageNode.imagePanelObject=this;
this.element.cbe.addEventListener('click', EVENT_LISTENER,false);
this.element.cbe.addEventListener('mouseover',EVENT_LISTENER,false);
this.element.cbe.addEventListener('mousedown',EVENT_LISTENER,false);
this.element.cbe.addEventListener('mouseup', EVENT_LISTENER,false);
this.element.cbe.addEventListener('mouseout', EVENT_LISTENER,false);
this.element.cbe.addEventListener('mousemove',EVENT_LISTENER,false);
this.setClass("ImagePanel");};
ImagePanel.prototype.centerImage=function(){
if ((this.imageWidth != null) && (this.imageHeight != null))
this.imageNode.cbe.moveTo((this.element.cbe.width()/2-(this.imageWidth/2)),this.element.cbe.height()/2-(this.imageHeight)/2);
else
this.imageNode.cbe.moveTo((this.element.cbe.width()/2-(this.imageNode.width/2)),this.element.cbe.height()/2-(this.imageNode.height)/2);};
ImagePanel.prototype.show=function(){
this.element.cbe.show();
this.centerImage();};
ImagePanel.prototype.mouseOver=function(e){};
ImagePanel.prototype.mouseOut=function(e){};
ImagePanel.prototype.click=function(e){};
ImagePanel.prototype.mouseDown=function(e){};
Button=function(newID,nP,nX,nY,nZ,nW,nH,nVi){
if (arguments.length > 0)
this.init(newID,nP,nX,nY,nZ,nW,nH,nVi);};
Button.prototype=new GuiWidget();
Button.prototype.constructor=Button;
Button.superclass=GuiWidget.prototype;
Button.prototype.init=function(newID,nP,nX,nY,nZ,nW,nH,nVi){
Button.superclass.init.call(this,newID,nP,nX,nY,nZ,nW,nH,nVi);
this.element.cbe.addEventListener('click',EVENT_LISTENER,false);
this.element.cbe.addEventListener('mouseover',EVENT_LISTENER,false);
this.element.cbe.addEventListener('mousedown',EVENT_LISTENER,false);
this.element.cbe.addEventListener('mouseup',EVENT_LISTENER,false);
this.element.cbe.addEventListener('mouseout',EVENT_LISTENER,false);
this.setClass('button');};
Button.prototype.mouseOver=function(e){
this.setClass('buttonHover');};
Button.prototype.mouseOut=function(e){
this.setClass('button');};
Button.prototype.mouseUp=function(e){
this.setClass('button');};
Button.prototype.mouseDown=function(e){
this.setClass('button');};
TextButton=function(newID,nP,nX,nY,nZ,nW,nH,nVi,newLabel){
if (arguments.length > 0)
this.init(newID,nP,nX,nY,nZ,nW,nH,nVi,newLabel);};
TextButton.prototype=new Button();
TextButton.prototype.constructor=TextButton;
TextButton.superclass=Button.prototype;
TextButton.prototype.init=function(newID,nP,nX,nY,nZ,nW,nH,nVi,newLabel){
TextButton.superclass.init.call(this,newID,nP,nX,nY,nZ,nW,nH,nVi);
var labelNode=document.createTextNode(newLabel);
this.element.cbe.appendChild(labelNode);
if (is.ie)
this.element.setAttribute("className","button");
else
if (is.gecko)
this.element.setAttribute("class","button");};
ImageButton=function(newID,nP,nX,nY,nZ,nW,nH,nVi,newimageName,nT){
if (arguments.length > 0)
this.init(newID,nP,nX,nY,nZ,nW,nH,nVi,newimageName,nT);};
ImageButton.prototype=new Button();
ImageButton.prototype.constructor=ImageButton;
ImageButton.superclass=Button.prototype;
ImageButton.prototype.init=function(newID,nP,nX,nY,nZ,nW,nH,nVi,newimageName,nT){
ImageButton.superclass.init.call(this,newID,nP,nX,nY,nZ,nW,nH,true);
this.imageName=newimageName;
this.tooltip=nT;
this.buttonImage=new Image;
this.buttonImage.src='./'+GuiWidget.THEME_PATH+GuiWidget.THEME+'/images/'+this.imageName+'.png';
this.tooltip=nT;
this.imageNode=document.cbe.createElement("IMG");
this.imageNode.src=this.buttonImage.src;
if (is.ie){
this.imageNode.cbe.width(nW * 3);
this.imageNode.cbe.height(nH);}
this.element.cbe.appendChild(this.imageNode);
if (is.ie){
this.element.setAttribute("className","imageButton");
this.imageNode.setAttribute("className","imageButtonImage");}
else
if (is.gecko){
this.element.setAttribute("class","imageButton");
this.imageNode.setAttribute("class","imageButtonImage");}};
ImageButton.prototype.mouseOver=function(e){
this.imageNode.cbe.left(0 - this.width());
if (is.ie)
this.element.setAttribute("className","imageButtonHover");
else
if (is.gecko)
this.element.setAttribute("class","imageButtonHover");
if (this.tooltip != ''){
GuiWidget.showTooltip(e,this.tooltip);}};
ImageButton.prototype.mouseOut=function(e){
this.imageNode.cbe.left(0);
if (is.ie)
this.element.setAttribute("className","imageButton");
else
if (is.gecko)
this.element.setAttribute("class","imageButtonHover");
GuiWidget.hideTooltip();};
ImageButton.prototype.mouseUp=function(e){
this.imageNode.cbe.left(0 - this.width());
if (is.ie)
this.element.setAttribute("className","imageButtonHover");
else
if (is.gecko)
this.element.setAttribute("class","imageButtonHover");
GuiWidget.hideTooltip();};
ImageButton.prototype.mouseDown=function(e){
this.imageNode.cbe.left(0 - this.width()*2);
if (is.ie)
this.element.setAttribute("className","imageButtonDown");
else
if (is.gecko)
this.element.setAttribute("class","imageButtonDown");
GuiWidget.hideTooltip();};
RadioButtonGroup=function(nId){
if (arguments.length > 0)
this.init(nId);
OBJECT_MANAGER.addControl(this,'radioButtonGroup',nId);};
RadioButtonGroup.prototype.init=function(nId){
this.buttons=new Array();
this.activeButton=-1;
this.id=nId;};
RadioButtonGroup.prototype.setActiveButton=function(buttonIndex){
if (this.activeButton != -1)
this.buttons[this.activeButton].setInactive();
this.activeButton=buttonIndex;};
RadioButtonGroup.prototype.addButton=function(button){
this.buttons[this.buttons.length]=button;
return this.buttons.length-1;};
RadioButton=function(newID,nP,nX,nY,nZ,nW,nH,nVi,newImageRoot,nT,newGroup,newGroupId){
if (arguments.length > 0)
this.init(newID,nP,nX,nY,nZ,nW,nH,nVi,newImageRoot,nT,newGroup,newGroupId);};
RadioButton.prototype=new ImageButton();
RadioButton.prototype.constructor=RadioButton;
RadioButton.superclass=ImageButton.prototype;
RadioButton.prototype.init=function(newID,nP,nX,nY,nZ,nW,nH,nVi,newImageRoot,nT,newGroup,newGroupId){
RadioButton.superclass.init.call(this,newID,nP,nX,nY,nZ,nW,nH,nVi,newImageRoot,nT);
if (newGroupId)
this.group=OBJECT_MANAGER.getControl(newGroupId);
else
this.group=newGroup;
this.groupIndex=this.group.addButton(this);
this.active=false;
if (is.ie){
this.element.setAttribute("className","ImageButton");
this.imageNode.setAttribute("className","ImageButtonImage");}
else
if (is.gecko){
this.element.setAttribute("class","ImageButton");
this.imageNode.setAttribute("class","ImageButtonImage");}
this.imageNode.cbe.moveTo(0,0);};
RadioButton.prototype.setGroup=function(newGroup){
this.group=newGroup;
this.groupIndex=newGroup.addButton(this);};
RadioButton.prototype.isActive=function(){
return this.active; };
RadioButton.prototype.setActive=function(){
this.active=true;
this.imageNode.cbe.left(0 - this.width()*2);};
RadioButton.prototype.setInactive=function(){
this.active=false;
this.imageNode.cbe.left(0);
if (this.setInactiveEvent)
this.setInactiveEvent();};
RadioButton.prototype.click=function(e){
this.group.setActiveButton(this.groupIndex);
this.active=true;
this.imageNode.cbe.left(0-this.width());
if (is.ie)
this.element.setAttribute("className","ImageButtonHover");
else
if (is.gecko)
this.element.setAttribute("class","ImageButtonHover");
GuiWidget.hideTooltip();};
RadioButton.prototype.mouseOver=function(e){
this.imageNode.cbe.left(0-this.width());
if (is.ie)
this.element.setAttribute("className","ImageButtonHover");
else
if (is.gecko)
this.element.setAttribute("class","ImageButtonHover");
if (this.tooltip != ''){
GuiWidget.showTooltip(e,this.tooltip);}};
RadioButton.prototype.mouseOut=function(e){
this.imageNode.cbe.left(this.active?(0-this.width()*2):0);
if (is.ie)
this.element.setAttribute("className","ImageButton");
else
if (is.gecko)
this.element.setAttribute("class","ImageButtonHover");
GuiWidget.hideTooltip();};
RadioButton.prototype.mouseUp=function(e){
this.imageNode.cbe.left(0-this.width());
if (is.ie)
this.element.setAttribute("className","ImageButtonHover");
else
if (is.gecko)
this.element.setAttribute("class","ImageButtonHover");
GuiWidget.hideTooltip();};
RadioButton.prototype.mouseDown=function(e){
this.imageNode.cbe.left(0-this.width()*2);
if (is.ie)
this.element.setAttribute("className","ImageButtonDown");
else
if (is.gecko)
this.element.setAttribute("class","ImageButtonDown");
GuiWidget.hideTooltip();};
ToggleButton=function(newID,nP,nX,nY,nZ,nW,nH,nVi,newImageName,newOnTooltip,newOffTooltip,nS,newUseRolloverImages){
if (arguments.length > 0)
this.init(newID,nP,nX,nY,nZ,nW,nH,nVi,newImageName,newOnTooltip,newOffTooltip,nS,newUseRolloverImages);};
ToggleButton.prototype=new Button();
ToggleButton.prototype.constructor=ToggleButton;
ToggleButton.superclass=Button.prototype;
ToggleButton.prototype.init=function(newID,nP,nX,nY,nZ,nW,nH,nVi,newImageName,newOnTooltip,newOffTooltip,nS,newUseRolloverImages){
ToggleButton.superclass.init.call(this,newID,nP,nX,nY,nZ,nW,nH,nVi);
this.imageName =newImageName;
this.onTooltip =newOnTooltip;
this.offTooltip =newOffTooltip;
this.state =nS;
this.buttonImage=new Image;
this.buttonImage.src='./'+GuiWidget.THEME_PATH+GuiWidget.THEME+'/images/'+this.imageName+'.png';
this.onTooltip =newOnTooltip;
this.offTooltip =newOffTooltip;
this.imageNode =document.cbe.createElement("IMG");
this.imageNode.src=this.buttonImage.src;
if (is.ie){
this.imageNode.cbe.height(this.height());
this.imageNode.cbe.width(this.width()*6);}
this.element.cbe.appendChild(this.imageNode);
this.imageNode.cbe.moveTo(0,0);
this.imageNode.cbe.left(this.state?0:(0-3*this.width()));
this.setClass('imageButton');};
ToggleButton.prototype.setState=function(nS){
this.state=nS;
this.imageNode.cbe.left(this.state?0:(0-3*this.width()));};
ToggleButton.prototype.click=function(e){
this.state=!this.state;
this.imageNode.cbe.left(this.state?0:(0-3*this.width()));
if (this.state){
if (this.clickOn)
this.clickOn(e); }
else{
if (this.clickOff)
this.clickOff(e);}
GuiWidget.hideTooltip();};
ToggleButton.prototype.mouseOver=function(e){
this.imageNode.cbe.left((this.state?0:0-3*this.width()) - this.width());
if (this.state){
if (this.onTooltip != '')
GuiWidget.showTooltip(e,this.onTooltip);}
else{
if (this.offTooltip != '')
GuiWidget.showTooltip(e,this.offTooltip);}};
ToggleButton.prototype.mouseOut=function(e){
this.imageNode.cbe.left(this.state?0:(0-3*this.width()));
GuiWidget.hideTooltip();};
ToggleButton.prototype.mouseUp=function(e){
this.imageNode.cbe.left((this.state?0:0-3*this.width()) - this.width());
GuiWidget.hideTooltip();};
ToggleButton.prototype.mouseDown=function(e){
this.imageNode.cbe.left((this.state?0:0-3*this.width()) - this.width()*2);
GuiWidget.hideTooltip();};
TAB_HORIZ_BUTTON_HEIGHT=20;
TAB_VERT_BUTTON_HEIGHT=27;
TAB_VERT_BUTTON_WIDTH=27;
TabPanel=function(newID,nP,nX,nY,nZ,nW,nH,nVi,newOrientation){
if (arguments.length > 0)
this.init(newID,nP,nX,nY,nZ,nW,nH,nVi,newOrientation);};
TabPanel.prototype=new GuiWidget();
TabPanel.prototype.constructor=TabPanel;
TabPanel.superclass=GuiWidget.prototype;
TabPanel.prototype.init=function(newID,nP,nX,nY,nZ,nW,nH,nVi,newOrientation){
TabPanel.superclass.init.call(this,newID,nP,nX,nY,nZ,nW,nH,nVi,'tabPanel');
this.buttonContainer=document.cbe.createElement("DIV");
this.pageContainer=document.cbe.createElement("DIV");
this.element.cbe.appendChild(this.buttonContainer);
this.element.cbe.appendChild(this.pageContainer);
this.orientation=newOrientation;
this.tabLookupTable=new Object;
buttonContainerX=0;
buttonContainerY=0;
buttonContainerWidth=this.width();
buttonContainerHeight=TAB_HORIZ_BUTTON_HEIGHT;
pageContainerX=0;
pageContainerY=TAB_HORIZ_BUTTON_HEIGHT;
pageContainerWidth=this.width();
pageContainerHeight=this.height()-TAB_HORIZ_BUTTON_HEIGHT;
if (this.orientation){
switch (this.orientation){
case 'left':
pageContainerX=TAB_VERT_BUTTON_WIDTH;
pageContainerY=0;
pageContainerWidth=this.width()-TAB_VERT_BUTTON_WIDTH;
pageContainerHeight=this.height();
buttonContainerWidth=TAB_VERT_BUTTON_WIDTH;
buttonContainerHeight=this.height();
this.buttonContainer.setAttribute(is.ie?"className":"class","TabButtonRowLeft");
this.pageContainer.setAttribute(is.ie?"className":"class","TabPageRow");
break;
case 'right':
break;
case 'bottom':
break;
case 'top':
this.buttonContainer.setAttribute(is.ie?"className":"class","TabButtonRowTop");
this.pageContainer.setAttribute(is.ie?"className":"class","TabPageRow");
break;
default:}}
else{
this.orientation='top';
this.buttonContainer.setAttribute(is.ie?"className":"class","TabButtonRowTop");
this.pageContainer.setAttribute(is.ie?"className":"class","TabPageRow");}
this.buttonContainer.cbe.moveTo(buttonContainerX,buttonContainerY);
this.buttonContainer.cbe.resizeTo(buttonContainerWidth,buttonContainerHeight);
this.pageContainer.cbe.resizeTo(pageContainerWidth,pageContainerHeight);
this.pageContainer.cbe.moveTo(pageContainerX,pageContainerY);
this.buttonContainer.id=this.id+'buttonContainer';
this.buttonContainer.cbe.show();
this.pageContainer.id=this.id+'pageContainer';
this.pageContainer.cbe.show();
this.numTabs=0;
this.firstTab=null;
this.lastTab=null;
this.activeTab=null;
this.totalButtonOffset=0;};
TabPanel.prototype.addTab=function(nId,newCaption,setActive,newPageScroll,newPageType,newUsePageControl,newImage){
if (setActive && (this.activeTab != null))
this.activeTab.setActiveState(false);
newTab=new Tab(nId,
this,
newCaption,
((this.orientation=='top') || (this.orientation=='bottom') || (!this.orientation))?this.totalButtonOffset:0,
((this.orientation=='left') || (this.orientation=='right'))?this.totalButtonOffset:0,
setActive,this.lastTab,newPageScroll,newPageType,newUsePageControl,this.orientation,newImage);
this.tabLookupTable[nId]=newTab;
if (setActive || (this.firstTab==null))
this.activeTab=newTab;
this.numTabs++;
if (this.firstTab==null)
this.firstTab=newTab;
else
this.lastTab.nextTab=newTab;
this.lastTab=newTab;
this.totalButtonOffset=((this.orientation=='top') || (this.orientation=='bottom') || (!this.orientation))?newTab.button.width():(newTab.button.height()+2) + this.totalButtonOffset;
this.redrawButtons();
return newTab;};
TabPanel.prototype.redrawButtons=function(){
this.numTabs=0;
currentTab=this.firstTab;
this.totalButtonOffset=0;
while (currentTab != null){
this.numTabs++;
currentTab.button.moveTo(((this.orientation=='top') || (this.orientation=='bottom') || (!this.orientation))?this.totalButtonOffset:0,((this.orientation=='top') || (this.orientation=='bottom') || (!this.orientation))?0:this.totalButtonOffset);
this.totalButtonOffset=((this.orientation=='top') || (this.orientation=='bottom') || (!this.orientation))?this.totalButtonOffset + currentTab.buttonWidth:(currentTab.button.height()) + this.totalButtonOffset;
currentTab=currentTab.nextTab;}};
TabPanel.prototype.setActiveTab=function(newActiveTab){
this.activeTab.setActiveState(false);
newActiveTab.setActiveState(true);
this.activeTab=newActiveTab;};
TabPanel.prototype.setActiveTabById=function(newActiveTabId){
if (this.tabLookupTable[newActiveTabId]){
this.activeTab.setActiveState(false);
this.tabLookupTable[newActiveTabId].setActiveState(true);
this.activeTab=this.tabLookupTable[newActiveTabId];}};
TabPanel.prototype.width=function(){
if (arguments.length > 0){
this.element.cbe.resizeTo(arguments[0],this.element.cbe.height());
if ((this.orientation=='top') || (this.orientation=='bottom')){
this.buttonContainer.cbe.resizeTo(arguments[0],this.buttonContainer.cbe.height());
this.pageContainer.cbe.resizeTo(arguments[0],this.element.cbe.height()-TAB_HORIZ_BUTTON_HEIGHT);
if (this.orientation=='bottom')
this.buttonContainer.cbe.moveTo(0,this.element.cbe.height()-TAB_HORIZ_BUTTON_HEIGHT);}
else{
if (this.orientation=='right')
this.buttonContainer.cbe.moveTo(arguments[0] - TAB_VERT_BUTTON_WIDTH,0);
this.pageContainer.cbe.resizeTo(nW - TAB_VERT_BUTTON_WIDTH,nH);}
currentTab=this.firstTab;
while (currentTab != null){
currentTab.page.element.cbe.resizeTo(arguments[0],currentTab.page.height());
currentTab=currentTab.nextTab;}}
return this.element.cbe.width();};
TabPanel.prototype.height=function(){
if (arguments.length > 0){
this.element.cbe.resizeTo(this.element.cbe.height(),arguments[0]);
this.pageContainer.cbe.resizeTo(this.pageContainer.cbe.width(),arguments[0] - 20);
if ((this.orientation=='left') || (this.orientation=='right'))
this.buttonContainer.cbe.resizeTo(this.buttonContainer.cbe.width(),this.element.cbe.height);
if (this.orientation=='bottom')
this.buttonContainer.cbe.moveTo(arguments[0] - this.buttonContainer.cbe.height());
currentTab=this.firstTab;
while (currentTab != null){
currentTab.page.element.cbe.resizeTo(this.pageContainer.cbe.width(),arguments[0] - 20);
currentTab=currentTab.nextTab;}}
return this.element.cbe.height();};
TabPanel.prototype.resize=function(nW,nH){
this.element.cbe.resizeTo(nW,nH);
if ((this.orientation=='top') || (this.orientation=='bottom')){
this.buttonContainer.cbe.resizeTo(arguments[0],this.buttonContainer.cbe.height());
this.pageContainer.cbe.resizeTo(nW,nH - this.buttonContainer.cbe.height());
if (this.orientation=='bottom')
this.buttonContainer.cbe.moveTo(nH - this.buttonContainer.cbe.height());}
else{
this.buttonContainer.cbe.resizeTo(this.buttonContainer.cbe.width(),nH);
if (this.orientation=='right')
this.buttonContainer.cbe.moveTo(nW - TAB_VERT_BUTTON_WIDTH,0);
this.pageContainer.cbe.resizeTo(nW - TAB_VERT_BUTTON_WIDTH,nH);}
currentTab=this.firstTab;
while (currentTab != null){
currentTab.page.resize(this.pageContainer.cbe.width(),this.pageContainer.cbe.height());
currentTab=currentTab.nextTab;}};
TabButton=function(newID,nP,nX,nY,newTabPanel,newTab,newCaption,newActive,newOrientation,newImage){
if (arguments.length > 0)
this.init(newID,nP,nX,nY,newTabPanel,newTab,newCaption,newActive,newOrientation,newImage);};
TabButton.prototype=new Button();
TabButton.prototype.constructor=TabButton;
TabButton.superclass=Button.prototype;
TabButton.prototype.init=function(newID,nP,nX,nY,newTabPanel,newTab,newCaption,newActive,newOrientation,newImage){
this.id=newID;
this.xPosition=nX;
this.parentElement=nP;
this.tabPanel=newTabPanel;
this.tab=newTab;
this.caption=newCaption;
this.active=newActive;
this.buttonWidth=(this.caption.length)*8+20;
this.orientation=newOrientation;
this.imagePath=newImage;
this.buttonElement=document.cbe.createElement("DIV");
this.parentElement.cbe.appendChild(this.buttonElement);
this.buttonElement.cbe.height(((!this.orientation) || (this.orientation=='top') || (this.orientation=='bottom'))?this.parentElement.cbe.height():27);
this.buttonElement.cbe.width(this.buttonWidth);
this.buttonElement.cbe.left(this.xPosition);
this.buttonElement.cbe.show();
if (!this.orientation) this.orientation='top';
switch (this.orientation){
case 'top':
this.buttonElement.setAttribute(is.ie?"className":"class","tabButton");
this.activeButtonHTML='<table id="'+this.id+'ActiveTabButton" cellpadding="0" cellspacing="0" width="'+this.buttonWidth+'" height="100%">'+'<tbody>'+'<tr>'+'<td class="activeTabButtonLeft">'+'<img src="./blank.gif" width="10px" border="0">'+'</td>'+'<td class="activeTabButtonCenter">'+this.caption+'</td>'+'<td class="activeTabButtonRight">'+'<img src="./blank.gif" width="10px" border="0">'+'</td>'+'</tr>'+'</tbody>'+'</table>';
this.inactiveButtonHTML='<table id="'+this.id+'inactiveTabButton" cellpadding="0" cellspacing="0" width="'+this.buttonWidth+'" height="100%">'+'<tbody>'+'<tr>'+'<td class="inactiveTabButtonLeft">'+'<img src="./blank.gif" width="10px" border="0">'+'</td>'+'<td class="inactiveTabButtonCenter">'+this.caption+'</td>'+'<td class="inactiveTabButtonRight">'+'<img src="./blank.gif" width="10px" border="0">'+'</td>'+'</tr>'+'</tbody>'+'</table>';
break;
case 'bottom':
break;
case 'left':
this.activeButtonHTML='<img src="'+this.imagePath+'">';
this.inactiveButtonHTML='<img src="'+this.imagePath+'">';
this.buttonElement.setAttribute(is.ie?"className":"class","vtabButtonLeftActive");
break;
case 'right':
break;}
TabButton.superclass.init.call(this,newID,nP,nX,0,5,this.buttonWidth,25,true);
this.element.cbe.width(this.buttonWidth);
this.setClass('tabButtonEventReciever');
this.setActiveState(this.active);};
TabButton.prototype.hide=function(newX,newY){
this.element.cbe.hide();
this.buttonElement.cbe.hide();};
TabButton.prototype.moveTo=function(newX,newY){
this.element.cbe.moveTo(newX,newY);
this.buttonElement.cbe.moveTo(newX,newY);};
TabButton.prototype.setActiveState=function (nS){
this.buttonElement.cbe.innerHtml(nS?this.activeButtonHTML:this.inactiveButtonHTML);
if ((this.orientation=='top') || (this.orientation=='bottom'))
this.buttonElement.setAttribute(is.ie?"className":"class","tabButton");
else
this.buttonElement.setAttribute(is.ie?"className":"class",nS?"vtabButtonLeftActive":"vtabButtonLeftInactive");
this.active=nS;};
TabButton.prototype.mouseOver=function (e){
if ((this.orientation=='left') || (this.orientation=='right'))
GuiWidget.showTooltip(e,this.caption);};
TabButton.prototype.mouseDown=function (e){
GuiWidget.hideTooltip();};
TabButton.prototype.mouseUp=function (e){
GuiWidget.hideTooltip();};
TabButton.prototype.mouseOut=function (e){
GuiWidget.hideTooltip();};
TabButton.prototype.click=function(e){
if (!this.active){
this.tabPanel.setActiveTab(this.tab);}
GuiWidget.hideTooltip();};
TabPage=function(nId,nP,newTabPanel,newTab,newScroll,newActive,page_type,newUsePageControl){
if (arguments.length > 0)
this.init(nId,nP,newTabPanel,newTab,newScroll,newActive,page_type,newUsePageControl);};
TabPage.prototype=new GuiWidget();
TabPage.prototype.constructor=TabPage;
TabPage.superclass=GuiWidget.prototype;
TabPage.prototype.init=function (nId,nP,newTabPanel,newTab,newScroll,newActive,page_type,newUsePageControl){
this.page_type=page_type;
this.scroll=newScroll;
this.active=newActive;
this.parentElement=nP;
this.tabPanel=newTabPanel;
this.usePageControl=newUsePageControl;
this.tab=newTab;
TabPage.superclass.init.call(this,nId,this.parentElement,0,0,0,this.parentElement.cbe.width(),this.parentElement.cbe.height(),newActive);
if (this.usePageControl){
this.pageHeader=new GuiWidget((this.id + 'PageHeader'),this.element,0,0,0,this.element.cbe.width(),25,true,'tabPageHeader');
this.closeButton=new ImageButton(this.id+"CloseButton",this.pageHeader.element,this.pageHeader.element.cbe.width() - 20,0,0,15,15,true,"tabKill","Close this tab");
this.closeButton.tab=this.tab;
this.closeButton.clickEvent=function(e){
this.tab.closeButtonCallback();};
this.contentWidget=new GuiWidget((this.id + 'PageContent'),this.element,0,25,0,this.element.cbe.width(),this.element.cbe.height()-25,true,this.scroll?"tabPageScroll":"tabPage");
this.content=this.contentWidget.element;}
else{
this.content=this.element;
if (this.page_type=='DIV')
if (is.ie)
this.element.setAttribute("className",this.scroll?"tabPageScroll":"tabPage");
else
if (is.gecko)
this.element.setAttribute("class",this.scroll?"tabPageScroll":"tabPage");}};
TabPage.prototype.setContentText=function(newContentString){
this.element.cbe.innerHtml(newContentString);
if (this.page_type=='DIV')
if (is.ie)
this.element.setAttribute("className",this.scroll?"tabPageScroll":"tabPage");
else
if (is.gecko)
this.element.setAttribute("class",this.scroll?"tabPageScroll":"tabPage");};
TabPage.prototype.setContentElement=function(nE){
this.element.cbe.appendChild(nE);};
TabPage.prototype.setActiveState=function(nS){
this.setVisibility(nS);
this.active=nS;
if (this.setActiveStateEvent)
this.setActiveStateEvent(nS);};
TabPage.prototype.resize=function(nW,nH){
this.element.cbe.resizeTo(nW,nH);
if (this.usePageControl){
this.pageHeader.resize(this.element.cbe.width(),25);
this.closeButton.setPosition(this.pageHeader.element.cbe.width() - 30,0);
this.contentWidget.resize(this.element.cbe.width(),this.element.cbe.height()-25);};
if (this.resizeEvent)
this.resizeEvent(nW,nH);};
Tab=function(nId,newPanel,newCaption,newButtonXOffset,newButtonYOffset,newActive,newPreviousTab,newPageScroll,newPageType,newPageControl,newOrientation,newImage){
this.id=nId;
OBJECT_MANAGER.addControl(this,'tab',nId);
this.panel=newPanel;
this.buttonXOffset=newButtonXOffset;
this.buttonYOffset=newButtonYOffset;
this.caption=newCaption;
this.active=newActive;
this.page_type=newPageType;
this.use_page_control=newPageControl;
this.orientation=newOrientation;
this.button=new TabButton(this.id+'Button',this.panel.buttonContainer,this.buttonXOffset,newButtonYOffset,this.panel,this,this.caption,this.active,this.orientation,newImage);
this.buttonWidth=this.button.width();
this.page=new TabPage(this.id+'Page',this.panel.pageContainer,this.panel,this,newPageScroll,this.active,this.page_type,this.use_page_control);
this.previousTab=newPreviousTab;
this.nextTab=null;
return;};
Tab.prototype.clear=function(){
this.button.hide();
this.page.element.cbe.hide();
if (this.previousTab==null){
if (this.nextTab==null){
this.panel.firstTab=null;
this.panel.lastTab=null;}
else{
this.nextTab.previousTab=null;
this.panel.firstTab=this.nextTab;
this.panel.setActiveTab(this.panel.firstTab);}}
else{
this.previousTab.nextTab=this.nextTab;
this.panel.setActiveTab(this.previousTab);
if (this.nextTab==null){
this.panel.lastTab=this.previousTab;}
else{
this.nextTab.previousTab=this.previousTab;}}
this.panel.redrawButtons();};
Tab.prototype.setActiveState = function(newState){
this.button.setActiveState(newState);
this.page.setActiveState(newState);
if (newState){
if (this.onTabShow)
this.onTabShow();}
else{
if (this.onTabHide)
this.onTabHide();}};
Tab.prototype.getButton=function(){
return this.button;};
Tab.prototype.getPage=function(){
return this.page;};
Tab.prototype.getPanel=function(){
return this.panel;};
Tab.prototype.closeButtonCallback=function(){
if (this.onClose)
this.onClose();
else
this.clear();};
function linearGradient(color1,color2,numSteps){
result=new Array();
c1=new Array(parseInt("0x"+color1.substr(1,2)),parseInt("0x"+color1.substr(3,2)),parseInt("0x"+color1.substr(5,2)));
c2=new Array(parseInt("0x"+color2.substr(1,2)),parseInt("0x"+color2.substr(3,2)),parseInt("0x"+color2.substr(5,2)));
dC=new Array(Math.round((c2[0]-c1[0])/numSteps),Math.round((c2[1]-c1[1])/numSteps),Math.round((c2[2]-c1[2])/numSteps));
for (i=0; i<numSteps; i++){
R=(dC[0]*i+c1[0]).toString(16);
G=(dC[1]*i+c1[1]).toString(16);
B=(dC[2]*i+c1[2]).toString(16);
result[i]="#"+((R.length==1)?("0"+R):R)+((G.length==1)?("0"+G):G)+((B.length==1)?("0"+B):B); }
return result;};


