
<script language="JavaScript">
<!--
var ${id}_mouse_is_down = 0;
var ${id}_oldx = -1;
var ${id}_oldy = -1;

function ${id}_send_new_position() {
	var posx = parseInt(document.getElementById("${id}").style.left.replace("px", ""));
	var posy = parseInt(document.getElementById("${id}").style.top.replace("px", ""));
	${id}_oldx = ${id}_oldy = -1;
	${id}_mouse_is_down = 0;

	location.href = "${cgi.url}?sid=${wmsid}&win=${id}&newx=" + posx + "&newy=" + posy;
}

function ${id}_move_handler() {
	if ( ${id}_mouse_is_down ) {
		if ( ${id}_oldx >= 0 ) {
			var posx = parseInt(document.getElementById("${id}").style.left.replace("px", ""));
			var posy = parseInt(document.getElementById("${id}").style.top.replace("px", ""));

			posx = posx + MouseX - ${id}_oldx;
			posy = posy + MouseY - ${id}_oldy;

			document.getElementById("${id}").style.left = posx + "px";
			document.getElementById("${id}").style.top = posy + "px";
		}

		${id}_oldx = MouseX;
		${id}_oldy = MouseY;
	}
}

function ${id}_close() {
	location.href = "${cgi.url}?sid=${wmsid}&win=${id}&close=1";
}

function ${id}_mouse_down() {
	${id}_mouse_is_down=1;
	MouseMoveManager=${id}_move_handler;
	document.getElementById("${id}").style.setAttribute("z-index", "${windows_z_counter}");
}
-->
</SCRIPT>

<div id="${id}" style="position:absolute; left:${posx}; top:${posy}; z-index:${posz}">
<table bgcolor="#4444ff" border>
<tr><td bgcolor="#000099" align="center"
	onmousedown="${id}_mouse_down();"
	onmouseup="${id}_send_new_position()"><font color="#ffffff"><b>${content.title}</b></font></td>
    <td bgcolor="#000099" align="center" width="20"
	onmousedown="${id}_close()"><font color="#ffffff"><b>X</b></font></tr>
<tr><td align=center valign=middle bgcolor="#ffffff" colspan=2>${content.get_html()}</td></tr>
</table>
</div>

