function getElement(id)
{
	return M3_GetElement(id);
}

function isShowElement(id)
{
	var elm = getElement(id);
	if (!elm) return false;
	return ((elm.style.display == "") || (elm.style.display == "block"));
}
function showHideElement(id)
{
	var elm = getElement(id);
	if (!elm) return;
	if (isShowElement(id)) {
		hideElement(id);
	} else {
		showElement(id);
	}
}
function showElement(id)
{
	var elm = getElement(id);
	if (!elm) return;
	elm.style.display = "block";
}
function hideElement(id)
{
	var elm = getElement(id);
	if (!elm) return;
	elm.style.display = "none";
}

// -----------------------
// public functions

function SwitchWindowPane(id) {
	var closeID = id + "_Close";
	var openID = id + "_Open";

	var isShow = isShowElement(openID);

	var elm = getElement(id);
	if (!elm) return;
	elm.className = ((!isShow) ? "open" : "close");
	showHideElement(openID);
	showHideElement(closeID);
}

function SwitchTabPane(id)
{
	var baseID = new String(id).substring(0, id.lastIndexOf("_"));
	for (i = 1; i < 256; i++)
	{
		var elm = getElement(baseID + "_" + i);
		if (elm == null) break;
		if (elm.id == id)
		{
			elm.className = "open";
			showElement(elm.id + "_Open");
		}
		else
		{
			elm.className = "close";
			hideElement(elm.id + "_Open");
		}
	}
}

function OpenSubWindow(url) {
	var width = 900;
	var height = 600;
	var params = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,copyhistory=0';
	if (OpenSubWindow.arguments.length > 1) {
		width = OpenSubWindow.arguments[1];
	}
	if (OpenSubWindow.arguments.length > 2) {
		height = OpenSubWindow.arguments[2];
	}
	if (width) {
		params += ',width='+width;
	}
	if (height) {
		params += ',height='+height;
	}
	wnd = window.open(url, null, params);
	wnd.focus();
}


//**************************************

