function Bs_TreeElement() { this.id; this.parent; this._tree;this.caption; this.url; this.target; this.onClick; this.isOpen = false; this.visible = true; this.isChecked = 0; this.checkboxName; this._checkboxObject; this._level = 0; this._children = new Array; this.imageDir; this.icon; this.beforeIconSpan; this.beforeCaptionSpan; this.afterCaptionSpan; this._attachedEvents; this._isOutrendered = false; this._errorArray; this.getThis = function() {return this;} this.addChild = function(treeElement) {treeElement.parent = this;if (this._children.push) {this._children.push(treeElement);} else {this._children[this._children.length] = treeElement;} } this.render = function(omitDivTags) {var imageDir = this._getVar('imageDir');var out = new Array();var outI = 0;var evalStr = '';if (!omitDivTags) {out[outI++] = ' 0 || (this._tree.showPseudoElement)) {out[outI++] = '';out[outI++] = '
';var level = this._level;if (!this._tree.showPseudoElement) --level;var obj = null;var outTemp = '';for (var i=0; i' + outTemp;} out[outI++] = outTemp;if (this.hasSiblingsDown()) {var imgNumber = 3;} else {var imgNumber = 2;} if (this.hasVisibleChildren()) {if ((this._level == 0) || (!this._tree.showPseudoElement && (this._level == 1) && ((this._tree.useAutoSequence && (this.id == 2)) || (!this._tree.useAutoSequence && true)))) {if (this.hasSiblingsDown()) {imgNumber++;} else {imgNumber--;} } if (this.isOpen) {var plusImg = 'minus' + imgNumber;var onClick = 'Close';} else {var plusImg = 'plus' + imgNumber;var onClick = 'Open';} } else {var plusImg = 'line' + imgNumber;var onClick = false;} if (onClick) {var onClickStr = 'onClick="' + this._tree._instanceName + '.elementToggleOpenClose(\'' + this.id + '\');"';} else {var onClickStr = '';} if (this.onClick) {var onClick = this.onClick;onClick = onClick.replace(/__this\.id__/g, this.id);out[outI++] = '';} out[outI++] = '';if (this.beforeIconSpan) {out[outI++] = "" + this.beforeIconSpan + "";} if (this.url) {var hRef = '";} if (this._tree.useCheckboxSystem) {var checkboxSpan = this.checkboxName + 'Span';var checkboxObj = this.checkboxName + 'Obj';out[outI++] = ' ';var t = new Bs_Checkbox();t.objectName = checkboxObj;t.checkboxName = this.checkboxName;t.value = this.isChecked;if (this._getVar('checkboxSystemGuiNochange')) {t.guiNochange = true;} var chkImagDir = this._getVar('checkboxSystemImgDir');if (chkImagDir) {t.imgDir = chkImagDir;} else {t.imgDir = "/_bsJavascript/components/checkbox/img/win2k_noBorder/";} t.imgWidth = '13';t.imgHeight = '13';if (this._tree.checkboxSystemWalkTree) {t.attachOnClick(this._tree._instanceName + '.elementCheckboxEvent(\'' + this.id + '\', ' + checkboxObj + '.value);');} eval(checkboxObj + ' = t;');this._checkboxObject = t;evalStr += checkboxObj + ".draw('" + checkboxSpan + "');";out[outI++] = '';} out[outI++] = ' ';if (this.hasEventAttached('onClickCaption')) {out[outI++] = '';} if (hRef) out[outI++] = hRef;out[outI++] = this.caption;if (hRef) out[outI++] = '';if (this.hasEventAttached('onClickCaption')) {out[outI++] = '';} if (this.onClick) {out[outI++] = '';} out[outI++] = '
';if (this.afterCaptionSpan) {out[outI++] = '
' + this.afterCaptionSpan + '
';out[outI++] = '
' + this.afterCaptionSpan + '
';} else {out[outI++] = '
';} out[outI++] = '
';out[outI++] = '
';} if ((this._tree.preloadDown == -1) || (this.isOpen && this.hasChildren())) {out[outI++] = ' 0)) {this.id = ++this._tree._elementSequence;} else {if (typeof(a['id']) == 'undefined') {this._addError('tree error: useAutoSequence is set to false, but for an array element there is no id defined.');return false;} this.id = a['id'];} if (typeof(a['caption']) != 'undefined') this.caption = a['caption'];if (typeof(a['url']) != 'undefined') this.url = a['url'];if (typeof(a['target']) != 'undefined') this.target = a['target'];if (typeof(a['onClick']) != 'undefined') this.onClick = a['onClick'];if (typeof(a['isOpen']) != 'undefined') this.isOpen = a['isOpen'];if (typeof(a['isChecked']) != 'undefined') this.isChecked = a['isChecked'];if (typeof(a['visible']) != 'undefined') this.visible = a['visible'];if (typeof(a['icon']) != 'undefined') this.icon = a['icon'];if (typeof(a['imageDir']) != 'undefined') this.imageDir = a['imageDir'];if (typeof(a['beforeIconSpan']) != 'undefined') this.beforeIconSpan = a['beforeIconSpan'];if (typeof(a['beforeCaptionSpan']) != 'undefined') this.beforeCaptionSpan = a['beforeCaptionSpan'];if (typeof(a['afterCaptionSpan']) != 'undefined') this.afterCaptionSpan = a['afterCaptionSpan'];if (typeof(a['checkboxName']) != 'undefined') {this.checkboxName = a['checkboxName'];} else {if (this._tree.useCheckboxSystem) {this.checkboxName = 'bsTreeCheckbox' + this.id;} } if (typeof(a['onClickCaption']) != 'undefined') {this.attachEvent('onClickCaption', a['onClickCaption']);} if (typeof(a['onChangeCheckbox']) != 'undefined') {this.attachEvent('onChangeCheckbox', a['onChangeCheckbox']);} return true;} this.updateObjectByArray = function(a) {this.reset();if (a['caption']) this.caption = a['caption'];if (a['url']) this.url = a['url'];if (a['target']) this.target = a['target'];if (a['onClick']) this.onClick = a['onClick'];if (a['isOpen']) this.isOpen = a['isOpen'];if (a['isChecked']) this.isChecked = a['isChecked'];if (a['imageDir']) this.imageDir = a['imageDir'];if (a['checkboxName']) {this.checkboxName = a['checkboxName'];} else {if (this._tree.useCheckboxSystem) {this.checkboxName = 'bsTreeCheckbox' + this.id;} } if (a['beforeIconSpan']) this.beforeIconSpan = a['beforeIconSpan'];if (a['beforeCaptionSpan']) this.beforeCaptionSpan = a['beforeCaptionSpan'];if (a['afterCaptionSpan']) this.afterCaptionSpan = a['afterCaptionSpan'];} this.getJavascriptCode = function(varName, recursive) {var ret = "";if ( (this._tree.useAutoSequence && (this.id > 1)) || (!this._tree.useAutoSequence && !this.parent) ) {} else {ret += varName + " = new Array();\n";if (!this._tree.useAutoSequence) {ret += varName + "['id'] = \"" + this.id + "\";\n";} if (this.caption) ret += varName + "['caption'] = \"" + this.caption + "\";\n";if (this.url) ret += varName + "['url'] = \"" + this.url + "\";\n";if (this.target) ret += varName + "['target'] = \"" + this.target + "\";\n";if (this.onClick) {var onClick = this.onClick.replace(/"/g, '\\"');ret += varName + "['onClick'] = \"" + onClick + "\";\n";} if (this.imageDir) ret += varName + "['imageDir'] = \"" + this.imageDir + "\";\n";if (this.isOpen) ret += varName + "['isOpen'] = '" + this.isOpen + "';\n";if (this.isChecked) ret += varName + "['isChecked'] = '" + this.isChecked + "';\n";if (this.checkboxName) ret += varName + "['checkboxName'] = '" + this.checkboxName + "';\n";if (this.icon) ret += varName + "['icon'] = \"" + this.icon + "\";\n";if (this.beforeIconSpan) ret += varName + "['beforeIconSpan'] = \"" + this.beforeIconSpan + "\";\n";if (this.beforeCaptionSpan) ret += varName + "['beforeCaptionSpan'] = \"" + this.beforeCaptionSpan + "\";\n";if (this.afterCaptionSpan) ret += varName + "['afterCaptionSpan'] = \"" + this.afterCaptionSpan + "\";\n";varName += "['children']";} if (recursive) {if (this._children.length > 0) {ret += varName + " = new Array();\n" for (var i=0; i 0);} this.hasVisibleChildren = function() {if (!this._children || !(this._children.length > 0)) return false;for (var i=0; i 0) {return this._errorArray[this._errorArray.length -1];} } return false;} this._getVar = function(varName) {if (typeof(this[varName]) != 'undefined') {return this[varName];} else {if (this._tree.walkTree && this.parent) {return this.parent._getVar(varName);} else if (typeof(this._tree[varName]) != 'undefined') {return this._tree[varName];} else {return null;} } } this.onMouseOver = function() {var img = document.getElementById(this._spanId + 'icon');if (!img.swapOver0) {img.swapOver0 = new Image();img.swapOver0.src = this.imgDir + 'enabled_0_over.gif';img.swapOver1 = new Image();img.swapOver1.src = this.imgDir + 'enabled_1_over.gif';img.swapOver2 = new Image();img.swapOver2.src = this.imgDir + 'enabled_2_over.gif';img.swapOut0 = new Image();img.swapOut0.src = this.imgDir + 'enabled_0.gif';img.swapOut1 = new Image();img.swapOut1.src = this.imgDir + 'enabled_1.gif';img.swapOut2 = new Image();img.swapOut2.src = this.imgDir + 'enabled_2.gif';} img.src = img['swapOver' + this.value].src;} this.onMouseOut = function() {var img = document.getElementById(this._spanId + 'icon');img.src = img['swapOut' + this.value].src;} /* ******** checkbox system functions ******** */ this.checkboxEvent = function(value) {if (!this.hasChildren()) {value = (value) ? 2 : 0;} else {if (this.isChecked == 1) {if ((!this._tree.checkboxSystemIfPartlyThenFull) || ((this._tree.checkboxSystemWalkTree) && (this._tree.checkboxSystemWalkTree != 2) && (this._tree.checkboxSystemWalkTree != 3))) {value = 0;} else {value = 2;} } else if (this.isChecked == 0) {if (this._tree.checkboxSystemWalkTree && (this._tree.checkboxSystemWalkTree != 2) && (this._tree.checkboxSystemWalkTree != 3) && this.hasChildren()) {value = 1;} } } this.isChecked = value;this._checkboxObject.setTo(value, true);if (this.hasEventAttached('onChangeCheckbox')) this.fireEvent('onChangeCheckbox');if ((this._tree.checkboxSystemWalkTree == 3) || (this._tree.checkboxSystemWalkTree == 1) || (this._tree.checkboxSystemWalkTree == 4)) {this.parent.updateCheckboxFromChild();} if ((this._tree.checkboxSystemWalkTree == 3) || (this._tree.checkboxSystemWalkTree == 2) || ((this._tree.checkboxSystemWalkTree == 4) && (value == 0))) {this.checkboxUpdateDown(value);} } this.checkboxUpdateDown = function(value) {for (var i=0; i 0) && (numNo > 0)) {break;} } if (!isPartly) {if ((numYes > 0) && (numNo > 0)) {this.isChecked = 1;} else if (numYes > 0) {this.isChecked = 2;} else {this.isChecked = 0;} } if (backupIsChecked != this.isChecked) {this.updateCheckboxVisually();if (this.hasEventAttached('onChangeCheckbox')) this.fireEvent('onChangeCheckbox');} if (typeof(this.parent) == 'object') {this.parent.updateCheckboxFromChild();} } }