var menu;
var submenu;
var menu_timer;

function getObj(name) {
	if (document.getElementById) {
		this.obj = document.getElementById(name);
		this.style = document.getElementById(name).style;
	}
	else if (document.all) {
		this.obj = document.all[name];
		this.style = document.all[name].style;
	}
	else if (document.layers) {
		this.obj = document.layers[name];
		this.style = document.layers[name];
	}
}


function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}



function ShowSubmenu(submenu_id,menu_item) {
	Hide();
	submenu = document.getElementById(submenu_id);
	active = document.getElementById(menu_item);
	pos = (findPos(document.getElementById(menu_item)));
	active.style.backgroundPosition = "bottom";
	x = pos[0];
	y = pos[1];
	if (submenu_id == "popup_05") {
		x = x - 81;
	}
	if(submenu == null) return;
	
	submenu.style.display = "block";
	opacityTween = new OpacityTween(submenu,Tween.regularEaseOut, 0, 100, 0.7);
	opacityTween.start();
	
	submenu.style.left = x + "px";
	submenu.style.top = y + "px";
	
}



function Hide() {
	ResetTimer();
	if(submenu != null) {
		submenu.style.display = "none";
	}
	document.getElementById("ib01").style.backgroundPosition = "top";
	document.getElementById("ib02").style.backgroundPosition = "top";
	document.getElementById("ib03").style.backgroundPosition = "top";
	document.getElementById("ib04").style.backgroundPosition = "top";
	document.getElementById("ib05").style.backgroundPosition = "top";
}		

function ResetTimer() {
	if(menu_timer!=null) {
		clearTimeout(menu_timer);
	}
}

function SetTimer() {
	menu_timer=setTimeout('Hide();', 500);
}


function setTab(param) {
	li1 = document.getElementById("tabli01");
	li2 = document.getElementById("tabli02");
	li3 = document.getElementById("tabli03");
	cnt1 = document.getElementById("tabcnt01");
	cnt2 = document.getElementById("tabcnt02");
	cnt3 = document.getElementById("tabcnt03");	
	if (param == 3) {
		li1.className = "";
		li2.className = "passive";
		li3.className = "active";
		cnt1.style.display = "none";
		cnt2.style.display = "none";
		cnt3.style.display = "block";
	}
	else if (param == 2) {
		li1.className = "passive";
		li2.className = "active";
		li3.className = "";
		cnt1.style.display = "none";
		cnt2.style.display = "block";
		cnt3.style.display = "none";
	}
	else {
		li1.className = "active";
		li2.className = "";
		li3.className = "";
		cnt1.style.display = "block";
		cnt2.style.display = "none";
		cnt3.style.display = "none";
	}
	
}


function Zoom(w,h,url) {
     var winl = (screen.width - w) / 2;
     var wint = (screen.height - h) / 2;
     winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+'resizable=0';
        window.open(url, "zoom", winprops);
}
