//************************** // LocapointDIYMap.js // Copyright (c) 2005 All rights reserved. Naoki Ueda and Locazing Inc. //////********************* // //called only first point //this.overlayobj this.gpoints = []; this.gpoints.push(gpoint); this.operations = []; this.operations.push(currentoperation); var startpos = info.indexOf("color="); if(startpos != -1){ this.color = info.substr(startpos+6, info.indexOf(";", startpos) -(startpos+6)); }else{ this.color = "#FF0000"; //default color } startpos = info.indexOf("weight="); if(startpos != -1){ this.weight = info.substr(startpos+7, info.indexOf(";", startpos) -(startpos+7)); }else{ this.weight = 3; //default weight } startpos = info.indexOf("opacity="); if(startpos != -1){ this.opacity = info.substr(startpos+8, info.indexOf(";", startpos) -(startpos+8)); }else{ this.opacity = 0.5; //default opacity } } //Methods new Overlaylist_Path("","",""); //Dummy Object Overlaylist_Path.prototype.pushgpoint = function(gpoint, currentoperation) { this.gpoints.push(gpoint); this.operations.push(currentoperation); var oldobj=this.overlayobj; //var polyline = this.overlayobj; var color= this.color; var weight=this.weight; var opacity = this.opacity; this.overlayobj = new GPolyline(this.gpoints, this.color, this.weight, this.opacity); if(this.gpoints.length > 1){ map.removeOverlay(oldobj); map.addOverlay(this.overlayobj); } //map.addOverlay(polyline); } Overlaylist_Path.prototype.lastgpoint = function() { if(this.gpoints.length > 0){ return(this.gpoints[this.gpoints.length -1]); }else{ return; } } function overlaylist2locapointcombo() { var LPC, LPI, lp; LPC = new LocapointCombo(""); for(n=0; n < lpobjs.overlaylist[1].overlaylist_point.length; n++){ comment = lpobjs.overlaylist[1].overlaylist_point[n].info; lp = GPoint2Locapoint(lpobjs.overlaylist[1].overlaylist_point[n].gpoint); lp.AddComment(comment); LPI = new LocapointItem(""); LPI.type = "point"; LPI.AddOneLocapoint(lp); LPC.AddOneLocapointItem(LPI); } for(n=0; n < lpobjs.overlaylist[1].overlaylist_path.length; n++){ var info = "/*Gmap:color="; info += lpobjs.overlaylist[1].overlaylist_path[n].color; info += ";weight="; info += lpobjs.overlaylist[1].overlaylist_path[n].weight; info += ";opacity="; info += lpobjs.overlaylist[1].overlaylist_path[n].opacity; info += ";*/"; LPI = new LocapointItem(""); LPI.type = "path"; for(m=0; m < lpobjs.overlaylist[1].overlaylist_path[n].gpoints.length; m++){ lp = GPoint2Locapoint(lpobjs.overlaylist[1].overlaylist_path[n].gpoints[m]); if (m==0){ lp.AddComment(info); } LPI.AddOneLocapoint(lp); } LPC.AddOneLocapointItem(LPI); } return(LPC); } function Locapoint2GPoint(locapoint) { var gpoint = new GLatLng(locapoint.latitude, locapoint.longitude); return(gpoint); //Return Gpoint Object } function GPoint2Locapoint(gpoint) { var LP = new Locapoint(latlon2locapoint(gpoint.lat(), gpoint.lng())); return(LP); //Return Locapoint Object } function IsWithinBound(gpoint){ var bounds = map.getBounds(); return((bounds.getSouthWest().lng() < gpoint.lng()) && (gpoint.lng() < bounds.getNorthEast().lng()) && (bounds.getSouthWest().lat() < gpoint.lat()) && (gpoint.lat() < bounds.getNorthEast().lat())); } //////********************* // Functions for DIY Map // // //************************ //Global vars MSIE = navigator.userAgent.indexOf("MSIE")!=-1 ; var env; var lpobjs; var map; function init(){ //Global vars for DIY Map env = new LPGmapEnv(); lpobjs = new Lp2GmapObject(); //prepare GoogleMap _mSvgEnabled = false; if (! GBrowserIsCompatible()){ return; } map = new GMap2(document.getElementById("map")); map.addControl(new GLargeMapControl()); map.addControl(new GMapTypeControl()); map.addControl(new GScaleControl()); new GKeyboardHandler(map); map.setCenter(new GLatLng(lang["default_lat"], lang["default_lon"]), 13); //Gmap Event Listeners GEvent.addListener(map, 'move', function(){Gmap_event_move();} ); GEvent.addListener(map, 'click', function(overlay, point) {Gmap_event_click(overlay, point);} ); GEvent.addListener(map, 'movestart', function() {Gmap_event_movestart();} ); GEvent.addListener(map, 'moveend', function() {Gmap_event_moveend();} ); GEvent.addListener(map, 'zoomend', function(oldZoomLevel, newZoomLevel) {Gmap_event_zoom(oldZoomLevel, newZoomLevel);} ); //Set Parameters as initial setting recoverfromhistory(0); refreshDetailData(); } //body Onload window.onload = function () { init(); //Preload Images //preload_image(); //Resize map on_resize(); //Attach events var obj; //Dummy Object //Regular Event addEvent(window,"resize",on_resize, false); //Mouse Event obj = document.getElementById('map'); addEvent(obj,"mouseover",change_cursor_over, false); addEvent(obj,"mouseout",change_cursor_out, false); //Key Event addEvent(document,"keypress",on_keypress, false); addEvent(document,"keydown",on_keydown, false); addEvent(document,"keyup",on_keyup, false); //Wheel Event AttachWheelEvent("map", map_wheel); //Imege button events obj = document.getElementById('line_icon'); addEvent(obj,"mousedown",mousedown_line, false); obj = document.getElementById('point_withcomment_icon'); addEvent(obj,"mousedown",mousedown_point_withcomment, false); obj = document.getElementById('point_small_icon'); addEvent(obj,"mousedown",mousedown_point_small, false); //obj = document.getElementById('newline_icon'); //addEvent(obj,"mousedown",mousedown_newline, false); obj = document.getElementById('pause_icon'); addEvent(obj,"mousedown",mousedown_pause, false); obj = document.getElementById('grid_icon'); addEvent(obj,"mousedown",mousedown_grid, false); obj =document.getElementById("pallet_icon"); addEvent(obj, "mousedown", mousedown_pallet, false); addEvent(obj, "mouseup", mouseup_pallet, false); addEvent(obj, "mouseout", mouseout_pallet, false); obj =document.getElementById("clear_icon"); addEvent(obj, "mousedown", mousedown_clear, false); addEvent(obj, "mouseup", mouseup_clear, false); addEvent(obj, "mouseout", mouseout_clear, false); obj = document.getElementById('undo_icon'); addEvent(obj,"mousedown",mousedown_undo, false); addEvent(obj,"mouseup",mouseup_undo, false); addEvent(obj,"mouseout",mouseout_undo, false); obj = document.getElementById('redo_icon'); addEvent(obj,"mousedown",mousedown_redo, false); addEvent(obj,"mouseup",mouseup_redo, false); addEvent(obj,"mouseout",mouseout_redo, false); obj = document.getElementById('search_icon'); addEvent(obj,"mousedown",mousedown_search, false); addEvent(obj,"mouseup",mouseup_search, false); addEvent(obj,"mouseout",mouseout_search, false); obj = document.getElementById('cut_icon'); addEvent(obj,"mousedown",mousedown_cut, false); addEvent(obj,"mouseup",mouseup_cut, false); addEvent(obj,"mouseout",mouseout_cut, false); obj = document.getElementById('blogmap_icon'); addEvent(obj,"mousedown",mousedown_blogmap, false); addEvent(obj,"mouseup",mouseup_blogmap, false); addEvent(obj,"mouseout",mouseout_blogmap, false); obj = document.getElementById('help_link'); addEvent(obj,"click",help_link_onclick, false); obj = document.getElementById('detail_icon'); addEvent(obj,"mousedown",mousedown_detail, false); addEvent(obj,"mouseup",mouseup_detail, false); addEvent(obj,"mouseout",mouseout_detail, false); //function buttons & links obj = document.getElementById('movebylonlat'); addEvent(obj,"click",move_by_latlon, false); obj = document.getElementById('movebylocapoint'); addEvent(obj,"click",move_by_locapoint, false); obj = document.getElementById('movebygmapurl'); addEvent(obj,"click",move_by_gmapurl, false); obj = document.getElementById('OpenGoogleMap'); addEvent(obj,"click",open_gmaplink, false); obj = document.getElementById('moveclose'); addEvent(obj,"click",move_close, false); obj = document.getElementById('palletclose'); addEvent(obj,"click",close_pallet, false); //palet events obj = document.getElementById('setcolor01'); addEvent(obj,"click",setlinecolor000000, false); obj = document.getElementById('setcolor02'); addEvent(obj,"click",setlinecolor808080, false); obj = document.getElementById('setcolor03'); addEvent(obj,"click",setlinecolorC0C0C0, false); obj = document.getElementById('setcolor04'); addEvent(obj,"click",setlinecolorFFFFFF, false); obj = document.getElementById('setcolor05'); addEvent(obj,"click",setlinecolorFF0000, false); obj = document.getElementById('setcolor06'); addEvent(obj,"click",setlinecolor00FF00, false); obj = document.getElementById('setcolor07'); addEvent(obj,"click",setlinecolorFFFF00, false); obj = document.getElementById('setcolor08'); addEvent(obj,"click",setlinecolor0000FF, false); obj = document.getElementById('setcolor09'); addEvent(obj,"click",setlinecolorFF00FF, false); obj = document.getElementById('setcolor10'); addEvent(obj,"click",setlinecolor00FFFF, false); obj = document.getElementById('setwidth01'); addEvent(obj,"click",setlinewidth1, false); obj = document.getElementById('setwidth02'); addEvent(obj,"click",setlinewidth2, false); obj = document.getElementById('setwidth03'); addEvent(obj,"click",setlinewidth3, false); obj = document.getElementById('setwidth04'); addEvent(obj,"click",setlinewidth5, false); obj = document.getElementById('setwidth05'); addEvent(obj,"click",setlinewidth7, false); obj = document.getElementById('setwidth06'); addEvent(obj,"click",setlinewidth9, false); obj = document.getElementById('setopacity01'); addEvent(obj,"click",setlineopacity1, false); obj = document.getElementById('setopacity02'); addEvent(obj,"click",setlineopacity075, false); obj = document.getElementById('setopacity03'); addEvent(obj,"click",setlineopacity05, false); obj = document.getElementById('setopacity04'); addEvent(obj,"click",setlineopacity025, false); //Initialize Locapoint init_locapointGrid(); Gmap_init_CenterZoom(); Gmap_event_move(); //Close all layers layerOnOff("palletlayer", false); layerOnOff("waitlayer", false); layerOnOff("findlayer", false); } function preload_image() { } //******* Event Handlers ******* //Image button control //On_Off buttons function mousedown_line() { if(env.flag.draw_line){ flag_draw_line_off(); }else{ flag_draw_line_on(); } } function mousedown_point_withcomment() { if(env.flag.commentmarker){ flag_commentmarker_off(); }else{ flag_commentmarker_on(); } } function mousedown_point_small() { if(env.flag.smallmarker){ flag_smallmarker_off(); }else{ flag_smallmarker_on(); } } function mousedown_pause() { if(env.flag.oause){ flag_pause_off(); }else{ flag_pause_on(); } } function mousedown_grid() { if(env.flag.locapointgrid){ flag_draw_grid_off(); }else{ flag_draw_grid_on(); } } //Push buttons function mousedown_clear() { clear_icon_on(); } function mouseup_clear() { clear_icon_off(); } function mouseout_clear() { clear_icon_out(); } function mousedown_undo() { undo_icon_on(); } function mouseup_undo() { undo_icon_off(); } function mouseout_undo() { undo_icon_out(); } function mousedown_redo() { redo_icon_on(); } function mouseup_redo() { redo_icon_off(); } function mouseout_redo() { redo_icon_out(); } function mousedown_search() { search_icon_on(); } function mouseup_search() { search_icon_off(); } function mouseout_search() { search_icon_out(); } function mousedown_pallet() { pallet_icon_on(); } function mouseup_pallet() { pallet_icon_off(); } function mouseout_pallet() { pallet_icon_out(); } function mousedown_cut() { cut_icon_on(); } function mouseup_cut() { cut_icon_off(); } function mouseout_cut() { cut_icon_out(); } function mousedown_blogmap() { blogmap_icon_on(); } function mouseup_blogmap() { blogmap_icon_off(); } function mouseout_blogmap() { blogmap_icon_out(); } function mousedown_help() { help_icon_on(); } function mouseup_help() { help_icon_off(); } function mouseout_help() { help_icon_out(); } function mousedown_detail() { detail_icon_on(); } function mouseup_detail() { detail_icon_off(); } function mouseout_detail() { detail_icon_out(); } //Functions called by Events function change_cursor_over() { if(((env.flag.draw_line) || (env.flag.commentmarker) || (env.flag.smallmarker)) && (env.flag.pause == false)){ document.body.style.cursor='crosshair'; }else{ document.body.style.cursor='auto'; } } function change_cursor_out() { document.body.style.cursor='auto'; } function on_keypress(e) { if(env.keyeventenabled==false) return; } function on_keydown(e) { var NO_stop_event_propagation = false; if(env.keyeventenabled==false) return; var keycode = getKEYCODE(e); //alert("keyPress e.charCode=" + e.charCode + " keycode=" + keycode); if(chkShift(e)){ switch (keycode) { case 16: //SHIFT itself! flag_pause_on(); break; case 38: // Shift + Up Arrow: Zoom In map_zoom_in(); break; case 40: // Shift + Down Arrow: Zoom Out map_zoom_out(); break; case 77: //Shift+M (Map mode) map_type_to_map(); break; case 83: //Shift+S (Satellite mode) map_type_to_satellite(); break; case 72: //Shift+H (Hybrid mode) map_type_to_hybrid(); break; default: NO_stop_event_propagation=true; } }else if(chkCtrl(e)){ NO_stop_event_propagation=true; }else{ switch (keycode) { case 71: //G (Show Locapoint Grid) 71 if(env.flag.locapointgrid){ flag_draw_grid_off(); }else{ flag_draw_grid_on(); } break; case 76: //L (Line mode) 76 if(env.flag.draw_line){ flag_draw_line_off(); }else{ flag_draw_line_on(); } break; case 77: //M (Marker Mode) 77 if(env.flag.smallmarker){ flag_smallmarker_off(); }else{ flag_smallmarker_on(); } break; case 73: //I (Info Marker) 73 if(env.flag.commentmarker){ flag_commentmarker_off(); }else{ flag_commentmarker_on(); } break; case 80: //P (Pause) 80 if(env.flag.pause){ flag_pause_off(); }else{ flag_pause_on(); } break; case 85: //U (Undo) undo_icon_on(); break case 82: //R (Redo) redo_icon_on(); break case 84: //T (Tiny URL) 84 cut_icon_on(); break; case 72: //H (Help) 72 help_icon_on(); break; case 66: //B (Blog Map) 66 blogmap_icon_on(); break; case 68: //D (Detail) 68 detail_icon_on(); break; case 83: //S (Setting line properties) pallet_icon_on(); break default: NO_stop_event_propagation=true; } } if(NO_stop_event_propagation == false){ stop_event_propagation(e); } } function on_keyup(e) { var NO_stop_event_propagation = false; if(env.keyeventenabled==false) return; var keycode = getKEYCODE(e); if(chkShift(e)){ NO_stop_event_propagation=true; }else if(chkCtrl(e)){ NO_stop_event_propagation=true; }else{ switch (keycode) { case 16: //SHIFT itself! flag_pause_off(); break; case 70: //F (Find location) 70 search_icon_off(); break; case 84: //T (Tiny URL) 84 cut_icon_off(); break; case 72: //H (Help) 72 help_icon_off(); break; case 66: //B (Blog Map) 66 blogmap_icon_off(); break; case 68: //D (Detail) 68 detail_icon_off(); break; case 85: //U (Undo) undo_icon_off(); break case 82: //R (Redo) redo_icon_off(); break case 83: pallet_icon_off(); break; default: NO_stop_event_propagation=true; } } if(NO_stop_event_propagation == false){ stop_event_propagation(e); } } //Map Operation functions function map_wheel(e){ if(env.keyeventenabled==false) return; //wheel count var count = e.wheelDelta? e.wheelDelta/-120: // IE e.detail/3; // Firefox if(count < 0){ map_zoom_in(); }else{ map_zoom_out(); } //var newZoomLevel = map.getZoom() + count; //map.setZoom(17-newZoomLevel); stop_event_propagation(e); } function map_zoom_in() { map.setZoom(17-map.getZoom() -1); } function map_zoom_out() { map.setZoom(17-map.getZoom() +1); } function map_type_to_map() { map.setMapType(G_NORMAL_MAP); } function map_type_to_satellite() { map.setMapType(G_SATELLITE_MAP); } function map_type_to_hybrid() { map.setMapType(G_HYBRID_MAP); } function move_by_latlon() { var latitude = Math.abs(document.moveform.LatDegree.value) -0 + Math.abs(document.moveform.LatMin.value/60) -0 + Math.abs(document.moveform.LatSec.value/3600) -0; var longitude = Math.abs(document.moveform.LonDegree.value) -0 + Math.abs(document.moveform.LonMin.value/60) -0 + Math.abs(document.moveform.LonSec.value/3600) -0; if(document.moveform.LatDegree.value < 0){ latitude = 0 - latitude; } if(document.moveform.LonDegree.value < 0){ longitude = 0 - longitude; } var gpoint = new GLatLng(latitude, longitude); map.panTo(gpoint); map.setZoom(17-15); layerOnOff("findlayer", false); env.keyeventenabled = true; } function move_by_locapoint() { var locapoint = new Locapoint(document.moveform.Locapoint.value); var gpoint = Locapoint2GPoint(locapoint.Full()); map.panTo(gpoint); map.setZoom(17-2); layerOnOff("findlayer", false); env.keyeventenabled = true; } function move_by_gmapurl() { //Sample http://maps.google.com/maps?q=denver&ll=34.533854,135.717459&spn=0.035063,0.072570&hl=en var url = document.moveform.GmapURL.value; var llpos = url.indexOf("ll="); if(llpos == -1){ alert(lang["google_url_have_no_ll"]); return; } var latbeginpos = url.indexOf("ll=") +3; var latendpos = url.indexOf(",", latbeginpos) -1; var lonbeginpos = url.indexOf(",", latbeginpos) +1; var lonendpos = Math.min((url.indexOf("&", lonbeginpos) -1),(url.length -1)); var latstr= url.substr(latbeginpos, latendpos - latbeginpos +1); var lonstr= url.substr(lonbeginpos, lonendpos - lonbeginpos +1); //in URL, "ll=" coordinate is in WGS 84 datum, //but I had to give lat/lon to googlemap in Tokyo datum ??? var gpoint = new GLatLng(latstr, lonstr); map.panTo(gpoint); map.setZoom(17-2); layerOnOff("findlayer", false); env.keyeventenabled = true; } function open_gmaplink() { var gmapq = encodeURIComponent(document.getElementById('GmapQ').value); gmapq = gmapq.replace("#","%23"); window.open('http://maps.google.com?q='+gmapq, 'newwin'); window.open('http://www.locapoint.com/publicutil/movebygmapdirection.htm', '', 'width=500,height=400'); } function move_close() { layerOnOff("findlayer", false); env.keyeventenabled = true; } function close_pallet() { layerOnOff("palletlayer", false); } function on_resize(){ var innerWinWidth; var innerWinHeight; if (!document.all && (document.layers || document.getElementById)) { //FF, NN //innerWinWidth=window.innerWidth; //innerWinHeight=window.innerHeight; innerWinWidth=innerWidth; innerWinHeight=innerHeight; }else if (document.getElementById && (document.compatMode=='CSS1Compat')) { //IE6 innerWinWidth=document.documentElement.clientWidth; innerWinHeight=document.documentElement.clientHeight; }else if (document.all) { //other IE innerWinWidth=document.body.clientWidth; innerWinHeight=document.body.clientHeight; }else { //others innerWinWidth=800; innerWinHeight=600; } var newwidth = innerWinWidth - 180-25; var newheight = innerWinHeight - 250; //newwidth = newwidth>500?newwidth:500; newheight = newheight>400?newheight:400; var canvasobj = document.getElementById('canvas'); var mapobj = document.getElementById('map'); var urltextboxobj = document.getElementById('url'); //bigtableobj = document.getElementById('belttable'); var lpgridobj = document.getElementById('lpgrid'); canvasobj.style.height = newheight+"px"; canvasobj.style.width = newwidth+"px"; if(env.flag.locapointgrid==true){ mapobj.style.left = env.rulerbandLat+"px"; mapobj.style.top = env.rulerbandLon+"px"; mapobj.style.width = (canvasobj.clientWidth - env.rulerbandLat) +"px"; mapobj.style.height = (canvasobj.clientHeight - env.rulerbandLon) +"px"; lpgridobj.style.left = env.rulerbandLat+"px"; lpgridobj.style.top = env.rulerbandLon+"px"; }else{ mapobj.style.left = 0+"px"; mapobj.style.top = 0+"px"; mapobj.style.width = canvasobj.clientWidth+"px"; mapobj.style.height = canvasobj.clientHeight+"px"; lpgridobj.style.left = 0+"px"; lpgridobj.style.top = 0+"px"; } urltextboxobj.style.width = canvasobj.clientWidth -195>350?canvasobj.clientWidth -195+"px":"350px"; map.checkResize(); init_locapointGrid(); refresh_locapointGrid(); } function initDivSize(div){ if(_dom==4){ div.style.width =div.offsetWidth +'px'; div.style.height=div.offsetHeight+'px'; } else if(_dom==2 || _dom==1){ div.style.pixelWidth =div.offsetWidth; div.style.pixelHeight=div.offsetHeight; } return div; } //Utility Functions for event handling //Add Event function addEvent(obj, eventType, afunction, isCapture) { // W3C DOM if (obj.addEventListener) { obj.addEventListener(eventType, afunction, isCapture); return true; } // Internet Explorer else if (obj.attachEvent) { return obj.attachEvent("on"+eventType, afunction); } else return false; } function removeEvent(obj, eventType, afunction, isCapture) { if (obj.removeEventListener) { obj.removeEventListener(eventType, afunction, isCapture); return true; } else if (obj.detachEvent) { return obj.detachEvent("on"+eventType, afunction); } else return false; } function startEvent(ojNameStr,eventTypeNameStr,funcNameStr) { //n4,m1,n7,e4,e5,e6,o6,o7,s1,k3 eval(ojNameStr+".on"+eventTypeNameStr+"="+ funcNameStr) //n4 if(document.layers) eval(ojNameStr+".captureEvents(Event."+eventTypeNameStr.toUpperCase()+")") } //Remove Event function stopEvent(ojNameStr,eventNameStr) { //n4,m1,n7,e4,e5,e6,o6,07,s1,k3 eval(ojNameStr+".on"+eventNameStr+" = null") //n4 if(document.layers) eval(ojNameStr+".releaseEvents(Event."+eventNameStr.toUpperCase()+")") } //Add Wheel Event function AttachWheelEvent(elementid, funcname){ var element = document.getElementById(elementid); element.attachEvent? element.attachEvent("onmousewheel",funcname): // IE element.addEventListener("DOMMouseScroll",funcname,false);// Firefox } // Key code functions function getKEYCODE(e){ if(document.all) return event.keyCode; else if(document.getElementById) return (e.keyCode!=0)?e.keyCode:e.charCode; else if(document.layers) return e.which; } function chkCtrl(e){ if(document.getElementById && !MSIE ) return e.ctrlKey else if(document.all) return event.ctrlKey else if(document.layers){ var ctl=e.modifiers if( ctl==2 || ctl==3 || ctl==6 || ctl==7 ) return true else return false } } function chkAlt(e){ if(document.getElementById && !MSIE ) return e.altKey else if(document.all) return event.altKey else if(document.layers){ var ctl=e.modifiers if( ctl==1 || ctl==3 || ctl==5 || ctl==7 ) return true else return false } } function chkShift(e){ if(document.getElementById && !MSIE ) return e.shiftKey else if(document.all) return event.shiftKey else if(document.layers){ var ctl=e.modifiers if( ctl==4 || ctl==5 || ctl==6 || ctl==7 ) return true else return false } } function stop_event_propagation(e) { if(window.event){ e=event; e.cancelBubble=true; e.returnValue=false; }else if(e){ e.stopPropagation(); e.preventDefault(); } e.cancelBubble=true; return false; } function layerOnOff(id, OnOff){ if(document.getElementById){ if(OnOff == true){ document.getElementById(id).style.visibility = 'visible' }else{ document.getElementById(id).style.visibility = 'hidden' } }else if(document.all){ if(OnOff == true){ document.all(id).style.visibility = 'visible' }else{ document.all(id).style.visibility = 'hidden' } }else if(document.layers){ if(OnOff == true){ document.layers[id].visibility = 'show' }else{ document.layers[id].visibility = 'hide' } } } //Actual Content of event functions function flag_draw_line_off() { var obj = document.getElementById("line_icon"); env.flag.draw_line=false; env.flag.newline=false; obj.src = "../image/line_icon.PNG"; } function flag_draw_line_on() { var obj = document.getElementById("line_icon"); env.flag.draw_line=true; env.flag.newline=true obj.src = "../image/line_icon_pressed.PNG"; //exclusive obj = document.getElementById("point_withcomment_icon"); env.flag.commentmarker=false; obj.src = "../image/point_withcomment_icon.PNG"; obj = document.getElementById("point_small_icon"); env.flag.smallmarker=false; obj.src = "../image/point_small_icon.PNG"; } function flag_commentmarker_off() { var obj = document.getElementById("point_withcomment_icon"); env.flag.commentmarker=false; obj.src = "../image/point_withcomment_icon.PNG"; } function flag_commentmarker_on() { var obj = document.getElementById("point_withcomment_icon"); env.flag.commentmarker=true; obj.src = "../image/point_withcomment_icon_pressed.PNG"; //exclusive obj = document.getElementById("line_icon"); env.flag.draw_line=false; obj.src = "../image/line_icon.PNG"; obj = document.getElementById("point_small_icon"); env.flag.smallmarker=false; obj.src = "../image/point_small_icon.PNG"; } function flag_smallmarker_off() { var obj = document.getElementById("point_small_icon"); env.flag.smallmarker=false; obj.src = "../image/point_small_icon.PNG"; } function flag_smallmarker_on() { var obj = document.getElementById("point_small_icon"); env.flag.smallmarker=true; obj.src = "../image/point_small_icon_pressed.PNG"; //exclusive obj = document.getElementById("point_withcomment_icon"); env.flag.commentmarker=false; obj.src = "../image/point_withcomment_icon.PNG"; obj = document.getElementById("line_icon"); env.flag.draw_line=false; obj.src = "../image/line_icon.PNG"; } function flag_pause_off() { var obj = document.getElementById("pause_icon"); env.flag.pause=false; obj.src = "../image/pause_icon.PNG"; } function flag_pause_on() { var obj = document.getElementById("pause_icon"); env.flag.pause=true; obj.src = "../image/pause_icon_pressed.PNG"; } function clear_icon_on() { var obj = document.getElementById("clear_icon"); obj.src = "../image/clear_icon_pressed.PNG"; } function clear_icon_off() { var obj = document.getElementById("clear_icon"); obj.src = "../image/clear_icon.PNG"; clearall(); } function clear_icon_out() { var obj = document.getElementById("clear_icon"); obj.src = "../image/clear_icon.PNG"; } function undo_icon_on() { var obj = document.getElementById("undo_icon"); obj.src = "../image/undo_icon_pressed.PNG"; } function undo_icon_off() { var obj = document.getElementById("undo_icon"); obj.src = "../image/undo_icon.PNG"; undoredo(-1); } function undo_icon_out() { var obj = document.getElementById("undo_icon"); obj.src = "../image/undo_icon.PNG"; } function redo_icon_on() { var obj = document.getElementById("redo_icon"); obj.src = "../image/redo_icon_pressed.PNG"; } function redo_icon_off() { var obj = document.getElementById("redo_icon"); obj.src = "../image/redo_icon.PNG"; undoredo(1); } function redo_icon_out() { var obj = document.getElementById("redo_icon"); obj.src = "../image/redo_icon.PNG"; } function search_icon_on() { var obj = document.getElementById("search_icon"); obj.src = "../image/search_icon_pressed.PNG"; } function search_icon_off() { var obj = document.getElementById("search_icon"); obj.src = "../image/search_icon.PNG"; layerOnOff("findlayer", true); env.keyeventenabled = false; } function search_icon_out() { var obj = document.getElementById("search_icon"); obj.src = "../image/search_icon.PNG"; } function pallet_icon_on() { var obj = document.getElementById("pallet_icon"); obj.src = "../image/pallet_icon_pressed.PNG"; } function pallet_icon_off() { var obj = document.getElementById("pallet_icon"); obj.src = "../image/pallet_icon.PNG"; layerOnOff("palletlayer", true); } function pallet_icon_out() { var obj = document.getElementById("pallet_icon"); obj.src = "../image/pallet_icon.PNG"; } function cut_icon_on() { var obj = document.getElementById("cut_icon"); obj.src = "../image/cut_icon_pressed.PNG"; } function cut_icon_off() { var obj = document.getElementById("cut_icon"); obj.src = "../image/cut_icon.PNG"; //document.tinyform.submit(); //In case use tiny URL //exit; var sourceLPC = lpobjs.history[0].locapointcombo; var keylp; var keylpc; if(lpobjs.history.length > 1){ if(lpobjs.history[1].locapointcombo.value !=""){ keylp= lpobjs.history[1].locapointcombo.LocapointItem[0].Locapoint[0]; }else{ keylp=GPoint2Locapoint(map.getCenter()); } }else if(lpobjs.history[0].locapointcombo.value !=""){ keylp= lpobjs.history[0].locapointcombo.LocapointItem[0].Locapoint[0]; }else{ keylp=GPoint2Locapoint(map.getCenter()); } keylp=keylp.Full(); keylp=keylp.code; var urlstring="http://www.locapoint.com/publicutil/shorturl" + lang["lang_ext"] + ".html?tgt=shorturl"; urlstring = appendurlparam(urlstring, "orgurl", document.getElementById('url').value); urlstring = appendurlparam(urlstring, "keylp", keylp); window.open(urlstring, "", "width=500,height=500"); } function cut_icon_out() { var obj = document.getElementById("cut_icon"); obj.src = "../image/cut_icon.PNG"; } function blogmap_icon_on() { var obj = document.getElementById("blogmap_icon"); obj.src = "../image/blogmap_icon_pressed.PNG"; } function blogmap_icon_off() { var obj = document.getElementById("blogmap_icon"); obj.src = "../image/blogmap_icon.PNG"; var urlstring="http://www.locapoint.com/publicutil/blogmap" + lang["lang_ext"] + ".html?tgt=blogmap"; urlstring = appendurlparam(urlstring, "url", document.getElementById('url').value); urlstring = appendurlparam(urlstring, "center", GPoint2Locapoint(map.getCenter()).value); urlstring = appendurlparam(urlstring, "v2zoom", map.getZoom()); window.open(urlstring); } function blogmap_icon_out() { var obj = document.getElementById("blogmap_icon"); obj.src = "../image/blogmap_icon.PNG"; } function help_link_onclick() { window.open("./guidehelp" + lang["lang_ext"] + ".htm", ""); } function help_icon_out() { var obj = document.getElementById("help_icon"); obj.src = "../image/help_icon.PNG"; } function detail_icon_on() { var obj = document.getElementById("detail_icon"); obj.src = "../image/detail_icon_pressed.PNG"; } function detail_icon_out() { var obj = document.getElementById("detail_icon"); obj.src = "../image/detail_icon.PNG"; } function flag_draw_grid_off() { alert("Sorry, LocaPoint Grid is temporarily unavailable."); return; var obj = document.getElementById("grid_icon"); env.flag.locapointgrid=false; obj.src = "../image/grid_icon.PNG"; on_resize(); } function flag_draw_grid_on() { alert("Sorry, LocaPoint Grid is temporarily unavailable."); return; var obj = document.getElementById("grid_icon"); env.flag.locapointgrid=true; obj.src = "../image/grid_icon_pressed.PNG"; on_resize(); } //My Guide Map Functions function make_topline(locapoint) { var latstr, lonstr, latlonstr; //write Locapoint if(document.getElementById) { document.getElementById("topline_lp").innerHTML = locapoint.value; } else if(document.all) { document.all("topline_lp").innerHTML = locapoint.value; } //write Latitude and Longitude if(locapoint.latitude >=0){ latstr = "N"+(Math.floor(locapoint.latitude*1000000)/1000000.0); }else{ latstr = "S"+((-1)*Math.floor(locapoint.latitude*1000000)/1000000.0); } latstr = latstr + "000000"; latstr = latstr.substr(0,10); if((locapoint.longitude >=0) && (locapoint.longitude <100)){ lonstr = "E0"+(Math.floor(locapoint.longitude*1000000)/1000000.0); }else if (locapoint.longitude > 100){ lonstr = "E"+(Math.floor(locapoint.longitude*1000000)/1000000.0); }else if((locapoint.longitude < 0) && (locapoint.longitude > -100)){ lonstr = "W0"+((-1)*Math.floor(locapoint.longitude*1000000)/1000000.0); }else if(locapoint.longitude <= -100){ lonstr = "W"+((-1)*Math.floor(locapoint.longitude*1000000)/1000000.0); } lonstr = lonstr + "000000"; lonstr = lonstr.substr(0,11); //N00.000000, E000.000000 latlonstr = latstr + ", " + lonstr; if(document.getElementById) { document.getElementById("topline_latlon").innerHTML = latlonstr; } else if(document.all) { document.all("topline_latlon").innerHTML = latlonstr; } } //Creator functions //line property config function setlinecolor000000(){setlinecolor("#000000");} function setlinecolor808080(){setlinecolor("#808080");} function setlinecolorC0C0C0(){setlinecolor("#C0C0C0");} function setlinecolorFFFFFF(){setlinecolor("#FFFFFF");} function setlinecolorFF0000(){setlinecolor("#FF0000");} function setlinecolor00FF00(){setlinecolor("#00FF00");} function setlinecolorFFFF00(){setlinecolor("#FFFF00");} function setlinecolor0000FF(){setlinecolor("#0000FF");} function setlinecolorFF00FF(){setlinecolor("#FF00FF");} function setlinecolor00FFFF(){setlinecolor("#00FFFF");} function setlinewidth1(){setlinewidth(1);} function setlinewidth2(){setlinewidth(2);} function setlinewidth3(){setlinewidth(3);} function setlinewidth5(){setlinewidth(5);} function setlinewidth7(){setlinewidth(7);} function setlinewidth9(){setlinewidth(9);} function setlineopacity1(){setlineopacity(1);} function setlineopacity075(){setlineopacity(0.75);} function setlineopacity05(){setlineopacity(0.5);} function setlineopacity025(){setlineopacity(0.25);} function setlinecolor(color) { obj = document.getElementById('line_color'); obj.value = color; } function setlinewidth(width) { obj = document.getElementById('line_width'); obj.value = width; } function setlineopacity(opacity) { obj = document.getElementById('line_opacity'); obj.value = opacity; } //Functions function Gmap_event_move() { var gpoint = map.getCenter(); var locapoint = GPoint2Locapoint(gpoint); make_topline(locapoint); //refresh_locapointGrid(); } function Gmap_event_movestart() { jg.clear(); } function Gmap_event_moveend() { refresh_locapointGrid(); } function Gmap_event_zoom() { refresh_locapointGrid(); } function initialLocapointCombo() { //if parameter submitted, make it history zero //otherwise var obj; obj = document.getElementById('LPC_submitted'); if(obj.value == ""){ if(myGetCookie("savedLPC")!=null){ return(new LocapointCombo(myGetCookie("savedLPC"))); }else{ return(new LocapointCombo("")); } }else{ return(new LocapointCombo(obj.value)); } } function Gmap_init_CenterZoom() { var sourceLPC = lpobjs.history[0].locapointcombo; if(sourceLPC.value==""){ return; }else{ if ((sourceLPC.range.height==0) && (sourceLPC.range.width ==0)){ map.setZoom(17-0); }else{ //thanks for David Streutker's post on Google-Maps-API group Jul, 28 var zoom=Math.max(sourceLPC.range.height, sourceLPC.range.width); zoom = zoom/0.00539/Math.cos(sourceLPC.range.centerlat / 180 * Math.PI); zoom = Math.log(zoom)/Math.LN2; zoom = Math.ceil(zoom); map.setZoom(17-zoom); } map.panTo(new GLatLng(sourceLPC.range.centerlat, sourceLPC.range.centerlon)); } } function incrementhistory() { lpobjs.currentoperation++; if(lpobjs.maxhistory > lpobjs.currentoperation){ for(n=0; n < (lpobjs.maxhistory - lpobjs.currentoperation + 1) ;n++){ lpobjs.history.pop(); } } lpobjs.maxhistory = lpobjs.currentoperation; lpobjs.history.push(new LPCreateHistory(overlaylist2locapointcombo(), lpobjs.currentoperation)); refreshDetailData(); } function undoredo(delta)// { if((delta == -1)&&(lpobjs.currentoperation > 0)){ //undo recoverfromhistory(lpobjs.currentoperation -1); lpobjs.currentoperation +=delta; refreshDetailData(); }else if((delta == 1)&&(lpobjs.currentoperation < lpobjs.maxhistory)){ //redo recoverfromhistory(lpobjs.currentoperation +1); lpobjs.currentoperation +=delta; refreshDetailData(); } } function clearalloverlayobj() { for(n=0; n < 3; n++){ for(m=lpobjs.overlaylist[n].overlaylist_point.length-1; m>=0; m--){ map.removeOverlay(lpobjs.overlaylist[n].overlaylist_point[m].overlayobj); lpobjs.overlaylist[n].overlaylist_point.pop(); } for(m=lpobjs.overlaylist[n].overlaylist_path.length-1; m>=0; m--){ map.removeOverlay(lpobjs.overlaylist[n].overlaylist_path[m].overlayobj); lpobjs.overlaylist[n].overlaylist_path.pop(); } } var obj = document.getElementById('markerlists'); obj.innerHTML= ""; } function clearall() { clearalloverlayobj(); incrementhistory(); } function recoverfromhistory(histNum) { var sourceLPC; var net_comment, full_comment; for (n= 0; n