//=0){//N if(0<=d && d<1){ direc="E"; }else if(1<=d && d<3){ direc="NEE"; }else if(3<=d && d<5){ direc="NE"; }else if(5<=d && d<7){ direc="NNE"; }else if(7<=d && d<9){ direc="N"; }else if(9<=d && d<11){ direc="NNW"; }else if(11<=d && d<13){ direc="NW"; }else if(13<=d && d<15){ direc="NWW"; }else if(15<=d && d<16){ direc="W"; } }else{//S if(0<=d && d<1){ direc="E"; }else if(1<=d && d<3){ direc="SEE"; }else if(3<=d && d<5){ direc="SE"; }else if(5<=d && d<7){ direc="SSE"; }else if(7<=d && d<9){ direc="S"; }else if(9<=d && d<11){ direc="SSW"; }else if(11<=d && d<13){ direc="SW"; }else if(13<=d && d<15){ direc="SWW"; }else if(15<=d && d<16){ direc="W"; } } return(direc + "" + dist_meter_round); } //******* Event Handlers ******* //Map Operation functions function map_wheel(e){ //wheel count var count = e.wheelDelta? e.wheelDelta/-120: // IE e.detail/3; // Firefox if(count < 0){ map.setZoom(map.getZoom() +1); }else{ map.setZoom(map.getZoom() -1); } stop_event_propagation(e); } function on_resize(){ map.checkResize(); //map.removeControl(map.RedCenterCrossControl); //map.addControl(map.RedCenterCrossControl); var d = document; var b = d.body; var innerWinWidth; var innerWinHeight; if (!d.all && (d.layers || d.getElementById)) { //FF, NN //innerWinWidth=window.innerWidth; //innerWinHeight=window.innerHeight; innerWinWidth=innerWidth; innerWinHeight=innerHeight; }else if (d.getElementById && (d.compatMode=='CSS1Compat')) { //IE6 innerWinWidth=d.documentElement.clientWidth; innerWinHeight=d.documentElement.clientHeight; }else if (d.all) { //other IE innerWinWidth=b.clientWidth; innerWinHeight=b.clientHeight; }else { //others innerWinWidth=800; innerWinHeight=600; } var mapobj = d.getElementById('map'); var newwidth = innerWinWidth;//20 var newheight = innerWinHeight - 100;//120;//mapobj.style.top; newwidth = newwidth>256?newwidth:256; newheight = newheight>256?newheight:256; //mapobj.style.width = newwidth +"px"; mapobj.style.height = newheight +"px"; map.checkResize(); map.removeControl(map.RedCenterCrossControl); map.addControl(map.RedCenterCrossControl); return; } //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(d.layers) eval(ojNameStr+".captureEvents(Event."+eventTypeNameStr.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 } 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(d.getElementById){ if(OnOff == true){ d.getElementById(id).style.visibility = 'visible' }else{ d.getElementById(id).style.visibility = 'hidden' } }else if(d.all){ if(OnOff == true){ d.all(id).style.visibility = 'visible' }else{ d.all(id).style.visibility = 'hidden' } }else if(d.layers){ if(OnOff == true){ d.layers[id].visibility = 'show' }else{ d.layers[id].visibility = 'hide' } } } function showAddress(address) { //Regular Expressions to detect location data var re_LP =/([A-Z]{2}\d\.){3}[A-Z]{2}\d/.exec(address); var re_DMS =/([-\+NnSs]?)(\d{1,2})[^0-9A-Za-z](\d{1,2})[^0-9A-Za-z](\d{1,2}\.?\d\d*)[^0-9A-Za-z]\s*([-\+EeWw]?)(\d{1,3})[^0-9A-Za-z](\d{1,2})[^0-9A-Za-z](\d{1,2}\.?\d\d*)/.exec(address); var re_DD =/([-\+NnSs]?)(\d{1,2}\.\d\d*){1}[^0-9A-Za-z]\s*([-\+EeWw]?)(\d{1,3}\.\d\d*){1}/.exec(address); var re_DMS_C =/([-\+NnSs])(\d{1,2})[^0-9A-Za-z](\d{1,2})[^0-9A-Za-z](\d{1,2}\.?\d\d*)\s*([-\+EeWw])(\d{1,3})[^0-9A-Za-z](\d{1,2})[^0-9A-Za-z](\d{1,2}\.?\d\d*)/.exec(address); var re_DD_C =/([-\+NnSs])(\d{1,2}\.\d\d*){1}\s*([-\+EeWw])(\d{1,3}\.\d\d*){1}/.exec(address); if(re_LP!=null){ //LocaPoint var location = LocaPoint2LatLon(address); map.setCenter(new GLatLng(location.latitude, location.longitude),13); save_point(); //return; }else if(re_DMS!=null && re_DMS.length==9){//DD*MM*SS.SSS var dotPosSS; dotPosSS = re_DMS[4].indexOf(".",0); var latd = re_DMS[2] -0 + (re_DMS[3]-0)/60 + (dotPosSS==-1?((re_DMS[4].subStr(0,dotPosSS)+"."+re_DMS[4].subStr(dotPosSS+1,len(re_DMS[4])-dotPosSS)))-0:(re_DMS[4]-0))/3600; dotPosSS = re_DMS[8].indexOf(".",0); var lond = re_DMS[6] -0 + (re_DMS[7]-0)/60 + (dotPosSS==-1?((re_DMS[8].subStr(0,dotPosSS)+"."+re_DMS[8].subStr(dotPosSS+1,len(re_DMS[8])-dotPosSS)))-0:(re_DMS[8]-0))/3600; if(re_DMS[1]=="" || re_DMS[1]=="+" || re_DMS[1]=="N" || re_DMS[1]=="n"){ }else if(re_DMS[1]=="-" || re_DMS[1]=="S" || re_DMS[1]=="s"){ latd*=(-1); } if(re_DMS[5]=="" || re_DMS[5]=="+" || re_DMS[5]=="E" || re_DMS[5]=="e"){ }else if(re_DMS[5]=="-" || re_DMS[5]=="W" || re_DMS[5]=="w"){ lond*=(-1); } map.setCenter(new GLatLng(latd, lond)); save_point(); //return; }else if(re_DD!=null && re_DD.length==5){//DD.DDDD var latdd = re_DD[2]; var londd = re_DD[4]; if(re_DD[1]=="" || re_DD[1]=="+" || re_DD[1]=="N" || re_DD[1]=="n"){ }else if(re_DD[1]=="-" || re_DD[1]=="S" || re_DD[1]=="s"){ latdd*=(-1); } if(re_DD[3]=="" || re_DD[3]=="+" || re_DD[3]=="E" || re_DD[3]=="e"){ }else if(re_DD[3]=="-" || re_DD[3]=="W" || re_DD[3]=="w"){ londd*=(-1); } map.setCenter(new GLatLng(latdd, londd),13); save_point(); //return false; }else if (map.geocoder) {//else Go search map.geocoder.getLatLng( address, function(point) { if (!point) { alert(address + " not found"); } else { map.setCenter(point, 13); save_point(); xajax_GetHopPepperInfo(point.lat(), point.lng(), document.getElementById("GenreSel").value, ((document.getElementById("exclude0kinen").checked==true)?"yes":"no"), document.getElementById("rangeCD").value, 1,20); } } ); //return; } return false; } /////////////////////////////////////////////////////////////////////////////// // Following are LocaPoint functions. // If you remove following, make sure not to use them in this file. /////////////////////////////////////////////////////////////////////////////// //LocaPoint2LatLon /////////////////////////////////////////////////////////////////////////////// function LocaPoint2LatLon(locapoint){ var location = new Object(); location.latitude =( ((locapoint.charCodeAt(0)-65)*1757600 +(locapoint.charCodeAt(1)-65)*67600 +(locapoint.charCodeAt(2)-48)*6760 +(locapoint.charCodeAt(8)-65)*260 +(locapoint.charCodeAt(9)-65)*10 +(locapoint.charCodeAt(10)-48)) *180/45697600-90).toFixed(6); location.longitude = ( ((locapoint.charCodeAt(4)-65)*1757600 +(locapoint.charCodeAt(5)-65)*67600 +(locapoint.charCodeAt(6)-48)*6760 +(locapoint.charCodeAt(12)-65)*260 +(locapoint.charCodeAt(13)-65)*10 +(locapoint.charCodeAt(14)-48) ) *360/45697600-180).toFixed(6); return(location); } /////////////////////////////////////////////////////////////////////////////// //LatLon2LocaPoint /////////////////////////////////////////////////////////////////////////////// function LatLon2LocaPoint(lat, lon){ var latstep=Math.floor(((lat-(-90))*45697600/180)); var lngstep=Math.floor(((lon-(-180))*45697600/360)); var locapoint=String.fromCharCode( Math.floor(latstep/1757600%26)+65, Math.floor(latstep/67600%26)+65, Math.floor(latstep/6760%10)+48, 46, Math.floor(lngstep/1757600%26)+65, Math.floor(lngstep/67600%26)+65, Math.floor(lngstep/6760%10)+48, 46, Math.floor(latstep/260%26)+65, Math.floor(latstep/10%26)+65, Math.floor(latstep%10)+48, 46, Math.floor(lngstep/260%26)+65, Math.floor(lngstep/10%26)+65, Math.floor(lngstep%10)+48 ); return(locapoint); } /////////////////////////////////////////////////////////////////////////////// //FormLatLonStr /////////////////////////////////////////////////////////////////////////////// function FormLatLonStr(lat, lon){ var latstr =lat>=0?"N":"S"; var lonstr =lon>=0?"E":"W"; lat = Math.abs(lat); lon = Math.abs(lon); lat = "000" + lat.toFixed(6); lon = "000" + lon.toFixed(6); latstr += lat.substr(lat.length - 9); lonstr += lon.substr(lon.length - 10); return(latstr + "," + lonstr); } /////////////////////////////////////////////////////////////////////////////// //Cookie Utility Functions /////////////////////////////////////////////////////////////////////////////// function mySetCookie(myCookie,myValue,myDay){ myExp = new Date(); myExp.setTime(myExp.getTime()+(myDay*24*60*60*1000)); myItem = "@" + myCookie + "=" + escape(myValue) + ";"; myExpires = "expires="+myExp.toGMTString(); document.cookie = myItem + myExpires; } function myGetCookie(myCookie){ myCookie = "@" + myCookie + "="; myValue = null; myStr = document.cookie + ";" ; myOfst = myStr.indexOf(myCookie); if (myOfst != -1){ myStart = myOfst + myCookie.length; myEnd = myStr.indexOf(";" , myStart); myValue = unescape(myStr.substring(myStart,myEnd)); } return myValue; } //]]>