var curMenu = "";

function doMenu(elemID){
	var theLayer, offset;
	
	theLayer = document.layers[elemID];
	theLayer.visibility = "show";
	
	// Display local menu via transition
	offset = theLayer.clip.height;
	theLayer.clip.height = 0;
	clipReveal(theLayer, 40, offset);
}

function hideMenu(elemID){
	var theLayer = document.layers[elemID];
	theLayer.visibility = "hide";
}

var prevWindowWidth = 0;
var currWindowWidth = window.innerWidth;
function browserResize(){
	currWindowWidth = window.innerWidth;
	
	//alert("curr=" + currWindowWidth + "\nprev=" + prevWindowWidth);
	
	if(currWindowWidth < 768){
		// menus need different positions for this width
		prevPos01 = document.layers.menu01.left + (prevWindowWidth - currWindowWidth);
		document.layers.menu01.moveTo(prevPos01,10);
		alert(prevPos01);
	}
	else{
		// menu01
		prevPos01 = window.innerWidth - 165 - 230;
		document.layers.menu01.moveTo(leftPos,10);
		
		// menu02
		prevPos02 = window.innerWidth - 165 - 117;
		document.layers.menu02.moveTo(leftPos,10);
		
		// menu03
		prevPos03 = window.innerWidth - 165 - 98;
		document.layers.menu03.moveTo(leftPos,10);
		
		// menu03
		prevPos04 = window.innerWidth - 165 - 24;
		document.layers.menu04.moveTo(leftPos,10);
	}
	
	prevWindowWidth = currWindowWidth;
}	

function clipReveal(lyr, step, stop)
{
	lyr.clip.height += step;
	
	if((step > 0) && (lyr.clip.height < stop))
	{
	     setTimeout('clipReveal(document.layers["'+lyr.name+'"],'+step+','+stop+')',15);
   	}
}

window.onresize = browserResize;
