/// EXPANDING DIVS

i=0;
j=0;
k=0;
finalHeight = 0;
listHolderArray = new Array();
originalHeightArray = new Array();
allShowing = 0;
expandIncrement = 10;
	

function getElementByClass(theClass) {
	allDivs = new Array();
	allDivs=document.getElementsByTagName("div");
	for (i=0; i<allDivs.length; i++) {
		if (allDivs[i].className==theClass) listHolderArray.push(allDivs[i]);
	}
}
	
	
function initialize(openDiv) {
	getElementByClass("hidden_div");
	for (k=0;k<listHolderArray.length;k++) {
		listHolderArray[k].style.display = "block";
		originalHeightArray[listHolderArray[k].id] = listHolderArray[k].offsetHeight;
		listHolderArray[k].style.display = "none";
	}
	if (openDiv!="") document.getElementById(openDiv).style.display = "block";
}


function showDiv(whichDiv) {
	if (document.getElementById(whichDiv).style.display == "block") {
		  document.getElementById(whichDiv).style.opacity = 0;
		  document.getElementById(whichDiv).style.filter='alpha(opacity=0)';
		closeSteps = setInterval("stepClosed('"+whichDiv+"')",10);
	} else {
		i=0;
		//for (j=0;j<listHolderArray.length;j++) {
		//	listHolderArray[j].style.display = "none";
		//}
		document.getElementById(whichDiv).style.display = "block";
		  document.getElementById(whichDiv).style.opacity = 0;
		  document.getElementById(whichDiv).style.filter='alpha(opacity=0)';
		finalHeight = originalHeightArray[whichDiv];
		document.getElementById(whichDiv).style.height =  i + "px";
		openSteps = setInterval("stepOpen('"+whichDiv+"')",10);
	}
}


function stepOpen(whichDiv) {
	if (i>=finalHeight) {
		clearInterval(openSteps);
		  document.getElementById(whichDiv).style.opacity = 1;
		  document.getElementById(whichDiv).style.filter='alpha(opacity=100)';
	} else {
		document.getElementById(whichDiv).style.height = i + "px";
		i = i+expandIncrement;
	}
}

function stepClosed(whichDiv) {
	if (i<=0) {
		document.getElementById(whichDiv).style.display = "none";
		clearInterval(closeSteps);
	} else {
		document.getElementById(whichDiv).style.height = i + "px";
		i = i-(expandIncrement*2);
	}
}


function showAll() {
	if (allShowing) {
		for (j=0;j<listHolderArray.length;j++) {
			listHolderArray[j].style.display = "none";
		}
		allShowing = 0;
		document.getElementById('show_all_link').innerHTML = "Show All";
	} else {
		for (j=0;j<listHolderArray.length;j++) {
			listHolderArray[j].style.display = "block";
		}
		allShowing = 1;
		document.getElementById('show_all_link').innerHTML = "Hide All";
	}
}
