/*
    File: ticl.js
    This file is part of the TICL library and is governed by the TICL
    distribution license. For more information, please visit
    http://www.kobrix.com.
    Copyright (c) 2001-2002 by Kobrix Software Inc. All rights reserved.
*/
var navigator4 = false;
var domobject_range = "";
var ticl_before_submit_handlers = new Array();

createDropDown();
createListBox();
//
// Most browser will react to a re-submit of a form while one is being
// submitted. All our form submits go through the postform method below.
// The following global variable track whether a form is currently being
// submitted to prevent a user from submitting it twice before the response
// has been returned.
//
var ticl_submitting_form0123456789 = false;
var TICLTrees = new Array()

if (navigator.appName == "Netscape")
{
   navigator4 = true;
}
else
{
    domobject_range="all.";
}

function addBeforeSubmitHandler(handler)
{
     ticl_before_submit_handlers[ticl_before_submit_handlers.length] = handler;
}

function invokeBeforeSubmitHandlers()
{
    for (var i = 0; i < ticl_before_submit_handlers.length; i++)
        eval(ticl_before_submit_handlers[i]);
}

function changeBox(form,cbox)
{
    if( document.layers ){
        var box = document.forms[form].elements[cbox];
        box.checked = !box.checked;
    }
    else{
        var box = document.getElementById(cbox);
        box.checked = !box.checked;
    }
}

function findRadioNN4x(form,group,item){
    if( document.layers ){
        var el = document.forms[form].elements[group];
        for( i = 0 ; i < el.length ; i++ ){
            if ( el[i].value == item )
                return el[i];
        }
    }
    else{
        for( i = 0 ; i < document.forms[form].elements.length ; i++ ){
            var el = document.forms[form].elements[i];
            if ( el == document.getElementById(item) )
                return el;
        }
    }
}

function changeRadio(form,group,item)
{
    if( document.layers ){
        var el = document.forms[form].elements[group];
        for( i = 0 ; i < el.length ; i++ ){
            if ( el[i].value == item )
                el[i].checked = true;
        }

    }
    else{
        for( i = 0 ; i < document.forms[form].elements.length ; i++ ){
            var el = document.forms[form].elements[i];
            if ( el == document.getElementById(item) )
                el.checked = true;
        }
    }
}

function noop()
{
    return;
}

function getObject(obj)
{
    if (typeof obj == "string")
        return eval("document." + domobject_range + obj);
    else
        return obj;
}


// create dropdown table to hold value of dropitem and ticlcmd
function createDropDown()
{
    this.dropitem = new dropItemS('', '', '', '', '', '');
    this.numDropItems = 0;
}

// add dropitem to dropdown table
function addDropItem(dropdownID, valueDropItem, ticlcmd, redirect_url, post, data)
{
    this.dropitem[this.numDropItems] = new dropItemS(dropdownID,
                                                     valueDropItem,
                                                     ticlcmd,
                                                     redirect_url,
                                                     post,
                                                     data);
    this.numDropItems++;
}

// dropitem structure
function dropItemS(dropdown_id, value, ticlcmd, url, post, data)
{
    this.id = dropdown_id;
    this.value = value;
    this.ticlcmd = ticlcmd;
    this.url = url;
    this.post = post;
    this.data = data;
}

// show dropdown table for debug purpose
function dropdown()
{
    alert("number:"+numDropItems);    for (i=0; i < numDropItems; i++)
    {
        alert(dropitem[i].value + ":" + dropitem[i].ticlcmd);
    }
}

//get dropitem or listitem by data
function getOptionItemByData(item_id, data)
{
    for (i=0; i < numDropItems; i++)
    {
        if ((dropitem[i].id == item_id) &&
            (dropitem[i].data == data))
        {
            return dropitem[i];
        }
    }
    for (i=0; i < numListItems; i++)
    {
        if ((listitem[i].id == item_id) &&
            (listitem[i].data == data))
        {
            return listitem[i];
        }
    }
    return null;
}

/** */
function getOptionItemByIndex(ddId, index)
{
    for (i=0; i < numDropItems; i++)
    {
        if ((dropitem[i].id == ddId) &&
            (dropitem[i].value == index + 1))
        {
            return dropitem[i];
        }
    }
    for (i=0; i < numListItems; i++)
    {
        if ((listitem[i].id == ddId) &&
            (listitem[i].value == index + 1))
        {
            return listitem[i];
        }
    }
    return null;
}


function checkDropDown(formid, value, dropdown_id)
{
    var ticlcmd = "";
    var url = "";
    var post = false;
    for (i=0; i < numDropItems; i++)
    {
        if ((dropitem[i].id == dropdown_id) &&
            (dropitem[i].value == value))
        {
            ticlcmd = dropitem[i].ticlcmd;
            url = dropitem[i].url;
            post = dropitem[i].post;
        }
    }
    if (post == "true")
    {
        postform(formid, ticlcmd);
    }
    else
    {
        if (url != "") // we have client side redirect
            window.document.location.href=url;
        else
            if (ticlcmd != "")
                window.document.location.href=ticlcmd;
    }
}


//*********************************************
// create listbox table to hold value of listitem and ticlcmd
function createListBox()
{
    this.listitem = new listItemS('', '', '', '', '');
    this.numListItems = 0;
}

// add listitem to listbox table
function addListItem(listboxID, valueListItem, ticlcmd, redirect_url, post, data)
{
    this.listitem[this.numListItems] = new listItemS(listboxID,
                                                     valueListItem,
                                                     ticlcmd,
                                                     redirect_url,
                                                     post,
                                                     data);
    this.numListItems++;
}

// listitem structure
function listItemS(listbox_id, value, ticlcmd, url, post, data)
{
    this.id = listbox_id;
    this.value = value;
    this.ticlcmd = ticlcmd;
    this.url = url;
    this.post = post;
    this.data = data;
}

// show listbox table for debug purpose
function listbox()
{
    alert("number:"+numListItems);
    for (i=0; i < numListItems; i++)
    {
        alert(listitem[i].value + ":" + listitem[i].ticlcmd);
    }
}

function checkListBox(formid, value, listbox_id)
{
    var ticlcmd = "";
    var url = "";
    var post = false;
    for (i=0; i < numListItems; i++)
    {
        if ((listitem[i].id == listbox_id) &&
            (listitem[i].value == value))
        {
            ticlcmd = listitem[i].ticlcmd;
            url = listitem[i].url;
            post = listitem[i].post;
        }
    }
    if (post == "true")
    {
        postform(formid, ticlcmd);
    }
    else
    {
        if (url != "") // we have client side redirect
            window.document.location.href=url;
        else
            if (ticlcmd != "")
                window.document.location.href=ticlcmd;
    }
}
// ***********************************************************


function postform(formid, value)
{
    if (!TICLValidate(formid))
    {
        return false;
    }
    var form = getObject(formid);
    if (navigator.userAgent.indexOf('Opera') >= 0 )
        form = eval('document.'+formid);
    if (ticl_submitting_form0123456789 == true)
    {
        return false;
    }
    ticl_submitting_form0123456789 = true;
    form.elements["ticlcmd"].value = value;
    invokeBeforeSubmitHandlers();
    form.submit();
    // Return false in case this was triggered by a submit button, so that the
    // does not end up being submitted twice.
    return false;
}

