    var tree=null;
    var arrayMessage=new Array();
    var forSubuser=false;
    var isUpdated=false;
//function for inialize tree
    function initTree(){
       if (tree==null){
            tree = new DynamicTreeBuilder("tree");
            tree.init();
            DynamicTreePlugins.call(tree);
        }else{
            document.getElementById('tree').innerHTML=tree.toHtml();
        }
    }

//switch to base/advanced mode for work with tree
    function gotoOtherMode(who){
        $("#idForMessageShow").html("");
        if (who==1){
            $('#mainDivForUpdate').load('./core/listAdvancedForm.php',{method:'switch_to_tree'},function(){
                initTree();
            });
        }else{
            $('#mainDivForUpdate').load('./core/action.php',{action:100},function(){
                initTree();
            });
        }
    }

//function send request to server for add folder
    function submitAddFolder(){
        $("#idForMessageShow").html("");
        $('#mainDivForUpdate').load('./core/listsActionForm.php',{method:'addfolder'},function(){
            initTree();
        });
    }

//function send to server request for remove folder
    function submitRemoveFolder(){
        $("#idForMessageShow").html("");
        $('#mainDivForUpdate').load('./core/listsActionForm.php',{method:'remfolder'},function(){
            initTree();
        });
    }

//function send to server request for add list
    function submitAddList(){
        $("#idForMessageShow").html("");
        $('#mainDivForUpdate').load('./core/listsActionForm.php',{method:'addlist'},function(){
            initTree();
        });
    }

//function send to server request for remove list
    function submitRemoveList(){
        $("#idForMessageShow").html("");
        $('#mainDivForUpdate').load('./core/listsActionForm.php',{method:'remlist'},function(){
            initTree();
        });
    }

//function create a array of message for user show process of execute request
    function getMessage(){
        $.post('./core/alertAction.php',{},function(data){
            var arrRes=data.split("|");
            var j=0;
            var size=arrRes.length;
            while(j<size){
                var value=arrRes[j];
                if (j==0){
                    isMono=value;
                }else{
                    arrayMessage[j]=value;
                }
                j++;
            }
        });
    }

//function back of previous state of work with interests
    function backSubmit(folder,name,flag){
        if (flag){
            if (name!=""){
                if (confirm(arrayMessage[6])) {                
                    $('#mainDivForUpdate').load('./core/action.php',{action:3,fid:folder,name:name},function(){
                        initTree();
                    });
                }
            }
        }
        $('#mainDivForUpdate').load('./core/action.php',{action:100},function(){
            initTree();
        });        
    }

//function send to server request for move folder in advanced mode
    function moveFolder(href,pid){
         $.post('./core/action.php',{action:9,fid:href,pid:pid},function(data){
            $("#idForMessageShow").html(data);
         });
    }

//function send to server request for move list in advanced mode
    function moveList(int_id,pid){
         $.post('./core/action.php',{action:10,int_id:int_id,pid:pid},function(data){
            $("#idForMessageShow").html(data);
         });
    }

//function send to server request for update folder in advanced mode
    function updateFolder(name,fid){
        $.post('./core/action.php',{action:11,name:name,fid:fid},function(data){
            $('#idForMessageShow').html(data);
        });
    }

//function send to server request for update list in advanced mode
    function updateList(name,int_id,title,checker,forwards){
        $.post('./core/action.php',{action:12,name:name,int_id:int_id,title:title,checker:checker,forwards:forwards},function(data){
            $('#idForMessageShow').html(data);
        });
    }

//function send to server request for delete folder in advanced mode
    function deleteFolder(fid){
        $.post('./core/action.php',{action:7,fid:fid},function(data){
            $('#idForMessageShow').html(data);
        });
    }

//function send to server request for delete list in advanced mode
    function deleteList(int_id){
        $.post('./core/action.php',{action:8,int_id:int_id},function(data){
            $('#idForMessageShow').html(data);
            var infoArray=$("#idListsSubscribers").html().split("/");
            var kol=new Number(infoArray[0].substr(1));
            if (kol>0){
                kol=kol-1;
                $("#idListsSubscribers").html("("+kol+"/"+infoArray[1]);
            }
        });
    }

