function colorTD(a,b)
{
	document.getElementById(a + "1").style.background = "#" + b;
	document.getElementById(a + "2").style.background = "#FFFFFF";
}
function colorTDout(a)
{
	document.getElementById(a + "1").style.background = "";
	document.getElementById(a + "2").style.background = "";
}
function colorTD1(a,b)
{
	document.getElementById(a).style.background = "#" + b;
}
function colorTDout1(a)
{
	document.getElementById(a).style.background = "";
}
function colorMenu(a)
{
	document.getElementById(a).style.background = "#ffffff";
	document.getElementById(a).style.color = "#7B7B73";
}
function colorMenuOut(a,b)
{
	document.getElementById(a).style.background = "#" + b;
	document.getElementById(a).style.color = "#FFFFFF";
}
function elem(id)
{
	return document.getElementById(id);
}
function showHidePanel(name, td)
{
	var panel = document.getElementById(name);
	var panel2 = document.getElementById(name == "panel" ? "panel2" : "panel");
	if (panel && panel2)
	{
		if (panel.style.display == "block")
		{
			panel.style.display = "none";
		}
		else {
			panel.style.display = "block";
			panel2.style.display = "none";
		}
		
		//set absolute position
		/*if (document.getElementById("panel").style.display == "block")
		{
			document.getElementById("panel").style.width = td.offsetWidth;
			document.getElementById("panel").style.position = "absolute";
			document.getElementById("panel").style.left = td.offsetLeft;
			document.getElementById("panel").style.top = elem("tab_background").offsetHeight + elem("tab_menuheader").offsetHeight
				 + elem("tab_menuspace1").offsetHeight + elem("tab_menuspace2").offsetHeight
				 + elem("tab_menu").offsetHeight + elem("tab_menu2").offsetHeight
		}*/
		if (panel.style.display == "block")
		{
			panel.style.width = td.offsetWidth;
			panel.style.position = "absolute";
			panel.style.left = td.offsetLeft;
			panel.style.top = elem("tab_background").offsetHeight + elem("tab_menuheader").offsetHeight
				 + elem("tab_menuspace1").offsetHeight + elem("tab_menuspace2").offsetHeight
				 + elem("tab_menu").offsetHeight + elem("tab_menu2").offsetHeight
		}
	}
}
function clickMedMenu(menuItem) {
	if (!menuItem)
		return false;
	var linkChild;
	for (var i = 0; !linkChild && i < menuItem.childNodes.length; i++)
	{
		if (menuItem.childNodes[i].tagName && menuItem.childNodes[i].tagName.toLowerCase() == "a")
			linkChild = menuItem.childNodes[i];
	}
	
	if (linkChild)
		document.location.href = linkChild.href;
}

var doLoadCinema = false;
function pageLoad()
{
	var contentTable = document.getElementById("contentTable");
	var mainTable = document.getElementById("mainTable");
	
	//firefox
	if (window.innerHeight)
	{
		if (mainTable.offsetHeight < window.innerHeight)
		{
			contentTable.rows[1].style.height = contentTable.offsetHeight - 34 + window.innerHeight - mainTable.offsetHeight - 8;
		}
	}
	else
	{
		contentTable.style.height = contentTable.offsetHeight + document.body.offsetHeight - mainTable.offsetHeight;
		contentTable.rows[1].cells[0].style.height = contentTable.offsetHeight - 34;
	}
	
	if (doLoadCinema)
		loadCinema();
}
function downloadFile(id)
{
	if (top.document.getElementById("DownloadFrame"))
		top.document.getElementById("DownloadFrame").src = top.document.getElementById("DownloadFrame").getAttribute("urlPath") + "download.html?id=" + id;
}
function downloadBackItem(id)
{
	if (document.getElementById("DownloadFrame"))
		document.getElementById("DownloadFrame").src = "downback.html?id=" + id;
}
function openPopup(url)
{
	window.open(url, "newwindow", "location=0,menubar=0,status=0,toolbar=0,innerWidth=740,innerHeight=644,resizable=1");
}

function loadCinema()
{
	if (document.getElementById("DownloadFrame"))
		document.getElementById("DownloadFrame").src = document.getElementById("DownloadFrame").getAttribute("urlPath") + "cinema.php?t=" + new Date();
}
function loadedCinema(html)
{
	if (document.getElementById("contentCell"))
		document.getElementById("contentCell").innerHTML = html;
}