/* PdMarker
 Purpose: extends Google Map API GMap and GMarker (hover effects, image swapping, moving)
 Details: http://wwww.pixeldevelopment.com/pdmarker.asp
 Updated: [see getPdMarkerRevisionInfo]
 Author: Peter Jones
 Notes: Relies on undocumented features of the Google Map API which may change.
 Based on my own PJToolTip and ideas from GxMarker, TLabel and the Google Maps API forum.
 Contact www.pixeldevelopment.com for your custom Google Map needs */

function getPdMarkerRevisionInfo(){var b="<br />";var a="1.99e 05/05/06 - fixed zoomed tooltip positioning &amp; non-centered marker graphics."+b+"1.99d 05/01/06 - fixed display &amp; blink when defining .transparent."+b+"1.99c 04/25/06 - added display and blink."+b+"1.99b 04/21/06 - added 'Powered By' version &amp; marker count display."+b+"1.99a 04/18/06 - revised for Google Maps API Version 2, GMap2 required."+b+"0.99c 01/30/06 - added setDetailWinClass and resetDetailWinClass."+b+"0.99a 10/12/05 - now handles maps in containers with undefined widths"+b+"define a div with id 'pdmarkerwork' to reduce flicker"+b+"0.99  10/03/05 - added setImageEnabled, allowLeftTooltips (global)"+b+"0.98  09/30/05 - fixed zoomToMarkers"+b+"0.97  09/24/05 - added setHoverImage, setShowDetailOnClick, setDetailWinHTML, showDetailWin, closeDetailWin"+b+"0.96  09/22/05 - added setTooltipHiding, getTooltipHiding"+b+"0.95  09/20/05 - handle zoom for lingering tooltips mouseOutEnabled(false) disables setImage and restoreImage"+b+"0.94  09/20/05 - added setTooltipClass and resetTooltipClass"+b+"0.93  09/19/05 - added slopPercentage [optional] parameter to zoomToMarkers"+b+"0.92  09/18/05 - added getMouseOutEnabled, setMouseOutEnabled"+b+"0.91  09/17/05 - fixed setOpacity";return a}function getPdMarkerVersion(){return getPdMarkerRevisionInfo().substring(0,15)}function getPdMarkerShortVersion(){return getPdMarkerRevisionInfo().substring(0,5)}var APIkey="";function getGoogleMapsVersion(){var j,g,f,k;var h="unknown";if(document.getElementsByTagName){for(j=0;(g=document.getElementsByTagName("script")[j]);j++){if(g.getAttribute("src")){f=g.getAttribute("src");k=f.indexOf("/mapfiles/maps");d=f.indexOf("http://maps.google.com/maps?file=api");e=f.indexOf("key=");if(k>0){h=parseFloat(f.substring(k+14))}if(d>=0){if(e>0){APIkey=f.substring(e+4)}}}}}return h}function latLongToPixel(f,g,c){var b=f.getCurrentMapType().getProjection().fromLatLngToPixel(f.fromDivPixelToLatLng(new GLatLng(0,0),true),f.getZoom());var a=f.getCurrentMapType().getProjection().fromLatLngToPixel(g,f.getZoom());return new GPoint(a.x-b.x,a.y-b.y)}var pdMarkerExtList=[];function PdMarkerAddToExtList(a){pdMarkerExtList.push(a)}function PdMarkerRemoveFromExtList(b){for(var a=0;a<pdMarkerExtList.length;a++){if(pdMarkerExtList[a].internalId==b){pdMarkerExtList.splice(a,1)}}}function PdMarkerFindInExtList(b){for(var a=0;a<pdMarkerExtList.length;a++){if(pdMarkerExtList[a].internalId==b){return pdMarkerExtList[a]}}}function PdMarkerClose(b){for(var a=0;a<pdMarkerExtList.length;a++){if(pdMarkerExtList[a].internalId==b){pdMarkerExtList[a].closeDetailWin();pdMarkerExtList.splice(a,1)}}}function PdMarkerBlinkOnOff(b){var a=PdMarkerFindInExtList(b);if(a){if(!a.blinking){return}a.blinkOn=!a.blinkOn;a.display(a.blinkOn);setTimeout("PdMarkerBlinkOnOff("+a.getId()+");",a.blinkSpeed)}}function isPdMarker(b){if(b.isMarker){return true}return false}function getPdMarkerCount(b){if(b.pdMarkers){return b.pdMarkers.length}return 0}GMap2.prototype.getMarkerById=function(c){var b=getPdMarkerCount(this);for(var a=0;a<b;a++){if(isPdMarker(this.pdMarkers[a])){if(this.pdMarkers[a].internalId==c){this.cursor=a;return this.pdMarkers[a]}}}return null};GMap2.prototype.getFirstMarker=function(){var b=getPdMarkerCount(this);for(var a=0;a<b;a++){if(isPdMarker(this.pdMarkers[a])){this.cursor=a;return this.pdMarkers[a]}}return null};GMap2.prototype.getNextMarker=function(){var b=getPdMarkerCount(this);if(b>0){if(this.cursor>=0){for(var a=this.cursor+1;a<b;a++){if(isPdMarker(this.pdMarkers[a])){this.cursor=a;return this.pdMarkers[a]}}}}return null};GMap2.prototype.getNthMarker=function(c){var b=getPdMarkerCount(this);for(var a=0;a<b;a++){if(isPdMarker(this.pdMarkers[a])){c--;if(c==0){this.cursor=a;return this.pdMarkers[a]}}}return null};GMap2.prototype.getMarkerCount=function(){return getPdMarkerCount(this)};GMap2.prototype.boxMap=function(a,c){var b=this.spec;var f=b.getLowestZoomLevel(a,c,this.viewSize);this.centerAndZoom(new GPoint(a.x,a.y),f)};GMap2.prototype.zoomToMarkers=function(m,l){var n=0;var g,p,o,j,f,h,c,q;var k=this.getFirstMarker();while(k!=null){g=k.getPoint();p=g.lat();o=g.lng();if(n==0){j=p;f=p;h=o;c=o}else{if(p<j){j=p}if(p>f){f=p}if(o<h){h=o}if(o>c){c=o}}k=this.getNextMarker();n++}if(n==1){this.setCenter(new GLatLng(p,o),this.getZoom())}else{if(n>1){var b=new GLatLng((j+f)/2,(h+c)/2);q=new GSize(Math.abs(f-j),Math.abs(c-h));slopWid=0;slopHgt=0;if(typeof m!="undefined"){slopWid=q.width*m/200;slopHgt=q.height*m/200;q.width*=1+m/100;q.height*=1+m/100}deltaHgt=0;if(typeof l!="undefined"){deltaHgt=q.height*l/100;b=new GLatLng(b.lat()+deltaHgt,b.lng())}var a=new GLatLngBounds(new GLatLng(j-slopHgt,h-slopWid),new GLatLng(f+slopHgt,c+slopWid));var r=this.getBoundsZoomLevel(a);this.setCenter(b,r)}}};function shorten(a){var b=1000000;return Math.round(a*b)/b}function poweredByClick(g){var a=g.getCenter();var c=g.getBounds().toSpan();var f=g.getZoom();var b="http://maps.google.com/maps?ll="+a.lat()+","+a.lng()+"&spn="+shorten(c.lat())+","+shorten(c.lng())+"&z="+f+"&key="+APIkey;document.location=b}function poweredByMouseover(h){var c=h.getFirstMarker();var g=h.getBounds();var f=0;var b=0;while(c!=null){var a=c.getPoint();if(g.contains(a)){f++}b=b+1;c=h.getNextMarker()}var j=h.poweredByTitle+" ("+f+" markers of "+b+" visible)";h.poweredByObj.setAttribute("title",j);h.poweredByObj.setAttribute("alt",j)}function getPoweredBy(g){try{var c="GMap "+getGoogleMapsVersion()+" & PdMarker "+getPdMarkerShortVersion();g.poweredByTitle=c;var a=document.createElement("img");a.setAttribute("src","http://www.google.com/intl/en_ALL/mapfiles/transparent.gif");a.setAttribute("width",62);a.setAttribute("alt",c);a.setAttribute("title",c);a.setAttribute("height",30);a.style.display="block";a.style.position="absolute";a.style.left="2px";a.style.bottom="0px";a.style.width="62px";a.style.height="30px";a.style.cursor="pointer";a.style.zIndex=600001;a.onclick=function(){poweredByClick(g)};a.onmouseover=function(){poweredByMouseover(g)};g.getPane(G_MAP_FLOAT_PANE).parentNode.parentNode.appendChild(a);return a}catch(f){}return true}function setPoweredBy(a){getGoogleMapsVersion();if(!a.poweredByObj){a.poweredByObj=getPoweredBy(a)}}function PdMarkerNamespace(){var userAgent=navigator.userAgent.toLowerCase();var n4=(document.layers);var n6=(document.getElementById&&!document.all);var ie=(document.all);var o6=(userAgent.indexOf("opera")!=-1);var safari=(userAgent.indexOf("safari")!=-1);var msie=(userAgent.indexOf("msie")!=-1)&&(userAgent.indexOf("opera")==-1);var nextMarkerId=10;var permitLeft=true;icon=new GIcon();icon.shadow="http://www.google.com/mapfiles/shadow50.png";icon.iconSize=new GSize(20,34);icon.shadowSize=new GSize(37,34);icon.iconAnchor=new GPoint(9,34);icon.infoWindowAnchor=new GPoint(9,2);icon.infoShadowAnchor=new GPoint(18,25);icon.image="http://www.google.com/mapfiles/marker.png";function PdMarker(a,b,tooltip){this.inheritFrom=GMarker;if(typeof b=="undefined"){b=icon}this.inheritFrom(a,b);if(typeof tooltip!="undefined"){this.pendingTitle=tooltip}else{this.pendingTitle=""}this.internalId=nextMarkerId;nextMarkerId+=1;this.zIndexSaved=false;this.oldImagePath="";this.pendingCursor="";this.percentOpacity=70;this.mouseOutEnabled=true;this.setImageOn=true;this.hidingEnabled=true;this.showDetailOnClick=true;this.detailOpen=false;this.userData=""}PdMarker.prototype=new GMarker(new GLatLng(1,1));function addMarkerToMapList(map,marker){try{if(map.pdMarkers.length){}}catch(e){map.pdMarkers=new Array()}map.pdMarkers.push(marker)}function removeMarkerFromMapList(map,marker){var id=marker.internalId;for(var i=0;i<map.pdMarkers.length;i++){if(map.pdMarkers[i].internalId==id){map.pdMarkers.splice(i,1);return}}}PdMarker.prototype.initialize=function(a){if(typeof a=="GMap"){GLog.write("PdMarker requires GMap2");return}addMarkerToMapList(a,this);try{GMarker.prototype.initialize.call(this,a);this.isMarker=true;if(this.pendingTitle.length>0){this.setTitle(this.pendingTitle)}if(this.pendingCursor.length>0){this.setCursor(this.pendingCursor)}this.map=a;setPoweredBy(a);GEvent.bindDom(this,"mouseover",this,this.onMouseOver);GEvent.bindDom(this,"mouseout",this,this.onMouseOut);GEvent.bindDom(this,"click",this,this.onClick);GEvent.bind(this.map,"zoomend",this,this.reZoom)}catch(e){alert("PdMarker initialize error: "+e)}};PdMarker.prototype.allowLeftTooltips=function(a){permitLeft=a};PdMarker.prototype.reZoom=function(){var didSet=false;if(this.tooltipObject){if(this.tooltipObject.style.display=="block"){setTTPosition(this);didSet=true}}if(this.detailObject){if(!didSet){setTTPosition(this)}this.detailObject.style.top=this.ttTop+"px";this.detailObject.style.left=this.ttLeft+"px"}};PdMarker.prototype.setId=function(id){this.internalId=id};PdMarker.prototype.getId=function(){return this.internalId};PdMarker.prototype.setName=function(a){this.name=a};PdMarker.prototype.getName=function(){if(this.name){return this.name}else{return null}};PdMarker.prototype.setUserData=function(a){this.userData=a};PdMarker.prototype.getUserData=function(){if(this.userData){return this.userData}else{return""}};PdMarker.prototype.setUserData2=function(a){this.userData2=a};PdMarker.prototype.getUserData2=function(){if(this.userData2){return this.userData2}else{return""}};PdMarker.prototype.setImageEnabled=function(a){this.setImageOn=a};var PdMIN="";var PdMIA="";function PdCompPdMIN(marker){if(PdMIN.length==0){for(var i in marker){if(eval("typeof marker."+i)=="object"){try{if(eval("typeof marker."+i+"[0].src")!="undefined"){PdMIA="this."+i;PdMIN=PdMIA+"[0]"}}catch(e){}}}}}PdMarker.prototype.setImage=function(a){var msFilter='progid:DXImageTransform.Microsoft.AlphaImageLoader(src="'+a+'")';if(this.mouseOutEnabled&&this.setImageOn){PdCompPdMIN(this);try{if(this.oldImagePath.length==0){eval("this.oldImagePath = "+PdMIN+".src")}if(msie){eval(PdMIN+".style.filter = msFilter")}else{eval(PdMIN+".src = a")}}catch(e){}}};PdMarker.prototype.restoreImage=function(){if(this.mouseOutEnabled&&this.setImageOn&&this.oldImagePath.length>0){var a=this.oldImagePath;this.setImage(a);this.oldImagePath=""}};PdMarker.prototype.display=function(a){PdCompPdMIN(this);var b="";if(!a){this.hideTooltip();this.closeDetailWin();b="none"}try{var count=2;if(this.getIcon().transparent){count=3}for(i=0;i<count;i++){eval(PdMIA+"["+i+"].style.display = b;")}}catch(e){}};PdMarker.prototype.blink=function(a,b){if(a){this.blinkOn=true;marker.blinkSpeed=b;if(!this.blinking){this.blinking=a;PdMarkerAddToExtList(this);PdMarkerBlinkOnOff(this.getId())}}else{this.blinking=a;this.display(true);PdMarkerRemoveFromExtList(this)}};PdMarker.prototype.setIcon=function(a){this.remove();this.icon=a;this.initialize(this.map);this.redraw(true)};PdMarker.prototype.setMarkerZIndex=function(a){if(!this.zIndexSaved){this.zIndexSaved=true;this.oldZIndex=eval(PdMIN+".style.zIndex")}eval(PdMIN+".style.zIndex = a");this.redraw(true)};PdMarker.prototype.topMarkerZIndex=function(){this.setMarkerZIndex(600000)};PdMarker.prototype.restoreMarkerZIndex=function(){if(this.zIndexSaved){this.zIndexSaved=false;eval(PdMIN+".style.zIndex = this.oldZIndex");this.redraw(true)}};PdMarker.prototype.onInfoWindowOpen=function(){this.hideTooltip();GMarker.prototype.onInfoWindowOpen.call(this)};PdMarker.prototype.setHoverImage=function(a){this.hoverImage=a};var inMouseOver=false;PdMarker.prototype.onMouseOver=function(){if(inMouseOver){return}inMouseOver=true;if(this.hoverImage){this.setImage(this.hoverImage)}if(!this.detailOpen){this.showTooltip()}inMouseOver=false};PdMarker.prototype.onMouseOut=function(){if(this.hoverImage){this.restoreImage()}if(!this.detailOpen){if(this.mouseOutEnabled){this.hideTooltip()}}};PdMarker.prototype.setMouseOutEnabled=function(a){this.mouseOutEnabled=a};PdMarker.prototype.getMouseOutEnabled=function(){return this.mouseOutEnabled};PdMarker.prototype.setTooltipHiding=function(a){this.hidingEnabled=a};PdMarker.prototype.getTooltipHiding=function(){return this.hidingEnabled};PdMarker.prototype.setTitle=function(a){this.tooltipText="";PdCompPdMIN(this);try{eval(PdMIN+".title = a")}catch(e){this.pendingTitle=a}};PdMarker.prototype.setCursor=function(a){PdCompPdMIN(this);try{eval(PdMIN+".style.cursor = a")}catch(e){this.pendingCursor=a}};PdMarker.prototype.setTooltipClass=function(a){this.pendingClassName=a;if(this.tooltipObject){var showing=(this.tooltipObject.style.display!="none");this.deleteObjects();if(this.tooltipRaw){this.setTooltipNoResize(this.tooltipRaw)}if(showing){this.showTooltip()}}else{if(this.tooltipRaw){this.setTooltipNoResize(this.tooltipRaw)}}};PdMarker.prototype.resetTooltipClass=function(){this.setTooltipClass("markerTooltip")};PdMarker.prototype.getTooltip=function(){try{return this.tooltipRaw}catch(e){return""}};PdMarker.prototype.setTooltipNoResize=function(a){this.setTitle("");var ttClass="markerTooltip";if(this.pendingClassName){ttClass=this.pendingClassName}this.tooltipRaw=a;this.tooltipText="<div class='"+ttClass+"'>"+a+"</div>";if(this.tooltipObject){this.tooltipObject.innerHTML=this.tooltipText}};PdMarker.prototype.setTooltip=function(a){this.setTooltipNoResize(a);this.deleteObjects()};PdMarker.prototype.showTooltip=function(){if(this.tooltipText){if(!this.tooltipObject){initTooltip(this)}setTTPosition(this);this.tooltipObject.style.display="block"}};PdMarker.prototype.hideTooltip=function(){if(this.tooltipObject){if(this.hidingEnabled){this.tooltipObject.style.display="none"}}};PdMarker.prototype.onClick=function(a){if(this.showDetailOnClick&&this.detailWinHTML){this.showDetailWin()}};PdMarker.prototype.setShowDetailOnClick=function(a){this.showDetailOnClick=a};PdMarker.prototype.setDetailWinHTML=function(a){this.detailWinHTML=a};PdMarker.prototype.setDetailWinClass=function(a){this.pendingDetailClassName=a};PdMarker.prototype.resetDetailWinClass=function(){this.setDetailWinClass("markerDetail")};PdMarker.prototype.showDetailWin=function(){if(this.detailOpen){this.closeDetailWin();return}this.hideTooltip();this.setMouseOutEnabled(false);var winClass="markerDetail";if(this.pendingWinClassName){winClass=this.pendingWinClassName}var html="<table summary='Detail Zone'><tr><td>"+this.detailWinHTML+"</td><td valign='top'><a class='markerDetailClose' href='javascript:PdMarkerClose("+this.internalId+")'><img src='http://www.google.com/mapfiles/close.gif' width='14' height='13'></a></td></tr></table>";html="<div class='"+winClass+"'>"+html+"</div>";this.detailOpen=true;if(!this.tooltipText){this.ttWidth=150;this.ttHeight=30;setTTPosition(this)}initDetailWin(this,this.ttTop,this.ttLeft,html);PdMarkerAddToExtList(this)};PdMarker.prototype.closeDetailWin=function(){this.detailOpen=false;if(this.detailObject){this.setMouseOutEnabled(true);this.onMouseOut();this.map.getPane(G_MAP_FLOAT_PANE).removeChild(this.detailObject);this.detailObject=null}};PdMarker.prototype.deleteObjects=function(){if(this.tooltipObject){this.map.getPane(G_MAP_FLOAT_PANE).removeChild(this.tooltipObject);this.tooltipObject=null}if(this.detailObject){this.map.getPane(G_MAP_FLOAT_PANE).removeChild(this.detailObject);this.detailObject=null}};PdMarker.prototype.remove=function(a){removeMarkerFromMapList(this.map,this);PdMarkerRemoveFromExtList(this.getId());GMarker.prototype.remove.call(this);this.deleteObjects()};PdMarker.prototype.setOpacity=function(b){if(b<0){b=0}if(b>=100){b=100}var c=b/100;this.percentOpacity=b;var d=document.getElementById(this.objId);if(d){if(typeof(d.style.filter)=="string"){d.style.filter="alpha(opacity:"+b+")"}if(typeof(d.style.KHTMLOpacity)=="string"){d.style.KHTMLOpacity=c}if(typeof(d.style.MozOpacity)=="string"){d.style.MozOpacity=c}if(typeof(d.style.opacity)=="string"){d.style.opacity=c}}};PdMarker.prototype.setOpacityNew=function(b){setObjOpacity(this.objId);this.percentOpacity=b};function setObjOpacity(objId,b){if(b<0){b=0}if(b>=100){b=100}var c=b/100;var d=document.getElementById(objId);if(d){if(typeof(d.style.filter)=="string"){d.style.filter="alpha(opacity:"+b+")"}if(typeof(d.style.KHTMLOpacity)=="string"){d.style.KHTMLOpacity=c}if(typeof(d.style.MozOpacity)=="string"){d.style.MozOpacity=c}if(typeof(d.style.opacity)=="string"){d.style.opacity=c}}}function idToElemId(id){return"ttobj"+id}function initTooltip(theObj){theObj.objId=idToElemId(theObj.internalId);theObj.anchorLatLng=theObj.point;var b=document.createElement("span");theObj.tooltipObject=b;b.setAttribute("id",theObj.objId);b.innerHTML=theObj.tooltipText;var c=document.body;var d=document.getElementById("pdmarkerwork");if(d){c=d}c.appendChild(b);b.style.position="absolute";b.style.bottom="5px";b.style.left="5px";b.style.zIndex=1;if(theObj.percentOpacity){theObj.setOpacity(theObj.percentOpacity)}var tempObj=document.getElementById(theObj.objId);theObj.ttWidth=tempObj.offsetWidth;theObj.ttHeight=tempObj.offsetHeight;c.removeChild(b);b.style.zIndex=600000;b.style.bottom="";b.style.left="";theObj.map.getPane(G_MAP_FLOAT_PANE).appendChild(b)}function initDetailWin(theObj,top,left,html){theObj.detailId="detail"+theObj.internalId;var b=document.createElement("span");theObj.detailObject=b;b.setAttribute("id",theObj.detailId);b.innerHTML=html;b.style.display="block";b.style.position="absolute";b.style.top=top+"px";b.style.left=left+"px";b.style.zIndex=600001;map=theObj.map;map.getPane(G_MAP_FLOAT_PANE).appendChild(b)}function setTTPosition(theObj){var gap=5;var map=theObj.map;var pt=theObj.getPoint();var ttPos=latLongToPixel(map,pt,map.getZoom());var theIcon=theObj.getIcon();ttPos.y-=Math.floor(theIcon.iconAnchor.y/2);var rightSide=true;var bounds=map.getBounds();var boundsSpan=bounds.toSpan();var longSpan=boundsSpan.lng();var mapWidth=map.getSize().width;var tooltipWidthInDeg=(theObj.ttWidth+theIcon.iconSize.width+6)/mapWidth*longSpan;if(pt.lng()+tooltipWidthInDeg>bounds.getNorthEast().lng()&&permitLeft){rightSide=false}if(rightSide){ttPos.y-=Math.floor(theObj.ttHeight/2);ttPos.x+=(theIcon.iconSize.width-theIcon.iconAnchor.x)+gap}else{ttPos.y-=Math.floor(theObj.ttHeight/2);ttPos.x-=(theIcon.iconAnchor.x+theObj.ttWidth)+gap}theObj.ttLeft=ttPos.x;theObj.ttTop=ttPos.y;if(theObj.tooltipObject){theObj.tooltipObject.style.left=ttPos.x+"px";theObj.tooltipObject.style.top=ttPos.y+"px"}}function makeInterface(a){var b=a||window;b.PdMarker=PdMarker}makeInterface()}PdMarkerNamespace();

/* ///// Fukuyo Gmap lib /////////////////////////////////////////////*/

window.onload = function(){
	var lat = 36.061997;
	var lng = 136.218739;
	var zoom = 16;
	var map = new GMap2(document.getElementById("mapz"));
	map.setCenter(new GLatLng(lat, lng), zoom);
	map.addControl(new GLargeMapControl());
	map.addControl(new GMapTypeControl());
	map.addControl(new GOverviewMapControl());
	marker = new PdMarker(new GLatLng(lat, lng));
	marker.setTooltip("<h3 class='KB12'>\u682A\u5F0F\u4F1A\u793E \u798F\u6D0B<br />- \u670D\u5730\u306E\u798F\u6D0B -<\/h3>");
	marker.setHoverImage("/media/aboutus/gm_point_over.gif");
	map.enableContinuousZoom();
	map.enableDoubleClickZoom();
	map.addOverlay(marker);
	GEvent.addListener(map, "click", function(){ map.setZoom(18); });
}

window.onunload = GUnload;


/* Encoding JS - Gzip */



