function ClassMenuTree(sElement, insName){

        this.className        = "menuTree";
        if(insName == null)
                this.insName        = this.className + '_' + Math.ceil(Math.random()*10000000000).toString();
        else
                this.insName         = insName;
        window[this.insName] = this;
        this.element = document.getElementById(sElement);
        this.contextMenu = null;
        this.Images = new Array();

        // constructor
        function ClassMenuTree(){
                this.created        = true;
        }

        function onNodeClick(oObject){
			
               // var oRow = oObject.firstChild.firstChild.rows.item(0);
               // var oFolder = oRow.cells.item(oRow.cells.length-2).firstChild;
               // var oPlus = oRow.cells.item(oRow.cells.length-3).firstChild;
                var bOpened = oObject.getAttribute("opened");
                if(bOpened == "true"){
                       // oFolder.src = this.Images['folder'];
                       // oPlus.src = this.Images['plus'+(oPlus.src.indexOf('bottom') >0 ? 'bottom' : '')];
                        oObject.setAttribute("opened",'false');
                } else {
                      //  oFolder.src = this.Images['folderopen'];
                      //  oPlus.src = this.Images['minus'+(oPlus.src.indexOf('bottom') >0 ? 'bottom' : '')];
                        oObject.setAttribute("opened",'true');
                }
				var text;
				var oO = oObject.getElementsByTagName('DIV');//oObject.childNodes;
                for (i=1; i< oO.length; i++){
					//i +=1;
					/*	if (bOpened == "true") {
							text = "none";*/
							
							if (oO[i].parentNode==oObject) {
								oO[i].style.display = (bOpened == "true" ? "none" : "block");
							}
						/*}
						else {
							text = "block";
						}
							oObject.childNodes[i].style.display = text;
					*/
				}
				
				
        }

        function appendImage(sName, src) {
                if(sName && src)
                        this.Images[sName] = src;
        }

        function appendContextMenu(sElement) {
                this.contextMenu = document.getElementById(sElement);
        }

        function onContextMenu(nNodeId){
                if(this.contextMenu == null)
                        return false;
                this.contextMenu.nodeId = nNodeId;
                this.contextMenu.style.posLeft = document.body.scrollLeft+event.clientX;
                this.contextMenu.style.posTop = document.body.scrollTop+event.clientY;
                this.contextMenu.style.filter = 'blendTrans(duration=0.4)';
                this.contextMenu.filters.blendTrans.apply();
                this.contextMenu.style.display = "block";
                this.contextMenu.filters.blendTrans.play();
        }

        function switchContextMenu(oObj) {
                if (oObj.className == "menuTreeContextItem") {
                        oObj.className = "menuTreeContextHighlightItem";
                } else if (oObj.className == "menuTreeContextHighlightItem") {
                        oObj.className = "menuTreeContextItem";
                }
        }

        public:
                this.appendImage                = appendImage;
                this.appendContextMenu        = appendContextMenu;
                this.onNodeClick                = onNodeClick;
                this.onContextMenu                = onContextMenu;
                this.switchContextMenu        = switchContextMenu;
}
