home *** CD-ROM | disk | FTP | other *** search
- document.oncontextmenu = function () { return false; };
-
- var $_ELEMENT_ = new Array();
- function $(id) {
- if (typeof $_ELEMENT_[id]!='object') {
- $_ELEMENT_[id] = document.getElementById(id);
- }
- return $_ELEMENT_[id];
- }
-
- var $gmap;
- function load() {
- if (GBrowserIsCompatible()) {
- $('info').innerHTML = $message.information;
-
- $gmap = new GMap2($('map'));
- $gmap.addControl(new GLargeMapControl());
- $gmap.addControl(new GMapTypeControl());
- $gmap.addControl(new GScaleControl());
- $gmap.setCenter(new GLatLng(0,0), 1);
- var icon = new GIcon();
- icon.image = 'pin_std1.png';
- icon.shadow = 'pin_std2.png';
- icon.iconSize = icon.shadowSize = new GSize(30, 32);
- icon.iconAnchor = new GPoint(9, 31);
- icon.infoWindowAnchor = new GPoint(16, 3);
- for (var i=0; i<$marker.length; i++) {
- createMarker(i, icon);
- }
-
- createThumbnailList();
-
- if (!$marker[$select].gmarker) {
- for (var i=0; i<$marker.length; i++) {
- if ($marker[i].gmarker) {
- $select = i;
- break;
- }
- }
- }
- if ($marker[$select].gmarker) {
- $gmap.setCenter(dms2gpoint($marker[$select]), 9);
- GEvent.trigger($marker[$select].gmarker, 'click');
- }
- }
- }
-
- function unload() {
- GUnload();
- }
-
- function createMarker(id, icon) {
- var gpoint = dms2gpoint($marker[id]);
- if (gpoint==null) return null;
- var gmarker = new GMarker(gpoint, icon);
- gmarker.number = id;
- $gmap.addOverlay(gmarker);
- GEvent.addListener(gmarker, 'click', function () {
- gmarker.openInfoWindow(createMarkerMsg(this.number));
- $('thumb_'+this.number).focus();
- });
- $marker[id].gmarker = gmarker;
- }
-
- function dms2gpoint (marker) {
- var lng = null;
- var lat = null;
- var a;
- a = marker.lng.split(':');
- if (a[0]=='E' || a[0]=='W') {
- lng = parseInt(a[1],10)+(parseInt(a[2],10)*60+parseFloat(a[3]))/3600;
- if (lng>180 || lng<0) lng = null;
- else if (a[0]=='W') lng = -lng;
- }
- a = marker.lat.split(':');
- if (a[0]=='N' || a[0]=='S') {
- lat = parseInt(a[1],10)+(parseInt(a[2],10)*60+parseFloat(a[3]))/3600;
- if (lat>90 || lat<0) lat = null;
- else if (a[0]=='S') lat = -lat;
- }
-
- if (lng==null || lat==null) return null;
- return new GLatLng(lat, lng);
- }
-
- function createThumbnailList() {
- var list = $('list');
- var thumb1 = $('thumb1'); thumb1.removeAttribute('id');
- var thumb2 = $('thumb2'); thumb2.removeAttribute('id');
- var shadow1 = $('shadow1'); shadow1.removeAttribute('id');
- var shadow2 = $('shadow2'); shadow2.removeAttribute('id');
- var gps = $('gps'); gps.removeAttribute('id');
- var thumbTime = $('thumbTime'); thumbTime.removeAttribute('id');
-
- for (var i=0; i<$marker.length; i++) {
- var marker = $marker[i];
-
- var shdw1 = shadow1.cloneNode();
- var shdw2 = shadow2.cloneNode();
- var img = document.createElement('img');
- img.setAttribute('src', marker.cache);
- var x;
- var y;
- if (marker.width>marker.height) {
- x = 100;
- y = Math.ceil(marker.height * x / marker.width);
- } else {
- y = 100;
- x = Math.ceil(marker.width * y / marker.height);
- }
- img.style.width = shdw1.style.width = shdw2.style.width = x + 'px';
- img.style.height= shdw1.style.height= shdw2.style.height= y + 'px';
-
- var link = marker.gmarker ? thumb1.cloneNode() : thumb2.cloneNode();
- link.setAttribute('id', 'thumb_'+i);
- link.appendChild(img);
- link.appendChild(shdw1);
- link.appendChild(shdw2);
- if (marker.gmarker) {
- var icon = gps.cloneNode();
- icon.style.left = (x - 16) + 'px';
- icon.style.top = (y - 16) + 'px';
- link.appendChild(icon);
- }
-
- list.appendChild(link);
- var div = thumbTime.cloneNode();
- div.appendChild(document.createTextNode(marker.time));
- list.appendChild(div);
- }
- }
-
- function createMarkerMsg(id) {
- var marker = $marker[id];
-
- var link = marker.broken ? $('msg2').cloneNode() : $('msg1').cloneNode();
- link.removeAttribute('id');
-
- var img = document.createElement('img');
- img.setAttribute('src', marker.cache);
- var x;
- var y;
- if (marker.width>marker.height) {
- x = 160;
- y = Math.ceil(marker.height * x / marker.width);
- } else {
- y = 160;
- x = Math.ceil(marker.width * y / marker.height);
- }
- img.style.width = x + 'px';
- img.style.height= y + 'px';
-
- link.appendChild(img);
-
- var msg = document.createElement('div');
- msg.style.textAlign = 'center';
- msg.appendChild(link);
-
- if (!marker.broken) setBigImg(id);
-
- return msg;
- }
-
- function setBigImg(id) {
- var marker = $marker[id];
-
- var img = $('bigImg');
- img.removeAttribute('src');
- img.setAttribute('src', marker.cache);
- var x;
- var y;
- if (marker.width>marker.height) {
- x = 550;
- y = Math.ceil(marker.height * x / marker.width);
- } else {
- y = 550;
- x = Math.ceil(marker.width * y / marker.height);
- }
- img.style.width = x + 'px';
- img.style.height= y + 'px';
- img.style.top = (558 - y -10)/2 + 'px';
- img.style.left = (784 - x -10)/2 + 'px';
-
- $select = id;
- }
-
- function msgClick() {
- $('big').style.display = 'block';
- }
-
- function bigClick() {
- $('big').style.display = 'none';
- $('thumb_'+$select).focus();
- }
-
- function thumbClick(_this) {
- var id = parseInt(_this.id.split('thumb_')[1]);
- GEvent.trigger($marker[id].gmarker, 'click');
- }
- function thumbOver(_this) {
- var id = parseInt(_this.id.split('thumb_')[1]);
- var elem = $('thumbAlt');
- elem.innerHTML = $marker[id].path;
- if ($marker[id].broken) elem.innerHTML+= '<br/>' + $message.broken;
- elem.style.visibility = 'visible';
- }
- function thumbOut() {
- var elem = $('thumbAlt');
- elem.style.visibility = 'hidden';
- }
- function thumbMove() {
- var elem = $('thumbAlt');
- elem.style.left = window.event.clientX + 10;
- elem.style.top = window.event.clientY + 10;
- }
-
- function mapWheel() {
- if (GBrowserIsCompatible()) $gmap.setZoom($gmap.getZoom() + ((window.event.wheelDelta>0) ? 1 : -1));
- }
-