/* =========================================================================== WMS HTML VIEWER JavaScript library =========================================================================== VERSION 1.1.0 DATE Marts, 2003 COMPANY GeoConsultinG, Denmark INTERNET www.geoconsulting.dk E-MAIL nk@geoconsulting.dk PHONE +45 35 349 349 AUTHOR Nikolaj Kamstrup DESCRIPTION REQUIREMENTS =========================================================================== 04.03.2003.xhbt: Bugfix if only one search result 10.03.2003.xhbt: Adding function to open different countries in windows 12.03.2003.xhbt: Adding module to show coordinates for map pin 13.03.2003.xhbt: Changing print to be able to print historic map as seen on the screen 18.03.2003.xhbt: Bugfix for historic divider on map 25.04.2003.xhbt: Bugfix to be able to choose the first element in results. // Adding onfocus event. Removing previous bugfix from 04.03.2003 30.04.2003.xhbt: adding coord search 04.06.2004.julian: adapted to work with Mozilla (tested with ver. 1.6) 07.06.2004.julian: fixed bug, whereby panning of DK_DETALJER occurred in far too large jumps - caused by accumulating pixel sizes. 09.06.2004.julian: fixed persistent coordinates (keep coordinates in hidden frame) 10.06.2004.julian: added divcoordmodule (from Det Geografiske Hjørne) for display af center coordinates 18.02.2005.julian: enabled display of central coordinate in Færø and Greenland. */ //========================================================================= //DECLARATION OF VARIABLES //========================================================================= // julians sandkasse document.domain = "kms.dk"; function returnTicket() { // var t = "" + "&ticket=756d366c66d541580d884b993e524443";; var t = "&ticket=756d366c66d541580d884b993e524443"; return t; } // julians sandkasse ender her var newLook = true; var mode = ""; // for use when dragging slider with Mozilla - julian 040514 var isMouseDown = false; var c_MOUSEDOWN = 1; var c_MOUSEMOVE = 2; var c_MOUSEUP = 3; //13.03.2003.xhbt var DIVLOC = 232 + 32; var mapList; //26.08.03.xhbt var mapList1; var mapList2; var mapList3; var mapType var mapName = Array(3); var mapNumber; var mapProjection; var mapImageFormat; var mapCenterX; var mapCenterY; var mapWidth; var mapHeight; var mapJPEGQuality; var mapURI; var mapLeft; var mapTop; var mapBorderSize; var mapBorderColor; var mapModuleBorderSize; var mapModuleLeft; var mapModuleTop; var mapModuleBGColor; var mapModuleBorderColor; var mapModuleHeaderColor; var mapModuleLayout; var navWidth; var navHeight; var navPixelSizeX; var navPixelSizeY; var navULX; var navULY; var navPath; var navLeft; var navTop; var navBorderSize; var navBorderColor; var navModuleColor; var navModuleEnabled; var navModuleLeft; var navModuleTop; var msModuleTop; var msModuleLeft; var msModuleColor; var msModuleEnabled; var msModuleHeaderColor; var msModuleHeaderText; var msModuleInterface; var msWidth; var csModuleTop; var csModuleLeft; var csModuleColor; var csModuleEnabled; var csModuleHeaderColor; var csModuleHeaderText; var csModuleInterface; var csWidth; var csID; var asModuleColor; var asModuleEnabled; var asModuleHeaderColor; var asModuleHeaderLeft; var asModuleHeaderText; var asModuleInterface; var asModuleLeft; var asModuleTop; var asDefaultLayout; var asModuleCoordSearch; //30.04.2003.xhbt var sbModuleEnabled; var sbModuleLeft; var sbModuleTop; var sbDarkColor; var sbLightColor; var sbHeight; var sbWidth; var sb2ModuleEnabled; var sb2ModuleLeft; var sb2ModuleTop; var sb2DarkColor; var sb2LightColor; var sb2Height; var sb2Width; var hsPath; var hsBorderSize; var hsBorderColor; var lmHeight; var lmWidth; var lmX; var lmY; var lmPath; var lmrlLeft; var lmrlTop; var lmrlText; //12.03.2003.xhbt:Adding module to show coordinates for map pin var lmcdLeft; var lmcdTop; var lmcdModuleEnabled; var lmcdText1; var lmcdText2; var swmLeft; var swmTop; var swmText; var swmBorderSize; var swmBorderColor; var swmBackground; var plModuleEnabled; var plLeft; var plTop; var plText; var plDestination; var plManyMaps; //13.03.2003.xhbt:To print many maps (DKFON) var LASTCLICKTIME = new Number(); var DELAY = 1000; var ISIMAGE1LOADED = false; var ISIMAGE2LOADED = false; var dipPath; var dipLeft; var dipTop; var gSearchType; //30.04.2003.xhbt - 13.05.2004 julian global variable for use when displaying LMCDModule. parc. var zoomLevel; //10.07.2003.xhbt //MapText 11.09.2003.xhbt var txtsModuleEnabled; var txtsModuleLeft; var txtsModuleTop; var txtsHeight; var txtsWidth; //coordsystem //03.12.03.xhbt var coordSystemOut; var coordSystemIn; var coordWidth; var coordHeight; var coordTop; var coordLeft; var coordEnabled; var coordVis; var ActiveASSearchType; var loadfinished = "false"; //========================================================================= //CONSTANTS - DO NOT CHANGE //========================================================================= var c_TABLE = 0; var c_LISTBOX = 1; var c_JPEG = 2; var c_PNG = 3; var c_NOTRANSPARENCY = 0; var c_TRANSPARENCY = 1; var c_ALIAS = 0; var c_ALIAS_UK = 3; var c_SCALE = 2; //30.7.2003.xhbt var c_PIXELSIZE = 1; var c_ZOOMIN = -1; var c_ZOOMOUT = 1; var c_SIMPLE = 0; var c_ADVANCED = 1; var c_ADDRESS = 0; var c_PLACENAME = 1; var c_PLACENAME_ONLY = 2; var c_COORDINATES = 3; //30.04.2003.xhbt: adding coord search var c_NO_COORD_PLACE = 4; var c_NO_COORD_ADDRESS = 5; var c_FIND_ET_STED = 0; var c_DK_FOER_OG_NU = 1; var c_DK_DETALJER = 2; var c_COORD1 = 1; var c_COORD2 = 2; //========================================================================= // Function that converts a UTM centerX to the corresponding screen x of // the hotspot (in pixel). //========================================================================= function getHSLeft(mapNumber,cx) { var hsl; // position of nav module left corner plus // distance between map centre (IRL coordinates) and // x-coordinate (IRL) of upper left corner of nav module, // converted to pixels in navn image hsl = Number(getNavLeft()) + ((cx - getNavULX())/getNavPixelSizeX()); // move HS so its center aligns with map center hsl -= Number( getHSWidth(mapNumber) / 2 ); return (parseInt(hsl)); } //========================================================================= // Function that converts a UTM centerY to the corresponding screen y of // the hotspot (in pixel). //========================================================================= function getHSTop(mapNumber,cy) { var hst; // position of nav module top (in screen pixels) minus // distance between map center (IRL coordinates) and // y-coordinate of upper left corner (IRL coordinates - navULY is something like 6424389), // converted to pixels in nav image. //hst = Number(getNavTop()) + (-(cy - getNavULY())/getNavPixelSizeY()); hst = Number(getNavTop() - ( cy - getNavULY() )/getNavPixelSizeY() ); // move top of HS, so that centre of HS aligns with centre of map hst -= Number( getHSHeight(mapNumber) / 2 ); return (parseInt(hst)); } //========================================================================= // Function that calculates the height (in pixels) of the hotspot based on // the map area. //========================================================================= function getHSHeight(mapNumber) { var ps = 0; var t; //loop through all maps and use the largest pixelsize to scale the hotspot for (var i=1; i<=getMapNumber(); i++) { t = getMapPixelSize(getMapName(i)); if (t > ps) ps = t; } var aoiy = ps * getMapHeight(mapNumber) / getNavPixelSizeY(); return (parseInt(aoiy)); } //========================================================================= // Function that calculates the width (in pixels) of the hotspot based on // the map area. //========================================================================= function getHSWidth(mapNumber) { var ps = 0; var t; //loop through all maps and use the largest pixelsize to scale the hotspot for (var i=1; i<=getMapNumber(); i++) { t = getMapPixelSize(getMapName(i)); if (t > ps) ps = t; } var aoix = ps * getMapWidth(mapNumber) / getNavPixelSizeX(); return (parseInt(aoix)); } //as function getASModuleColor() { return(asModuleColor); } function getASModuleDefaultLayout() { return(asModuleDefaultLayout); } function getASModuleEnabled() { return(asModuleEnabled); } //30.04.2003.xhbt function getASModuleCoordSearch() { return(asModuleCoordSearch); } function getASModuleHeaderColor() { return(asModuleHeaderColor); } function getASModuleHeaderLeft() { return(asModuleHeaderLeft); } function getASModuleHeaderText() { return(asModuleHeaderText); } function getASModuleInterface() { return(asModuleInterface); } function getASModuleLeft() { return(asModuleLeft); } function getASModuleTop() { return(asModuleTop); } function getASWidth() { return(asWidth); } //cs function getCSID() { return(csID); } function getCSLeft() { return(csLeft); } function getCSModuleColor() { return(csModuleColor); } function getCSModuleEnabled() { return(csModuleEnabled); } function getCSModuleHeaderColor() { return(csModuleHeaderColor); } function getCSModuleHeaderLeft() { return(csModuleHeaderLeft); } function getCSModuleHeaderText() { return(csModuleHeaderText); } function getCSModuleLeft() { return(csModuleLeft); } function getCSModuleTop() { return(csModuleTop); } function getCSModuleInterface() { return(csModuleInterface); } function getCSTop() { return(csTop); } function getCSWidth() { return(csWidth); } //========================================================================= // Function that returns the UTM centerX based on the position of the mouse // on the navigation image. //========================================================================= function getCenterXFromNav(CursorX, pixelsizex, ULX) { // return( getNavULX() + (getNavPixelSizeX()*(CursorX-getNavLeft()))); return( getNavULX() + getNavPixelSizeX() * ( CursorX - getNavLeft() ) ); } //========================================================================= // Function that returns the UTM centerY based on the position of the mouse // on the navigation image. //========================================================================= function getCenterYFromNav(CursorY, pixelsizey, ULY) { return(getNavULY() - (getNavPixelSizeY()*(CursorY-getNavTop()))); } //dip function getDIPLeft() { return(dipLeft); } function getDIPPath() { return(dipPath); } function getDIPTop() { return(dipTop); } //hs function getHSBorderColor() { return(hsBorderColor); } function getHSBorderSize() { return(hsBorderSize); } function getHSPath() { return(hsPath); } //lm function getLMPath() { return(lmPath); } function getLMHeight() { return(lmHeight); } function getLMRLLeft() { return(lmrlLeft); } function getLMRLText() { return(lmrlText); } function getLMRLTop() { return(lmrlTop); } function getLMWidth() { return(lmWidth); } function getLMX() { return(lmX); } function getLMY() { return(lmY); } //12.03.2003.xhbt:Adding module to show coordinates for map pin function getLMCDLeft() { return(lmcdLeft); } function getLMCDTop() { return(lmcdTop); } function getLMCDModuleEnabled() { return(lmcdModuleEnabled); } function getLMCDText1() { return(lmcdText1); } function getLMCDText2() { return(lmcdText2); } //common function getLRX(centerx, pixelsize, sizex) { //get LRX coordinates from center X coordinate var LRX = Number( Number(centerx) + (sizex / 2 * pixelsize)); return(LRX); } function getLRY(centery, pixelsize, sizey) { //get LRY coordinates from center Y coordinate var LRY = Number( Number(centery) - (sizey / 2 * pixelsize)); return(LRY); } //map function getMapBorderColor() { return(mapBorderColor); } function getMapBorderSize() { return(mapBorderSize); } function getMapCenterX() { return(mapCenterX); } function getMapCenterY() { return(mapCenterY); } function getMapHeight() { return(mapHeight); } function getMapImageFormat() { return(mapImageFormat); } function getMapJPEGQuality() { return(mapJPEGQuality); } function getMapLeft() { return(mapLeft); } function getMapList() { return(mapList); } //------------------------ //26.07.03.xhbt //------------------------ function getMapLists(number) { if(number == 1) return(mapList1); else if (number == 2) return(mapList2); else return(mapList3); } function getMapType() { return(mapType); } function getMapList2() { return(mapList2); } function getMapList3() { return(mapList3); } function getMapNames(number) { return (mapNames[number]); } //------------------------ function getMapModuleBorderSize() { return(mapModuleBorderSize); } function getMapModuleBGColor() { return(mapModuleBGColor); } function getMapModuleBorderColor() { return(mapModuleBorderColor); } function getMapModuleHeaderText() { return(mapModuleHeaderText); } function getMapModuleHeaderColor() { return(mapModuleHeaderColor); } function getMapModuleLayout() { return(mapModuleLayout); } function getMapModuleLeft() { return(mapModuleLeft); } function getMapModuleTop() { return(mapModuleTop); } function getMapWidth() { return(mapWidth); } function getMapNumber() { return(mapNumber); } function getMapName(mapNumber) { return(mapName[mapNumber]); } function getMapPixelSize(mapName) { var ps = Number(getMapInfo(c_PIXELSIZE, mapName)); //ps = ps * getUtilZoomFactor() / 100; return(ps); } function getMapProjection() { return(mapProjection); } function getMapTop() { return(mapTop); } function getMapURI() { return(mapURI); } function getMapURL(mapNumber) { var url; var mapName = getMapName(mapNumber); var ps = getMapPixelSize(mapName); var w = getMapWidth(); var h = getMapHeight(); var cx = getMapCenterX(); var cy = getMapCenterY(); url = getMapURI(); url += "version=1.1.1"; url += "&service=WMS"; url += "&request=GetMap"; url += "&servicename=" + mapName; url += "&srs=" + getMapProjection(); url += "&bbox=" + getULX(cx, ps, w); url += "," + getLRY(cy, ps, h); url += "," + getLRX(cx, ps, w); url += "," + getULY(cy, ps, h); url += "&width=" + getMapWidth(); url += "&height=" + getMapHeight(); url += "&exceptions=application/vnd.ogc.se_inimage"; url += "&illegallayers=true"; //url += "&transparent=false"; //url += "&style=default"; //url += "&layers=" + l; //url += "&ticket="; //url += "&ticket=756d366c66d541580d884b993e524443"; url += "&ticket=756d366c66d541580d884b993e524443"; if (getMapImageFormat()==c_JPEG) { url += "&format=image/jpeg"; url += "&jpegquality=" + getMapJPEGQuality(); } else url += "&format=image/png"; return(url); } //ms function getMSLeft() { return(msLeft); } function getMSModuleColor() { return(msModuleColor); } function getMSModuleEnabled() { return(msModuleEnabled); } function getMSModuleHeaderColor() { return(msModuleHeaderColor); } function getMSModuleHeaderLeft() { return(msModuleHeaderLeft); } function getMSModuleHeaderText() { return(msModuleHeaderText); } function getMSModuleLeft() { return(msModuleLeft); } function getMSModuleTop() { return(msModuleTop); } function getMSModuleInterface() { return(msModuleInterface); } function getMSTop() { return(msTop); } function getMSWidth() { return(msWidth); } //nav function getNavBorderColor() { return(navBorderColor); } function getNavBorderSize() { return(navBorderSize); } function getNavHeight() { return(navHeight); } function getNavLeft() { return(navLeft); } function getNavModuleEnabled() { return(navModuleEnabled); } function getNavModuleLeft() { return(navModuleLeft); } function getNavModuleTop() { return(navModuleTop); } function getNavPath() { return(navPath); } function getNavPixelSizeX() { return(navPixelSizeX); } function getNavPixelSizeY() { return(navPixelSizeY); } function getNavTop() { return(navTop); } function getNavULX() { return(navULX); } function getNavULY() { return(navULY); } function getNavWidth() { return(navWidth); } //pl function getPLModuleEnabled() { return(plModuleEnabled); } function getPLDestination() { return(plDestination); } function getPLLeft() { return(plLeft); } function getPLText() { return(plText); } function getPLTop() { return(plTop); } //13.03.2003.xhbt function getPLManyMaps() { return(plManyMaps); } //sb function getSBDarkColor() { return(sbDarkColor); } function getSBHeight() { return(sbHeight); } function getSBLightColor() { return(sbLightColor); } function getSBModuleEnabled() { return(sbModuleEnabled); } function getSBModuleLeft() { return(sbModuleLeft); } function getSBModuleTop() { return(sbModuleTop); } function getSBWidth() { return(sbWidth); } //sb2 function getSB2DarkColor() { return(sb2DarkColor); } function getSB2Height() { return(sb2Height); } function getSB2LightColor() { return(sb2LightColor); } function getSB2ModuleEnabled() { return(sb2ModuleEnabled); } function getSB2ModuleLeft() { return(sb2ModuleLeft); } function getSB2ModuleTop() { return(sb2ModuleTop); } function getSB2Width() { return(sb2Width); } //swm function getSWMLeft() { return(swmLeft); } function getSWMText() { return(swmText); } function getSWMTop() { return(swmTop); } function getSWMBorderSize() { return(swmBorderSize); } function getSWMBorderColor() { return(swmBorderColor); } function getSWMBackground() { return(swmBackground); } //zoomLevel function getZoomLevel() { return (zoomLevel); } //11.09.2003.xhbt: txt function getTXTSModuleEnabled() { return(txtsModuleEnabled); } function getTXTSModuleLeft() { return(txtsModuleLeft); } function getTXTSModuleTop() { return(txtsModuleTop); } function getTXTSWidth() { return(txtsWidth); } function getTXTSHeight() { return(txtsHeight); } //CoordSystem 03.12.03.xhbt: function getCoordSystemOut() { return (coordSystemOut); } function getCoordSystemIn() { return (coordSystemIn); } function getCoordWidth(v) { return (coordWidth); } function getCoordHeight(v) { return (coordHeight); } function getCoordTop(v) { return (coordTop); } function getCoordLeft(v) { return (coordLeft); } function getCoordModuleEnabled(v) { return (coordModuleEnabled); } function getCoordVis(v) { return (coordVis); } //common function getULX(centerx, pixelsize, sizex) { //get ULX coordinates from center X coordinate var ULX = Number( Number(centerx) - (sizex / 2 * pixelsize)); return(ULX); } function getULY(centery, pixelsize, sizey) { //get ULX coordinates from center Y coordinate var ULY = Number( Number(centery) + (sizey / 2 * pixelsize)); return(ULY); } //========================================================================= //========================================================================= //SET FUNCTIONS //========================================================================= //as function setASModuleColor(v) { asModuleColor = v; } function setASModuleDefaultLayout(v) { asModuleDefaultLayout = v; } function setASModuleEnabled(v) { asModuleEnabled = v; } //30.04.2003.xhbt function setASModuleCoordSearch(v) { asModuleCoordSearch = v; } function setASModuleHeaderColor(v) { asModuleHeaderColor = v; } function setASModuleHeaderLeft(v) { asModuleHeaderLeft = v; } function setASModuleHeaderText(v) { asModuleHeaderText = v; } function setASModuleInterface(v) { asModuleInterface = v; } function setASModuleLeft(v) { asModuleLeft = v; } function setASModuleTop(v) { asModuleTop = v; } function setASWidth(v) { asWidth = v; } //cs function setCSID(v) { csID = v; } function setCSLeft(v) { csLeft = v; } function setCSModuleColor(v) { csModuleColor = v; } function setCSModuleEnabled(v) { csModuleEnabled = v; } function setCSModuleHeaderColor(v) { csModuleHeaderColor = v; } function setCSModuleHeaderLeft(v) { csModuleHeaderLeft = v; } function setCSModuleHeaderText(v) { csModuleHeaderText = v; } function setCSModuleLeft(v) { csModuleLeft = v; } function setCSModuleTop(v) { csModuleTop = v; } function setCSModuleInterface(v) { csModuleInterface = v; } function setCSTop(v) { csTop = v; } function setCSWidth(v) { csWidth = v; } //dip function setDIPPath(v) { dipPath = v; } function setDIPTop(v) { dipTop = v; } function setDIPLeft(v) { dipLeft = v; } //hs function setHSBorderColor(v) { hsBorderColor = v; } function setHSBorderSize(v) { hsBorderSize = v; } function setHSPath(v) { hsPath = v; } //lm function setLMPath(v) { lmPath = v; } function setLMHeight(v) { lmHeight = v; } function setLMRLLeft(v) { lmrlLeft = v; } function setLMRLText(v) { lmrlText = v; } function setLMRLTop(v) { lmrlTop = v; } function setLMWidth(v) { lmWidth = v; } function setLMX(v) { lmX = v; } function setLMY(v) { lmY = v; } //12.03.2003.xhbt:Adding module to show coordinates for map pin function setLMCDLeft(v) { lmcdLeft = v; } function setLMCDTop(v) { lmcdTop = v; } function setLMCDModuleEnabled(v) { lmcdModuleEnabled = v; } function setLMCDText1(v) { lmcdText1 = v; } function setLMCDText2(v) { lmcdText2 = v; } //map function setMapBorderColor(v) { mapBorderColor = v; } function setMapBorderSize(v) { mapBorderSize = v; } function setMapCenterX(v) { mapCenterX = v; } function setMapCenterY(v) { mapCenterY = v; } function setMapHeight(v) { mapHeight = v; } function setMapImageFormat(v) { mapImageFormat = v; } function setMapJPEGQuality(v) { mapJPEGQuality = v; } function setMapLeft(v) { mapLeft = v; } function setMapList(v) { mapList = v; } //------------------------ //26.07.03.xhbt //------------------------ function setMapList1(v) { mapList1 = v; } function setMapList2(v) { mapList2 = v; } function setMapList3(v) { mapList3 = v; } function setMapType(v) { mapType = v; } function setMapNames(v) { mapNames = v; } //------------------------ function setMapModuleBorderSize(v) { mapModuleBorderSize = v; } function setMapModuleBorderColor(v) { mapModuleBorderColor = v; } function setMapModuleBGColor(v) { mapModuleBGColor = v; } function setMapModuleHeaderColor(v) { mapModuleHeaderColor = v; } function setMapModuleLayout(v) { mapModuleLayout = v; } function setMapModuleLeft(v) { mapModuleLeft = v; } function setMapModuleTop(v) { mapModuleTop = v; } function setMapNumber(v) { mapNumber = v; } function setMapName(mapNumber, v) { mapName[mapNumber] = v; } function setMapProjection(v) { mapProjection = v; } function setMapTop(v) { mapTop = v; } function setMapURI(v) { mapURI = v; } function setMapWidth(v) { mapWidth = v; } //ms function setMSLeft(v) { msLeft = v; } function setMSModuleColor(v) { msModuleColor = v; } function setMSModuleEnabled(v) { msModuleEnabled = v; } function setMSModuleHeaderColor(v) { msModuleHeaderColor = v; } function setMSModuleHeaderLeft(v) { msModuleHeaderLeft = v; } function setMSModuleHeaderText(v) { msModuleHeaderText = v; } function setMSModuleLeft(v) { msModuleLeft = v; } function setMSModuleTop(v) { msModuleTop = v; } function setMSModuleInterface(v) { msModuleInterface = v; } function setMSTop(v) { msTop = v; } function setMSWidth(v) { msWidth = v; } //nav function setNavBorderColor(v) { navBorderColor = v; } function setNavBorderSize(v) { navBorderSize = v; } function setNavHeight(v) { navHeight = v; } function setNavLeft(v) { navLeft = v; } function setNavModuleColor(v) { navModuleColor = v; } function setNavModuleEnabled(v) { navModuleEnabled = v; } function setNavModuleLeft(v) { navModuleLeft = v; } function setNavModuleTop(v) { navModuleTop = v; } function setNavPath(v) { navPath = v; } function setNavPixelSizeX(v) { navPixelSizeX = v; } function setNavPixelSizeY(v) { navPixelSizeY = v; } function setNavTop(v) { navTop = v; } function setNavULX(v) { navULX = v; } function setNavULY(v) { navULY = v; } function setNavWidth(v) { navWidth = v; } //pl function setPLModuleEnabled(v) { plModuleEnabled = v; } function setPLDestination(v) { plDestination = v; } function setPLLeft(v) { plLeft = v; } function setPLText(v) { plText = v; } function setPLTop(v) { plTop = v; } //13.03.2003.xhbt function setPLManyMaps(v) { plManyMaps = v; } //sb function setSBDarkColor(v) { sbDarkColor = v; } function setSBHeight(v) { sbHeight = v; } function setSBLightColor(v) { sbLightColor = v; } function setSBModuleEnabled(v) { sbModuleEnabled = v; } function setSBModuleLeft(v) { sbModuleLeft = v; } function setSBModuleTop(v) { sbModuleTop = v; } function setSBWidth(v) { sbWidth = v; } //sb2 function setSB2DarkColor(v) { sb2DarkColor = v; } function setSB2Height(v) { sb2Height = v; } function setSB2LightColor(v) { sb2LightColor = v; } function setSB2ModuleEnabled(v) { sb2ModuleEnabled = v; } function setSB2ModuleLeft(v) { sb2ModuleLeft = v; } function setSB2ModuleTop(v) { sb2ModuleTop = v; } function setSB2Width(v) { sb2Width = v; } //swm function setSWMLeft(v) { swmLeft = v; } function setSWMText(v) { swmText = v; } function setSWMTop(v) { swmTop = v; } function setSWMBorderSize(v) { swmBorderSize = v; } function setSWMBorderColor(v) { swmBorderColor = v; } function setSWMBackground(v) { swmBackground = v; } //zoomLevel function setZoomLevel(v) { zoomLevel = v; } //11.09.2003.xhbt: txt function setTXTSModuleEnabled(v) { txtsModuleEnabled = v; } function setTXTSModuleLeft(v) { txtsModuleLeft = v; } function setTXTSModuleTop(v) { txtsModuleTop = v; } function setTXTSWidth(v) { txtsWidth = v; } function setTXTSHeight(v) { txtsHeight = v; } //CoordSystem 03.12.03.xhbt: function setCoordSystemOut(v) { coordSystemOut = v; } function setCoordSystemIn(v) { coordSystemIn = v; } function setCoordWidth(v) { coordWidth = v; } function setCoordHeight(v) { coordHeight = v; } function setCoordTop(v) { coordTop = v; } function setCoordLeft(v) { coordLeft = v; } function setCoordModuleEnabled(v) { coordModuleEnabled = v; } function setCoordVis(v) { coordVis = v; } //========================================================================= // Function that loads the enabled modules according to the settings in the // customize function. //========================================================================= function load() { //customize application customize(); // if(parent.hidden.document.cx && parent.hidden.document.cx.value != "601040" && parent.hidden.document.cy.value != "6190053"){ // if( parent.hidden.cx.value != "601040" && parent.hidden.cy.value != "6190053" ) { if( top.hidden.document.forms['hiddenform']['cx'].value != "601040" && top.hidden.document.forms['hiddenform']['cy'].value != "6190053" ) { setMapCenterX(top.hidden.document.forms['hiddenform']['cx'].value); //676000 setMapCenterY(top.hidden.document.forms['hiddenform']['cy'].value); //6124000 } //load Print link module if(getPLModuleEnabled()==true) loadPLModule(); //load country selector module if(getCSModuleEnabled()==true) loadCSModule(); //load map selector module if(getMSModuleEnabled()==true) loadMSModule(); //load navigation module and hotspot if(getNavModuleEnabled()==true) { loadNavModule(); loadHS(); } //load scale bar module if(getSBModuleEnabled()==true) loadSBModule(); //load 2nd scale bar module if(getSB2ModuleEnabled()==true) loadSB2Module(); //load search module (address default) if(getASModuleEnabled()==true) { ActiveASSearchType = c_ADDRESS; loadASModule(getASModuleDefaultLayout()); loadSWMModule(); } //load dip module loadDIPModule(); //load lmrl module loadLMRLModule(); //12.03.2003.xhbt:load lmcd module if(getLMCDModuleEnabled() == true) { loadLMCDModule(); } //11.09.2003.xhbt: loading map text module if(getTXTSModuleEnabled() == true) { loadTXTSModule(); } //10.06.2004.julian: display coordinates (copy from FindInternal) if(getCoordModuleEnabled() == true) { loadCoordModule(); } //load map module loadMapModule(getMapModuleLayout()); //load map(s) in map module for (var i=1; i<=getMapNumber(); i++) { loadMap(i); } } function loadJul() { //customize application customize(); if(top.hidden.document.forms['hiddenform']['cx'].value != "601040" && top.hidden.document.forms['hiddenform']['cy'].value != "6190053"){ setMapCenterX(top.hidden.document.forms['hiddenform']['cx'].value); //676000 setMapCenterY(top.hidden.document.forms['hiddenform']['cy'].value); //6124000 } //load Print link module if(getPLModuleEnabled()==true) loadPLModule(); //load country selector module if(getCSModuleEnabled()==true) loadCSModule(); //load map selector module if(getMSModuleEnabled()==true) loadMSModule(); //load navigation module and hotspot if(getNavModuleEnabled()==true) { loadNavModule(); loadHS(); } //load scale bar module if(getSBModuleEnabled()==true) loadSBModule(); //load 2nd scale bar module if(getSB2ModuleEnabled()==true) loadSB2Module(); mode = "jul"; //load search module (address default) if(getASModuleEnabled()==true) { loadASModule(getASModuleDefaultLayout()); loadSWMModule(); } //load dip module loadDIPModule(); //load lmrl module loadLMRLModule(); //12.03.2003.xhbt:load lmcd module if(getLMCDModuleEnabled() == true) { loadLMCDModule(); } //11.09.2003.xhbt: loading map text module if(getTXTSModuleEnabled() == true) { loadTXTSModule(); } //load map module loadMapModule(getMapModuleLayout()); //load map(s) in map module for (var i=1; i<=getMapNumber(); i++) { //loadMap(i); moveMaptoLocation("6130066,576;863257,487"); } geoVWithDelay("Julegade",'9999'); } function loadKms() { //customize application customize(); if(top.hidden.document.forms['hiddenform']['cx'].value != "601040" && top.hidden.document.forms['hiddenform']['cy'].value != "6190053"){ setMapCenterX(top.hidden.document.forms['hiddenform']['cx'].value); //676000 setMapCenterY(top.hidden.document.forms['hiddenform']['cy'].value); //6124000 } //load Print link module if(getPLModuleEnabled()==true) loadPLModule(); //load country selector module if(getCSModuleEnabled()==true) loadCSModule(); //load map selector module if(getMSModuleEnabled()==true) loadMSModule(); //load navigation module and hotspot if(getNavModuleEnabled()==true) { loadNavModule(); loadHS(); } //load scale bar module if(getSBModuleEnabled()==true) loadSBModule(); //load 2nd scale bar module if(getSB2ModuleEnabled()==true) loadSB2Module(); mode = "kms"; //load search module (address default) if(getASModuleEnabled()==true) { loadASModule(getASModuleDefaultLayout()); loadSWMModule(); } //load dip module loadDIPModule(); //load lmrl module loadLMRLModule(); //12.03.2003.xhbt:load lmcd module if(getLMCDModuleEnabled() == true) { loadLMCDModule(); } //11.09.2003.xhbt: loading map text module if(getTXTSModuleEnabled() == true) { loadTXTSModule(); } //load map module loadMapModule(getMapModuleLayout()); //load map(s) in map module for (var i=1; i<=getMapNumber(); i++) { //loadMap(i); moveMaptoLocation("6178892,299;722125,868"); } geoAWithDelay("5804;101",'9999'); } //========================================================================= // Display/loads the address search (AS) module //========================================================================= function loadASModule(searchType) { var imgLM = document.getElementById("imgLM"); imgLM.style.visibility = "hidden"; imgLM.style.zIndex = 13; imgLM.src = getLMPath(); if(searchType == c_COORDINATES){ gSearchType = searchType; // save searchType in global variable for use in loadLM() } else{ gSearchType = 0; } //display module var divASModule = document.getElementById("divASModule"); divASModule.style.position = "absolute"; divASModule.style.top = getASModuleTop() + "px"; divASModule.style.left = getASModuleLeft()-9 + "px"; divASModule.style.zIndex = 1; divASModule.innerHTML = asModule(searchType); } //========================================================================= // Display/loads the country selector (CS) module //========================================================================= function loadCSModule() { var divCSModule = document.getElementById("divCSModule"); divCSModule.innerHTML = csModule(); } //========================================================================= // Display/loads the country selector (CS) module //========================================================================= function loadDIPModule() { var imgDIP = document.getElementById("imgDIP"); imgDIP.src = getDIPPath(); imgDIP.style.position = "absolute"; imgDIP.style.top = getDIPTop(); imgDIP.style.left = getDIPLeft(); imgDIP.style.zIndex = 100; // was 11 julian 040517 imgDIP.style.visibility = "visible"; } //========================================================================= // Function that displays/loads the hotspot module //========================================================================= function loadHS() { //get image var imgHS = document.getElementById("imgHS"); imgHS.src = getHSPath(); //Set color of hotspot border imgHS.style.border = getHSBorderSize() + "px solid " + getHSBorderColor(); } //========================================================================= // Function that loads the location marker if location is within the // current map's area. This function is triggered when the map has just // loaded. //========================================================================= function loadLM(mapNumber) { //show marker for latest search result if it is located within the map var lmx = getLMX(); var lmy = getLMY(); if (isPointWithinMap(mapNumber, lmx, lmy)==true) { showLM(mapNumber, lmx, lmy); showLMRLModule(); //12.03.2003.xhbt: if(getLMCDModuleEnabled() == true && gSearchType == c_COORDINATES){ showLMCDModule(lmx, lmy); } } } //========================================================================= // Display/loads the LMRemoveLink module //========================================================================= function loadLMRLModule() { //load module var divLMRLModule = document.getElementById("divLMRLModule"); divLMRLModule.style.visibility = "visible"; //hidden as it will only be displayed after a search // divLMRLModule.style.visibility = "hidden"; //hidden as it will only be displayed after a search divLMRLModule.innerHTML = lmrlModule(); } //========================================================================= // 12.03.2003.xhbt:Display/loads the LMCDShowCoord module //========================================================================= function loadLMCDModule() { //load module // var obj = eval("divLMCDModule"); var divLMCDModule = document.getElementById( "divLMCDModule" ); divLMCDModule.style.visibility = "hidden"; //hidden as it will only be displayed after a search divLMCDModule.innerHTML = lmcdModule(0,0); } //========================================================================= // Function that loads a map and synchronizes the hotspot so its location // and size corresponds to the map area just loaded //========================================================================= function loadMap(mapNumber) { //show downloading image picture showDownloadingImagePicture(mapNumber); //clear all markers on map clearLM(); //load map image var mapImg = document.getElementById( "imgMap" + mapNumber ); mapImg.src = getMapURL(mapNumber); //synchronize map and HS on navigation image - only if nav is enabled if (getNavModuleEnabled()==true) syncHS(mapNumber); //synchronize scale bar to map - only if scale bar is enabled if (getSBModuleEnabled()==true) syncSB(mapNumber) //if(getCSID() == "dk"){ //don't restrict coordinate showing to DK var cx = getMapCenterX(); var cy = getMapCenterY(); //top.hidden.document.getElementById("cx").value = cx; //top.hidden.document.getElementById("cy").value = cy; top.hidden.document.forms['hiddenform']['cx'].value = cx; top.hidden.document.forms['hiddenform']['cy'].value = cy; // update coordinates in coordinate display module if (getCoordModuleEnabled()==true && getCoordVis() == 2){ var northing = document.getElementById( "N" ); var easting = document.getElementById( "E" ); northing.innerHTML = cy; easting.innerHTML = cx; } //} return false; } //========================================================================= // Display/loads the map module //========================================================================= function loadMapModule(layout) { //set position of upper left corner of map image setMapTop(getMapModuleTop()+getMapModuleBorderSize()+getMapBorderSize()); setMapLeft(getMapModuleLeft()+getMapModuleBorderSize()+getMapBorderSize()); var divMapModule = document.getElementById("divMapModule"); divMapModule.innerHTML = mapModule(layout); } //========================================================================= // Display/loads the map selector (MS) module //========================================================================= function loadMSModule() { var divMSModule = document.getElementById("divMSModule"); divMSModule.innerHTML = msModule(); } //========================================================================= // Display/loads the navigation (NAV) module //========================================================================= function loadNavModule() { //set position of upper left corner of navigation image setNavTop(getNavModuleTop()); setNavLeft(getNavModuleLeft()); var divNavModule = document.getElementById("divNavModule"); divNavModule.innerHTML = navModule(); } //========================================================================= // Display/loads the print link (PL) module //========================================================================= function loadPLModule() { var divPLModule = document.getElementById("divPLModule"); divPLModule.innerHTML = plModule(); divPLModule.style.position = "absolute"; divPLModule.style.left = getPLLeft()+"px"; divPLModule.style.top = getPLTop()+"px"; } //========================================================================= // Display/loads the scale bar (SB) module //========================================================================= function loadSBModule() { var divSBModule = document.getElementById("divSBModule"); divSBModule.innerHTML = sbModule(); } //========================================================================= // Display/loads the second scale bar (SB2) module //========================================================================= function loadSB2Module() { var divSB2Module = document.getElementById("divSB2Module"); divSB2Module.innerHTML = sb2Module(); } //========================================================================= // Loads the search wait message (SWM) module //========================================================================= function loadSWMModule() { var divSWMModule = document.getElementById("divSWMModule"); divSWMModule.innerHTML = " " + getSWMText() + " "; divSWMModule.style.visibility = "hidden"; divSWMModule.style.position = "absolute"; divSWMModule.style.height = "15px"; divSWMModule.style.border = ""+getSWMBorderSize()+"px solid " + getSWMBorderColor(); divSWMModule.style.background = ""+getSWMBackground(); divSWMModule.style.left = ""+getSWMLeft()+"px"; divSWMModule.style.top = ""+getSWMTop()+"px"; divSWMModule.style.zIndex = "10"; } //11.09.2003.xhbt: //========================================================================= // Display/loads the text (TXTS) module //========================================================================= function loadTXTSModule() { //set position of upper left corner of navigation image var divTXTSModule = document.getElementById("divTXTSModule"); divTXTSModule.innerHTML = txtsModule(); } //========================================================================= // Display/loads the coordsystem (Coord) module //========================================================================= function loadCoordModule() { var divCoordModule = document.getElementById("divCoordModule"); // workaround 040630.julian // it seems that when the applikation is called with "index.htm?map=dk", // divCoordModule is somehow undefined at initial load time (but not thereafter) // Calling the application as simply "index.htm" without parameters seems to solve it. if( divCoordModule ) divCoordModule.innerHTML = coordModule(); } //30.04.2003.xhbt: Adding if conditions for coordSearch //========================================================================= // Functions that create the address search (AS) module //========================================================================= function asModule(searchType) { var html = ""; var bg = getASModuleColor(); var t = getASModuleTop(); var l = getASModuleLeft(); var ht = getASModuleHeaderText(); var tw = 226; var w = getASWidth(); var rc = 50; html += ""; return(html); } //========================================================================= // Functions that create the country selector (CS) module //========================================================================= function csModule() { var w = getCSWidth(); var tw = w+ 41; //62; var t = getCSModuleTop(); var l = getCSModuleLeft(); var ht = getCSModuleHeaderText(); var bg = getCSModuleColor(); //create html var html = ""; html+="
"; html+=" "; html+=" "; html+=" "; html+=" "; html+=" "; html+=" "; html+=" "; html+=" "; html+=" "; html+=" "; html+="
"+ht+"
"; html += ""; html+="
"; html+="
"; return(html); } //========================================================================= // Functions that create the lmRemoveLink module //========================================================================= function lmrlModule() { var html = ""; var t = getLMRLTop(); var l = getLMRLLeft(); html += ""; html += "  "; //30.04.2003.xhbt: html += getLMRLText(); html += ""; return(html); } //========================================================================= // // 12.03.2003.xhbt:Functions that create the lmCoord module //========================================================================= function lmcdModule(utmx,utmy) { var html = ""; var t = getLMCDTop(); var l = getLMCDLeft(); html += "

