<?php
/* 
	POMM  v1.3
	Player Online Map for MangOs

	Show online players position on map. Update without refresh.
	Show tooltip with location, race, class and level of player.
	Show realm status.

	16.09.2006		http://pomm.da.ru/
	
	Created by mirage666 (c) (mailto:mirage666@pisem.net icq# 152263154)
*/

require_once "pomm_conf.php";
if (test_realm()) $point=$img_base."realm_on.gif"; else $point=$img_base."realm_off.gif";
$realm_name=get_realm_name();
?>
<HTML><HEAD><title><?php echo $realm_name ?></title>
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	color: #EABA28;
	background-color: #000000;
}
#world {
	position: absolute;
	height: 525px;
	width: 784px;
	left: 50%;
	margin-left: -392px;
	background-image: url(<?php echo $img_base ?>map.jpg);
	z-index: 10;
}
#points {
	position: absolute;
	height: 525px;
	width: 784px;
	left: 50%;
	margin-left: -392px;
	z-index: 100;
}
#wow {
	position: absolute;
	height: 525px;
	width: 784px;
	left: 50%;
	margin-left: -392px;
	z-index: 20;
	text-align: center;
	clear: none;
	float: none;
}
#info {
	position: absolute;
	height: 525px;
	width: 784px;
	left: 50%;
	margin-left: -392px;
	z-index: 30;
	text-align: center;
}
#timer {
	font-family: arial;
	font-size: 12px;
	font-style: normal;
	text-align: center;
	font-weight: bold;
	color: #FFFF99;
	z-index: 40;
	filter: Glow(Color=#000099, Strength=3);
}
#server_info {
	font-family: Georgia, "Times New Roman", Times, serif;
	font-size: 12px;
	font-style: italic;
	text-align: center;
	font-weight: bold;
	color: #FFFF99;
	filter: Glow(Color=0, Strength=3);
}
#tip {
	background: #000000;
	border: 0px solid #aaaaaa;
	left: -1000px;
	padding: 0px;
	position: absolute;
	top: -1000px;
	z-index: 110;
} 
.tip_header {
	background: #bb0000;
	FONT-WEIGHT: bold;
	color: #FFFFFF;
	font-family: arial, helvetica, sans-serif;
	font-size: 12px;
	font-style: normal;
	text-align: center;
	padding: 0px;
} 
.tip_text {
	background: #000000;
	FONT-WEIGHT: normal;
	color: #ffffff;
	font-family: arial, helvetica, sans-serif;
	font-size: 12px;
	font-style: normal;
	text-align: center;
	padding: 3px;
} 
-->
</style>
</HEAD>
<script language="JavaScript" src="JsHttpRequest/Js.js"></script>
<SCRIPT LANGUAGE="javascript" TYPE="text/javascript">

var time = <?php echo $time ?>;
var show_time=<?php echo $show_time ?>;
var race_name = {
		1: 'Human',
		2: 'Orc',
		3: 'Dwarf',
		4: 'Night Elf',
		5: 'Undead',
		6: 'Tauren',
		7: 'Gnome',
		8: 'Troll',
		9: 'Goblin'
}

var class_name = {
		1: 'Warrior',
		2: 'Paladin',
		3: 'Hunter',
		4: 'Rogue',
		5: 'Priest',
		7: 'Shaman',
		8: 'Mage',
		9: 'Warlock',
		11: 'Druid'
}

function tip(header,text) { 
var t; 
t=document.getElementById("tip"); 

if (window.opera) { 
x=window.event.clientX+15; 
y=window.event.clientY-10; 
} else if (navigator.appName=="Netscape") {
document.onmousemove=function(e) { x = e.pageX+15; y = e.pageY-10; return true}
} else { 
x=window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft + 15; 
y=window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop - 10; 
} 

t.innerHTML='<table width="80" border="0" cellspacing="0" cellpadding="0"\><tr class=\'tip_header\'\><td\>'+header+'</td\></tr\><tr class=\'tip_text\'\><td\>'+text+'</td\></tr\><\/table\>';
if (screen.width-x<150) x-=150; 
t.style.left=x + "px"; 
t.style.top=y + "px"; 
} 

function h_tip() { 
var t; 
t=document.getElementById("tip"); 
t.innerHTML=""; 
t.style.left="-1000px"; 
t.style.top="-1000px"; 
} 

function show(data) {
i=0;
text='';
if (data) {
while (i<data.length) {
	if (data[i].race==2 || data[i].race==5 || data[i].race==6 || data[i].race==8) 
											{point="<?php echo $img_base ?>horde.gif";} else
											{point="<?php echo $img_base ?>allia.gif";}
	text=text+'<img src="'+point+'" style="position: absolute; border: 0px; left: '+data[i].x+'px; top: '+data[i].y+'px;" onMouseMove="tip(\''+data[i].name+'\',\''+data[i].zone+'<br\><img src=\\\'<?php echo $img_base ?>'+data[i].race+'-'+data[i].gender+'.gif\\\' style=\\\'float:center\\\' border=0 width=18 height=18\> <img src=\\\'<?php echo $img_base ?>'+data[i].cl+'.gif\\\' style=\\\'float:center\\\' border=0 width=18 height=18\><br\>'+race_name[data[i].race]+'<br/>'+class_name[data[i].cl]+'<br/>'+data[i].level+' lvl\');" onMouseOut="h_tip();"\>';
i++;
}
}
document.getElementById("points").innerHTML=text;
document.getElementById("server_info").innerHTML='Online '+i+' players on <?php echo $realm_name ?><br>&nbsp;';
//window.status='Online '+i+' players';
}

function load_data() {
var req = new Subsys_JsHttpRequest_Js();
req.onreadystatechange = function() {
	if (req.readyState == 4) {show(req.responseJS);}
    }
    req.open('GET', 'pomm_play.php', true);
    req.send({ });
}

function reset() {
var ms = 0;
then = new Date();
then.setTime(then.getTime()-ms);
load_data();
}

function display() {
now = new Date();
ms = now.getTime() - then.getTime();
ms = time*1000-ms;
if ((show_time==1) && (time!=0)) {document.getElementById("timer").innerHTML=(Math.round(ms/1000));}
if (ms<=0) {
	reset();
	}
if (time!=0) {setTimeout("display();", 500);}
}

function start() {
reset();
display();
if (navigator.appName=="Netscape") {
document.onmousemove=function(e) { x = e.pageX+15; y = e.pageY-10; return true}
}
}
</SCRIPT>
<BODY onload=start()>
<div id="tip"></div><div ID="points"></div><div ID="world"></div><div ID="wow"><img src="<?php echo $point ?>" style="position: absolute; border: 0px; left: 245; top: 0;" onClick="window.location='<?php echo $_SERVER['PHP_SELF'] ?>'"></div><div ID="info"><center><table border="0" cellspacing="0" cellpadding="0" height="20"><tr><td valign="top" id="timer"></td></tr></table>
<table border="0" cellspacing="0" cellpadding="0" height="470" width="1">
<tr><td></td></tr></table>
<table border="0" cellspacing="0" cellpadding="0" height="35" width="100%">
<tr><td align="center" valign="top" id="server_info"></td></tr></table></center>
</div></BODY></HTML>
