function init() {
	window.onerror = stopError;
	startHeight = 50;
	endHeight = 480;
	speed = 20;
	acc = 10;
	menu = document.getElementById('menu');
	headerBlock = document.getElementById('headerBlock');
	// expand(); // For Development purposes
}

function toggle() {
	if(endHeight > menu.offsetHeight) {
		expand();
	} else {
		contract();
	}
}

function expand() {
	var ge = window.setTimeout('expand()',speed);
	var currHeight = menu.offsetHeight;
	var newHeight=currHeight+Math.ceil((endHeight-currHeight)/acc);
	menu.style.height = newHeight+"px";
	headerBlock.style.height = newHeight+10+"px";
	if (currHeight >= endHeight) {
		menu.style.height = endHeight+'px';
		window.clearTimeout(ge);
	}
}

function contract() {
	var gc = window.setTimeout('contract()',speed);
	var currHeight = menu.offsetHeight;
	var newHeight=currHeight-Math.ceil((currHeight-startHeight)/acc);
	menu.style.height = newHeight+'px';
	headerBlock.style.height = newHeight+10+"px";
	if (currHeight <= startHeight) {
		menu.style.height = startHeight+'px';
		headerBlock.style.height = startHeight+10+'px';
		window.clearTimeout(gc);
	}
}


function stopError() {
  return true;
}

//

