﻿// @TRONC /Kaley/Kaley.TreeView.js

/*
var nextToggleTmr = null;


function startToggleNode(ctrlNode, idNode){
  var node = document.getElementById(idNode);
  var nodechilds = document.getElementById(idNode+"_childs");
  var isopened = (node.className=="node nodemulti nodeopened");
  if (!isopened)
    nextToggleTmr = window.setTimeout("togglNode('"+ctrlNode+"','"+idNode+"')",500);
}


function cancelToggleNode(ctrlNode, idNode){
  if (nextToggleTmr!=null){
    window.clearTimeout(nextToggleTmr);
    nextToggleTmr = null;  
  }
} */


function togglNode(ctrlNode, idNode){
   var node = document.getElementById(idNode);
   var nodechilds = document.getElementById(idNode+"_childs");
   var expanded = (node.getAttribute("expanded")=="1");            
   if (expanded)          
     AnthemClientCollapse(ctrlNode, idNode);
     else          
     AnthemClientExpand(ctrlNode, idNode); 
}


function AnthemClientCollapse(ctrlNode, idNode) {        
  Anthem_InvokeControlMethod(
      ctrlNode,
      'ClientCollapse',
      [],
      function(result) {  
        DropUpNode(idNode);
      }
  );
} // function AnthemClientCollapse


function AnthemClientExpand(ctrlNode, idNode) {      
  Anthem_InvokeControlMethod(
      ctrlNode,
      'ClientExpand',
      [],
      function(result) {     
        DropDownNode(idNode);
      }
  );
} // function AnthemClientExpand


function DropUpNode(idNode){  
  var node = document.getElementById(idNode);       
  var nodechilds = document.getElementById(idNode+"_childs");  
  nodechilds.style.display="none"; 
  node.className = node.getAttribute("csscollapsed"); 
  node.setAttribute("expanded","0");
}


function DropDownNode(idNode){     
  var node = document.getElementById(idNode);       
  var nodechilds = document.getElementById(idNode+"_childs");  
  nodechilds.style.display="block";  
  node.className = node.getAttribute("cssexpanded");  
  node.setAttribute("expanded","1");   
}