//same as the above, but without submiting the form
//used for the ImageButton
function TICLValidateEx(formid)
{

    if (TICLValidate() == false)
    {
        return false;
    }
    if (ticl_submitting_form0123456789 == true)
    {
        return false;
    }
    ticl_submitting_form0123456789 = true;
    return true;
}


function treeItemAddChild (idnum, type)
{
    this.children[this.numChildren] = new TreeItemChild(idnum, type)
    this.numChildren++
}

function TreeItemChild (idnum, type)
{
    this.idnum = idnum
    this.type = type
}

function treeItemAddIndent (indent)
{
    this.indents[this.numIndents] = new TreeItemIndent(indent)
    this.numIndents++
}

function TreeItemIndent (indent)
{
    this.indent = indent
}

function TreeItem (parent, idnum, type, contents, selcontents, expContents, selExpContents, curimage, toggleimage, expandByCapt, status)
{
    this.parent = parent
    this.idnum = idnum
    this.type = type
    this.contents = contents
    this.selcontents = selcontents
    this.expContents = expContents
    this.selExpContents = selExpContents
    this.curimage = curimage
    this.toggleimage = toggleimage
    this. expandByCapt = expandByCapt
    this.status = status
    this.visible = 'hidden'
    this.numChildren = 0
    this.children = new TreeItemChild(-1, '')
    this.addChild = treeItemAddChild
    this.numIndents = 0
    this.indents = new TreeItemIndent('')
    this.addIndent = treeItemAddIndent
}

function addTreeItem (parent, idnum, type, contents, selcontents, expContents, selExpContents, curimage, toggleimage, expandByCapt, status)
{
    this.items[this.itemsCount] = new TreeItem(parent, idnum, type, contents, selcontents, expContents, selExpContents, curimage, toggleimage, expandByCapt, status)
    this.itemsCount++
    if(parent != '-1' )
        for( i = 0 ; i < this.itemsCount ; i++)
            if ( this.items[i].idnum == parent )
            {
                this.items[i].addChild(idnum,type)
                break
            }
}

function TreeView (treename, lineHeight, highlightClientSideSelect, allowReselect, allowMultiple)
{
    this.name = treename
    this.itemsCount = 0
    this.numScrollSteps = 0
    this.items = new TreeItem(-1, 0, '', '', '', '', '')
    this.addItem = addTreeItem
    this.render = renderTree
    this.refresh = refreshTree
    this.rearange = rearangeTree
    this.subrefresh = refreshSubTree
    this.noderefresh = refreshNode
    this.selNode = selectNode
    this.getItemByIdnum = getItemByIdNumber
    this.scrollwin = scrollWindow
    this.changePic = changePicture
    this.lineHeight = lineHeight
    this.selected = ''
    this.selectedNum = ''
    this.selAction = 'select'
    this.multipleSelection = new Array()
    this.highlightClientSideSelect = highlightClientSideSelect
    this.allowReselect = allowReselect
    this.allowMultiple = allowMultiple
	TICLTrees[treename] = this
}

