function WMPlayer(objPlayer, sPath)
{
	var obj = GetObj(objPlayer);
	if (obj.controls == null)
		return;
	obj.controls.stop();
	obj.URL = sPath;
	obj.controls.play();
}
function OpenWindow(theURL, winName, features, w, h, scrollbars, center)
{
	var l = window.screen.width / 2 - (w / 2) - 6;
	l = l > 0 ? l : 0;
	var t = window.screen.height / 2 - (h / 2) - 40;
	t = t > 0 ? t : 0;
	return window.open(theURL, winName, "toolbar=no,location=no,status=no,menubar=no,width=" + w + ",height=" + h + (scrollbars ? ",scrollbars=yes" : "") + (center ? ",left=" + l + ",top=" + t : ""));
}
function TheBody()
{
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
function GetObj(id)
{
	return document.getElementById(id);
}
function ShowDiv(divId, show, x, y, allwayShow)
{
	var objDiv = document.getElementById(divId);
	if (objDiv == null)
		return;

	if (show == null)
		if (objDiv.style.display == "")
			objDiv.style.display = "none";
		else
			objDiv.style.display = "";
	else
		if (show == false)
			objDiv.style.display = "none";
		else
			objDiv.style.display = "";

	if (x != null && y != null)
	{
		if (allwayShow)
		{
			var winwidth = TheBody().clientWidth;
			var winheight = TheBody().clientHeight;
			if (x + objDiv.offsetWidth > winwidth)
				x = x - objDiv.offsetWidth - 20;
			if (y + objDiv.offsetHeight > winheight)
				y = y - objDiv.offsetHeight - 20;
		}
		objDiv.style.left = x + "px";
		objDiv.style.top = y + "px";
	}
}
function ShowDivAtMouse(event, divId, dx, dy, allwayShow)
{
	var curX = event.clientX+TheBody().scrollLeft;
	var curY = event.clientY+TheBody().scrollTop;
	if (dx == null)
		dx = 0;
	if (dy == null)
		dy = 0;
	ShowDiv(divId, true, curX + dx, curY + dy, allwayShow);
}
function GetObjParam(id, offsettype)
{
	var what = GetObj(id);
	if (what == null)
		return 0;
	if (offsettype == "left" || offsettype == "top")
	{
		var totaloffset = (offsettype=="left")? what.offsetLeft : what.offsetTop;
		var parentEl = what.offsetParent;
		while (parentEl!=null)
		{
			totaloffset = (offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
			parentEl = parentEl.offsetParent;
		}
		return totaloffset;
	}
	else if (offsettype == "width" || offsettype == "height")
	{
		var totaloffset = (offsettype=="width")? what.offsetWidth : what.offsetHeight;
		return totaloffset;
	}
	return 0;
}
