/* ================================================================ 
This copyright notice must be untouched at all times.

The original version of this script and the associated (x)html
is available at http://www.stunicholls.com/menu/riser.html
Copyright (c) 2005-2008 Stu Nicholls. All rights reserved.
This script and the associated (x)html may be modified in any 
way to fit your requirements.

Please see 'Terms of use' on stunicholls.com
=================================================================== */

onload = function() {
document.getElementById("sub_0").style.top = 200 + 'px';
	var getEls = document.getElementById('sub_0').getElementsByTagName("LI");	
	for (var i=0; i<getEls.length; i++) {
		getEls[i].onclick=function() {

		cY = parseInt(document.getElementById("sub_0").style.top);
		if (this.id == "nosub1") {pos = 0;}
		if (this.id == "top_1") {pos = 20;}
	if (this.id == "nosub2") {pos = 40;}
		if (this.id == "top_2") {pos = 60;}
		if (this.id == "top_3") {pos = 80;}
		if (this.id == "top_4") {pos = 100;}
		if (this.id == "top_5") {pos = 120;}
		if (this.id == "top_6") {pos = 140;}

fY = (cY + pos);

xY = (200 - fY);

fY = (cY + xY);
moveIt (cY,fY)

		switchOn (this)

		switchOff ('sub1',this)
		}
	}
}


function switchOn (subs) {
		ulId = subs.id.replace("top", "sub");
		document.getElementById(ulId).className = 'yes';
		}


function switchOff (subs,current) {
			var getListElts = document.getElementById(subs).getElementsByTagName("UL");
			for (var i=0; i<getListElts.length; i++) {
			if (ulId !== getListElts[i].id && getListElts[i].className == "yes"){
					getListElts[i].className = "none";
				}
			}
			var getListSub = document.getElementById(subs).getElementsByTagName("LI");
			for (var s=0; s<getListSub.length; s++) {
					getListSub[s].className = "";
				}
		}



function moveIt (cY,fY) {
 if (cY > fY) {cY--;}
 else {cY++;}
if (cY != fY) {
document.getElementById('sub_0').style.top = cY + "px";
setTimeout ('moveIt(' + cY + ',' + fY + ')', 5);
}
}