function renderTree (linePic, PicWidth, PicHeight, spacePic,
                     spacePicWidth, spacePicHeight)
{
    if ( !myBrowser.canDoDOM )
        document.writeln("<ILAYER ID='tree_" + this.name + "' HEIGHT=" + (this.itemsCount + 1)*this.lineHeight + ">")
    else if ( myBrowser.name == "Opera" )
        document.writeln("<DIV ID=tree_" + this.name + " STYLE={visibility:visible;height:" + (this.itemsCount + 1) * this.lineHeight + "}>")

    for ( i2 = 0 ; i2 < this.itemsCount ; i2++ )
    {
        var section = this.name + '_section'+i2
        var cont = this.items[i2].contents
        var selcont = this.items[i2].selcontents
        var expCont = this.items[i2].expContents
        var selExpCont = this.items[i2].selExpContents
        var curim = this.items[i2].curimage
        var idn = this.items[i2].idnum
        var stat = this.items[i2].status
        var name = this.name
        if ( myBrowser.canDoDOM )
            document.writeln("<DIV ID=" + section + " STYLE={position:relative; visibility:visible}>")
        else
            document.writeln("<LAYER ID=" + section + " visibility='hide'>")
        document.writeln("<table cellspacing=0 cellpadding=0 border=0>")
        document.writeln("<tr>")
        for( i22 = 0; i22 < this.items[i2].numIndents ; i22++)
        {
            var nextind = this.items[i2].indents[i22].indent
            if (nextind=='line'){
               if (linePic != null)
                  document.writeln("<td nowrap><img src='" + linePic + "' border=0 width=" + PicWidth + " height=" + PicHeight + "></td>")
            }
            else{
               if (spacePic != null)
                  document.writeln("<td nowrap><img src='" + spacePic + "' border=0 width=" + PicWidth + " height=" + PicHeight + "></td>")
            }
        }
        var imgid =  name + "togglePic"+i2
        if (this.items[i2].type == 'node')
        {
            document.writeln("<td nowrap><a href='#' onClick='"+name+".changePic("+i2+",&#39;"+imgid+"&#39;,&#39;"+idn+"&#39;);"+name+".items["+i2+"].status=changeStatus("+name+".items["+i2+"].status);"+name+".noderefresh(&#39;"+idn+"&#39;,"+name+".items["+i2+"].status);"+name+".rearange("+name+".itemsCount+1);return "+name+".scrollwin("+i2+")'><img src='" + curim + "' name='" +imgid +"' border=0 width="
                    + PicWidth + " height=" + PicHeight + "></td>")
            if( selcont == 'null' ){
                if (this.items[i2].expandByCapt == 'true')
                    document.writeln("<td nowrap><a href='#' onClick='"+name+".changePic("+i2+",&#39;"+imgid+"&#39;,&#39;"+idn+"&#39;);"+name+".items["+i2+"].status=changeStatus("+name+".items["+i2+"].status);"+name+".noderefresh(&#39;"+idn+"&#39;,"+name+".items["+i2+"].status);"+name+".rearange("+name+".itemsCount+1);return "+name+".scrollwin("+i2+")'>")
                else
                    document.writeln("<td nowrap>")

                if ( myBrowser.canDoDOM ){
                    if ( myBrowser.name == "InternetExplorer" ){
                        document.write("<DIV ID=" + section + "_NORM STYLE={display:" + (stat == 'true'? "none" : "inline") + "}>")
                        document.write(cont + "</DIV>")
                        document.write("<DIV ID=" + section + "_EXPNORM STYLE={display:" + (stat == 'true'? "inline" : "none") + "}>")
                        document.write(expCont + "</DIV>")
                    }
                    else if ( myBrowser.name == "Opera" ){
                        document.write("<DIV ID=" + section + "_BASE STYLE={POSITION:relative;visibility:VISIBLE}>")
                        document.write("<DIV ID=" + section + "_NORM STYLE={POSITION:relative;visibility:" + (stat == 'true'? "hidden" : "visible") + "}>")
                        document.write(cont + "</DIV>")
                        document.write("<DIV ID=" + section + "_EXPNORM STYLE={POSITION:absolute;visibility:" + (stat == 'true'? "visible" : "hidden") + ";top:0}>")
                        document.write(expCont + "</DIV></DIV>")
                    }
                    else{
                        document.write("<DIV ID=" + section + "_NORM STYLE={position:" + (stat == 'true'? "absolute" : "relative") + ";visibility:" + (stat == 'true'? "hidden" : "inherit") + "}>")
                        document.write(cont + "</DIV>")
                        document.write("<DIV ID=" + section + "_EXPNORM STYLE={position:" + (stat == 'true'? "relative" : "absolute") + ";visibility:" + (stat == 'true'? "inherit" : "hidden") + "}>")
                        document.write(expCont + "</DIV>")
                    }
                }
                else{
                    document.write("<ILAYER ID=" + section + "_OUT>")
                    document.write("<LAYER ID=" + section + "_NORM visibility=" + (stat == 'true'? "hide" : "show") + ">" + cont + "</LAYER>")
                    document.write("<LAYER ID=" + section + "_EXPNORM visibility=" + (stat == 'true'? "show" : "hide") + ">" + expCont + "</LAYER>")
                    document.writeln("</ILAYER>")
                }

                if (this.items[i2].expandByCapt == 'true')
                    document.writeln("</a></td>")
                else
                    document.writeln("</td>")

            }
            else{
                if ( myBrowser.canDoDOM ){
                    if ( myBrowser.name == "InternetExplorer" ){
						if ( cont.indexOf('hasSelectionTreeView') >= 0 )
							document.write("<td nowrap onClick="+name+".selNode('" + this.name + "','" + section + "','" + i2 + "','" + idn + "')>")
		  				else
							document.write("<td nowrap>")
                        document.write("<DIV ID=" + section + "_NORM STYLE={display:" + (stat == 'true'? "none" : "inline") + "}>")
                        document.write(cont + "</DIV>")
                        document.write("<DIV ID=" + section + "_SEL STYLE={display:none}>")
                        document.write(selcont + "</DIV>")
                        document.write("<DIV ID=" + section + "_EXPNORM STYLE={display:" + (stat == 'true'? "inline" : "none") + "}>")
                        document.write(expCont + "</DIV>")
                        document.write("<DIV ID=" + section + "_EXPSEL STYLE={display:none}>")
                        document.write(selExpCont + "</DIV>")
                        document.writeln("</a></td>")
                    }
                    else if ( myBrowser.name == "Opera" ){
						if ( cont.indexOf('hasSelectionTreeView') >= 0 )
							document.write("<td nowrap onClick="+name+".selNode('" + this.name + "','" + section + "','" + i2 + "','" + idn + "')>")
		  				else
							document.write("<td nowrap>")
                        document.write("<DIV ID=" + section + "_BASE STYLE={POSITION:relative;visibility:VISIBLE}>")
                        document.write("<DIV ID=" + section + "_NORM STYLE={POSITION:relative;visibility:" + (stat == 'true'? "hidden" : "visible") + "}>")
                        document.write(cont + "</DIV>")
                        document.write("<DIV ID=" + section + "_EXPSEL STYLE={POSITION:absolute;visibility:hidden;top:0}>")
                        document.write(selExpCont + "</DIV>")
                        document.write("<DIV ID=" + section + "_SEL STYLE={POSITION:absolute;visibility:hidden;top:0}>")
                        document.write(selcont + "</DIV>")
                        document.write("<DIV ID=" + section + "_EXPNORM STYLE={POSITION:absolute;visibility:" + (stat == 'true'? "visible" : "hidden") + ";top:0}>")
                        document.write(expCont + "</DIV></DIV>")
                        document.writeln("</td>")
                    }
                    else{
                        var cont1 = cont
                        if ( cont.indexOf("javascript:") >= 0 ){
                            cont1 = cont.substring(0,cont.indexOf("javascript:") + 11)
                            cont1 = cont1 + name+'.selNode(&#39;' + this.name + '&#39;,&#39;' + section + '&#39;,&#39;' + i2 + '&#39;,&#39;' + idn + '&#39;);'
                            cont1 = cont1 + cont.substring(cont.indexOf("javascript:") + 11, cont.length)
                        }
                    	var selcont1 = selcont
                    	if ( selcont.indexOf("javascript:") >= 0 ){
                        	selcont1 = selcont.substring(0,selcont.indexOf("javascript:") + 11)
                        	selcont1 = selcont1 + name+'.selNode(&#39;' + this.name + '&#39;,&#39;' + section + '&#39;,&#39;' + i2 + '&#39;,&#39;' + idn + '&#39;);'
                        	selcont1 = selcont1 + selcont.substring(selcont.indexOf("javascript:") + 11, selcont.length)
                    	}
                    	var expCont1 = expCont
	                    if ( expCont.indexOf("javascript:") >= 0 ){
    	                    expCont1 = expCont.substring(0,expCont.indexOf("javascript:") + 11)
        	                expCont1 = expCont1 + name + '.selNode(&#39;' + this.name + '&#39;,&#39;' + section + '&#39;,&#39;' + i2 + '&#39;,&#39;' + idn + '&#39;);'
            	            expCont1 = expCont1 + expCont.substring(expCont.indexOf("javascript:") + 11, expCont.length)
                	    }
                    	var selExpCont1 = selExpCont
	                    if ( selExpCont.indexOf("javascript:") >= 0 ){
    	                    selExpCont1 = selExpCont.substring(0,selExpCont.indexOf("javascript:") + 11)
        	                selExpCont1 = selExpCont1 + name + '.selNode(&#39;' + this.name + '&#39;,&#39;' + section + '&#39;,&#39;' + i2 + '&#39;,&#39;' + idn + '&#39;);'
            	            selExpCont1 = selExpCont1 + selExpCont.substring(selExpCont.indexOf("javascript:") + 11, selExpCont.length)
                	    }
						document.write("<td nowrap>")
                        document.write("<DIV ID=" + section + "_NORM STYLE={position:" + (stat == 'true'? "absolute" : "relative") + ";visibility:" + (stat == 'true'? "hidden" : "inherit") + "}>")
                        document.write(cont1 + "</DIV>")
                        document.write("<DIV ID=" + section + "_SEL STYLE={position:absolute;visibility:hidden}>")
                        document.write(selcont1 + "</DIV>")
                        document.write("<DIV ID=" + section + "_EXPNORM STYLE={position:" + (stat == 'true'? "relative" : "absolute") + ";visibility:" + (stat == 'true'? "inherit" : "hidden") + "}>")
                        document.write(expCont1 + "</DIV>")
                        document.write("<DIV ID=" + section + "_EXPSEL STYLE={position:absolute;visibility:hidden}>")
                        document.write(selExpCont1 + "</DIV>")
                        document.writeln("</td>")
                    }
                }
                else{
                    var cont1 = cont
                    if ( cont.indexOf("javascript:") >= 0 ){
                        cont1 = cont.substring(0,cont.indexOf("javascript:") + 11)
                        cont1 = cont1 + name + '.selNode(&#39;' + this.name + '&#39;,&#39;' + section + '&#39;,&#39;' + i2 + '&#39;,&#39;' + idn + '&#39;);'
                        cont1 = cont1 + cont.substring(cont.indexOf("javascript:") + 11, cont.length)
                    }
                    var selcont1 = selcont
                    if ( selcont.indexOf("javascript:") >= 0 ){
                        selcont1 = selcont.substring(0,selcont.indexOf("javascript:") + 11)
                        selcont1 = selcont1 + name + '.selNode(&#39;' + this.name + '&#39;,&#39;' + section + '&#39;,&#39;' + i2 + '&#39;,&#39;' + idn + '&#39;);'
                        selcont1 = selcont1 + selcont.substring(selcont.indexOf("javascript:") + 11, selcont.length)
                    }
                    var expCont1 = expCont
                    if ( expCont.indexOf("javascript:") >= 0 ){
                        expCont1 = expCont.substring(0,expCont.indexOf("javascript:") + 11)
                        expCont1 = expCont1 + name + '.selNode(&#39;' + this.name + '&#39;,&#39;' + section + '&#39;,&#39;' + i2 + '&#39;,&#39;' + idn + '&#39;);'
                        expCont1 = expCont1 + expCont.substring(expCont.indexOf("javascript:") + 11, expCont.length)
                    }
                    var selExpCont1 = selExpCont
                    if ( selExpCont.indexOf("javascript:") >= 0 ){
                        selExpCont1 = selExpCont.substring(0,selExpCont.indexOf("javascript:") + 11)
                        selExpCont1 = selExpCont1 + name + '.selNode(&#39;' + this.name + '&#39;,&#39;' + section + '&#39;,&#39;' + i2 + '&#39;,&#39;' + idn + '&#39;);'
                        selExpCont1 = selExpCont1 + selExpCont.substring(selExpCont.indexOf("javascript:") + 11, selExpCont.length)
                    }
					if ( cont.indexOf('hasSelectionTreeView') >= 0 )
						document.write("<td nowrap onClick="+name+".selNode('" + this.name + "','" + section + "','" + i2 + "','" + idn + "')>")
		 			else
		 				document.write("<td nowrap>")
                    document.write("<ILAYER ID=" + section + "_OUT>")
                    document.write("<LAYER ID=" + section + "_NORM visibility=" + (stat == 'true'? "hide" : "show") + ">" + cont1 + "</LAYER>")
                    document.write("<LAYER ID=" + section + "_SEL visibility='hide'>" + selcont1 + "</LAYER>")
                    document.write("<LAYER ID=" + section + "_EXPNORM visibility=" + (stat == 'true'? "show" : "hide") + ">" + expCont1 + "</LAYER>")
                    document.write("<LAYER ID=" + section + "_EXPSEL visibility='hide'>" + selExpCont1 + "</LAYER>")
                    document.writeln("</ILAYER></td>")
                }
            }
        }
        else
        {
            document.write("<td nowrap><img src='" + curim + "' border=0 width="
                    + PicWidth + " height=" + PicHeight + "></td>")
            if ( selcont != 'null' ){
                if ( myBrowser.canDoDOM ){
                    if ( myBrowser.name == "InternetExplorer" ){
						if ( cont.indexOf('hasSelectionTreeView') >= 0 )
							document.write("<td nowrap onClick="+name+".selNode('" + this.name + "','" + section + "','" + i2 + "','" + idn + "')>")
		  				else
							document.write("<td nowrap>")
                        document.write("<DIV ID=" + section + "_NORM STYLE={display:inline}>")
                        document.write(cont + "</DIV>")
                        document.write("<DIV ID=" + section + "_SEL STYLE={display:none}>")
                        document.write(selcont + "</DIV>")
                        document.writeln("</td>")
                    }
                    else if ( myBrowser.name == "Opera" ){
						if ( cont.indexOf('hasSelectionTreeView') >= 0 )
                        	document.write("<td nowrap onClick="+name+".selNode('" + this.name + "','" + section + "','" + i2 + "','" + idn + "')>")
		  				else
							document.write("<td nowrap>")
                        document.write("<DIV ID=" + section + "_BASE STYLE={POSITION:relative;visibility:VISIBLE}>")
                        document.write("<DIV ID=" + section + "_NORM STYLE={POSITION:relative;visibility:visible}>")
                        document.write(cont + "</DIV>")
                        document.write("<DIV ID=" + section + "_SEL STYLE={POSITION:absolute;visibility:hidden;top:0}>")
                        document.write(selcont + "</DIV></DIV>")
                        document.writeln("</td>")
                    }
                    else{
                        var cont1 = cont
                        if ( cont.indexOf("javascript:") >= 0 ){
                            cont1 = cont.substring(0,cont.indexOf("javascript:") + 11)
                            cont1 = cont1 + name + '.selNode(&#39;' + this.name + '&#39;,&#39;' + section + '&#39;,&#39;' + i2 + '&#39;,&#39;' + idn + '&#39;);'
                            cont1 = cont1 + cont.substring(cont.indexOf("javascript:") + 11, cont.length)
                        }
	                    var selcont1 = selcont
    	                if ( selcont.indexOf("javascript:") >= 0 ){
        	                selcont1 = selcont.substring(0,selcont.indexOf("javascript:") + 11)
            	            selcont1 = selcont1 + name + '.selNode(&#39;' + this.name + '&#39;,&#39;' + section + '&#39;,&#39;' + i2 + '&#39;,&#39;' + idn + '&#39;);'
                	        selcont1 = selcont1 + selcont.substring(selcont.indexOf("javascript:") + 11, selcont.length)
                    	}
                        document.write("<td nowrap>")
                        document.write("<DIV ID=" + section + "_NORM STYLE={position:relative;visibility:inherit}>")
                        document.write(cont1 + "</DIV>")
                        document.write("<DIV ID=" + section + "_SEL STYLE={position:absolute;visibility:hidden}>")
                        document.write(selcont1 + "</DIV>")
                        document.writeln("</td>")
                    }
                }
                else{
                    var cont1 = cont
                    if ( cont.indexOf("javascript:") >= 0 ){
                        cont1 = cont.substring(0,cont.indexOf("javascript:") + 11)
                        cont1 = cont1 + name + '.selNode(&#39;' + this.name + '&#39;,&#39;' + section + '&#39;,&#39;' + i2 + '&#39;,&#39;' + idn + '&#39;);'
                        cont1 = cont1 + cont.substring(cont.indexOf("javascript:") + 11, cont.length)
                    }
                    var selcont1 = selcont
                    if ( selcont.indexOf("javascript:") >= 0 ){
                        selcont1 = selcont.substring(0,selcont.indexOf("javascript:") + 11)
                        selcont1 = selcont1 + name + '.selNode(&#39;' + this.name + '&#39;,&#39;' + section + '&#39;,&#39;' + i2 + '&#39;,&#39;' + idn + '&#39;);'
                        selcont1 = selcont1 + selcont.substring(selcont.indexOf("javascript:") + 11, selcont.length)
                    }

                    document.write("<td nowrap><ILAYER ID=" + section + "_OUT>")
                    document.write("<LAYER ID=" + section + "_NORM visibility='show'>" + cont1 + "</LAYER>")
                    document.write("<LAYER ID=" + section + "_SEL visibility='hide'>")
                    document.write(selcont1 + "</LAYER>")
                    document.writeln("</ILAYER></td>")
                }
            }
            else{
                document.writeln("<td nowrap>" + cont + "</td>");
            }
        }
        document.writeln("</tr>")
        if ( myBrowser.canDoDOM )
            document.writeln("</table></DIV>")
        else
            document.writeln("</table></LAYER>")
    }
    if ( !myBrowser.canDoDOM )
        document.writeln("</ILAYER>")
    else if ( myBrowser.name == "Opera" )
        document.writeln("</DIV>")
}

