// JavaScript Document
var timer1;
var timer2;
var timeStep = 60;

function initialMenuPos(input){
	if (input > 0){
		var tagHeight = 30;
		var objMenu = document.getElementById("listMenu");
		var list1Top = tagHeight;
		var list2Top = 0;
	
		for (var i = 1; i <= 2; i++){
			if (i <= (input + 1)){
				var	obj = document.getElementById("list" + i);
				obj.style.top = eval("list" + i + "Top") + "px";
			} // end if
		} // end for
	} // end if
}

function switchMenu(input){
	var tagHeight = 30;
	var objMenu = document.getElementById("listMenu");
	var list1Top = tagHeight;
	var list2Top =  0;
	var list1Bottom = objMenu.offsetHeight - tagHeight;
	var list2Bottom = 0;
	
	lightOn(input);
	clearTimeout(timer1);
	clearTimeout(timer2);
	//clearTimeout(timer3);
	for (var i = 2; i >= 1; i--){
		if (i < input){
			menuMove(i, eval("list" + i + "Bottom"));
			
		} else {
			menuMove(i, eval("list" + i + "Top"));
			
		} // end if
	} // end for
} // end function switchMenu

function menuMove(index, target){
	var stepSize = 60;
	var obj = document.getElementById("list" + index);
	
	if (obj.offsetTop != target){
		if (index == 2){
			timer2 = setTimeout("menuMove(2," + target + ")",timeStep);
		} else if (index == 1){
			timer1 = setTimeout("menuMove(1," + target + ")",timeStep);
		} // end if
	} else {
		clearTimeout(eval("timer" + index));
	} // end if
	
	if (obj.offsetTop > target){
		if ((obj.offsetTop - target) >= stepSize){
			obj.style.top =  obj.offsetTop - stepSize + "px";
		} else {
			obj.style.top = target + "px";
			
		} // end if
	} else if (obj.offsetTop < target) {
		if ((target - obj.offsetTop) >= stepSize){
			obj.style.top = obj.offsetTop + stepSize + "px";
		} else {
			obj.style.top = target + "px";
		} // end if
	} // end if
	document.getElementById("listMenu").style.overflow = "hidden";
} // end function menuMove

function lightOn(btn_no){
	for (i=1;i<=2;i++){
		document.getElementById("btn_"+i).src="images/btn_"+i+".gif";
		document.getElementById("btn_"+i).oSrc="";
	}
	document.getElementById("btn_"+btn_no).src="images/btn_"+btn_no+"_r.gif";
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}