var isIE=false;

if (window.attachEvent)
{
	window.attachEvent('onload',InitializeHeights);
	isIE = true;
}
else
{
	window.addEventListener('load',InitializeHeights, false);
	isIE = false;
}

var PixelIncrement=10;
function ShowObject(id)
{
	if (!isIE) return; 

	var index=parseInt(document.getElementById(id).index);
	if (document.getElementById(id).style.display=='block')
	{
		SlideUp(id,headerSizes[index]);
	}
	else
	{
		document.getElementById(id).style.height='0px';
		document.getElementById(id).style.display='block';	
		SlideDown(id,headerSizes[index]);
	}
}

headerSizes=new Array();
function InitializeHeights()
{
	return;
	if (!isIE) return; 

	var headerCount=parseInt(document.getElementById('headercount').value);
	for(var ii=1;ii<=headerCount;ii++)
	{
		var id='SidebarTextCell'+ii;
		document.getElementById(id).style.display='block';
		headerSizes[ii]=document.getElementById(id).offsetHeight;
		//document.getElementById(id).style.display='none';
	}	
}

function SlideDown(id,fullHeight)
{
	if (!isIE) return; 

	var obj=document.getElementById(id);
	var newTop=parseInt(obj.style.height)+PixelIncrement;
	if(newTop>=fullHeight)newTop=fullHeight;
	obj.style.height=newTop;
	if (newTop<fullHeight)
	{
		obj.style.height=newTop;
		newCode='SlideDown(\''+id+'\','+fullHeight+');';
		setTimeout(newCode,1);
	}
}


function SlideUp(id,currentHeight)
{
	if (!isIE) return; 

	var obj=document.getElementById(id);
	var newTop=parseInt(currentHeight)-PixelIncrement;
	if (newTop<0)newTop=0;
	obj.style.height=newTop;	
	if (newTop>0)
	{
		obj.style.height=newTop;
		newCode='SlideUp(\''+id+'\','+newTop+');';
		setTimeout(newCode,1);
	}
	else
	{
		document.getElementById(id).style.display='none';
	}
}

