function mv_declareClassIdentifyObject(){mv_Map.Identifys=new MV.List;dojo.declare("MV.IdentifyObject",null,{recIds:[],Name:"",Headings:null,Status:"",VB:"",constructor:function(b){dojo.mixin(this,b);try{this.VB=this.data.selectSingleNode("ext").firstChild.nodeValue}catch(d){try{var a=this.data.selectSingleNode("lon").firstChild.nodeValue,c=this.data.selectSingleNode("lat").firstChild.nodeValue,a=mv_Map.getMapviewX(parseFloat(a)),c=mv_Map.getMapviewY(parseFloat(c));this.VB=new MV.Viewbox(new MV.Point(a,
c))}catch(e){}}try{this.recIds=mv_getRecIdsFromXMLFile(this.data.selectSingleNode("ts"),this.id)}catch(f){}this.setName()},getRecIds:function(){return this.recIds},getName:function(){return this.Name},setName:function(){return this.Name=this.Headings.setName(this.data)},getVBString:function(b){return"string"==typeof this.VB?""==this.VB?"":this.VB+","+b:this.VB.getVBString(b)},centerP:function(){return"string"!=typeof this.VB?this.VB.centerP():null},deleteMe:function(){1==mv_Map.Layers.item(this.themaId).IdentifyObj.DeleteRecInMap&&
null!=this.ele&&this.ele.parentNode.removeChild(this.ele)}})}
function mv_declareClassIdentifyTP(){dojo.declare("MV.IdentifyTP",[dijit.TitlePane,MV.ColorList],{id:"",tabContainer:"",pinned:!1,constructor:function(b){dojo.mixin(this,b);mv_Map.Identifys.addMe(this)},deleteItem:function(){dijit.byId("legch"+this.id)&&dijit.byId("legch"+this.id).destroy();"MV.RouteObject"==this.data.declaredClass&&mv_OSMNominatim.clearRoutingRec(this.id);this.destroy();mv_Map.Identifys.deleteItem(this.id)},toggle:function(){this.inherited(arguments);require(["dojo/query","dijit/registry"],
function(b,a){b("audio").forEach(function(a){a.pause()})});if(1==this.open){var b=dojo.query("audio",this.domNode);0<b.length&&b[0].play();this.flicker(!0,0)}}})}
function mv_declareClassIdentifyMW(){dojo.declare("MV.IdentifyMW",MV.ColorList,{id:"",constructor:function(b){dojo.mixin(this,b);mv_Map.Identifys.addMe(this)},clear:function(){dojo.byId("MVidentifyHint")&&(dojo.byId("MVidentifyHint").innerHTML="");mv_Map.Identifys.deleteItem(this.id)},deleteItem:function(){dijit.byId("legch"+this.id)&&dijit.byId("legch"+this.id).destroy();this.clear()}})}function mv_deleteIdentifyList(){0!=mv_Map.Identifys.length()&&mv_Map.Identifys.List[0].deleteItem()}
function mv_flickerIdentify(b,d){if(d){var a=mv_Map.Identifys.item(b);a.deleteMe();a.doFillRecArray()}mv_Map.Identifys.item(b).flicker(!0,0)}
function mv_identifyCheck(b,d){var a=mv_getIdentifySolution(d),c=mv_getThemaIdFromRecId(b),e=mv_Map.Layers.item(c),c=null;switch(a){case 0:"undefined"!==typeof dijit.byId(b)&&(c=dijit.byId(b),null!=c&&("categories"!=d&&(mv_closeTPs(mv_Map.Identifys),c.toggle(),dojo.byId(b).scrollIntoView(),"ClusterLayer"==e.Layertype&&0==c.data.appendNodeId.indexOf("cat")&&(a=c.data.appendNodeId,a=a.substring(0,a.indexOf("Container")),a=dijit.byId(a+"TP"),mv_categoriesTPOpen(a))),dijit.byId("MVtabContainer").selectChild(c.tabContainer)));
break;case 2:c=mv_Map.Identifys.item(b);null!=c&&c.flicker(!0,0);break;case 3:"undefined"!=typeof dijit.byId(b)&&(c=dijit.byId(b),null!=c&&c.bringToTop())}return c}
function mv_identify(b,d){if(null!=mv_Map.MapPoint&&dojo.isObject(b)){var a=mv_Map.getMapPoint(b.clientX,b.clientY);if(mv_Map.MapPoint.x!=a.x&&mv_Map.MapPoint.y!=a.y)return}mv_Map.Pressed=!1;if(!mv_Doc.PrintStatus){dojo.isObject(b)?(mv_Map.Point=new MV.Point(b.clientX,b.clientY),b.preventDefault(),a=mv_getRecEle(b),a=mv_getRecId(a),-1!=a.indexOf("gpxmar")&&(a=a.substring(0,a.indexOf("gpxmar")),a=mv_Map.Root.getElementById(a),a=mv_getRecId(a))):a=b;var c=mv_identifyCheck(a,d);if(null!=c)return c;var c=
null,e=mv_getIdentifySolution(d),f=mv_getThemaIdFromRecId(a),f=mv_Map.Layers.item(f);switch(e){case 2:mv_Map.Identifys=new MV.List;break;case 3:0==f.IdentifyObj.FPMultiple&&mv_deleteTPs(mv_Map.Identifys)}f.XMLAccess?c=mv_identifyXML2(d,a):mv_identifyDB(a);return c}}function mv_getIdentifySolution(b){return mv_Doc.Solution?mv_Doc.Solution:"categories"==b?0:"smallscreen"==mv_getMediaScreen()?3:dojo.byId("MVtabContainer")?0:dojo.byId("MVidentifyContent")?2:3}
function mv_identifyClear(b,d,a){if("categories"!=b)switch(d){case 0:d=mv_Map.Layers.item(a);dijit.byId("MVtabContainer").selectChild(d.IdentifyObj.Container+"Container");mv_mapTipOut();switch(b){case "route":break;default:dojo.byId("MVidentifyHint")&&(dojo.byId("MVidentifyHint").innerHTML="")}break;case 2:dojo.byId("MVidentifyHint")&&(dojo.byId("MVidentifyHint").innerHTML=""),dojo.byId("MVidentifyClose")&&(dojo.byId("MVidentifyClose").innerHTML="")}}
function mv_getIdentifyParNode(b,d,a){switch(b){case 0:return mv_makeNode(d,"div",{});case 2:return d.getElementById("MVidentifyContainer");case 3:return mv_makeNode(d,"div",{})}}
function mv_addTopButton(b,d,a,c,e,f){var g=mv_getThemaIdFromRecId(e),k="",l=!1,m=mv_Map.Layers.item(g),h=f.getVBString(20);"ClusterLayer"==m.Layertype&&(l=!0);l="mv_flickerIdentify('"+e+"',"+l+");";m="";""!=h&&(m="mv_zoomToExtent("+h+");");var n="mv_print('"+e+"');";switch(d){case 0:k="mv_deleteTP('"+e+"');";break;case 2:k="mv_deleteIdentifyList();"}m+=l;mv_Doc.isSmartPhoneLayout()&&(m+="mv_Doc.setMapTab();",l+="mv_Doc.setMapTab();");3!=d&&"categories"!=b&&mv_makeButton(a,c,mv_Doc.getText("Close",
"Clear Selection"),"dijitMapViewIcon dijitMapViewIconClear",k);mv_makeButton(a,c,mv_Doc.getText("Flicker","Highlight object"),"dijitMapViewIcon dijitMapViewIconHighlight",l);mv_makeButton(a,c,mv_Doc.getText("ZoomTo","Zoom to Object"),"dijitMapViewIcon dijitMapViewIconZoomTo",m);null!=dojo.byId("MVtoolbar.print")&&0==mv_Doc.IsMobile&&mv_makeButton(a,c,mv_Doc.getText("Print","Print"),"dijitMapViewIcon dijitMapViewIconPrint",n);(mv_Doc.IsMobile||mv_Doc.isSmartPhoneLayout())&&"MV.IdentifyObject"==f.declaredClass&&
"WebMercator"==mv_Map.Projection&&(b="mv_zoomToDeviceLocation_Poi('"+h+"');",mv_makeButton(a,c,mv_Doc.getText("CurrentPositionToObject","Distance to POI"),"dijitMapViewIcon dijitMapViewIconDistanceLocationToPOI",b),"undefined"!==typeof mv_OSMNominatim&&(b=mv_Map.getRealMapX(parseFloat(h.split(",")[0])),h=mv_Map.getRealMapY(parseFloat(h.split(",")[2])),f=mv_OSMNominatim.Texts.getText("routing.presentLocation","Present Location")+" -> "+f.getName(),b="mv_routeDeviceLocation_Poi("+h+","+b+",'"+f+"');",
mv_makeButton(a,c,mv_Doc.getText("RouteToObject","Route to POI"),"dijitMapViewIcon dijitMapViewIconRouteLocationToPOI",b)));"function"==typeof mv_userButtonsInIdentifyWin&&mv_userButtonsInIdentifyWin(a,c,g,e);return a}
function mv_insertInDocument(b,d,a){var c=mv_getIdentifySolution(b),e=0;null!=mv_Map.Layers.getLayerObj("MV.MarkerClusters")&&(e=1);"categories"==b&&(e=2);"route"==b&&(e=0);var f=a.getName(),g=a.getRecIds(),k=!1;"MV.GPXTrk"==a.declaredClass&&(k=!0);var l=mv_Map.Layers.item(a.themaId),m=l.SVGLayerProp.StyleProp,h=null;switch(c){case 0:c=!0;2==e&&(c=!1);h=new MV.IdentifyTP({tabContainer:l.getIdentifyContainer(),title:f,open:c,doCopy:k,doFlicker:!1,recIds:g,prop:m,id:a.id,data:a});h.set("content",d);
dojo.byId(a.appendNodeId).appendChild(h.domNode);h.startup();0==e&&(mv_closeTPs(mv_Map.Identifys),h.toggle());break;case 2:h=new MV.IdentifyMW({doCopy:k,recIds:g,prop:m,doFlicker:!0,id:a.id,data:a});break;case 3:var n=mv_makeNode(document,"div",{});dojo.byId("MVidentifyFPContainer").appendChild(n);var p=mv_Map.CurrentExt.Width/2,q=mv_Map.CurrentExt.Height/2;mv_Map.Point&&(p=mv_Map.Point.x,q=mv_Map.Point.y);var r="position:absolute;top:"+(30+q)+"px;left:"+(30+p)+"px;width:auto;height:auto;visibility:hidden;z-index:4;";
require(["dojo/_base/declare","dojo/_base/lang","dojox/layout/FloatingPane"],function(c,e,h){c("MV.IdentifyFP",[h,MV.ColorList],{"-chains-":{close:"after"},dockable:!1,resizable:!1,constructor:function(a,b){e.mixin(this,a);mv_Map.Identifys.addMe(this)},close:function(){mv_Map.Identifys.deleteItem(this.id)},deleteItem:function(){this.destroy();mv_Map.Identifys.deleteItem(this.id)},init2:function(){this.flicker(!0,0);var a=30+p,c=30+q,d=!1;p+this.content.clientWidth>mv_Map.CurrentExt.Width&&(a=p-this.content.clientWidth-
30,d=!0);q+this.content.clientHeight>=mv_Map.CurrentExt.Height&&(c=Math.max(mv_Map.MapOrigin.y,q-this.content.clientHeight),d=!0);1==d&&this.set("style","top:"+c+"px;left:"+a+"px;");"chart"==b?this.set("style","min-width:350px;width:auto;height:auto"):this.set("style","width:auto;height:auto")}});c=new MV.IdentifyFP({title:f,doCopy:k,recIds:g,prop:m,id:a.id,data:a,style:r,content:d},n);c.startup();c.show();c.init2();c.bringToTop()})}return h}
function mv_identifyXML2(b,d){var a=null;if("gpx"!=b)return a=mv_identifyXML3(b,d);var c=!1,e=mv_getDataObj(d,b),f=null;if("MV.GPXTrk"==e.declaredClass){if(e.Analyses.Wikipedia||e.Analyses.Departure)c=!0;f=mv_GPXModul.CountryInfo}1==c&&null!=f?(null==mv_Doc.Para&&(mv_Doc.Para=[]),mv_Doc.Para.push([b,d]),mv_geonamesFindNearby(e)):a=mv_identifyXML3(b,d);return a}
function mv_identifyXML3(b,d){var a=null,a=mv_getDataObj(d,b);if(null==a)return null;var c=mv_getThemaIdFromRecId(d),c=mv_Map.Layers.item(c);a.appendNodeId=c.getTPAppendNode(b);return a=mv_identifyXML4(a,b,d)}
function mv_identifyXML4(b,d,a){var c=mv_getThemaIdFromRecId(a),e=mv_getIdentifySolution(d),f=document;mv_identifyClear(d,e,c);var g=mv_getIdentifyParNode(e,f,!1);g.innerHTML="";try{mv_Map.Layers.item(c)}catch(k){}g=mv_addTopButton(d,e,g,f,a,b);"gpx"==d&&"MV.GPXTrk"==b.declaredClass&&(g=mv_addWikiButtons(g,f,b,c,a));mv_identifyXML5(b,g,f,!1);return mv_insertInDocument(d,g,b)}
function mv_getDataObj(b,d){var a=null,a=mv_getTableIdFromRecId(b);switch(d){case "pano":-1!==b.indexOf("g",b.length-1)&&(b=b.substr(0,b.length-1));a=mv_XMLFileArray[a].item(b);break;case "wiki":a=mv_XMLFileArray[a].item(b);break;case "gpx":a=mv_XMLFileArray[a].item(b);break;case "route":a=mv_XMLFileArray[a].item(b);break;case "user":a=mv_XMLFileArray[a].item(b);break;default:var a=mv_loadAttrTableFile(a,!1),c=a.getRecord(b),a=mv_getDataObjXML(a,b,c,d)}return a}
function mv_getDataObjXML(b,d,a,c){var e=mv_getThemaIdFromRecId(d);b=new MV.IdentifyObject({id:d,themaId:e,data:a,Status:c,Headings:b.Headings});null!=b.getRecIds()&&1<b.getRecIds().length&&(d=mv_Map.Layers.item(e),d.isTiled()&&d.TileRules.getSpecificTiles(e,b.getRecIds()));return b}
function mv_identifyXML5(b,d,a,c){switch(b.Status){case "pano":d=mv_makeIdentifyPanoramioNode(d,a,c,b);break;case "wiki":d=mv_makeIdentifyWikiNode(d,a,c,b);break;case "gpx":d=mv_makeIdentifyGPXNode(d,a,c,b);break;case "route":d=mv_makeIdentifyRouteNode(d,a,c,b);break;case "chart":(new mv_Timer).setTimeout("mv_makeIdentifyChartNode",1E3,d,a,b,c);break;case "list":d=mv_makeIdentifyListNode(d,a,c,b);break;case "categories":d=mv_makeIdentifyListNode(d,a,c,b);break;case "user":d=mv_makeIdentifyXMLFeedNode(d,
a,c,b)}return d}
function mv_makeIdentifyListNode(b,d,a,c){var e,f=mv_makeNode(d,"table",{"class":"identify"}),g=mv_Map.Layers.item(c.themaId),k=2;g.IdentifyObj.ShowHeadings||(k=1);a&&(a=mv_makeNode(d,"tr",{}),e=mv_makeFullNode(d,"th",{"class":"identify",colspan:k},c.getName()),mv_appendNode(e,a,f));if(null!=c.data){a=c.data.selectSingleNode("c");try{var l=c.data.selectSingleNode("Im").firstChild.nodeValue.split(",");for(e=0;e<l.length;e++)mv_writeTRTDs(d,f,{"class":"identifyPic",colspan:k},[[l[e],!0,!0,""]])}catch(m){}k=
c.Headings.getHeadings();for(l=0;l<k.length;l++){var h=k[l];for(e=0;e<a.childNodes.length;e++){var n=a.childNodes.item(e);if(1==n.nodeType&&n.nodeName==h.NodeName){e="";n.hasChildNodes()&&(e=n.firstChild.nodeValue);1==h.HasDefault&&h.DefValue==e&&(e=h.DefSubst);0==g.IdentifyObj.ShowHeadings&&""!=e&&(e=h.TextPrefix+e);if(""!=e){if("number"==h.Datatype)try{e=Number(e).toLocaleString(mv_Doc.Language,{maximumFractionDigits:15})}catch(p){}e=[e,!0,!0,""]}g.IdentifyObj.ShowHeadings?mv_writeTRTDs(d,f,{"class":"identify"},
[h.Alias,e]):""!=e&&mv_writeTRTDs(d,f,{"class":"identify"},[e]);break}}}null!=c.data&&null!=c.data.selectSingleNode("TL")&&(g=mv_getXMLNodeValue(c.data,"TL",""),1==mv_relateCheckData(c.themaId,g)[0]&&(e=["js:parent.mv_showRelateTable('"+c.themaId+"','"+g+"');"+mv_Doc.getText("Hyperlink","Further Data")+"",!0,!0,""],mv_writeTRTDs(d,f,{"class":"identify"},["",e])))}else mv_writeTRTDs(d,f,{"class":"identify"},[mv_Doc.getText("QueryNoRec","No records selected."),""]);b.appendChild(f);return b}
function mv_relateCheckData(b,d){var a=mv_loadAttrTableFile(b+"link",!1);return null==a?[!1,null]:mv_Map.Layers.item(b).XMLAccess?(a=a.queryTableLink(d),mv_oExists(a)&0<a.length?[!0,a]:[!1,null]):[!0,null]}function mv_showRelateTable(b,d){var a=mv_Map.Layers.item(b);if(a.XMLAccess){var c=b+"link",e=mv_relateCheckData(b,d);1==e[0]&&mv_selRecords2(a.XMLAccess,e[1],c,b,!1,!0,!1,20,!1)}else mv_showRelateTableDB(b,d)}
function mv_makeIdentifyListLinkNode(b,d,a,c){var e,f=b+"link";null==mv_XMLFileArray[f]&&(mv_XMLFileArray[f]=new MV.XMLFile(f));if(null==mv_XMLFileArray[f])return!1;d=mv_XMLFileArray[f].queryTableLink(d);if(null!=d&&0<d.length){b=mv_XMLFileArray[f].count();e=mv_makeFullNode(c,"h1",{"class":"identify"},mv_XMLFileArray[f].Name);a.appendChild(e);e=mv_makeFullNode(c,"p",{"class":"identify"},d.length+mv_Doc.getText("QueryRec1"," of ")+b+mv_Doc.getText("QueryRec2"," records selected:"));a.appendChild(e);
b=mv_makeNode(c,"table",{"class":"identify"});f=mv_XMLFileArray[f].getHeadings();e=mv_writeTH(c,f,"identify");b.appendChild(e);for(var g=0;g<d.length;g++){e=d[g];var k=!1;0==g%2&&(k=!0);e=mv_writeRec(c,e,f,!1,"",k,{"class":"identify"});b.appendChild(e)}a.appendChild(b)}a.innerHTML+="";return a}
function mv_printIdentifys(b,d,a,c){var e=b.document;0<d.length()&&(e.getElementById("MVidentifyContainer").parentNode.style.display="block");mv_Doc.Para=[];for(var f=0;f<d.length();f++){var g=d.item(f),k=mv_Map.Layers.item(g.data.themaId);k.XMLAccess?c=mv_identifyXML5(g.data,c,e,!0):""==k.DB.HandleIdentifyContent?mv_makeIdentifyListNodeDB(c,e,g.data,!0):(mv_Doc.Para.push([!0,c,e,g.data]),mv_makeIdentifyListNodeStart(eval(k.DB.HandleIdentifyContent)));switch(g.data.declaredClass){case "MV.RouteObject":mv_Doc.Para=
[b,g.data.ele,g.data.themaId,a],mv_checkPrintMapLoaded()}g=mv_makeFullNode(e,"p",{},"");c.appendChild(g);c.innerHTML+=""}};