function selectNode(name,section,num,id){

    var status = 'false'
    if ( this.items[num])
    	status = this.items[num].status
    var oldSelection = this.name + '_section' + this.selectedNum
    var norm = (status == 'true' ? "_EXPNORM" : "_NORM")
    var sel = (status == 'true' ? "_EXPSEL" : "_SEL")
    if ( this.highlightClientSideSelect == 'false' )
        sel = norm;
    if ( this.allowMultiple == 'true' ){
		if ( isSelected(this.multipleSelection, id) && this.allowReselect == 'false' ){
            var hlp = sel
        	sel = norm
            norm = hlp
		}
    }

    if ( myBrowser.canDoDOM )
    {
        if ( myBrowser.name == "InternetExplorer" ){
            eval('document.getElementById("' + section + norm + '").style').display='none'
            eval('document.getElementById("' + section + sel + '").style').display='inline'
            if ( this.allowMultiple != 'true' ){
				if ( this.selected != '' && this.selected != id ){
                	if ( eval('document.getElementById("' + oldSelection + '_EXPSEL")') ){
                    	if ( eval('document.getElementById("' + oldSelection + '_EXPSEL").style').display=='inline' ){
                        	eval('document.getElementById("' + oldSelection + '_EXPNORM").style').display='inline'
	                        eval('document.getElementById("' + oldSelection + '_EXPSEL").style').display='none'
    	                }
        	        }
            	    if ( eval('document.getElementById("' + oldSelection + '_SEL").style').display=='inline' ){
                	    eval('document.getElementById("' + oldSelection + '_NORM").style').display='inline'
                    	eval('document.getElementById("' + oldSelection + '_SEL").style').display='none'
                	}
            	}
            }
        }
        else if ( myBrowser.name == "Opera" )
        {
            eval('document.getElementById("' + section + norm +'").style').visibility='hidden'
            eval('document.getElementById("' + section + sel +'").style').visibility='inherit'
            if ( this.allowMultiple != 'true' ){
        	    if ( this.selected != '' && this.selected != id ){
            	    if ( eval('document.getElementById("' + oldSelection + '_EXPSEL")') ){
                	    if ( eval('document.getElementById("' + oldSelection + '_EXPSEL").style').visibility=='visible' ){
                    	    eval('document.getElementById("' + oldSelection + '_EXPNORM").style').visibility='visible'
                        	eval('document.getElementById("' + oldSelection + '_EXPSEL").style').visibility='hidden'
	                    }
    	            }
        	        if ( eval('document.getElementById("' + oldSelection + '_SEL").style').visibility=='visible' ){
            	        eval('document.getElementById("' + oldSelection + '_NORM").style').visibility='visible'
                	    eval('document.getElementById("' + oldSelection + '_SEL").style').visibility='hidden'
	                }
    	        }
        	}
        }
        else
        {
            eval('document.getElementById("' + section + norm + '").style').position='absolute'
            eval('document.getElementById("' + section + norm + '").style').visibility='hidden'
            eval('document.getElementById("' + section + sel + '").style').position='relative'
            eval('document.getElementById("' + section + sel + '").style').visibility='inherit'
            if ( this.allowMultiple != 'true' ){
	            if ( this.selected != '' && this.selected != id ){
    	            if ( eval('document.getElementById("' + oldSelection + '_EXPSEL")') ){
        	            if ( eval('document.getElementById("' + oldSelection + '_EXPSEL").style').visibility=='inherit' ){
            	            eval('document.getElementById("' + oldSelection + '_EXPNORM").style').position='relative'
                	        eval('document.getElementById("' + oldSelection + '_EXPSEL").style').position='absolute'
                    	    eval('document.getElementById("' + oldSelection + '_EXPNORM").style').visibility='inherit'
                        	eval('document.getElementById("' + oldSelection + '_EXPSEL").style').visibility='hidden'
	                    }
    	            }
        	        if ( eval('document.getElementById("' + oldSelection + '_SEL").style').visibility=='inherit' ){
            	        eval('document.getElementById("' + oldSelection + '_NORM").style').position='relative'
                	    eval('document.getElementById("' + oldSelection + '_SEL").style').position='absolute'
                    	eval('document.getElementById("' + oldSelection + '_NORM").style').visibility='inherit'
	                    eval('document.getElementById("' + oldSelection + '_SEL").style').visibility='hidden'
    	            }
        	    }
	        }
	    }
    }
    else
    {
		if( eval('document.tree_' + name) )
		{
	        eval('document.tree_' + name + '.layers["' + section + '"].layers[0].layers["' + section + norm + '"]').visibility='hide'
	        eval('document.tree_' + name + '.layers["' + section + '"].layers[0].layers["' + section + sel + '"]').visibility='show'
        	if ( this.allowMultiple != 'true' ){
        		if ( this.selected != '' && this.selected != id ){
	            	if ( eval('document.tree_' + name + '.layers["' + oldSelection + '"].layers[0].layers["' + oldSelection + '_EXPSEL"]') ){
    	            	if ( eval('document.tree_' + name + '.layers["' + oldSelection + '"].layers[0].layers["' + oldSelection + '_EXPSEL"]').visibility=='show' ){
        	            	eval('document.tree_' + name + '.layers["' + oldSelection + '"].layers[0].layers["' + oldSelection + '_EXPNORM"]').visibility='show'
	            	        eval('document.tree_' + name + '.layers["' + oldSelection + '"].layers[0].layers["' + oldSelection + '_EXPSEL"]').visibility='hide'
    	            	}
	    	        }
    	    	    if ( eval('document.tree_' + name + '.layers["' + oldSelection + '"].layers[0].layers["' + oldSelection + '_SEL"]').visibility=='show' ){
        	    	    eval('document.tree_' + name + '.layers["' + oldSelection + '"].layers[0].layers["' + oldSelection + '_NORM"]').visibility='show'
            	    	eval('document.tree_' + name + '.layers["' + oldSelection + '"].layers[0].layers["' + oldSelection + '_SEL"]').visibility='hide'
		            }
    		    }
	    	}
        }
        else
        {
            eval('document.layers["' + section + '_OUT"].layers["' + section + norm + '"]').visibility='hide'
            eval('document.layers["' + section + '_OUT"].layers["' + section + sel + '"]').visibility='show'
            if ( this.allowMultiple != 'true' ){
                if ( this.selected != '' && this.selected != id ){
                    if ( eval('document.layers["' + oldSelection + '_OUT"].layers["' + oldSelection + '_EXPSEL"]') ){
                        if ( eval('document.layers["' + oldSelection + '_OUT"].layers["' + oldSelection + '_EXPSEL"]').visibility=='show' ){
                            eval('document.layers["' + oldSelection + '_OUT"].layers["' + oldSelection + '_EXPNORM"]').visibility='show'
                            eval('document.layers["' + oldSelection + '_OUT"].layers["' + oldSelection + '_EXPSEL"]').visibility='hide'
                        }
                    }
                    if ( eval('document.layers["' + oldSelection + '_OUT"].layers["' + oldSelection + '_SEL"]').visibility=='show' ){
                        eval('document.layers["' + oldSelection + '_OUT"].layers["' + oldSelection + '_NORM"]').visibility='show'
                        eval('document.layers["' + oldSelection + '_OUT"].layers["' + oldSelection + '_SEL"]').visibility='hide'
                    }
                }
            }
        }
	}

    if ( this.allowMultiple == 'false' )
        this.selectedNum = num

}

