var leftmenu=document.all.leftnav.style;
var iframe=document.all.iframebox.style;
var menuopen = "true";
var menuwidth = 220;
var barwidth = 12;

function getwindowwidth()
{
	return (document.body.clientWidth);
}

function mouseoverbutton()
{
	document.all.leftpushbar.style.backgroundColor = "#e6e6e6";
	document.all.leftpushbar.style.borderRightColor = "#dad4d4";
	if (menuopen == "false") {
	document.all.pushbarimage.style.backgroundImage = 'url(images/arrowopen.gif)';	
	} else {
	document.all.pushbarimage.style.backgroundImage = 'url(images/arrowclose.gif)';
	}
}

function mouseoutbutton()
{
	document.all.leftpushbar.style.backgroundColor = "#c9c9c9";
	document.all.leftpushbar.style.borderRightColor = "#ababab";
	if (menuopen == "false") {
	document.all.pushbarimage.style.backgroundImage = 'url(images/arrowopenlt.gif)';	
	} else {
	document.all.pushbarimage.style.backgroundImage = 'url(images/arrowcloselt.gif)';
	}
}

function animation (t, s, m, l) {
	return ((-m/2) * (Math.cos(Math.PI*(t/l)) - 1) + s);
}

function animate () {
	curtime = getTimer();
	timeelapsed = curtime - starttime;
	box._x = animation1(timeelapsed, startposX, movementX, lengthanim)
	box._y = animation2(timeelapsed, startposY, movementY, lengthanim)
	
	if (timeelapsed > lengthanim) {
		clearInterval(movebox);
	}
}

function closemenu()
{
		menuopen = "false";
		// animation 
			
		var startpos = 0;
		var endpos = 220;
		var lengthanim = 1500 //time in MS
		var movement = endpos - startpos;
		//var starttime = getTimer();
		
		

		// move menu to final position
		leftmenu.left = -menuwidth;
		// move iframe to final position
		iframe.left = barwidth;
		// reset pushbar
		document.all.leftpushbar.className = 'leftpushbarclosed';
		document.all.pushbarimage.style.backgroundImage = 'url(images/arrowopenlt.gif)';
}

function openmenu()
{
		menuopen = "true";
		// move menu to final position
		leftmenu.left = 0;
		// move iframe to final position
		iframe.left = menuwidth + barwidth;
		// reset pushbar
		document.all.leftpushbar.className = 'leftpushbaropen';
		document.all.pushbarimage.style.backgroundImage = 'url(images/arrowcloselt.gif)';
}

function domenu()
{
	if (menuopen == "false")
	{
		openmenu(-menuwidth);
	} else {
		closemenu(0);
	}
}