
//window.onload=init;

var d=document;
var expander; 			// object reference for the plus/minus div
var lContainer; 			// object reference for the UL

var currentTop=0;			// the current Y position of the UL
var zInterval = null;		// animation thread interval
var direction;			// direction we're scrolling the UL. 0==up, 1==down
var startTop=0;			// the starting top of the UL

var _SCROLLRATE=5;			// initial rate of scrolling
var scrollTick=0;			// keeps track of long we've scrolled so we can slow it down accordingly

var listExpand=true;		// boolean to tell us if we're expanding or contracting the list
var listHeight=70;			// the current height of the UL

var MIN_LIST_HEIGHT=70;		// contracted height of the list

var MAX_HEIGHT=-160;

var maxScrollDown = -20;

function init(itemNum,itemMin) {
	
	if ( itemNum < itemMin ) return;
	
	if(!d.getElementById) return; // bail out if this is an older browser
	
	up=d.getElementById("upArrow");
	down=d.getElementById("downArrow");

	down.onmouseover=function(){scrollObjects(0);}
	down.onmouseout=function(){stopObjects(0);}
	
	up.onmouseover=function(){scrollObjects(1);}
	up.onmouseout=function(){stopObjects(1);}
	//alert(up)
	//expander=d.getElementById("changeSize");

	lContainer = d.getElementById("listContainer");

	d.getElementById("nContainer").style.height=MIN_LIST_HEIGHT+"px";
}

function scrollObjects(dir) {
	direction=dir;
	//alert('START currentTop:'+currentTop+' direction:'+dir);
	if ( currentTop >= 0 && dir) {
		return;
	}
	
	zInterval=setInterval("animate()",60);
}

function stopObjects(dir) { 
	clearInterval(zInterval);
	//alert('STOP currentTop:'+currentTop+' direction:'+dir);
}

function setMaxScrollDown() {
	
}

function animate() {
	
	// increment or decrement currentTop based on direction
	if(!direction) {
		currentTop-=5;
	} else {
		currentTop+=5;
	}
	
	lContainer.style.top=currentTop+"px";

	
	if ( currentTop == 0 || currentTop <= maxScrollDown ) {
		//alert('currentTop:'+currentTop+' direction:'+dir);
		clearInterval(zInterval);
		
	}
}



