var m_rootCache =       [];
var m_tokenMap =        [];
var m_tokenList =       null;
var m_synonyms =        [];
var m_eventLayer =      null;
var PREFIX =            0;
var HEADING =           1;
var HORIZONTAL =        0;
var VERTICAL =          1;
var NORMAL =            0;
var SELECTED =          1;
var HOVER =             2;
var SELECTEDHOVER =     3;
var PRESSED =           4;
var BACKGROUND =        5;
var TOP =               0;
var BOTTOM =            1;
var LEFT =              0;
var RIGHT =             1;
var CENTER =            2;
var UNSORTED =          0;
var ASCENDING =         1;
var DESCENDING =        -1;
var NOSELECTION =       0;
var SINGLESELECTION =   1;
var MULTISELECTION =    2;
function click(strID,isClickedOnText,intRecordIndex)
{
var item = getItem(strID);
if( item != null )
{
m_eventLayer = getLayer(item.itemRoot.getLayer());
item.click(isClickedOnText,intRecordIndex);
m_eventLayer = null;
}
}
function hover(strID,isMouseOver,intRecordIndex)
{
var item = getItem(strID);
if( item != null )
{
m_eventLayer = getLayer(item.itemRoot.getLayer());
item.hover(isMouseOver,intRecordIndex);
m_eventLayer = null;
}
return true;
}
function press(strID,isMouseDown,intRecordIndex)
{
var item = getItem(strID);
if( item != null )
{
m_eventLayer = getLayer(item.itemRoot.getLayer());
item.press(isMouseDown,intRecordIndex);
m_eventLayer = null;
}
return true;
}
function change(strID,strContent,intRecordIndex)
{
var item = getItem(strID);
if( item != null )
{
m_eventLayer = getLayer(item.itemRoot.getLayer());
item.change(strContent,intRecordIndex);
m_eventLayer = null;
}
}
function build(strID)
{
var item = getItem(strID);
if( item != null )
{
m_eventLayer = getLayer(item.itemRoot.getLayer());
item.build();
m_eventLayer = null;
}
}
function getItem(strID)
{
var item = getRoot(strID);
if( item != null && strID != null )
item = item.get(strID);
return item;
}
function getRoot(strID)
{
var item = null;
var i = strID.indexOf("/");
if( i > 0 )
{
var firstField = strID.substring(0,i);
item = m_rootCache[firstField];
}
else
item = m_rootCache[strID];
return item;
}
function addRoot(itemRoot,strKey)
{
if( strKey )
m_rootCache[strKey] = itemRoot;
else
m_rootCache[itemRoot.strID] = itemRoot;
Cell.prototype.intCellCount = 0;
}
function removeRoot(strID)
{
var item = m_rootCache[strID];
m_rootCache[strID] = null;
return item;
}
function addSynonym(strName,strConstuctor)
{
m_synonyms[strName] = strConstuctor;
}
function getSynonym(strName)
{
return m_synonyms[strName];
}
function setImageSource(strLayer,strImageID,strImageSrc)
{
var layer = getLayer(strLayer);
if( layer != null )
{
var img;
img = layer.document.images[strImageID];
if( img != null )
img.src = strImageSrc;
}
}
function setClass(strLayer,strValueID,strClass)
{
var layer = getLayer(strLayer);
if ( layer !=null && layer.tagName !="DIV" )
layer.className = strClass;
}
function setToken(key,token)
{
m_tokenMap[key] = ""+token;
}
function getToken(key)
{
var ret = m_tokenMap[key];
if( !ret && m_tokenList )
ret = m_tokenList.getContent(key);
if( ret && ret != "" )
return ret;
return null;
}
function displayContent(strContent,strLayer)
{
var layer = getLayer(strLayer);
if( layer != null )
{
if( layer.tagName == "DIV" ){
layer.innerHTML = strContent;
top.getit_main_head.prepLyr('tabs');
}
else if (layer.document == null)
{
top.location.reload();
}
}
else
{
alert( "Layer not found:"+strLayer );
layer.getlayer();
}
}
function displayLink(strLink,strLayer)
{
if( strLink.indexOf("javascript:") == 0 )
{
var func = strLink.substring(11);
eval(func);
}
else if( strLayer && strLayer != null && strLayer != "_blank" )
{
var layer = getLayer( strLayer );
if( layer != null )
{
layer.location.href=strLink;
}
else
alert( "Layer not found:"+strLayer );
}
}
function encode(str)
{
str = str.replace(/&nbsp;/g,"&.nbsp;");
str = str.replace(/ /g,"&nbsp;");
str = str.replace(/</g,"&lt;");
str = str.replace(/>/g,"&gt;");
var lines = str.split('\n');
str = "";
for( var i=0; i < lines.length; ++i )
str += lines[i]+"<br>\n";
return str;
}
function Item(strID,strContent)
{
if( strID )  this.setID(strID);
if( strContent ) this.strContent = strContent;
}
Item.prototype.strType =            "Item";
Item.prototype.strClassList =       ";Item;";
Item.prototype.build =              _item_build;
Item.prototype.calcVisible =        _item_calcVisible;
Item.prototype.getCurrentRecord =   _item_getCurrentRecord;
Item.prototype.getCurrentRecordIndex = _item_getCurrentRecordIndex;
Item.prototype.getFullPathID =      _item_getFullPathID;
Item.prototype.getLink =            _item_getLink;
Item.prototype.getTarget =          _item_getTarget;
Item.prototype.getContent =         _item_getContent;
Item.prototype.gotoLink =           _item_gotoLink;
Item.prototype.isInContext =        _item_isInContext;
Item.prototype.isSelectable =       _item_isSelectable;
Item.prototype.setContent =         new Function("strValue","this.strContent = strValue;");
Item.prototype.setContext =         new Function("strValue","this.strContext = strValue");
Item.prototype.setCondition =       new Function("strValue","this.strCondition = strValue");
Item.prototype.setGetModelValue =   new Function("bValue",  "this.bGetValueFromModel = bValue");
Item.prototype.setID =              _item_setID;
Item.prototype.setLink =            _item_setLink;
Item.prototype.setRoot =            new Function("itemRoot","this.itemRoot = itemRoot;");
Item.prototype.setSelectable =      new Function("bValue",  "this.bSelectable = bValue");
Item.prototype.setSelection =       _item_setSelection;
Item.prototype.setSupportsLink =    new Function("bValue",  "this.bSupportsLink = bValue;");
Item.prototype.setTarget =          new Function("strValue","this.strTarget = strValue;");
Item.prototype.typeOf =             _item_typeOf;
addSynonym("Name","ID");
function Html(strID,strContent)
{
this.base =                       Item;
this.base(strID,strContent);
}
Html.prototype =                    new Item;
Html.prototype.strType =            "Html";
Html.prototype.strClassList =       Item.prototype.strClassList+"Html;";
function _item_build()
{
var retString = "";
var bHasLink = (this.getLink && this.getLink() );
if( bHasLink )
{
retString += "<A href='"+this.getLink()+"'";
if( this.getTarget() )
retString += " target='"+this.getTarget()+"'";
retString += ">";
}
retString += this.getContent();
if( bHasLink )
retString += "</A>";
return retString;
}
function _item_calcVisible()
{
this.bIsVisible = this.isInContext();
}
function _item_getCurrentRecord()
{
if( this.itemRoot )
return this.itemRoot.getCurrentRecord();
return null;
}
function _item_getCurrentRecordIndex()
{
if( this.itemRoot )
return this.itemRoot.getCurrentRecordIndex();
return -1;
}
function _item_getFullPathID()
{
var retString = this.strID;
retString = retString;
if( ! retString )
retString = this.strType;
if( this.itemParent )
retString = this.itemParent.getFullPathID() + "/" + retString;
return retString;
}
function _item_getLink()
{
var strReturn = null;
if( this.getCurrentRecordIndex() == -2 )
return null;
if( this.bSupportsLink )
{
if( this.strLink && this.strLink != null )
{
if( this.itemRoot != null )
{
strReturn = this.strLink,this.getCurrentRecord();
}
else
{
strReturn = this.strLink;
}
}
else if( this.itemParent != null )
strReturn = this.itemParent.getLink();
if( strReturn != null )
{
strReturn = strReturn;
}
}
return strReturn;
}
function _item_getTarget()
{
if( this.strLink && this.strLink != null )
{
return this.strTarget;
}
if( this.itemParent != null )
return this.itemParent.getTarget();
return null;
}
function _item_getContent(strID)
{
if( strID && eval("typeof this"+strID) == "string" )
return eval("this"+strID );
var strReturn = this.strContent;
if( this.bGetValueFromModel && this.getCurrentRecord() != null )
strReturn = this.getCurrentRecord().getContent(this.strContent);
return strReturn;
}
function _item_gotoLink()
{
var link = this.getLink();
var target = this.getTarget();
if( link == null || link == "" )
return;
var layer = getLayer(this.itemRoot.getLayer());
var formName = 0;
if( this.itemRoot && this.itemRoot.bLinks){
displayLink( link, target );
}
}
function _item_isSelectable()
{
if( this.bSelectable && this.itemRoot
&& this.itemRoot.intSelectionModel > 0 )
return true;
return false;
}
function _item_isInContext()
{
var bVisible = true;
if( this.itemRoot != null )
bVisible = this.itemRoot.isItemInContext(this);
return bVisible;
}
function _item_setID(strValue)
{
this.strID = strValue;
this.strLowerID = strValue.toLowerCase();
if( this.itemParent != null && isNaN(this.strID) )
this.itemParent[this.strLowerID] = null;
if( this.itemParent != null && this.itemParent.addDescendent )
this.itemParent.addDescendent(this);
}
function _item_setLink(strValue)
{
if( strValue == "true" )
this.setSupportsLink(true);
else if( strValue == "false" )
this.setSupportsLink(false);
else
this.strLink = strValue;
}
function _item_setSelection(bValue,bOverride)
{
if( bOverride || this.isSelectable() && this.itemRoot
&& this.itemRoot.strSelectionType == this.strType )
{
if( this.bSelected != bValue )
{
this.bSelected = bValue;
if( !bOverride && this.itemRoot.intSelectionModel == 1 )
{
var itemLastSelection = this.itemRoot.itemLastSelection;
if( itemLastSelection != null && itemLastSelection != this )
this.itemRoot.itemLastSelection.setSelection(false);
if( bValue )
this.itemRoot.itemLastSelection = this;
else
this.itemRoot.itemLastSelection = null;
}
if( this.getIterator )
{
var it = this.getIterator();
for( var item = it.getFirstItem(); item != null; item = it.getNextItem() )
{
item.setSelection(bValue,true);
}
}
}
}
else if( this.itemParent )
this.itemParent.setSelection(bValue);
}
function _item_typeOf(strType)
{
if( this.strClassList.indexOf(";"+strType+";") >= 0 )
return true;
return false;
}
Item.prototype.bGetValueFromModel = true;
Item.prototype.bInAlternateRow =    false;
Item.prototype.bIsVisible =         true;
Item.prototype.bSelectable =        true;
Item.prototype.bSelected =          false;
Item.prototype.bSupportsLink =      true;
Item.prototype.intCurrentItemIndex = -1;
Item.prototype.itemParent =         null;
Item.prototype.itemRoot =           null;
Item.prototype.strCondition =       "";
Item.prototype.strContext =         "";
Item.prototype.strID =              null;
Item.prototype.strLink =            null;
Item.prototype.strLowerID =         null;
Item.prototype.strContent =         "";
Html.prototype.bGetValueFromModel = false;
function Cell(strID,strContent)
{
this.base =                       Item;
this.base(strID,strContent);
this.intCellID = Cell.prototype.intCellCount++;
}
Cell.prototype =                    new Item;
Cell.prototype.strType =            "Cell";
Cell.prototype.strClassList =       Item.prototype.strClassList+"Cell;";
Cell.prototype.build =              _cell_build;
Cell.prototype.buildImage =         _cell_buildImage;
Cell.prototype.click =              _cell_click;
Cell.prototype.getBalloonText =     _cell_getBalloonText;
Cell.prototype.getCellName =        _cell_getCellName;
Cell.prototype.getClass =           _cell_getClass;
Cell.prototype.getColumnCount =     _cell_getColumnCount;
Cell.prototype.getImage =           _cell_getImage;
Cell.prototype.getImagePath =       _cell_getImagePath;
Cell.prototype.hover =              _cell_hover;
Cell.prototype.press =              _cell_press;
Cell.prototype.setAlign =           new Function("intValue", "this.intAlign = intValue");
Cell.prototype.setBalloonText =     new Function("strValue", "this.strBalloon = strValue || ''");
Cell.prototype.setClass =           _cell_setClass;
Cell.prototype.setImage =           _cell_setImage;
Cell.prototype.setImageLocation =   new Function("intValue", "this.intImageLocation = intValue");
Cell.prototype.setLinkWhenSelected = new Function("bValue",  "this.bLinkWhenSelected = bValue");
Cell.prototype.setNowrap =          new Function("bValue",   "this.bNowrap = bValue");
Cell.prototype.setSelection =       _cell_setSelection;
Cell.prototype.setStyle =           new Function("strValue", "this.strStyle = strValue");
Cell.prototype.setSpan =            _cell_setSpan;
Cell.prototype.setVAlign =          new Function("intValue", "this.intVAlign = intValue");
Cell.prototype.setWidth =           new Function("strValue", "this.strWidth = strValue" );
addSynonym("Balloon","BalloonText");
function Label(strID,strContent)
{
this.base =                       Cell;
this.base(strID,strContent);
}
Label.prototype =                   new Cell;
function Break(strID)
{
this.base =                       Cell;
this.base(strID,"&nbsp;");
}
Break.prototype =                   new Cell;
function ProxyCell(item)
{
this.base =                       Cell;
this.base(item.strID,null);
this.itemWrap =                   item;
item.itemParent =                 this;
item.setRoot(this.itemRoot);
}
ProxyCell.prototype =               new Cell;
ProxyCell.prototype.strType =       "ProxyCell";
ProxyCell.prototype.strClassList =  Cell.prototype.strClassList+"ProxyCell;";
ProxyCell.prototype.getContent =    new Function("return this.itemWrap.build()");
ProxyCell.prototype.setRoot =       new Function("item","this.itemRoot=item;this.itemWrap.setRoot(item)");
function _cell_build()
{
if( !this.bIsVisible )
return "";
var retString = "";
var strID = this.getCellName();
var intRecordIndex = this.getCurrentRecordIndex();
if( intRecordIndex == -2 )
this.bInHeading = true;
else
this.bInHeading = false;
if( intRecordIndex >= 0 )
this.bInAlternateRow = this.getCurrentRecord().bInAlternateRow;
else
this.bInAlternateRow = false;
var strClass = "";
if( this.getClass() )
strClass = " class='"+this.getClass()+"'";
var bHasLink = (this.getLink && this.getLink() != null || this.isSelectable() );
retString += "   <TD ";
if( bHasLink )
retString += " id='cell"+strID+"' name='cell"+strID+"'";
if( this.getImage() != null && this.intImageLocation == LEFT && intRecordIndex != -2)
{
retString += this.buildImage(bHasLink);
}
if( bHasLink )
{
retString += "<A id='link"+strID+"' name='link"+strID+"'"+strClass+" href='javascript:"+this.strSourceLocation+".click(\""+this.getFullPathID()+"\",true,"+intRecordIndex+")'";
retString += " onmouseover='"+this.strSourceLocation+".hover(\"" + this.getFullPathID() + "\",true,"+intRecordIndex+"); return true;'";
retString += " onmouseout='"+this.strSourceLocation+".hover(\"" + this.getFullPathID() + "\",false,"+intRecordIndex+"); return true;'";
retString += ">";
}
if( this.strSpan != null )
retString += this.strSpan;
var strContent = this.getContent();
if( intRecordIndex != -2 || this.bIsLabel && strContent && strContent != "" )
retString += strContent;
else
retString += "&nbsp;";
if( this.strSpan != null )
retString += "</SPAN>";
if( bHasLink )
retString += "</A>";
if( this.getImage() != null && (this.intImageLocation == RIGHT || intRecordIndex == -2))
{
retString += this.buildImage(bHasLink);
}
retString += "</TD>\n";
return retString;
}
function _cell_buildImage(bHasLink)
{
var retString = "";
var intRecordIndex = this.getCurrentRecordIndex();
var strID = this.getCellName();
if( bHasLink )
{
retString += "<A href='javascript:"+this.strSourceLocation+".click(\"" + this.getFullPathID() + "\",false,"+intRecordIndex+")'";
if( this.strStyle != null && this.strStyle != "" )
retString += " style='"+this.strStyle+"'";
if( this.strBalloon )
retString += " title='"+this.getBalloonText()+"'";
retString += " onmouseover='"+this.strSourceLocation+".hover(\"" + this.getFullPathID() + "\",true,"+intRecordIndex+"); return true;'";
retString += " onmouseout='"+this.strSourceLocation+".hover(\"" + this.getFullPathID() + "\",false,"+intRecordIndex+"); return true;'";
retString += ">";
}
var strDimensions = "";
if( this.intImageWidth > 0 )
strDimensions += " width="+this.intImageWidth;
if( this.intImageHeight > 0 )
strDimensions += " height="+this.intImageHeight;
var strImageName = "image"+((this.intImageLocation==LEFT)?"Left":"Right")+strID;
retString += "<IMG id='"+strImageName+"' name='"+strImageName+"' src="+this.getImage()+strDimensions+" border=noborder";
if( bHasLink )
retString += "></A>";
else
retString += ">";
return retString;
}
function _cell_click(bClickedOnText,intRecordIndex)
{
if( this.itemRoot )
this.itemRoot.setCurrentRecordIndex(intRecordIndex);
if( intRecordIndex == -2 )
this.bInHeading = true;
else
this.bInHeading = false;
if( intRecordIndex >= 0 )
this.bInAlternateRow = this.getCurrentRecord().bInAlternateRow;
else
this.bInAlternateRow = false;
if( this.bLinkWhenSelected || ! this.bSelected )
this.gotoLink();
this.setSelection(!this.bSelected);
}
function _cell_getBalloonText()
{
return this.strBalloon;
}
function _cell_getCellName()
{
var intRecordIndex = this.getCurrentRecordIndex();
if( intRecordIndex >= 0 )
return this.intCellID + "_" + intRecordIndex;
return this.intCellID;
}
function _cell_getClass()
{
if( this.bInHeading )
return this.strHeadingClass;
if( this.bInAlternateRow )
{
if( this.bSelected && this.strAltSelectedClass )
return this.strAltSelectedClass;
return this.strAltClass;
}
if( this.bSelected && this.strSelectedClass )
return this.strSelectedClass;
return this.strClass;
}
function _cell_getColumnCount(intCol)
{
var root = this.itemRoot;
if( this.itemRoot == this )
root = this.itemParent.itemRoot;
if( intCol > 0 && root.bUseCellSeparator )
return 2;
return 1;
}
function _cell_getImage()
{
var retString = null;
if( this.bInHeading )
{
return null;
}
if( this.bInAlternateRow )
{
if( this.bSelected && this.strAltSelectedImage )
retString = this.strAltSelectedImage;
else if( this.strAltImage )
retString = this.strAltImage;
}
if( ! retString )
{
if( this.bSelected && this.strSelectedImage )
retString = this.strSelectedImage;
else
retString = this.strImage;
}
return this.getImagePath(retString);
}
function _cell_getImagePath(image)
{
if( ! this.strImagePath || !image || image.substring(0,6).toLowerCase() == "images" )
return image;
return this.strImagePath + image;
}
function _cell_hover(bMouseOver,intRecordIndex)
{
if( this.itemRoot )
this.itemRoot.setCurrentRecordIndex(intRecordIndex);
if( intRecordIndex == -2 )
this.bInHeading = true;
else
this.bInHeading = false;
if( intRecordIndex >= 0 )
this.bInAlternateRow = this.getCurrentRecord().bInAlternateRow;
else
this.bInAlternateRow = false;
var strID = this.getCellName();
var strImage = null;
var strClass = null;
if( bMouseOver )
{
window.status=this.getBalloonText();
}
else
{
strImage = this.getImage();
window.status="";
}
if( strImage != null )
if( this.intImageLocation == LEFT )
setImageSource(this.itemRoot.getLayer(),"imageLeft"+strID,strImage);
else
setImageSource(this.itemRoot.getLayer(),"imageRight"+strID,strImage);
if( strClass != null )
{
setClass(this.itemRoot.getLayer(),"cell"+strID,strClass);
setClass(this.itemRoot.getLayer(),"link"+strID,strClass);
}
}
function _cell_press(bMouseDown,intRecordIndex)
{
if( this.itemRoot )
this.itemRoot.setCurrentRecordIndex(intRecordIndex);
if( intRecordIndex == -2 )
this.bInHeading = true;
else
this.bInHeading = false;
if( intRecordIndex >= 0 )
this.bInAlternateRow = this.getCurrentRecord().bInAlternateRow;
else
this.bInAlternateRow = false;
var strID = this.getCellName();
var strImage = null;
var strClass = null;
if( strImage != null )
if( this.intImageLocation == LEFT )
setImageSource(this.itemRoot.getLayer(),"imageLeft"+strID,strImage);
else
setImageSource(this.itemRoot.getLayer(),"imageRight"+strID,strImage);
if( strClass != null  )
{
setClass(this.itemRoot.getLayer(),"cell"+strID,strClass);
setClass(this.itemRoot.getLayer(),"link"+strID,strClass);
}
}
function _cell_setClass(intType,strClass,bSetAlternate)
{
if( bSetAlternate )
{
if( ! intType || intType == 0 )
this.strAltClass = strClass;
else if( intType == 1 )
this.strAltSelectedClass = strClass;
}
else
{
if( ! intType || intType == 0 )
this.strClass = strClass;
else if( intType == 1 )
this.strSelectedClass = strClass;
}
}
function _cell_setImage(intType,strImageSrc,bSetAlternate)
{
if( bSetAlternate )
{
if( ! intType || intType == 0 )
this.strAltImage = strImageSrc;
else if( intType == 1 )
this.strAltSelectedImage = strImageSrc;
}
else
{
if( ! intType || intType == 0 )
this.strImage = strImageSrc;
else if( intType == 1 )
this.strSelectedImage = strImageSrc;
}
}
Cell.prototype.baseSetSelection = Item.prototype.setSelection;
function _cell_setSelection(bValue,bOverride)
{
this.baseSetSelection(bValue,bOverride);
this.hover(bValue,this.getCurrentRecordIndex());
}
function _cell_setSpan(strSpanID,strOptions)
{
if( strSpanID )
this.strSpan = "<SPAN id='"+strSpanID+"' name='"+strSpanID+"'";
if( strOptions )
this.strSpan += " "+strOptions;
this.strSpan += ">";
}
Cell.prototype.bIsLabel =           false;
Cell.prototype.bInHeading =         false;
Cell.prototype.bLinkWhenSelected =  true;
Cell.prototype.bNowrap =            false;
Cell.prototype.intAlign =           LEFT;
Cell.prototype.intCellCount =       0;
Cell.prototype.intColumnWidth =     1;
Cell.prototype.intImageLocation =   LEFT;
Cell.prototype.intVAlign =          CENTER;
Cell.prototype.strBalloon =         "";
Cell.prototype.strImage =           null;
Cell.prototype.strSelectedClass =   "SelectedItem";
Cell.prototype.strSelectedImage =   null;
Cell.prototype.strSourceLocation =  "window.parent";
Cell.prototype.strSpan =            null;
Cell.prototype.strStyle =           null;
Cell.prototype.strWidth =           null;
Break.prototype.bGetValueFromModel = false;
Label.prototype.bGetValueFromModel = false;
Label.prototype.bNarrowWidth =     true;
Label.prototype.setImageLocation = RIGHT;
Label.prototype.getLink =          null;
function List(strID,strContent)
{
this.base =                       Item;
this.base(strID,strContent);
}
List.prototype =                    new Item;
List.prototype.strType =            "List";
List.prototype.strClassList =       Item.prototype.strClassList+"List;";
List.prototype.add =                _list_add;
List.prototype.addDescendent =      _list_addDescendent;
List.prototype.calcVisible =        _list_calcVisible;
List.prototype.find =               _list_find;
List.prototype.get =                _list_get;
List.prototype.getContent =         _list_getContent;
List.prototype.getIterator =        _list_getIterator;
List.prototype.isItemInContext =    _list_isItemInContext;
List.prototype.set =                _list_set;
List.prototype.setRoot =            _list_setRoot;
List.prototype.setSelectionModel =  _list_setSelectionModel;
function _list_add(item,strContent)
{
if( typeof item == "string" )
item = eval( "new "+this.strType+"(item,strContent)" );
this[this.length] = item;
if( item.strID == null )
item.strID = ""+this.length;
else
this.addDescendent(item);
item.itemParent = this;
if( this.itemRoot != null )
item.setRoot(this.itemRoot);
this.length++;
return item;
}
function _list_addDescendent(item)
{
if( ! isNaN(item.strID) )
return;
var descendent = this[item.strLowerID];
if( descendent )
{
if( descendent.strID != "_list" )
{
var newList = new List("_list");
newList[newList.length++] = descendent;
this[item.strLowerID] = newList;
descendent = newList;
}
descendent[descendent.length++] = item;
}
else
this[item.strLowerID] = item;
}
function _list_calcVisible()
{
this.bIsVisible = true;
if( this.itemRoot != null && this.itemRoot != this )
this.bIsVisible = this.itemRoot.isItemInContext(this);
if( this.bIsVisible )
{
this.bIsVisible = false;
var it = this.getIterator();
for( var item = it.getFirstItem(); item != null; item = it.getNextItem() )
{
item.calcVisible();
if( item.bIsVisible )
this.bIsVisible = true;
}
}
}
function _list_find(key)
{
if( this.get(key) )
return this;
else
{
var it = this.getIterator();
for( var item = it.getFirstItem(); item != null; item = it.getNextItem() )
{
if( item.find )
{
var retItem = item.find(key);
if( retItem )
return retItem;
}
}
}
return null;
}
function _list_get(key)
{
var strLowerKey = key;
if( isNaN(key) )
{
var i = key.indexOf("/");
if( i > 0 )
{
var firstField = key.substring(0,i).toLowerCase();
var nextField = key.substring(i+1);
var itemFound;
if( isNaN(firstField) && firstField == this.strLowerID )
{
itemFound = this;
if( itemFound )
itemFound = itemFound.get(nextField);
}
else if( this.strID == "_list" )
{
var it = itemFound.getIterator();
for( var item = it.getFirstItem(); item != null; item = it.getNextItem() )
{
itemFound = item.get(firstField);
if( itemFound )
itemFound = itemFound.get(nextField);
if( itemFound )
break;
}
}
else
{
itemFound = this.get(firstField);
if( itemFound )
itemFound = itemFound.get(nextField);
}
return itemFound;
}
strLowerKey = key.toLowerCase();
if( strLowerKey == this.strID )
return this;
if( key.charAt(0) == '.' && eval("typeof this"+key ) == "string" )
return eval( "this"+key );
if( key == this.strType )
return this;
}
if( this[strLowerKey] )
return this[strLowerKey];
return null;
}
function _list_getIterator(strRecordID)
{
var list = this;
if( strRecordID )
{
list = this.get(strRecordID);
if( ! list )
{
list = this.find(strRecordID);
if( list )
list = list.get(strRecordID);
}
if( list && list.strID != "_list" )
{
var newList = new List( "_list" );
newList.add(list);
list = newList;
}
}
return new ListIterator(list);
}
List.prototype.baseGetContent = Item.prototype.getContent;
function _list_getContent(strID)
{
if( strID && strID.charAt("0") != '.' )
{
var descendent = this.get(strID);
if( descendent == null )
return "";
if( descendent.getContent )
return descendent.getContent();
return descendent;
}
return this.baseGetContent(strID);
}
function _list_isItemInContext(item)
{
if( this.itemParent != null )
this.itemParent.isItemInContext(item);
var bContextTest =
( !item.strContext || item.strContext.length == 0
|| item.strContext.indexOf(this.strContext) != -1
);
var bConditionTest =
( !this.strCondition || this.strCondition.length == 0
|| this.strCondition.indexOf(item.strCondition) != -1
);
return( bContextTest && bConditionTest );
}
function _list_set(strID,strContent)
{
var item = this.get(strID);
if( item != null )
item.strContent = strContent;
else
{
this.add(item = new this.funcPropertyConstuctor(strID,strContent));
}
return item;
}
function _list_setRoot(itemRoot)
{
if( this.itemRoot == null )
{
this.itemRoot = itemRoot;
var it = this.getIterator();
for( var item = it.getFirstItem(); item != null; item = it.getNextItem() )
{
if( item.itemRoot == null )
item.setRoot(itemRoot);
}
}
}
function _list_setSelectionModel(intModel,strType)
{
if( this.itemRoot && this.itemRoot != this )
this.itemRoot.setSelectionModel(intModel,strType);
else
{
this.intSelectionModel = intModel;
this.strSelectionType  = strType;
}
}
function ListIterator(list)
{
this.list = list;
if( list != null )
this.length = list.length;
else
this.length = 0;
this.intCurrentListIndex = 0;
}
ListIterator.prototype.get =          _listIt_get;
ListIterator.prototype.getCurrentItem = _listIt_getCurrentItem;
ListIterator.prototype.getFirstItem = _listIt_getFirstItem;
ListIterator.prototype.getNextItem =  _listIt_getNextItem;
function _listIt_get(offset)
{
if( this.list )
return this.list.get(offset);
return null;
}
function _listIt_getCurrentItem()
{
if( ! this.list || this.intCurrentListIndex >= this.list.length )
return null;
var item = this.list[this.intCurrentListIndex];
item.intCurrentItemIndex = this.intCurrentListIndex;
return item;
}
function _listIt_getFirstItem()
{
this.intCurrentListIndex = 0;
return this.getCurrentItem();
}
function _listIt_getNextItem()
{
this.intCurrentListIndex++;
return this.getCurrentItem();
}
List.prototype.funcPropertyConstuctor = Item;
List.prototype.intSelectionModel =  0;
List.prototype.itemLastSelection =  null;
List.prototype.length =             0;
List.prototype.strSelectionType =   null;
function Root(strID,strLayer)
{
this.base =                       List;
this.base(strID);
this.strLayer =                   strLayer || "self";
this.itemRoot =                   this;
}
Root.prototype =                    new List;
Root.prototype.strType =            "Root";
Root.prototype.strClassList =       List.prototype.strClassList+"Root;";
Root.prototype.build =              _root_build;
Root.prototype.getColumnCount =     Cell.prototype.getColumnCount;
Root.prototype.getCurrentRecord =   _root_getCurrentRecord;
Root.prototype.getCurrentRecordIndex = _root_getCurrentRecordIndex;
Root.prototype.getLayer =           _root_getLayer;
Root.prototype.getModel =           _root_getModel;
Root.prototype.getRecord =          _root_getRecord;
Root.prototype.setCurrentRecordIndex = new Function("intValue", "this.intCurrentRecordIndex = intValue");
Root.prototype.setLayer =           new Function("strValue", "this.strLayer = strValue");
Root.prototype.setModel =           new Function("listModel", "this.listDataModel = listModel");
Root.prototype.setRecordID =        new Function("strValue", "this.strRecordID = strValue");
addSynonym("Record","RecordID");
function _root_build()
{
var retString = "";
if( this.bIsVisible )
{
var it = this.getIterator();
for( var item = it.getFirstItem(); item != null; item = it.getNextItem() )
{
retString += item.build();
}
}
if( this.itemParent == null )
displayContent(retString,this.strLayer);
return retString;
}
function _root_getCurrentRecord()
{
if( this.iterDataModel != null && this.intCurrentRecordIndex >= 0 )
return this.iterDataModel.get(this.intCurrentRecordIndex);
if( this.listDataModel != null && this.intCurrentRecordIndex == -1 )
return this.listDataModel;
if( this.itemParent != null )
return this.itemParent.getCurrentRecord();
return null;
}
function _root_getCurrentRecordIndex()
{
if( this.intCurrentRecordIndex == -2 )
return -2;
if( this.iterDataModel != null && this.intCurrentRecordIndex >= 0 )
return this.intCurrentRecordIndex;
if( this.listDataModel != null && this.intCurrentRecordIndex == -1 )
return 0;
if( this.itemParent != null )
return this.itemParent.getCurrentRecordIndex();
return -1;
}
function _root_getLayer()
{
if( this.itemParent != null )
return this.itemParent.itemRoot.getLayer();
return this.strLayer;
}
function _root_getModel()
{
if( this.listDataModel )
return this.listDataModel;
if( this.itemParent != null )
return this.itemParent.itemRoot.getModel();
return null;
}
function _root_getRecord(intRecordIndex)
{
if( intRecordIndex >= 0 && this.listDataModel != null )
{
if( this.strRecordID == null )
return this.listDataModel.get(intRecordIndex);
else
{
var it = this.listDataModel.getIterator(this.strRecordID);
return it.get(intRecordIndex);
}
}
if( this.listDataModel != null )
return this.listDataModel;
if( this.itemParent != null )
return this.itemParent.itemRoot.getRecord(intRecordIndex);
return null;
}
Root.prototype.intCurrentRecordIndex = -1;
Root.prototype.iterDataModel =     null;
Root.prototype.listDataModel =     null;