"; html += getLMCDText1() + utmx + getLMCDText2() +utmy; html += "

"; return(html); } //========================================================================= // Functions that create the map module //========================================================================= function mapModule(layout) { //required parameters var mapwidth = getMapWidth()-1; var mapheight = getMapHeight()-1; var buffer = getMapModuleBorderSize(); //size in pixel of "buffer" cells around map var mbs = getMapBorderSize(); var mbc = getMapBorderColor(); var t = getMapModuleTop(); var l = getMapModuleLeft(); if (layout==c_FIND_ET_STED) { var tw = mapwidth+(2*mbs)-6+(2*buffer); //table width var th = mapheight+(2*mbs)-2+(2*buffer); //table height var bcw = parseInt((mapwidth+(2*mbs)-20)/4); //horisontal cell width var bch = parseInt((mapheight+(2*mbs)-20)/4); //vertical cell height //create HTML var html = ""; html +=""; html +=""; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; // html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +="
\"panorer\"panorer\"panorer\"panorer\"panorer\"panorer\"panorer
\"panorer\"panorer
\"panorer\"panorer
\"panorer\"panorer
\"panorer\"panorer
\"panorer\"panorer
\"panorer\"panorer\"panorer\"panorer\"panorer\"panorer\"panorer
"; html +=""; } else if (layout==c_DK_FOER_OG_NU) { var tw = mapwidth+1+(2*mbs)-6+(2*buffer); //table width var th = mapheight+1+(2*mbs)-2+(2*buffer); //table height var bcw = parseInt((mapwidth-20)/4); //horisontal cell width var bch = parseInt((mapheight+(2*mbs)-20)/4); //vertical cell height // mozilla 040510 var div2top = t+buffer; var div2left = l + buffer; //create HTML var html = ""; // html +="
"; // html +="
"; // html +="
"; html +="
"; html +="
"; html +=""; html +=""; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html+=" "; if (nom>1) { html += ""; if (j==2) html += ""; else html += ""; } html+=" "; } html+="
\"panorer\"panorer\"panorer\"panorer\"panorer\"panorer\"panorer
\"panorer"; // for some reason, IE reckons top:16px; left 16px; places divMapn inside MapModule table... // these lines have been moved up before // html +="
"; // html +="
"; html +=""; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +="
\"panorer
\"panorer\"panorer
\"panorer\"panorer
\"panorer\"panorer
\"panorer\"panorer
\"panorer\"panorer\"panorer\"panorer\"panorer\"panorer\"panorer
"; html +=""; html +=""; //18.03.2003.xhbt.begin: Bugfix for historic divider on map // html +="
"; html +="
"; // html +="
"; // html +="
"; html +=""; //18.03.2003.xhbt.end: Bugfix for historic divider on map html +=" "; html +=" "; html +=" "; html +="
 
