var selection=null;
var objStyle = null;
var DynaStyle=false;
function expand(node,a){
	var good=false;
	ul=document.getElementById("div"+node);
	if(good=(ul!=null && ul.className!=null && ul.innerHTML!=null ))
	{
		if(ul.className=="Shown"){
			ul.className="Hidden";
			if(a!=null) a.href="javascript:;";
		}else if(ul.className=="Hidden"){
			ul.className="Shown";
		}
		if(ul.innerHTML==""){
			ul.innerHTML="<DIV ONCLICK='cancelLoad(this);' CLASS='loadMsg'>&nbsp;Загрузка,&nbsp;пожалуйста&nbsp;подождите...&nbsp;</DIV>";
			ul.className="";}
		if(a!=null && "object"==typeof(a) && window.length>0) a.target="frm"+node;
	}
	return true;
}
function setSel(node){
	if(selection!=null) if(selection.className!=null)
	 selection.className="";
	if(node){
	 if(node.className!=null){
	  node.className="Current";
	  selection=node;
	 }
	 if(node!=null && "object"==typeof(window.parent))
	  if(window.parent.document.title!=null)
	   window.parent.document.title="HTML Tree Control - "+node.innerText;
	}
	return;
}
function cancelLoad(d){
	if(d!=null) if("object"==typeof(ul=d.parentElement)) {
		ul.innerHTML="";
		ul.className="hdn";
	}
}
function loadNode(id, node, selID){
	ul=document.getElementById("div"+id);
	done=false;
	if(ul!=null && "object"==typeof(ul)  && node && "object"==typeof(node)) 
	{
		ul.innerHTML=node.innerHTML;
		ul.className="Hidden";
		expand(id);
	}
	return;
}
function initSel(id){
	a=document.getElementById("a"+id);
	if("object"==typeof(a)){
		setSel(a);
		if(a.offsetTop!=null && document.body.clientHeight!=null)
			window.scrollTo(0,a.offsetTop-(document.body.clientHeight/2));
	}
	return;
}
if(document.styleSheets&&document.styleSheets.length) {
if("object"==typeof(objStyle=document.styleSheets[1]) && objStyle!=null){
        objStyle.addRule( "DIV.Hidden" , "DISPLAY: none");
//        objStyle.addRule( "DIV.Shown" , "DISPLAY: none");
        DynaStyle=true;
}
}