// JavaScript Document
var menuTransition=false;
var LINEHEIGHT=12;

function expandCollapse(element, child, totHeight)
{
	//COLLAPSED = 1 State = 2
	if(menuTransition)
	{
		//alert("wait..");
		return false;
	}
	menuTransition=true;
	totHeight*=LINEHEIGHT;
	//alert(element.childNodes[0].childNodes[0].nodeValue);
	if(!element.State) //first time 
	{
		childElement=document.getElementById(child);
		if(childElement.style.display=='none')	//find state as per display property :-)
			element.State=1;
		else
			element.State=2;
	}
	if(element.State==1)
	{
		childElement=document.getElementById(child);
			
		childElement.style.display='';
		expand(child, 2, totHeight);
		element.State=2; 				//set to expanded state
		if(BROWSER=="MSIE")
			element.childNodes[0].childNodes[0].nodeValue='\u25bc';
			//element.parentNode.firstChild.firstChild.firstChild.nodeValue="\u9660";
		else
			element.firstChild.nextSibling.firstChild.nodeValue='\u25bc';
		
	}
	else	//bye bye
	{
		childElement=document.getElementById(child);

		collapse(child, totHeight);
		element.State=1;						//set to collapsed state
		if(BROWSER=="MSIE")
			element.childNodes[0].childNodes[0].nodeValue='\u25ba';
		else
			element.firstChild.nextSibling.firstChild.nodeValue='\u25ba';
	}
}

function expand(eid, perc, totHeight)
{
	element=document.getElementById(eid);
	if(perc>=totHeight)
	{
		element.style.height= totHeight+'px';
		menuTransition=false;
		return;
	}
	element.style.height=perc+"px";
	var inc=0.3*(perc);
	if(inc<0)
		alert("oh no!!!!");
	inc=inc<1?1:inc;
	//alert(inc);
	perc+=inc;
	setTimeout("expand('"+eid+"', "+perc+", "+totHeight +")", 25);
}

function collapse(eid, perc)
{
	element=document.getElementById(eid);
	if(perc<=1)
	{
		element.style.height= '5px';
		element.style.display='none';
		menuTransition=false;
		return;
	}
	element.style.height=perc+"px";
	var inc=0.3*(perc);
	if(inc<0)
		alert("oh no!!!!");
	
	inc=inc<1?1:inc;
	
	perc-=inc;
	setTimeout("collapse('"+eid+"', "+perc+")", 33);
}