var currentHeight = 0;
var moving = 0;
var timeouts;

function echoDropdown(){
	document.write('<div id="dropdownBox" onmouseover="expandMenu()" onmouseout="contractMenu()"><span class="dropdownItem"><a href="http://www.mjtbengineering.com/projects/structural/">Structural</a></span><span class="dropdownItem"><a href="http://www.mjtbengineering.com/projects/electrical/">Electrical</a></span><span class="dropdownItem"><a href="http://www.mjtbengineering.com/projects/mechanical/">Mechanical</a></span></div>');
	document.getElementById('dropdownBox').style.height = currentHeight + "px";
}

function expandMenu(){
	clearTimeout(timeouts);
	expandContractMenu(5);
}

function contractMenu(){
	clearTimeout(timeouts);
	if(currentHeight < 75){
		expandContractMenu(-5);
	}else{
		timeouts=setTimeout('expandContractMenu(-5)', 500);
	}
}

function expandContractMenu(amount){
	document.getElementById('dropdownBox').style.height = currentHeight + "px";
	if(amount > 0 && currentHeight < 75){
		timeouts=setTimeout('expandContractMenu(5)', 10);
		currentHeight += amount;
	}else if(amount < 0 && currentHeight > 0){
		timeouts=setTimeout('expandContractMenu(-5)', 10);
		currentHeight += amount;
	}else{
		clearTimeout(timeouts);
	}
}

