jsext_menuLoaded = 1;

   function JTreeView(allid1){

                 //alert(allid1);
                 this.allid1 = allid1;
                 this.allid2 =this.allid1.split(",");
                 //alert(allid2[0]);
                 this.allid = new Array();

                 for(var n1 in this.allid2) {
                 var row = this.allid2[n1].split("-");
                 //alert(row[0]);
                  this.allid.push(row);
                }

                  this.vis = new Array();
                //HideAllExRoot();

               this.ByClip = function (id) {
                 //HideAllExRoot();
				 
                 var childs = this.Find_Childs(id);
                 if(childs) {
                   //alert("n"+ childs[0]);
                   var td = document.getElementById("n"+ childs[0]);
                  // alert(td);
                   var state = td.style.display;
                   //  alert(state);
                  // ChangeImage(id);
                  // alert(state);
                   if(state == 'block' || state == '') {this.GetAllChilds(id)}
                   else {this.ShowChilds(id);}//if
                   td.style.color = "#ffffff";
                 }//ifchilds

                }


                this.GetAllChilds = function (id) {
                  var childs = this.Find_Childs(id);
                 if(childs) {
                  for(var n in childs) {
                        var td = document.getElementById("n"+ childs[n]);
                        td.style.display = "none";
                        this.GetAllChilds(childs[n]);
                  }//for
                 }//if
                }




                this.Find_Childs = function(id_parent)
                {
                 var childs = new Array();
                 for(var n in this.allid) {
                  if(this.allid[n][1] == id_parent){
                   childs.push(this.allid[n][0]);
                  }//if
                 }//for

                 if(childs.length==0){
                                 return false;
                                 } else {return childs;}
                }


               this.HideAllExRoot = function () {
                 for(var n in this.allid) {
                  if(this.allid[n][1] != 0){
                                //alert(allid[n][0]);
                        var td = document.getElementById("n"+ this.allid[n][0]);
                        td.style.display = "none";
                  }//if
                 }//for
                }


                this.ShowChilds = function (id) {
						 //document.getElementById("m"+ id).style.fontWeight = "bold";
						 //document.getElementById("m"+ id).style.color = "#ffffff";
				
                 var childs = this.Find_Childs(id);
				 //alert(id);
				 //alert(childs+id);
				 //td.style.color = "#ffffff";
                 if(childs) {
                   for(var n in childs) {
					    var td = document.getElementById("n"+ childs[n]);
                        td.style.display = "block";
                   }//for
                 }//if
                }
                this.scolor = function (id) {
						document.getElementById("m"+ id).style.fontWeight = "bold";
						document.getElementById("m"+ id).style.color = "#ffffff";
				}
               this.GetVisible = function (id) {
                 var id_parent = this.GetParent(id);
                 var is_end = (id_parent!=0);
                 if(is_end) {
                  var childs = this.Find_Childs(id_parent);
                   if(childs){concat(this.vis,childs); }
                   this.GetVisible(id_parent);
                 }
                }

               this.GetParent = function (id) {
                 for(var n in this.allid) {
                   if (allid[n][0] == id) {return this.allid[n][1];} //на входе id
                 }//function
                }

               this.ChangeImage = function (id) {
                 var img = document.getElementById("i"+ id);
                 var p="../1struc/img/plus.gif";
                 var m="../1struc/img/minus.gif";
                 alert
                 if(img.src.length>p.length) {img.src =p;}
                 else {img.src = m;}
                }
       }
       JTreeViewLoaded = 1;
