{ /** * Internal state vars. */ var config; var geoWindow; /** * Main, public API function. */ function myGeoPositionGeoPicker(configObj) { /** * Check for config data and store in specific var */ if (typeof configObj != 'object') { return; } config = configObj; /** * Get page META information */ var metaWindowTitle = ''; var metaTitle = ''; var metaDescription = ''; var metaKeywords = ''; if (document.getElementsByTagName) { var metatags = document.getElementsByTagName("meta"); for (var i = 0; i < metatags.length; i++) { if (metatags[i].getAttribute('name') && metatags[i].getAttribute('name').toLowerCase() == 'title') { metaTitle = metatags[i].getAttribute('content'); } if (metatags[i].getAttribute('name') && metatags[i].getAttribute('name').toLowerCase() == 'description') { metaDescription = metatags[i].getAttribute('content'); } if (metatags[i].getAttribute('name') && metatags[i].getAttribute('name').toLowerCase() == 'keywords') { metaKeywords = metatags[i].getAttribute('content'); } } if (document.getElementsByTagName("title").length > 0 && document.getElementsByTagName("title")[0].innerHTML) { metaWindowTitle = document.getElementsByTagName("title")[0].innerHTML } } /** * Prepare some vars */ var id = mgpGenerateId(document.location.hostname + document.location.pathname); if (typeof config.startPositionInputFieldIds == 'object' && config.startPositionInputFieldIds.length > 0) { config.startAddress = ''; for (var i = 0; i < config.startPositionInputFieldIds.length; i++) { if (document.getElementById(config.startPositionInputFieldIds[i])) { config.startAddress += document.getElementById(config.startPositionInputFieldIds[i]).value + ', '; } } } /** * Create iframe URL */ var iframeUrl = 'http://api.mygeoposition.com/api/geopicker/id-' + id + '/?'; function addToUrl(name, value) { if (value) { iframeUrl = iframeUrl + "&" + name + "=" + escape(value); } } addToUrl('startAddress', config.startAddress); addToUrl('startPositionLat', config.startPositionLat); addToUrl('startPositionLng', config.startPositionLng); addToUrl('autolocate', config.autolocate); addToUrl('locateme',config.locateme); addToUrl('zoomLevel', config.zoomLevel); addToUrl('mapType', config.mapType); addToUrl('showStartupInfoWindow', config.showStartupInfoWindow); addToUrl('showResultInfoWindow', config.showResultInfoWindow); addToUrl('returnUrl', document.location.href); addToUrl('langCode', config.langCode); addToUrl('langButtonSearch', config.langButtonSearch); addToUrl('langButtonReturn', config.langButtonReturn); addToUrl('langMarkerInfo', config.langMarkerInfo); addToUrl('langSearchField', config.langSearchField); addToUrl('langLookupFailed', config.langLookupFailed); addToUrl('langLookupNoResults', config.langLookupNoResults); addToUrl('backgroundColor', config.backgroundColor); addToUrl('windowTitle', config.windowTitle); addToUrl('metaWindowTitle', metaWindowTitle); addToUrl('metaTitle', metaTitle); addToUrl('metaDescription', metaDescription); addToUrl('metaKeywords', metaKeywords); /** * Open external window and connect to API server via iframe */ geoWindow = window.open("", "MGPGeoPickerWindow", "width=488,height=518,location=no,menubar=no,resizable=no,status=no,toolbar=no"); geoWindow.focus(); geoWindow.document.write("