var selection=null;
var objStyle = null;
var DynaStyle=false;
function expand(node,a){
	var good=false;
	ul=document.getElementById("ul"+node);
	img=document.getElementById("img"+node);
	if(good=(ul!=null && img!=null && ul.className!=null && ul.innerHTML!=null )) 
	{
		str=''+img.src;
		if(ul.className=="Shown"){
			ul.className="Hidden";
			img.src=str.substr(0,str.length-5)+"c.gif";
			if(a!=null) a.href="javascript:;";
		}else if(ul.className=="Hidden"){
			ul.className="Shown";
			img.src=str.substr(0,str.length-5)+"o.gif";
		}
		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="fra"+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="ERA online store - "+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("ul"+id);
	done=false;
	if(ul!=null && "object"==typeof(ul)  && node && "object"==typeof(node)) 
	{
		ul.innerHTML=node.innerHTML;
		ul.className="Hidden";
		expand(id);
	}
	if(selID){
		a=document.getElementById("a"+selID);
		setSel(a);
	}else{
		a=document.getElementById("a"+id);
		if(selection==null)
			setSel(a);
		else if(selection.innerHTML==null || selection.innerHTML=='')
			setSel(a);
	}
	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)
if("object"==typeof(objStyle=document.styleSheets[0]) && objStyle!=null){
        objStyle.addRule( "UL.Hidden" , "DISPLAY: none");
        objStyle.addRule( "UL.Shown" , "DISPLAY: none");
        DynaStyle=true;
}