function rearangeTree(visitems)
{
    var lineHeight = this.lineHeight
    var hidpos = (visitems)*lineHeight
    var lineNumber = 0

    for ( i1 = 0 ; i1 < this.itemsCount ; i1++ )
    {
        var section = this.name + '_section'+i1
        if (this.items[i1].visible == 'visible')
        {
            lineNumber ++
            if ( myBrowser.canDoDOM )
            {
                if ( myBrowser.name == "InternetExplorer" ){
                    eval('document.getElementById("' + section + '").style').display='inline'
                }
                else if ( myBrowser.name == "Opera" )
                {
                    document.getElementById(section).style.visibility = 'visible'
                    document.getElementById(section).style.top=(lineNumber)*lineHeight
                }
                else
                {
                    eval('document.getElementById("' + section + '").style').position='relative'
                    eval('document.getElementById("' + section + '").style').visibility='inherit'
                }
            }
            else
            {
                eval('document.tree_' + this.name + '.layers["' + section + '"]').top=(lineNumber)*lineHeight
                eval('document.tree_' + this.name + '.layers["' + section + '"]').visibility='show'
            }
        }
        else
        {
            if ( myBrowser.canDoDOM )
            {
                if ( myBrowser.name == "InternetExplorer" ){
                    eval('document.getElementById("' + section + '").style').display='none'
                }
                else if ( myBrowser.name == "Opera" )
                {
                    document.getElementById(section).style.visibility = 'hidden'
                    document.getElementById(section).style.top=hidpos
                }
                else
                {
                    eval('document.getElementById("' + section + '").style').position='absolute'
                    eval('document.getElementById("' + section + '").style').visibility='hidden'
                }
            }
            else
            {
                eval('document.tree_' + this.name + '.layers["' + section + '"]').top=hidpos
                eval('document.tree_' + this.name + '.layers["' + section + '"]').visibility='hide'
            }
        }
    }
}


