var curPop=null;
var curSubPop=null;
var curSrc="";

var tickMain=null;
var percentShowMain=0;
var stepMain=20;

var tickSub=null;
var percentShowSub=0;
var stepSub=20;


		
function ClearCurent(){
	if (curPop!=null){
		curPop.style.visibility="hidden";
		if (tickMain!=null){
			percentShowMain=0;
			clearInterval(tickMain);
			tickMain=null;
		}
	}
	if (curSrc!=null){
		curSrc.className="normal";
		curSrc=null;
	}	
}

		
function ShowPop(){
	var el=curPop;
    el.style.clip="rect( 0% 100% "+ percentShowMain+"% 0%)";
	percentShowMain+=stepMain;
	if (percentShowMain>100) {
		percentShowMain=0;
		clearInterval(tickMain);
		tickMain=null;
	}
}
		
function ShowSubPop(){
	var el=document.all[curSubPop];
    el.style.clip="rect( 0% "+ percentShowSub+"% "+percentShowSub+"% 0%)";
	percentShowSub+=stepSub;
	if (percentShowSub>100) {
		percentShowSub=0;
		clearInterval(tickSub);
		tickSub=null;
	}
}

		
function ShowHide(elem){
	event.srcElement.className="selected";
	var curElem=document.all[elem];
	curElem.style.clip="rect( 0%  0% 0% 0%)";		
	curElem.style.visibility="visible";
	curSrc=event.srcElement;
	curElem.style.pixelLeft=event.srcElement.offsetLeft;
	curElem.style.pixelTop=document.all["baner"].offsetHeight+document.all["menu"].offsetHeight;
	curPop=curElem;
	if (tickMain!=null){
		percentShowMain=0;
		clearInterval(tickMain);
	}
	tickMain=setInterval("ShowPop()",50);
}

function ShowHideSub(elem,levelup){
	event.srcElement.className="selected";
	var curElem=document.all[elem];
	curElem.style.clip="rect( 0%  0% 0% 0%)";	
	curElem.style.visibility="visible";
	curElem.style.pixelLeft=document.all[levelup].offsetLeft+document.all[levelup].offsetWidth-3;
	curElem.style.pixelTop=event.srcElement.offsetTop+document.all["baner"].offsetHeight+document.all["menu"].offsetHeight+5;
	curSubPop=elem;
	if (tickSub!=null){
		percentShowSub=0;
		clearInterval(tickSub);
	}
	tickSub=setInterval("ShowSubPop()",50);
}

function hOnMenuMouseOver(elem){
	elem.style.visibility="visible";
}

function hOnMenuMouseOut(elem){
	elem.style.visibility="hidden";
	event.className="normal";
	if (curSubPop!="" && curSubPop!=null) document.all[curSubPop].style.visibility="hidden";
}

function hOnMenuItemOut(elem){
	elem.className="normal";
}

function hOnSubMenuMouseOver(elem){
	curPop.style.visibility="visible";
	elem.style.visibility="visible";
}

function hOnSubMenuMouseOut(elem){
	curPop.style.visibility="hidden";
	elem.style.visibility="hidden";
}


 function BodyClick(){
  if ((event.srcElement.tagName=="LI") && (event.srcElement.className!="leaf")){
   el=event.srcElement;
   el.className=el.className=="expended"?"colapsed":"expended";
   for(i=0;i<el.children.length;i++)
	   if (el.children[i].tagName=="UL")
    	el.children[i].style.display=el.className=="expended"?"":"none";
  }
  event.cancelBubble=true;
 }
 
function OnMouseClick(elem){
	var visible=document.all[elem].style.display;
	document.all[elem].style.display=visible=="none"?"":"none";
}

function doShowNextElement(elem){
	var obj=document.all[elem.sourceIndex+1];
	if (obj.style.display=="none") obj.style.display='';
	else obj.style.display="none";
}