"; html +="
"; html +=""; html +=""; html +="
"; html +=""; html +=" "; html +=" "; html +=" "; html +="
"; html +="
"; html +=""; //18.03.2003.xhbt.begin: Bugfix for historic divider on map // html +="
"; html +="
"; html +=""; //18.03.2003.xhbt.end: Bugfix for historic divider on map html +=" "; html +=" "; html +=" "; html +="
 
"; html +="
"; html +=""; html +="
"; } else { var tw = mapwidth+(2*mbs)-6+(4*buffer)-6; //table width var th = mapheight+(2*mbs)-2+(2*buffer); //table height var bcw = parseInt(mapwidth/2); //horisontal cell width var bch = parseInt((mapheight+(2*mbs)-20)/4); //vertical cell height // mozilla 040510 var div2top = t+buffer; var div2left = l + buffer; //create HTML var html = ""; html +=""; html +=""; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; // html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +=" "; html +="
\"panorer\"panorer\"panorer\"panorer\"panorer\"panorer\"panorer
\"panorer"; // this line made Mozilla go bad: // (1) table width/height of 100% was interpreted relative to the whole window // (2) style="position:absolute" without top or left values .... pfui! (But this is not the complete story, since single cells subsequently set their z-index -1) // html +=" "; // this made IE go bad // html +="
"; // html +=" "; // rowspan and colspan added - julian 040510 // html +=" "; html +=" "; html +=" "; // html +=" "; html +=" "; // html +=" "; // html +="
"; html +="
\"panorer
\"panorer\"panorer
\"panorer\"panorer
\"panorer\"panorer
\"panorer\"panorer
\"panorer\"panorer\"panorer\"panorer\"panorer\"panorer\"panorer
"; html +=""; } return(html); // return html; } //========================================================================= // Functions that create the map selector (MS) module //========================================================================= function msModule() { var nom = getMapNumber(); var mn = getMapName(mapNumber); var w = getMSWidth(); var tw = w+ 41; //62; var t = getMSModuleTop(); var l = getMSModuleLeft(); var ht = getMSModuleHeaderText(); var bg = getMSModuleColor(); var maptype = getMapType(); //create html var html=""; html+="
"; html+=""; html+=" "; html+=" "; html+=" "; html+=" "; html+=" "; html+=" "; if(newLook == true){ if(getCSID() == "dk"){ var mapLists; if(getMapModuleLayout() != c_DK_DETALJER){ if( getMapModuleLayout() != c_DK_FOER_OG_NU ) { html+=" "; html+=" "; html+=" "; } // !c_DK_FOER_OG_NU mapLists = getMapLists(maptype); //setMapName(); if( getMapModuleLayout() == c_DK_FOER_OG_NU ) { //selector for historical map (map #2) html+=" "; html+=" "; html +=" "; } else { // c_DK_FOER_OG_NU //create a mapselector for each available map for (var j=1; j<=nom ; j++) { html+=" "; html+=" "; html +=" "; } } } else{ mapLists = getMapList(); for (var j=1; j<=nom ; j++) { html+=" "; html+=" "; html+=" "; } } html+="
"+ht+"
"; html += ""; html+="
"; html += ""; html += ""; html += ""; html +="
"; html += ""; html += ""; html += ""; html +="
"; html += ""; html += ""; html += ""; html+="
"; html+="
"; } else{ //if other countries //create a mapselector for each available map for (var j=1; j<=nom ; j++) { html+="
"; html += ""; html+="HøjreVenstre
"; } //end other countries } else{ //if new look is false setMapList(Array("DTK_Skaermkort_4","DTK_Skaermkort_10","DTK_Kort25_klassisk","D_100","D_200","D_3200","none","M_20","M20_lav","D_25")); //create a mapselector for each available map for (var j=1; j<=nom ; j++) { html+=" "; html+=" "; html += ""; html+=""; if (nom>1) { html += ""; if (j==2) html += "Højre"; else html += "Venstre"; } html+=" "; } html+=""; } return(html); } //========================================================================= // Functions that create the navigation (NAV) module //========================================================================= function navModule() { var html = ""; var nw = getNavWidth(); var nh = getNavHeight(); var np = getNavPath(); var t = getNavTop(); var l = getNavLeft(); var bc = getNavBorderColor(); var bs = getNavBorderSize(); //create html // html +=""; // html += ""; html +=""; html += ""; return(html); } function triggerGeoS() { geoS(document.formPNS.stednavn.value); return(false); } //========================================================================= // Functions that create the Print Link module //========================================================================= function plModule() { var html = ""; if(getMapModuleLayout() == c_FIND_ET_STED){ html += ""; html += " "; html += getPLText(); html += ""; } return(html); } //========================================================================= // Functions that create the scale bar (SB) module //========================================================================= function sbModule() { var lw = 1; //line width var w = parseInt((getSBWidth()-(3*lw))/2); var h = getSBHeight(); var l = getSBModuleLeft(); var t = getSBModuleTop(); var html=""; html+=""; html+=" " html+=" "; html+=" "; html+=" "; html+=" "; html+=" "; html+=" "; html+="
"; html+="
0m
"; html+="
"; html+="
"; return(html); } //========================================================================= // Functions that create a second scale bar (SB2) module //========================================================================= function sb2Module() { var lw = 1; //line width var w = parseInt((getSB2Width()-(3*lw))/2); var h = getSB2Height(); var l = getSB2ModuleLeft(); var t = getSB2ModuleTop(); var html=""; html+=""; html+=" " html+=" "; html+=" "; html+=" "; html+=" "; html+=" "; html+=" "; html+="
"; html+="
0m
"; html+="
"; html+="
"; return(html); } //11.09.2003.xhbt: text module //========================================================================= // Functions that create the text (TXTS) module //========================================================================= function txtsModule() { var html = ""; var w = getTXTSWidth(); var h = getTXTSHeight(); var t = getTXTSModuleTop(); var l = getTXTSModuleLeft(); var bc = getNavBorderColor(); var bs = getNavBorderSize(); // html+=""; html+="
"; html+=" " html+=" "; html+=" "; html+="
"; // html+=" "; html+=" "; //html+=" © Kort & Matrikelstyrelsen"; html+="
"; //create html return html; } //========================================================================= // Functions that create the coordsystem module //========================================================================= function coordModule() { var html = ""; var t = getCoordTop(); var l = getCoordLeft(); var w = getCoordWidth(); var cx = getMapCenterX(); var cy = getMapCenterY(); if(getCoordVis() == 1){ html += ""; html += "  "; //30.04.2003.xhbt: html += "Vis centerkoordinat"; html += ""; } else{ html += ""; html += "  "; //30.04.2003.xhbt: html += "Skjul centerkoordinat"; html += ""; t = t + 10 html += "