function getItemByIdNumber (number)
{
    for ( i3 = 0 ; i3 < this.itemsCount ; i3++ )
        if ( this.items[i3].idnum == number )
            return eval(this.items[i3])
}


function refreshSubTree ( num, stat )
{
    var thisItem = this.getItemByIdnum(num)
    thisItem.visible = (stat == 'true')?'visible':'hidden'
    if ( thisItem.visible == 'visible')
        this.numScrollSteps++
    if ( thisItem.numChildren > 0 ){
        var nextstate = (stat == 'true') ? thisItem.status : 'false'
        for ( i4 = 0 ; i4 < thisItem.numChildren ; i4++ )
        {
            var memo = i4
            var thisEl = this.getItemByIdnum(thisItem.children[i4].idnum)
            this.subrefresh(thisEl.idnum, nextstate)
            i4 = memo
        }
    }
}


function refreshTree ()
{
    for ( i5 = 0 ; i5 < this.itemsCount ; i5++ )
    {
        if ( this.items[i5].parent == -1 )
        {
            this.items[i5].visible = 'visible'
            for ( i6 = 0 ; i6 < this.items[i5].numChildren ; i6++ )
            {
                this.subrefresh(this.getItemByIdnum(this.items[i5].children[i6].idnum).idnum, this.items[i5].status)
            }
        }
    }
}

function refreshNode ( numb, status )
{
    this.numScrollSteps = 0
    var thisNode = this.getItemByIdnum(numb)
    if ( thisNode.numChildren > 0 )
    {
        var nextstat = (status == 'true') ? thisNode.status : 'false'
        for ( i7 = 0 ; i7 < thisNode.numChildren ; i7++ )
        {
            var nextNode = this.getItemByIdnum(thisNode.children[i7].idnum)
            this.subrefresh(nextNode.idnum, nextstat)
        }
    }
}


function browserData()
{
    var useragnt = navigator.userAgent
    this.canDoDOM = (document.getElementById) ? true : false
    if ( useragnt.indexOf('Opera') >= 0)
        this.name = 'Opera'
    else if (  useragnt.indexOf('MSIE') >= 0 )
        this.name = 'InternetExplorer'
    else
        this.name = 'Another'
}


function isSelected(selectionArray, element){
	for ( i = 0 ; i < selectionArray.length ; i++ ){
    	if ( selectionArray[i] == element )
    		return true
	}
  	return false
}


function isSelectAction(tree){
	if ( TICLTrees[tree].selAction == 'select' )
    	return true;
    else
    	return false;
}


function toggleNode(tree, sectnum, id){

    var section = tree.name + '_section' + sectnum
    var expanded = tree.items[sectnum].status
    var norm = '_NORM'
    var exp = '_EXPNORM'
    if ( !(tree.highlightClientSideSelect =='false') ){
        if ( tree.allowMultiple == 'true'){
        	if ( isSelected(tree.multipleSelection, id) ){
        		norm = '_SEL'
        		exp = '_EXPSEL'
        	}
        }
        else if ( tree.selected == id ){
            norm = '_SEL'
            exp = '_EXPSEL'
        }
    }

    if ( myBrowser.canDoDOM )
    {
        if ( myBrowser.name == "InternetExplorer" ){
            if ( expanded != 'true'){
                eval('document.getElementById("' + section + exp +'").style').display='inline'
                eval('document.getElementById("' + section + norm +'").style').display='none'
            }
            else{
                eval('document.getElementById("' + section + exp + '").style').display='none'
                eval('document.getElementById("' + section + norm + '").style').display='inline'
            }
        }
        else if ( myBrowser.name == "Opera" )
        {
            if ( expanded != 'true'){
                eval('document.getElementById("' + section + norm + '").style').visibility='hidden'
                eval('document.getElementById("' + section + exp + '").style').visibility='visible'
            }
            else{
                eval('document.getElementById("' + section + exp + '").style').visibility='hidden'
                eval('document.getElementById("' + section + norm + '").style').visibility='visible'
            }
        }
        else
        {
            if ( expanded != 'true'){
                eval('document.getElementById("' + section + norm + '").style').position='absolute'
                eval('document.getElementById("' + section + norm + '").style').visibility='hidden'
                eval('document.getElementById("' + section + exp + '").style').position='relative'
                eval('document.getElementById("' + section + exp + '").style').visibility='inherit'
            }
            else{
                eval('document.getElementById("' + section + exp + '").style').position='absolute'
                eval('document.getElementById("' + section + exp + '").style').visibility='hidden'
                eval('document.getElementById("' + section + norm + '").style').position='relative'
                eval('document.getElementById("' + section + norm + '").style').visibility='inherit'
            }
        }
    }
    else
    {
        if ( expanded != 'true'){
            eval('document.tree_' + tree.name + '.layers["' + section + '"].layers[0].layers["' + section + exp + '"]').visibility='show'
            eval('document.tree_' + tree.name + '.layers["' + section + '"].layers[0].layers["' + section + norm + '"]').visibility='hide'
        }
        else{
            eval('document.tree_' + tree.name + '.layers["' + section + '"].layers[0].layers["' + section + exp + '"]').visibility='hide'
            eval('document.tree_' + tree.name + '.layers["' + section + '"].layers[0].layers["' + section + norm + '"]').visibility='show'
        }
    }
}



