 
var currentHeight = 1;
var lastHeight = 1;
var SectionMaxHeight = 200;
var openPixelsPerLoop = 60;
var openSpeed = 30;

var closePixelsPerLoop = 80;
var closeSpeed = 30;
var SectionOpen = false;
var timerObj = null;
var closetimerObj = null;


var currentObj = null;
var lastObj = null;
var lastOpenId = "";

var arrowImg = null;

var panelHeights = new Array();
var panelArrowUpImages = new Array();
var panelArrowDownImages = new Array();


function getElement(id) {	
	if(document.all) { return document.all(id); }
	else if(document.getElementById) { return document.getElementById(id); }
	else { return null; }
}




function openSection(openId) {


	arrowImg = getElement(openId+"img");
	arrowImg.src = panelArrowDownImages[openId].src;


	if(timerObj!=null) { return false; }

	if(lastOpenId!="" && lastOpenId==openId) {
		currentObj = getElement(openId);
		lastObj = currentObj;
		lastHeight = lastObj.offsetHeight;
		arrowImg = getElement(lastOpenId+"img");
		arrowImg.src = panelArrowUpImages[lastOpenId].src;
		closePanel();
		return false;
	}

	lastObj = null;

	if(currentObj!=null) {
		lastObj = currentObj;
		lastHeight = lastObj.offsetHeight;
		arrowImg = getElement(lastOpenId+"img");
		arrowImg.src = panelArrowUpImages[lastOpenId].src;
		closePanel();
	}

	currentObj = getElement(openId);

	currentObj.style.display="block";
	currentHeight = 1;
	SectionMaxHeight = panelHeights[openId];

	lastOpenId = openId;

	openPanel();
}

 
 
function openPanel() {

	currentHeight += openPixelsPerLoop;
 
	if(currentHeight<=SectionMaxHeight) { 
		if(currentObj!=null) { currentObj.style.height = currentHeight + "px"; }
		timerObj = setTimeout("openPanel()", openSpeed);
	} else {
		timerObj = null;
	}
}
 
function closePanel() {
 
	lastHeight -= closePixelsPerLoop;
 
	if(lastHeight>=1) { 
		if(lastObj!=null) { lastObj.style.height = lastHeight + "px"; }
		closetimerObj = setTimeout("closePanel()", closeSpeed);
	} else {
		lastObj.style.height = "1px";
		lastObj.style.display = "none";
		lastObj.style.height = SectionMaxHeight + "px";
		closetimerObj = null;
	}
  
}

function createPanel(Id) {
	var tmp = getElement(Id);
	if(tmp!=null) {
		panelHeights[Id] = tmp.offsetHeight;
		tmp.style.display = "none";
		tmp.style.overflow="hidden";
		panelArrowUpImages[Id] = new Image();
		panelArrowUpImages[Id].src = "./images/arrowup.gif";
		panelArrowDownImages[Id] = new Image();
		panelArrowDownImages[Id].src = "./images/arrowdown.gif";
	}
}