
function ArticleIcon(g_oMap){var oOwner=this;var oDrawCache=new Array();var DIV=g_oMap.document.createElement("div");DIV.id="ArticleIconLayer";DIV.style.position="absolute";DIV.style.zIndex=3;g_oMap.document.getElementById("IconLayer").appendChild(DIV);var oLayer=g_oMap.document.getElementById("ArticleIconLayer");function createIcon(uid,kind,pref){var oImgIcon=g_oMap.document.createElement("img");oImgIcon.uid=uid;oImgIcon.src=MAP_IMG_PATH+getIcon(kind);oImgIcon.style.zIndex=3;oImgIcon.style.position="absolute";oImgIcon.style.left=-1000;oImgIcon.style.top=-1000;oLayer.appendChild(oImgIcon);this.OnMouseOver=null;this.OnMouseOut=null;this.OnMouseDown=null;this.OnMouseUp=null;oImgIcon.onmousedown=function(e){var oEvent=CMN_GetEvent(this.ownerDocument,e);oEvent.cancelBubble=true;if(oOwner.OnMouseDown!=null)oOwner.OnMouseDown(uid,kind,pref);}
oImgIcon.onmouseup=function(e){var oEvent=CMN_GetEvent(this.ownerDocument,e);oEvent.cancelBubble=true;if(oOwner.OnMouseUp!=null)oOwner.OnMouseUp(uid);}
return oImgIcon;}
this.Create=function(data){for(var i=0;i<data.length;i++){oDrawCache[i]=new Object();oDrawCache[i].Kind=data[i].article_kind;oDrawCache[i].Longitude=data[i].sumicalon256;oDrawCache[i].Latitude=data[i].sumicalat256;oDrawCache[i].oObj=createIcon(data[i].id,data[i].article_kind,data[i].pref);}}
this.Draw=function(g_oMap){for(var i=0;i<oDrawCache.length;i++){var oPixel=g_oMap.GetViewPoint(oDrawCache[i].Longitude,oDrawCache[i].Latitude);var pixX=0;var pixY=0;var zIdx=0;var h=0;switch(oDrawCache[i].Kind){case"1":case"2":pixX=50;pixY=34;zIdx=5;h=35;break;case"3":pixX=0;pixY=69;zIdx=6;h=70;break;case"4":pixX=0;pixY=44;zIdx=7;h=45;break;case"5":case"6":pixX=50;pixY=84;zIdx=3;h=85;break;case"7":case"8":pixX=50;pixY=59;zIdx=4;h=60;break;}
oDrawCache[i].oObj.style.left=oPixel.PixelX-pixX;oDrawCache[i].oObj.style.top=oPixel.PixelY-pixY;oDrawCache[i].oObj.style.zIndex=zIdx;oDrawCache[i].oObj.style.height=h;oDrawCache[i].oObj.style.visibility="visible";}}
this.Remove=function(){if(oLayer!=null){var imgs=oLayer.getElementsByTagName('img');while(imgs[0])imgs[0].parentNode.removeChild(imgs[0]);}}
this.getPosition=function(uid){var oIcon=this.findDrawCache(uid);var obj=new Object();obj.Left=parseInt(oIcon.oObj.style.left);obj.Top=parseInt(oIcon.oObj.style.top);return obj;}
this.getLonLat=function(uid){var oIcon=this.findDrawCache(uid);if(oIcon!=null){var obj=new Object();obj.Lon=oIcon.Longitude;obj.Lat=oIcon.Latitude;return obj;}else{return null;}}
this.findDrawCache=function(uid){for(var i=0;i<oDrawCache.length;i++){if(oDrawCache[i].oObj.uid==uid)return oDrawCache[i];}
return null;}
function getIcon(sKind){switch(sKind){case"1":case"2":return"ico_1_2.gif";case"3":return"ico_3.gif";case"4":return"ico_4.gif";case"5":case"6":return"ico_5_6.gif";default:return"ico_7_8.gif";}}}
function MappingIcon(g_oMap){var oOwner=this;var oDrawCache=new Array();var DIV=g_oMap.document.createElement("div");DIV.id="MappingIconLayer";DIV.style.position="absolute";DIV.style.zIndex=2;g_oMap.document.getElementById("IconLayer").appendChild(DIV);var oLayer=g_oMap.document.getElementById("MappingIconLayer");function createIcon(uid,spot,kind){var oImgIcon=g_oMap.document.createElement("img");oImgIcon.uid=uid;oImgIcon.src=MAP_IMG_PATH+kind+".gif";oImgIcon.alt=spot;oImgIcon.style.zIndex=2;oImgIcon.style.position="absolute";oImgIcon.style.left=-1000;oImgIcon.style.top=-1000;oImgIcon.style.height=20;oImgIcon.style.width=20;oLayer.appendChild(oImgIcon);this.OnMouseOver=null;this.OnMouseOut=null;this.OnMouseDown=null;this.OnMouseUp=null;oImgIcon.onmousedown=function(e){var oEvent=CMN_GetEvent(this.ownerDocument,e);oEvent.cancelBubble=true;if(oOwner.OnMouseDown!=null)oOwner.OnMouseDown(uid);}
oImgIcon.onmouseup=function(e){var oEvent=CMN_GetEvent(this.ownerDocument,e);oEvent.cancelBubble=true;if(oOwner.OnMouseUp!=null)oOwner.OnMouseUp(uid);}
return oImgIcon;}
this.Create=function(data){var cnt=oDrawCache.length;for(var i=0;i<data.length;i++){oDrawCache[i+cnt]=new Object();oDrawCache[i+cnt].id=i+cnt;oDrawCache[i+cnt].Kind=data[i].gnrkind;oDrawCache[i+cnt].Name=data[i].spot;oDrawCache[i+cnt].Addr=data[i].addr;oDrawCache[i+cnt].Tel=data[i].tel;oDrawCache[i+cnt].Longitude=data[i].lon256;oDrawCache[i+cnt].Latitude=data[i].lat256;if(data[i].gnrcd=="MF0204"||data[i].gnrcd=="MF0207"){oDrawCache[i+cnt].oObj=createIcon(i+cnt,data[i].spot,data[i].gnrcd);}else{oDrawCache[i+cnt].oObj=createIcon(i+cnt,data[i].spot,data[i].gnrkind);}}}
this.Draw=function(g_oMap){for(var i=0;i<oDrawCache.length;i++){var oPixel=g_oMap.GetViewPoint(oDrawCache[i].Longitude,oDrawCache[i].Latitude);oDrawCache[i].oObj.style.left=oPixel.PixelX-10;oDrawCache[i].oObj.style.top=oPixel.PixelY-10;oDrawCache[i].oObj.style.visibility="visible";}}
this.Show=function(kind){for(var i=0;i<oDrawCache.length;i++){if(oDrawCache[i].Kind==kind){oDrawCache[i].oObj.style.width=20;oDrawCache[i].oObj.style.height=20;}}}
this.Hide=function(kind){for(var i=0;i<oDrawCache.length;i++){if(oDrawCache[i].Kind==kind){oDrawCache[i].oObj.style.width=0;oDrawCache[i].oObj.style.height=0;}}}
this.Remove=function(){oDrawCache=new Array();var imgs=oLayer.getElementsByTagName('img');while(imgs[0])
imgs[0].parentNode.removeChild(imgs[0]);}
this.getPosition=function(uid){var oIcon=this.Find(uid);var obj=new Object();obj.Left=parseInt(oIcon.oObj.style.left);obj.Top=parseInt(oIcon.oObj.style.top);return obj;}
this.Find=function(id){for(var i=0;i<oDrawCache.length;i++){if(oDrawCache[i].id==id)return oDrawCache[i];}
return null;}
this.ExistKind=function(kind){for(var i=0;i<oDrawCache.length;i++){if(oDrawCache[i].Kind==kind)return true;}
return false;}}