//function send to server request for add list in advanced mode
    function addList(name,fid,title,checker,forwards,target,type,where){
        $.post('./core/action.php',{action:5,name:name,fid:fid,title:title.value,checker:checker,forwards:forwards},function(data){
            var results=data.split("|");
            if (results.length>1){
                $('#idForMessageShow').html(results[0]);
                addElementToTree(results[1],title,target,checker,forwards,type,name,where,results[2]);
                var infoArray=$("#idListsSubscribers").html().split("/");
                var kol=new Number(infoArray[0].substr(1));
                kol=kol+1;
                $("#idListsSubscribers").html("("+kol+"/"+infoArray[1]);
            }else{
                $('#idForMessageShow').html(results[0]);
            }
        });
    }

//function send to server request for add folder in advanced mode
    function addFolder(name,fid,title,target,checker,forwards,type,where){
        $.post('./core/action.php',{action:6,name:name,fid:fid},function(data){
            var results=data.split("|");
            if (results.length>1){
                $('#idForMessageShow').html(results[0]);
                addElementToTree(results[1],title,target,checker,forwards,type,name,where,results[2]);
            }else{
                $('#idForMessageShow').html(results[0]);
            }
        });
    }

//function for added folder in base mode
    function submitBaseAddFolder(fid,name){
        if ((fid=="")||(name.value=="")){
            $('#idForMessageShow').html(arrayMessage[3]);
        }else{
            $.post('./core/action.php',{action:2,fid:fid,name:name},function(data){
                var arrayInfo=data.split("#####");
                if (arrayInfo[0]=='ok')
                    $('#idForMessageShow')[0].className='style_normal_message';
                else
                    $('#idForMessageShow')[0].className='style_bad_message';

                $("#idForMessageShow").html(arrayInfo[1]);
                $("#mainDivForUpdate").html(arrayInfo[2]);
                tree=null;
                initTree();
            });
        }
    }

//function for added list in base mode
    function submitBaseAddList(fid,name){
        if ((fid=="")||(name=="")){
            $('#idForMessageShow').html(arrayMessage[3]);
        }else{
            $.post('./core/action.php',{action:3,fid:fid,name:name},function(data){
                var arrayInfo=data.split("#####");
                if (arrayInfo[0]=='ok')
                    $('#idForMessageShow')[0].className='style_normal_message';
                else
                    $('#idForMessageShow')[0].className='style_bad_message';

                $("#idForMessageShow").html(arrayInfo[1]);
                $("#mainDivForUpdate").html(arrayInfo[2]);
                tree=null;
                initTree();
            });
        }
    }

//function for delete folder in base mode
    function submitBaseRemoveFolder(fid) {
        if (confirm(arrayMessage[7])) {
            $.post('./core/action.php',{action:1,fid:fid},function(data){
                var arrayInfo=data.split("#####");
                if (arrayInfo[0]=='ok')
                    $('#idForMessageShow')[0].className='style_normal_message';
                else
                    $('#idForMessageShow')[0].className='style_bad_message';

                $("#idForMessageShow").html(arrayInfo[1]);
                $("#mainDivForUpdate").html(arrayInfo[2]);
                tree=null;
                initTree();
            });
        }else{
            $('#mainDivForUpdate').load('./core/action.php',{action:100},function(){
                tree=null;
                initTree();
            });
        }
    }
//function for delete list in base mode
    function submitBaseDeleteList(list_id) {
        if (confirm(arrayMessage[7])) {
            $.post('./core/action.php',{action:4,list_id:list_id},function(data){
                var arrayInfo=data.split("#####");
                if (arrayInfo[0]=='ok')
                    $('#idForMessageShow')[0].className='style_normal_message';
                else
                    $('#idForMessageShow')[0].className='style_bad_message';

                $("#idForMessageShow").html(arrayInfo[1]);
                $("#mainDivForUpdate").html(arrayInfo[2]);
                tree=null;
                initTree();
            });
        }else{
            $('#mainDivForUpdate').load('./core/action.php',{action:100},function(){
                tree=null;
                initTree();
            });
        }
    }