<? include("config.php"); ?>
<?
$zoom 
$default_zoom_level;
$longitude 100.5351375;
$latitude 13.767734;

if ( 
$_REQUEST["lat"] != "" ) { $latitude $_REQUEST["lat"]; }
if ( 
$_REQUEST["long"] != "" ) { $longitude $_REQUEST["long"]; }
if ( 
$_REQUEST["res"] != "" ) { $res $_REQUEST["res"]; $zoom log($res)/log(2); }
if ( 
$_REQUEST["zoom"] != "" ) { $zoom $_REQUEST["zoom"]; }

$map_topmargin 100;
$map_leftmargin 5;
$map_rightmargin 5;
$map_bottommargin 5;

$title "Longdo Map Demo Site";
$theme_color "#cce0fb";
$logo_file "images/logo_map.png";

$mmmap_api_key "7a19bf7e66f74a0b39843f76eaf11371";

?>

<html>
<head>
<title><?=$title?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="imagetoolbar" content="no">

<script type="text/javascript" src="http://<?=$mmmap_server?>?key=<?=$mmmap_api_key?>"></script>

<script>

var mmmap;

function mmmap_client_init() {
    var mmmap_div = document.getElementById("mmmap_div");

    window.onresize = myRepaint;

    mmmap = new MMMap(mmmap_div,<? print $latitude ?>,<? print $longitude ?>,<? print $zoom ?>, "icons");

    // add something when do right-click mouse
    mmmap.setRightClickFunction(myExtraRightClickFunction);

    myRepaint();
}

var arraytestdiv;

function myRepaint() {
    chkWinSize();

    var newwidth = parseInt(ww) - <? print $map_leftmargin?> - <? print $map_rightmargin?>;
    var newheight = parseInt(wh) - <? print $map_topmargin?> - <? print $map_bottommargin?>;

    mmmap.setSize(newwidth,newheight);
    mmmap.rePaint();

}

function myExtraRightClickFunction() {
    var txt = '<br/><span id="add_location_text" style="font-family:loma,tahoma; font-size: 9pt;cursor:pointer;text-decoration: underline" onmousedown="window.open(\'http://myweb/myurl?lat=' + mmmap.mouseCursorLat() + '&long=' + mmmap.mouseCursorLong() + '\');">My custom menu item</span>';
    return txt;
}

</script>

</head>

<body onLoad="mmmap_client_init()" scroll="no" style="overflow:hidden;margin: 0px 0px 0px 5px;" marginwidth=0 marginheight=0>

<form action="javascript:">

<table width=100% cellpadding=0 cellspacing=0><tr>
<td>
<a href='/'><IMG SRC=<?=$logo_file?> BORDER=0 ALT="Logo"></a>
</td>
<td align=right>
<table cellpadding=5 cellspacing=5>
<tr>
<td align=center bgcolor=#EEEEEE>
Setting
</td>
</tr>
<tr>
<td>
<input type=checkbox id=showroad onclick="if (this.checked) { mmmap.setMapMode('normal')} else {mmmap.setMapMode('hydro');};myRepaint()" checked><span title="Show streets on map">แสดงถนน</span>
</td>
</tr>
</table>

</td>
</table>

<table border=0 cellspacing=0 cellpadding=0 width=100%><tr>
<td bgcolor="<?=$theme_color?>" style="padding:0px;" valign="bottom" align=left>
</td>
<td bgcolor="<?=$theme_color?>" style="padding:0px;" valign="middle" align=right>
&nbsp;
</td>
</tr>
</table>

</form>

<div id="mmmap_div" style="position: absolute; left: <? print $map_leftmargin;?>px; top: <? print $map_topmargin;?>px; width: 800px; height: 500px; border: 0px solid red"></div>

</body>
</html>