function changePicture(section, picture, id)
{
    var sect = this.name + '_section' + section
    var srcbase = ""
    var source = ""

    toggleNode(this, section, id)

    if ( myBrowser.canDoDOM )
    {
        if ( myBrowser.name == 'InternetExplorer' )
        {
            source = eval('document.getElementById("' + picture + '")').src
            srcbase = source.substring(0,source.lastIndexOf("/") + 1)
            if ( source.indexOf(this.items[section].curimage) >= 0 )
                source = this.items[section].toggleimage
            else
                source = this.items[section].curimage
            source = source.substring(source.lastIndexOf("/") + 1)
            eval('document.getElementById("' + picture + '")').src = srcbase + source
        }
        else
        {
            source = document.images[picture].src
            srcbase = source.substring(0,source.lastIndexOf("/") + 1)
            if ( source.indexOf(this.items[section].curimage) >= 0 )
                source = this.items[section].toggleimage
            else
                source = this.items[section].curimage
            source = source.substring(source.lastIndexOf("/") + 1)
            document.images[picture].src = srcbase + source
        }
    }
    else
    {
        var holder = eval('document.tree_' + this.name + '.layers["' + sect + '"]')
        source = holder.document.images[picture].src
        srcbase = source.substring(0,source.lastIndexOf("/") + 1)
        if ( source.indexOf(this.items[section].curimage) >= 0 )
            source = this.items[section].toggleimage
        else
            source = this.items[section].curimage
        source = source.substring(source.lastIndexOf("/") + 1)
        holder.document.images[picture].src = srcbase + source
    }
    srcbase = ""
    source = ""
}


function changeStatus(status)
{
    return  status == 'true' ? 'false' : 'true'
}


function scrollWindow(section)
{
    var sect = this.name + '_section' + section
    var lineHeight = this.lineHeight
    if ( this.items[section].status == 'true' )
    {
        var thisSection = ''
        if ( myBrowser.canDoDOM )
            thisSection = eval('document.getElementById("' + sect + '").style')
        else
            thisSection = eval('document.tree_' + this.name + '.layers["' + sect + '"]')

        if (myBrowser.canDoDOM){
            if ( myBrowser.name == 'InternetExplorer' )
                var sectionTop = document.body.scrollTop + this.lineHeight * section
            else
                var sectionTop = window.pageYOffset + this.lineHeight * section
        }
        else
              var sectionTop = thisSection.pageY
        var sectionBottom = sectionTop + lineHeight*this.numScrollSteps
        if ( myBrowser.name == 'InternetExplorer')
        {
            var clientAreaTop = document.body.scrollTop;
            var clientAreaBottom = clientAreaTop + document.body.clientHeight
        }
        else
        {
            var clientAreaTop = window.pageYOffset;
            var clientAreaBottom = clientAreaTop + window.innerHeight;
        }
        var scrollValue = sectionBottom - clientAreaBottom;

        if ((sectionBottom > clientAreaBottom) || (sectionTop < clientAreaTop))
        {
            if ((sectionTop - clientAreaTop) > lineHeight*this.numScrollSteps)
                scrollValue = lineHeight*this.numScrollSteps + 10
            else if (sectionTop < (clientAreaTop + scrollValue))
                scrollValue = sectionTop - clientAreaTop + 10
            setTimeout('scrollBy(0, ' + scrollValue + ')', 50)
        }
    }
    return false
}

function hasSelectionTreeView(id, item){
	if ( TICLTrees[id].allowMultiple == 'true' ){
        if ( isSelected(TICLTrees[id].multipleSelection, item) ){
        	if ( TICLTrees[id].allowReselect == 'false' ){
            	ar = TICLTrees[id].multipleSelection
            	TICLTrees[id].multipleSelection = new Array()
            	for ( i = 0 ; i < ar.length ; i++ )
            		if ( ar[i] != item )
                		TICLTrees[id].multipleSelection[TICLTrees[id].multipleSelection.length] = ar[i]
            	TICLTrees[id].selAction = 'unselect'
        	}
            else
            	TICLTrees[id].selAction = 'select'
        }
        else{
        	TICLTrees[id].multipleSelection[TICLTrees[id].multipleSelection.length] = item
            TICLTrees[id].selAction = 'select'
        }
        return true
    }
    else{
	    if ( TICLTrees[id].selected != item ){
            TICLTrees[id].selected = item
       		return true
	    }
    	else{
			if ( TICLTrees[id].allowReselect == 'true' )
	  			return true
	  		else
        		return false
    	}

    }
}

function writeTreeSelection(tree, item, cont, selcont){
    if ( selcont != 'null' ){
        if ( myBrowser.canDoDOM ){
            if ( myBrowser.name == "InternetExplorer" ){
                document.write("<td nowrap>")
                document.write("<DIV ID=" + tree + "_section" + item + "_NORM STYLE={display:inline}>")
                document.write(cont + "</DIV>")
                document.write("<DIV ID="  + tree + "_section" + item + "_SEL STYLE={display:none}>")
                document.write(selcont + "</DIV>")
                document.writeln("</td>")
            }
            else if ( myBrowser.name == "Opera" ){
                document.write("<td nowrap>")
                document.write("<DIV ID=" + tree + "_section" + item + "_BASE STYLE={POSITION:relative;visibility:VISIBLE}>")
                document.write("<DIV ID=" + tree + "_section" + item + "_NORM STYLE={POSITION:relative;visibility:visible}>")
                document.write(cont + "</DIV>")
                document.write("<DIV ID=" + tree + "_section" + item + "_SEL STYLE={POSITION:absolute;visibility:hidden;top:0}>")
                document.write(selcont + "</DIV></DIV>")
                document.writeln("</td>")
            }
            else{
                document.write("<td nowrap>")
                document.write("<DIV ID=" + tree + "_section" + item + "_NORM STYLE={position:relative;visibility:inherit}>")
                document.write(cont + "</DIV>")
                document.write("<DIV ID=" + tree + "_section" + item + "_SEL STYLE={position:absolute;visibility:hidden}>")
                document.write(selcont + "</DIV>")
                document.writeln("</td>")
            }
        }
        else{
            document.write("<td nowrap><ILAYER ID=" + tree + "_section" + item + "_OUT>")
            document.write("<LAYER ID=" + tree + "_section" + item + "_NORM visibility='show'>" + cont + "</LAYER>")
            document.write("<LAYER ID=" + tree + "_section" + item + "_SEL visibility='hide'>")
            document.write(selcont + "</LAYER>")
            document.writeln("</ILAYER></td>")
        }
    }
    else
        document.writeln(cont)
}

// This function toggles the visibility state of the panel componnent