"; // if(ActiveASSearchType == c_COORDINATES){ html += ""; html += " "; // html +=" "; html += " "; html += " "; html += " "; html += " "; html += " "; html += " "; html += " "; html += "
"; html +=" "; if( getCSID() == "dk" ) html += " (UTM32 ETRS89):"; if( getCSID() == "gr" ) html += " (UTM24 WGS84):"; if( getCSID() == "faro" ) html += " (UTM29 ETRS89):"; html += "
N: " + cy + "E: " + cx + "
"; html += "

"; } return(html); } function changeCoordVis(cc){ setCoordVis(cc); loadCoordModule(); } //========================================================================= // Function that changes the currently loaded map to another. //========================================================================= function changeCountry(country) { setCSID(country); //setMapNumber(1); //setMapModuleLayout(c_FIND_ET_STED); if (country=="dk") { //use full place name search loadASModule(c_PLACENAME); //setMapList(Array("D_3200","D_300","D_100")); setMapList(Array("1","2")); setMapName(1,"DTK_Skaermkort_10"); setMapProjection("EPSG:32632"); //32632 setMapCenterX(601040); //676000 setMapCenterY(6190053); //6124000 setNavWidth(172); setNavHeight(133); setNavPixelSizeX(2740); //2014 setNavPixelSizeY(2907); //2014 setNavULX(432190); //429190 setNavULY(6424389); //6408389 setNavPath("images/sat_dk_70.gif"); setNavModuleLeft(560); setNavModuleTop(88); setPLDestination("findetsted_udskrift.htm"); setSWMTop(393); //324 } else { //use place name search only loadASModule(c_PLACENAME_ONLY); if (country=="gr") { setMapList(Array("G_2500","G_500")); setMapName(1,"G_2500"); setMapProjection("EPSG:32624"); setMapCenterX(-69578); setMapCenterY(7710779); setNavWidth(164); setNavHeight(134); setNavPixelSizeX(21329); setNavPixelSizeY(21419); setNavULX(-1310000); setNavULY(9370000); setNavPath("images/sat_gr_70.gif"); setNavModuleLeft(546); setNavModuleTop(88); setPLDestination("findetsted_udskrift.htm"); setSWMTop(373); } else { setMapList(Array("F_100")); setMapName(1,"F_100"); setMapProjection("EPSG:32629"); //23029 setMapCenterX(617389); setMapCenterY(6877914); //setMapModuleLayout(c_FIND_ET_STED); setNavWidth(164); setNavHeight(134); setNavPixelSizeX(908); setNavPixelSizeY(911); setNavULX(534257); setNavULY(6925400); setNavPath("images/sat_faro_70.gif"); setNavModuleLeft(546); setNavModuleTop(88); setPLDestination("findetsted_udskrift.htm"); setSWMTop(373); } } //load map selector module if(getMSModuleEnabled()==true) loadMSModule(); //load navigation module and hotspot if(getNavModuleEnabled()==true) { loadNavModule(); loadHS(1); } loadCoordModule(); //load lmrl module loadLMRLModule(); // 12.03.2003.xhbt:load lmcd module loadLMCDModule(); // 02.09.2003.xhbt:load PLModule loadPLModule(); //11.09.2003.xhbt: load seach text loadSWMModule(); //load map module loadMapModule(getMapModuleLayout()); //load map(s) in map module for (var i=1; i<=getMapNumber(); i++) { loadMap(i); } } //========================================================================= // Function that changes the currently loaded map to another. //========================================================================= function changeMap(mapNumber, mapName) { if(mapName == "none"){ } else{ setMapName(mapNumber, mapName); loadMap(mapNumber); } } //========================================================================= // Function that clears any location marks on the map. //========================================================================= function clearLM() { var imgLM = document.getElementById( "imgLM" ); var divLMRLModule = document.getElementById( "divLMRLModule" ); var divLMCDModule = document.getElementById( "divLMCDModule" ); // alert("clearLM (3254): imgLM, divLMRL are about to be hidden"); imgLM.style.visibility = "hidden"; divLMRLModule.style.visibility = "hidden"; // 12.03.2003.xhbt: if(getLMCDModuleEnabled() == true){ divLMCDModule.style.visibility = "hidden"; } } //========================================================================= // Function that converts the X part of a UTM coordinate to the correspon- // ding screen x. //========================================================================= function utmXtoScreenX(mapNumber, x) { var ps = getMapPixelSize(getMapName(mapNumber)); var cx = getMapCenterX(); var w = getMapWidth(); var scrulx = getMapLeft(); var utmulx = getULX(cx, ps, w); return(parseInt((x-utmulx)/ps)+scrulx); } //========================================================================= // Function that converts the Y part of a UTM coordinate to the correspon- // ding screen y. //========================================================================= function utmYtoScreenY(mapNumber, y) { var ps = getMapPixelSize(getMapName(mapNumber)); var cy = getMapCenterY(); var h = getMapHeight(); var scruly = getMapTop(); var utmuly = getULY(cy, ps, h); return(parseInt((utmuly-y)/ps)+scruly); } //========================================================================= // Function that shows the location marker on the map //========================================================================= function showLM(mapNumber,utmx, utmy) { //convert UTM point to screen point var l = utmXtoScreenX(mapNumber,utmx)-12; var t = utmYtoScreenY(mapNumber,utmy)-36; var imgLM = document.getElementById( "imgLM" ); imgLM.style.position = "absolute"; imgLM.style.zIndex = "13"; imgLM.style.left = ""+l+"px"; imgLM.style.top = ""+t+"px"; imgLM.style.visibility = "visible"; } //========================================================================= // Function that show the hyperlink to remove the location marker from map //========================================================================= function showLMRLModule() { var divLMRLModule = document.getElementById( "divLMRLModule" ); divLMRLModule.style.visibility = "visible"; } //========================================================================= // 12.03.2003.xhbt: Function that show the coords for the location marker from map //========================================================================= function showLMCDModule(utmx,utmy) { // var obj = eval("divLMCDModule"); var divLMCDModule = document.getElementById( "divLMCDModule" ); divLMCDModule.innerHTML = lmcdModule(utmx,utmy); divLMCDModule.style.visibility = "visible"; } //========================================================================= // Function that returns true if the UTM point (x,y) is within the current // map area. Otherwise false is returned. //========================================================================= function isPointWithinMap(mapNumber,x,y) { var w=getMapWidth(); var h=getMapHeight(); var ps=getMapPixelSize(getMapName(mapNumber)); var cx=getMapCenterX(); var cy=getMapCenterY(); var dx = getLMWidth()/2*ps; var dy = getLMHeight()/2*ps; var minx=getULX(cx, ps, w) + dx; var miny=getLRY(cy, ps, h); var maxx=getLRX(cx, ps, w) - dx; var maxy=getULY(cy, ps, h) - dy; if(x>=minx && x<=maxx && y>=miny && y<=maxy) return(true); else return(false); } //========================================================================= // Function that moves the map a half map's width/height to one of eight // directions //========================================================================= function moveMap(mapNumber, direction) { var ps = Number(getMapPixelSize(getMapName(mapNumber))); if (getMapModuleLayout()==c_DK_DETALJER) // we choose the smallest pixel size, corresponding to the map with finest scale { var ps1 = getMapPixelSize( getMapName(1) ); var ps2 = getMapPixelSize( getMapName(2) ); ps = ps1 < ps2 ? ps1 : ps2; } var w = Number(getMapWidth()); var h = Number(getMapHeight()); var cx = Number(getMapCenterX()); var cy = Number(getMapCenterY()); if (direction=='N') { cy += (h / 2 * ps); } if (direction=='S') { cy -= (h / 2 * ps); } if (direction=='W') { cx -= (w / 2 * ps); } if (direction=='E') { cx += (w / 2 * ps); } if (direction=='NE') { cy += (h / 2 * ps); cx += (w / 2 * ps); } if (direction=='NW') { cy += (h / 2 * ps); cx -= (w / 2 * ps); } if (direction=='SW') { cy -= (h / 2 * ps); cx -= (w / 2 * ps); } if (direction=='SE') { cy -= (h / 2 * ps); cx += (w / 2 * ps); } //update variables setMapCenterX(cx); setMapCenterY(cy); //reload map if( (getMapModuleLayout()==c_DK_FOER_OG_NU) || (getMapModuleLayout()==c_DK_DETALJER) ) { for (var i=1; i<=getMapNumber(); i++) loadMap(i); } else loadMap(mapNumber); } //========================================================================= // Function that occurs when mouse buttion is clicked over map or nav. // Action depends on where the cursor was placed (map or nav). //========================================================================= function mouseClicked(e) { if( !e ) e=window.event; //IE // var cursorX = getMouseX(); // var cursorY = getMouseY(); var x = e.clientX; var y = e.clientY; var mapClicked = false; var navClicked = false; var navLeft = getNavModuleLeft() + getNavBorderSize(); var navRight = navLeft + getNavWidth(); var navTop = getNavModuleTop() - getNavBorderSize(); var navBottom = navTop + getNavHeight(); var map1Left = getMapModuleLeft() + getMapModuleBorderSize() + getMapBorderSize(); var map1Right = map1Left + getMapWidth(); var map1Top = getMapModuleTop() + getMapModuleBorderSize() + getMapBorderSize(); var map1Bottom = map1Top + getMapHeight(); if( getMapModuleLayout()==c_DK_DETALJER) { var map2Left = map1Right + getMapModuleBorderSize() + 2*getMapBorderSize(); var map2Right = map2Left + getMapWidth(); var map2Top = map1Top; var map2Bottom = map1Bottom; } var ml = getMapLeft(); var mt = getMapTop(); var ps; var cx = getMapCenterX(); var cy = getMapCenterY(); // did click occur within navModule (incl. HS) if( navLeft <= x && x <= navRight && navTop <= y && y <= navBottom ) { navClicked = true; cx = Number(getCenterXFromNav(x, getNavPixelSizeX(), getNavULX())); cy = Number(getCenterYFromNav(y, getNavPixelSizeY(), getNavULY())); var ps1 = Number(getMapPixelSize(getMapName(1))); if( getMapModuleLayout()==c_DK_DETALJER ) { var ps2 = Number(getMapPixelSize(getMapName(2))); ps = ps1DELAY*0.9) { if (result != "") { if (result != "0;0") //due to 0;0 coordinates in address database { //split result var coordinates = new Array(2); coordinates = result.split(";"); //convert to float var newCenterX = parseFloat(coordinates[1]); var newCenterY = parseFloat(coordinates[0]); //set center coordinate setMapCenterX(newCenterX); setMapCenterY(newCenterY); //set PNS marker coordinate setLMX(newCenterX); setLMY(newCenterY); //load map(s) in map module for (var i=1; i<=getMapNumber(); i++) { loadMap(i); } } else alert("Der var ikke muligt at stedbestemme adressen."); } } } //========================================================================= // //========================================================================= function moveMaptoLocationWithDelay(result) { LASTCLICKTIME = timeSince70(); window.setTimeout("moveMaptoLocation('"+result+"')", DELAY); } //========================================================================= // Function that replaces "text" by "by" in string "string". //========================================================================= function replace(string,text,by) { // Replaces text with by in string var strLength = string.length, txtLength = text.length; if ((strLength == 0) || (txtLength == 0)) return string; var i = string.indexOf(text); if ((!i) && (text != string.substring(0,txtLength))) return string; if (i == -1) return string; var newstr = string.substring(0,i) + by; if (i+txtLength < strLength) newstr += replace(string.substring(i+txtLength,strLength),text,by); return newstr; } //========================================================================= // Function that rounds number to X decimals. //========================================================================= function round(number, X) { //rounds number to X decimal places, defaults to 2 X = (!X ? 2 : X); return Math.round(number*Math.pow(10,X))/Math.pow(10,X); } //========================================================================= // Function that synchronize the position and size of the hot spot to the // map. //========================================================================= function syncHS(mapNumber) { var l = getHSLeft(mapNumber,getMapCenterX()); var t = getHSTop(mapNumber,getMapCenterY()); var w = getHSWidth(mapNumber); var h = getHSHeight(mapNumber); var nl = getNavLeft(); var nt = getNavTop(); var nw = getNavWidth(); var nh = getNavHeight(); var bs = getHSBorderSize(); var bc = getHSBorderColor() var bl = "" + bs + "px solid " + bc; var br = "" + bs + "px solid " + bc; var bt = "" + bs + "px solid " + bc; var bb = "" + bs + "px solid " + bc; //left if(l(nl+nw)) // if hs-right is outside nav { w-=(l+w)-(nl+nw); // subtract from hs-width the distance from nav-right to hs-right br="0px solid " + bc; } //top if(t(nt+nh)) // if hs-bottom is outside ("greater than" = "below") nav { h-=(t+h)-(nt+nh); // subtract from hs-height the distance between nav-bottom and hs-bottom bb="0px solid " + bc; } //positions the hot spot. var imgHSStyle = document.getElementById( "imgHS" ).style; imgHSStyle.zIndex = 10; imgHSStyle.position = "absolute"; imgHSStyle.left = "" + l + "px"; imgHSStyle.top = "" + t + "px"; //sets hot spot border. imgHSStyle.borderLeft = bl; imgHSStyle.borderRight = br; imgHSStyle.borderTop = bt; imgHSStyle.borderBottom = bb; //resizes the hot spot so it's size correspond to the map. imgHSStyle.width = w; imgHSStyle.height = h; } //========================================================================= // Function that synchronize the scale bar so it's scale corresponds to the // map. //========================================================================= function syncSB(mapNumber) { //get pixel size var ps = getMapPixelSize(getMapName(mapNumber)); //get scale bar width if (mapNumber>1 && getMapModuleLayout==c_DK_DETALJER) var w = getSB2Width(); else var w = getSBWidth(); var start = 0; var mid = parseInt(0.5 * ps * w); var end = parseInt(ps * w); //check if thousand separator (km) is necessary if (ps*w<1000) { start+="m"; mid+="m"; end+="m"; } else { start+="km"; mid=round(mid/1000,2); mid+="km"; end=round(end/1000,2); end+="km"; } //change scale bar if (mapNumber>1 && getMapModuleLayout()==c_DK_DETALJER) { var divSB2StartLabel = document.getElementById("divSB2StartLabel"); divSB2StartLabel.innerHTML = start; var divSB2EndLabel = document.getElementById("divSB2EndLabel"); divSB2EndLabel.innerHTML = end; var divSB2MidLabel = document.getElementById("divSB2MidLabel"); divSB2MidLabel.innerHTML = mid; } else { var divSBStartLabel = document.getElementById("divSBStartLabel"); divSBStartLabel.innerHTML = start; var divSBEndLabel = document.getElementById("divSBEndLabel"); divSBEndLabel.innerHTML = end; var divSBMidLabel = document.getElementById("divSBMidLabel"); divSBMidLabel.innerHTML = mid; } } //========================================================================= function getDecimal(n) { var m = getInteger(n); return(n-m); } //========================================================================= function getInteger(n) { if (n<0) return(Math.ceil(n)); else return(Math.floor(n)); } //========================================================================= function showSearchWaitMessage() { var divSWMModule = document.getElementById( "divSWMModule" ); divSWMModule.style.visibility = "visible"; } //========================================================================= function hideSearchWaitMessage() { var divSWMModule = document.getElementById( "divSWMModule" ); divSWMModule.style.visibility = "hidden"; } //========================================================================= function showDownloadingImagePicture(mapNumber) { // This is tricky. // It appears that the onload event for the map image is not executed by Opera when the src attribute of the img is // changed. Thus, hideDownloadingImagePicture() is called when the application is first loaded - but not when the // user navigates! 040628.julian // This solution is chosen, since Opera by itself displays a dowloading bar while an image is being downloaded. if( navigator.userAgent.indexOf( "Opera" ) < 0 ) { if (mapNumber==1) ISIMAGE1LOADED = false; else ISIMAGE2LOADED = false; var imgDIP = document.getElementById( "imgDIP" ); imgDIP.style.visibility = "visible"; } } //========================================================================= function hideDownloadingImagePicture(imgIndex, numberOfImages) { var imgDIP = document.getElementById( "imgDIP" ); //alert("hide DIP"+imgIndex); if (numberOfImages==1) ISIMAGE2LOADED = true; if (imgIndex==1) ISIMAGE1LOADED = true; else ISIMAGE2LOADED = true; if (ISIMAGE1LOADED != true || ISIMAGE2LOADED != true) imgDIP.style.visibility = "visible"; else imgDIP.style.visibility = "hidden"; } //========================================================================= function showPrintPreview(pdffile) { var url; url = getPLDestination()+"?"+getMapURLParameters(pdffile); window.open(url,"Udskriv","toolbar=no,scrollbars=yes,location=no,status=yes,menubar=no,width=789,height=500,screenX=0,screenY=0,top=0,left=0,resizable=yes"); } //========================================================================= function stripEnd(string, character) { var endpos; for (var i=0; i"; html+=""; html+=" "; html+=" "; html+=" "; html+=" "; html+=" "; html+=" "; html+=" "; html+=" "; html+=" "; html+="
"+ht+"
"; html += ""; html+="
"; html+=""; return(html); } //------------------------------------------------------------------------- //10.03.03.xhbt.end: Adding function to open different countries in windows //------------------------------------------------------------------------- //========================================================================= function openInfoWindow(path) { //open window og send med variable var url = "info.htm?" + getMetaPath(); //window.open(url,"Udskriv","toolbar=no,scrollbars=yes,location=yes,status=yes,menubar=yes,width=789,height=500,screenX=0,screenY=0,top=0,left=0,resizable=yes"); window.open(url,"Info","toolbar=no,location=no,directories=no,menubar=no,scrollbars=no,resizable=no,status=no,width=450,height=450"); } //========================================================================= // Function that makes metadataurl //========================================================================= function getMetaPath() { var url=""; var mapName = getMapName(1); var ps = getMapPixelSize(mapName); url += "name="+getMapInfo(c_ALIAS, mapName); url += "&srs=" + getMapProjection(); url += "&ps=" + ps; url += "&scale=" + getMapInfo(c_SCALE, mapName); url += "&service=" + mapName; return url; } //========================================================================= // Function that changes the currently loaded map to another. //========================================================================= function changeType(typeNo) { var html = ""; var nom = getMapNumber(); var mn = getMapName(mapNumber); var w = getMSWidth(); var tw = w+62; var t = getMSModuleTop(); var l = getMSModuleLeft(); var ht = getMSModuleHeaderText(); var bg = getMSModuleColor(); //setMapType(typeNo); var mapLists = getMapLists(typeNo); typeNo = typeNo -1; //create a mapselector for each available map for (var j=1; j<=nom ; j++) { html += ""; } //Update listbox content var tdMapResult = document.getElementById( "tdMapResult" ); tdMapResult.innerHTML = html; changeMap(1,getMapNames(typeNo)); }