/// EXPANDING DIVS

i=0;
j=0;
k=0;
finalHeight = 0;
originalHeightArray = new Array();
allShowing = 0;
expandIncrement = 10;
closeMe = 0;	
	
	
function initialize(openDiv) {

	var r1=document.getElementById('nav_list').getElementsByClassName('current_page_item'); 
	for (m=0;m<r1.length;m++){
	 r1[m].setAttribute('onmouseover',"showList('subnav')");
	 r1[m].setAttribute('onmouseout',"startHide()");
	}
	
	var r2=document.getElementById('subnav'); 
	r2.setAttribute('onmouseover',"dontHide()");
	r2.setAttribute('onmouseout',"startHide()");
	
	var r3=document.getElementById('subnav').getElementsByTagName('li'); 
	for (m=0;m<r3.length;m++){
		r3[m].setAttribute('onmouseover',"dontHide()");
	}
	
	
	listHolderArray = new Array();
	listHolderArray[0] = document.getElementById('subnav');

	for (k=0;k<listHolderArray.length;k++) {
		listHolderArray[k].style.display = "block";
		originalHeightArray[listHolderArray[k].id] = listHolderArray[k].offsetHeight;
		listHolderArray[k].style.display = "none";
	}
}

function startHide() {
	clearTimeout(closeMe);
	closeMe = setTimeout("hideList('subnav')",600);
}

function dontHide() {
	clearTimeout(closeMe);
}

function showList(whichList) {
	if (document.getElementById(whichList).style.display == "block") {
		 
	} else {
		document.getElementById(whichList).style.display = "block";
		finalHeight = originalHeightArray[whichList];
		document.getElementById(whichList).style.height =  i + "px";
		openSteps = setInterval("stepOpen('"+whichList+"')",10);
	}
}


function hideList(whichList) {
	closeSteps = setInterval("stepClosed('"+whichList+"')",10);
}


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

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