var submenu;
var menu;
var currentKey;
var menuInterval;
function setMenus(key) {
	menu = document.getElementById('menu' + key) ;
	menu_a = document.getElementById('menu_a' + key);
	submenu = document.getElementById('submenu' + key) ;
}
function menu_on(key) {
	menu_stay_on() ;
	menu_off();
	setMenus(key);
	currentKey = key;
	// rollovers
	menu.className = "menu_on" ;
	menu_a.className = "menu_on" ;
	if ( submenu != undefined && submenu ) {
		move_submenu();
		submenu.style.display = "" ;
	}
}
function menu_stay_on() {
	clearTimeout(menuInterval);
}
function move_submenu() {
	var coords = findPos(menu_a);
	submenu.style.position = "absolute" ;
	submenu.style.left = parseInt(coords[0]) + "px";
}
function menu_off() {
	if ( currentKey != undefined ) {
		menu.className = "menu_off" ;
		menu_a.className = "menu_off" ;
		if ( submenu != undefined && submenu ) {
			submenu.style.display = "none" ;
		}
	}
}
function countdown() {
	if ( currentKey != undefined ) {
		menuInterval = setTimeout("menu_off()",250);
	}
}
var initialized = false;
var gmap;
var belowmap;
var gmapInterval;
var mapTargetTop;
var mapEasing = 0.3;
var mapOriginalTop;
function startMoveMap(map_id) {
	if ( !initialized ) {
		gmap = document.getElementById(map_id + "_container");
		gmap.style.width = gmap.offsetWidth + "px" ;
		gmap.style.position = "absolute" ;
		var coords = findPos(gmap);
		mapOriginalTop = parseInt(coords[1]);
		belowmap = document.getElementById("belowmap");
		initialized = true;
	}
	gmap.style.zIndex = "10";
	belowmap.style.zIndex = "5";
	document.getElementById(map_id + "_back").style.display = "" ;
	mapTargetTop = parseInt(posTop()) + 10;
	if ( mapTargetTop < mapOriginalTop ) {
		moveMapBackTop(map_id);
		return ;
	}
	gmapInterval = setInterval("moveMap()",20);
}
function moveMap() {
	var coords = findPos(gmap);
	var vy = (mapTargetTop - parseInt(coords[1])) * mapEasing;
	var newY = parseInt(coords[1]) + vy;
	var dy = Math.abs(mapTargetTop - newY);
	if ( dy < 2 ) {
		gmap.style.top = mapTargetTop + "px" ;
		clearInterval(gmapInterval);
	} else {
		gmap.style.top = newY + "px" ;
	}
}
function moveMapBackTop(map_id) {
	mapTargetTop = mapOriginalTop;
	document.getElementById(map_id + "_back").style.display = "none" ;
	gmapInterval = setInterval("moveMap()",15);
}