function toggleShowHide(panel_id2){
    var myBrowser = new browserData()
    if (document.getElementById){
        if ( myBrowser.name == "InternetExplorer" ){
            if ( eval('document.getElementById("panel_' + panel_id2 + '")').style.display == 'none'){
                eval('document.getElementById("panel_' + panel_id2 + '")').style.display='inline';
                eval('document.getElementById("show_' + panel_id2 + '")').style.display='none';
                eval('document.getElementById("hide_' + panel_id2 + '")').style.display='inline';
            }
            else{
                eval('document.getElementById("panel_' + panel_id2 + '")').style.display='none';
                eval('document.getElementById("hide_' + panel_id2 + '")').style.display='none';
                eval('document.getElementById("show_' + panel_id2 + '")').style.display='inline';
            }
        }
        else if ( myBrowser.name == "Opera" ){
            if ( document.getElementById("panel_" + panel_id2).style.visibility == 'visible' ){
                document.getElementById("panel_" + panel_id2).style.visibility = 'hidden'
                document.getElementById("show_" + panel_id2).style.visibility = 'visible'
                document.getElementById("hide_" + panel_id2).style.visibility = 'hidden'
            }
            else{
                document.getElementById("panel_" + panel_id2).style.visibility = 'visible'
                document.getElementById("show_" + panel_id2).style.visibility = 'hidden'
                document.getElementById("hide_" + panel_id2).style.visibility = 'visible'
            }
        }
        else{
            if ( eval('document.getElementById("panel_' + panel_id2 + '")').style.position == 'absolute'){
                eval('document.getElementById("panel_' + panel_id2 + '")').style.position='relative';
                eval('document.getElementById("panel_' + panel_id2 + '")').style.visibility='inherit';
                eval('document.getElementById("hide_' + panel_id2 + '")').style.position='relative';
                eval('document.getElementById("show_' + panel_id2 + '")').style.position='absolute';
                eval('document.getElementById("hide_' + panel_id2 + '")').style.visibility='inherit';
                eval('document.getElementById("show_' + panel_id2 + '")').style.visibility='hidden';
            }
            else{
                eval('document.getElementById("panel_' + panel_id2 + '")').style.position='absolute';
                eval('document.getElementById("panel_' + panel_id2 + '")').style.visibility='hidden';
                eval('document.getElementById("show_' + panel_id2 + '")').style.position='relative';
                eval('document.getElementById("hide_' + panel_id2 + '")').style.position='absolute';
                eval('document.getElementById("show_' + panel_id2 + '")').style.visibility='inherit';
                eval('document.getElementById("hide_' + panel_id2 + '")').style.visibility='hidden';
            }
        }
        return false;
    }
    else{
        if(eval('document.panel_' + panel_id2 ).visibility == 'hide'){
            eval('document.panel_' + panel_id2 ).visibility='show'
            eval('document.blank_' + panel_id2).layers[1].visibility='hide'
            eval('document.blank_' + panel_id2).layers[0].visibility='show'
        }
        else{
            eval('document.panel_' + panel_id2 ).visibility='hide'
            eval('document.blank_' + panel_id2).layers[0].visibility='hide'
            eval('document.blank_' + panel_id2).layers[1].visibility='show'
        }
    }
}


function renderHeaderLinks(link_id, active, pasive){
   myBrowser = new browserData()
   if ( document.getElementById ){
       if (myBrowser.name == 'InternetExplorer' ) {
           document.writeln("<DIV ID='active_" + link_id + "' STYLE='position:relative;visibility:visible;display:inline'> &nbsp;&nbsp;" + active + "&nbsp;&nbsp;</DIV>")
           document.writeln("<DIV ID='pasive_" + link_id + "' STYLE='position:relative;visibility:visible;display:none'>&nbsp;&nbsp;" + pasive + "&nbsp;&nbsp;</DIV>")
       }
       else{
           document.writeln("<DIV ID='active_" + link_id + "' STYLE='position:relative;visibility:visible'>&nbsp;&nbsp;" + active + "&nbsp;&nbsp;</DIV>")
           document.writeln("<DIV ID='pasive_" + link_id + "' STYLE='position:absolute;visibility:hidden'>&nbsp;&nbsp;" + pasive + "&nbsp;&nbsp;</DIV>")
       }
   }
   else{
       document.writeln("<ILAYER ID='blank_" + link_id + "' >")
       document.writeln("<LAYER ID='active_" + link_id + "' visibility='show'>&nbsp;&nbsp;" + active + "&nbsp;&nbsp;</LAYER>")
       document.writeln("<LAYER ID='pasive_" + link_id + "' visibility='hide'>&nbsp;&nbsp;" + pasive + "&nbsp;&nbsp;</LAYER>")
       document.writeln("</ILAYER>")
   }
}


function deactivateLink(link_id2){
    if (document.getElementById){
        if ( myBrowser.name == "InternetExplorer" ){
                eval('document.getElementById("active_' + link_id2 + '")').style.display='none';
                eval('document.getElementById("pasive_' + link_id2 + '")').style.display='inline';
        }
        else{
                eval('document.getElementById("active_' + link_id2 + '")').style.position='absolute';
                eval('document.getElementById("pasive_' + link_id2 + '")').style.position='relative';
                eval('document.getElementById("active_' + link_id2 + '")').style.visibility='hidden';
                eval('document.getElementById("pasive_' + link_id2 + '")').style.visibility='visible';
        }
    }
    else{
            eval('document.blank_' + link_id2 + '.layers["active_' + link_id2 +'"]' ).visibility='hide'
            eval('document.blank_' + link_id2 + '.layers["pasive_' + link_id2 +'"]' ).visibility='show'
    }
}


///////////// end panel

function getFormFieldLabel(formid, fieldid){
    if ( document.getElementById ){
        return document.getElementById(formid + "_" + fieldid).style ;
    }
    else{
        var inl = formid + "_" + fieldid;
        var outl = formid + "___" + fieldid;
        return eval('document.'+outl+'.layers["'+inl+'"]');
    }
}

///////////// change days when change month
function change_days(year, month, day)
{
    if (day == null)
      return;
    var monthDays = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
    var year = year.selectedIndex;
    selind = day.selectedIndex;
    if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0))
        monthDays[1] = 29;
    else
        monthDays[1] = 28;
    days = monthDays[month.selectedIndex];
    for (i=0 ; i<31; i++)
    {
        day.options[i]=null;
    }
    for (i=0 ; i<days; i++)
    {
        var optionName = new Option(i+1,i+1);
        eval("day.options[i]=optionName")
    }
    if (selind<days)
        day.options[selind].selected = true;

}

function switchTabItem(paneid, itemname)
{
    eval("toggleTabuserTabs('" + paneid + "_" + itemname + "');");
}

function ticlDualListMoveSelected(source, destination)
{
    for (var i = 0; i < source.options.length; i++)
    {
        var op = source.options[i];
        if (op.selected)
        {
            destination[destination.options.length] = new Option(op.text, op.value);
            source.options[i] = null;
            i--;
        }
    }
}

function ticlDualListMoveAll(source, destination)
{
    for (var i = 0, l = source.options.length; i < l; i++)
    {
        var op = source.options[i];
        destination[destination.options.length] = new Option(op.text, op.value);
    }

    while (source.options.length > 0)
    {
        source.remove(0);
    }
}

function listSelectAll(list)
{
    for (var i = 0, l = list.options.length; i < l; i++)
    {
        list.options[i].selected = true;
    }
}