function mv_declareClassSelectDependent(){dojo.declare("MV.SelectDependent",null,{FieldArray:null,ValueArray:null,Identify:!0,AutoComplete:!0,ZoomTo:!0,ShowRec:!0,FirstFName:"Categories",FPAlign:"left",Index:0,InitDropDownMenu:!1,constructor:function(b){dojo.mixin(this,b)},init:function(){this.InitDropDownMenu||(this.InitDropDownMenu=!0,dojo.byId("MVCategoriesMenu")&&this.createDropDownMenu())},fillSelect:function(b){if(null!=b.item){var a=b.id.substring(b.id.lastIndexOf("t")+1),e=parseInt(a.substring(a.lastIndexOf("_")+
1)),a=a.replace("_"+e,"_");if(b.item.value&&-1!=b.item.value[0].search(/MVClearSelection.+/))mv_clearFeatures(),this.clearSelect(a,1);else{b=mv_Map.Layers.item(this.id);for(var c=0;c<=e;c++){var d=dijit.byId("MVselectDependent"+a+c);if(0==c){var f=d.item.name[0];d.item.value&&""!=d.item.value[0]&&(f=d.item.value[0]);var g=this.FieldArray[c]+mv_makeSQLString2(b,f,this.ValueArray[c])}else g+=" and "+this.FieldArray[c]+mv_makeSQLString2(b,d.item.name,this.ValueArray[c])}f=g;b.XMLAccess&&(f=mv_selRecords(g,
this.id));if(e<this.FieldArray.length-1){g=[];d=this.FieldArray[e+1];for(c=0;c<f.length;c++)try{f[c].selectSingleNode(d),g.push(f[c].selectSingleNode(d).firstChild.nodeValue)}catch(k){}d=g.unique();0==this.ValueArray[e+1]?d.sort(mv_numsort2):d.sort();g=[];for(c=0;c<d.length;c++){var h={};h.name=d[c];g.push(h)}c=new dojo.store.Memory({data:g,idProperty:"name"});d=dijit.byId("MVselectDependent"+a+(e+1));d.reset();d.set("store",c);d.set("disabled",!1);this.clearSelect(a,e+2);1==g.length&&this.AutoComplete&&
d.set("item",c.data[0]);0==g.length&&(mv_selRecords2(b.XMLAccess,f,this.id,this.id,this.ZoomTo,!1,this.ShowRec,20),this.Identify&&(a=f[0].parentNode.getAttributeNode("id").value,mv_identify(a,"list")))}else mv_selRecords2(b.XMLAccess,f,this.id,this.id,this.ZoomTo,!1,this.ShowRec,20),this.Identify&&(a=f[0].parentNode.getAttributeNode("id").value,mv_identify(a,"list"))}}},clearSelect:function(b,a){for(;a<this.FieldArray.length;)selObj=dijit.byId("MVselectDependent"+b+a),selObj.set("disabled",!0),selObj.reset(),
a++},createDropDownMenu:function(){var b=mv_loadAttrTableFile(this.id,!0);if(null!=b){var a=mv_loadXMLDoc(mv_Doc.BaseURL+"embfiles/"+this.id+"_json.js","json");if(null!=a){for(var a=a.items,e=[],c=1;c<a.length;++c)e.push(a[c].name);a=mv_makeNode(document,"div",{id:"MVCategoriesMenu"+this.Index});dojo.byId("MVCategoriesMenu").appendChild(a);a=new dijit.DropDownMenu({style:"display:inline-table;vertical-align:middle;margin-left:10px","class":"MVCategoriesMenu"},a);b=this.doSelectDropDownMenu(e,this.FieldArray[0],
b,0);a.addChild(new dijit.PopupMenuItem({label:this.FirstFName,popup:b}));b.startup();a.startup()}}},doSelectDropDownMenu:function(b,a,e,c){for(var d=new dijit.DropDownMenu({style:"box-shadow:5px 5px 8px 5px #666"}),f=0;f<b.length;++f){var g=a+mv_makeSQLString2(mv_Map.Layers.item(this.id),b[f],this.ValueArray[c]),k='mv_showSubCategories("'+g+'",'+c+",this,"+this.Index+")";if(c<this.FieldArray.length-1){var h=e.query(g),h=e.getUniques(h,this.FieldArray[c+1],this.ValueArray[c+1]),g=g+(" and "+this.FieldArray[c+
1]),g=this.doSelectDropDownMenu(h,g,e,c+1);mv_writePopupMenuItem(d,b[f],g,k)}else k='mv_selRecordsStart("'+g+"\",'"+this.id+"',"+this.ZoomTo+",false,"+this.ShowRec+")",mv_writeLegendMenuItem(d,b[f],"",k)}d.startup();return d},showSubCategoriesInFP:function(b,a,e){var c=mv_loadAttrTableFile(this.id,!0);b=c.query(b);var d=new dijit.DropDownMenu({});sortIndex=this.FieldArray.length-1;c=c.recsSortByField(b,this.FieldArray[sortIndex],this.ValueArray[sortIndex],!1);for(b=0;b<c.length;++b){var f="";if(a<
sortIndex-1)try{f=c[b].obj.selectSingleNode(this.FieldArray[sortIndex-1]).firstChild.nodeValue,f=" ("+f+")"}catch(g){}var f=c[b].name+f,k="mv_zoomToExtent2('"+c[b].obj.parentNode.selectSingleNode("ext").firstChild.nodeValue+"',20)";mv_writeLegendMenuItem(d,f,"",k)}d.startup();dijit.byId("MVCategoriesMenu"+this.Index).onClose();a=dijit.byId("MVFPCategoriesContainer");null!=a?(a.set("content",d),a.set("title",e),a.startup(),a.bringToTop(),a.show(),a.set("style","width:auto;height:auto")):require(["dojox/layout/FloatingPane"],
function(a){a=new a({resizable:!1,dockable:!1,content:d,title:e,style:"position:absolute;top:120px;left:25px;width:auto;height:auto;visibility:hidden;z-index:5;"},"MVFPCategoriesContainer");a.startup();a.bringToTop();a.show();a.set("style","width:auto;height:auto");"right"==this.FPAlign&&a.set("style","left:"+(mv_Map.CurrentExt.Width-a.canvas.clientWidth-20)+"px")})}})}function mv_selectDependent(b,a){mv_Doc.SelectDependents[a].fillSelect(b)}
function mv_showSubCategories(b,a,e,c){mv_Doc.SelectDependents[c].showSubCategoriesInFP(b,a,e.label)}Array.prototype.unique=function(){var b={},a,e=this.length,c=[];for(a=0;a<e;a+=1)b[this[a]]=this[a];for(a in b)c.push(b[a]);return c};function mv_writePopupMenuItem(b,a,e,c){b.addChild(new dijit.PopupMenuItem({label:a,popup:e,onMouseUp:function(){eval(c)}}))}
function mv_zoomObjectDojo(b,a,e,c,d,f,g){if(b)if(b.value&&-1!=b.value[0].search(/MVClearSelection.+/))mv_clearFeatures();else{var k=Array.isArray(b.name)?b.name[0]:b.name;b.value&&""!=b.value[0]&&(k=b.value[0]);b=mv_Map.Layers.item(e);a+=mv_makeSQLString2(b,k,c);mv_selRecordsStart(a,e,d,f,g);mv_Doc.ZoomBMIndex=0}}function mv_selRecordsStart(b,a,e,c,d){var f=mv_Map.Layers.item(a),g=b;f.XMLAccess&&(g=mv_selRecords(b,a));mv_selRecords2(f.XMLAccess,g,a,a,e,c,d,20)}
function mv_makeSQLString2(b,a,e){e?(" "==a&&(a=""),b="="+mv_quoteSQLString(b.XMLAccess,a)):b="="+a;return b}function mv_selRecords(b,a){var e=null,c=mv_loadAttrTableFile(a,!0);return null==c?e:e=c.query(b)}function mv_selRecords2(b,a,e,c,d,f,g,k,h,m){mv_Doc.IsMobile&&(f=!1);g&&mv_clearFeatures();b?f?_mv_writeTableDoc(a,e,c,d,f,g,k,h,m):mv_selRecInsert(a,e,c,d,f,g,k,h,m):mv_selRecInsertDB(a,c,d,f,g,k)}
function _mv_writeTableDoc(b,a,e,c,d,f,g,k,h){var m="Attribute von "+mv_XMLFileArray[a].Name,l=dijit.byId("MVrectableFP");if("undefined"!=typeof l)mv_selRecInsert(b,a,e,c,d,f,g,k,h),l.bringToTop(),l.show(),l.set("title",m),l.set("style","width:auto;height:auto");else{l=mv_makeNode(document,"div",{id:"MVrectableFP","class":"tableFP"});l.style.display="none";dojo.byId("MVhtmlBody").appendChild(l);var p=dojo.byId("MVrectableContent");mv_removeEle(p);p=mv_makeNode(document,"div",{id:"MVrectableContent",
style:"margin-right:5px"});l.appendChild(p);mv_selRecInsert(b,a,e,c,d,f,g,k,h);require(["dojox/layout/FloatingPane"],function(a){a=new a({resizable:!1,dockable:!1,"class":"tableFP",title:m,style:"position:absolute;top:60px;left:30px;width:auto;height:auto;padding-bottom:10px;z-index:4;",close:function(){mv_clearSelection(this);this.hide()}},"MVrectableFP");a.startup();a.bringToTop();a.show();a.set("style","width:auto;height:auto")})}}
function _mv_getTableTop(b,a,e,c){var d="";0<e?(d+="<p>"+e+mv_Doc.getText("QueryRec1"," of ")+a+mv_Doc.getText("QueryRec2"," records selected:")+"</p>",1==c&&(b='mv_tableToExcel("MVrecTable", "'+b+'")',b="<form><input type='button' style='margin-left:10px;' value='"+mv_Doc.getText("ExportExcel","Export to Excel")+"' onclick='"+b+"'></form>",d=d+"<p>"+b+"</p>")):d+="<p>"+mv_Doc.getText("QueryNoRec","No records selected.")+"</p>";return d}
function mv_clearSelection(b){mv_clearFeatures();document.getElementById("selRecContent")&&(document.getElementById("selRecContent").innerHTML="")}function mv_recOver(b,a,e,c,d,f){e=e.split(",");mv_hiliteRec2(b,a,e,c,d,f,mv_Doc.HiQueryColor)}
function mv_selRecInsert(b,a,e,c,d,f,g,k,h){var m=window.onerror;window.onerror=mv_selRecError;if(null==b)return!1;"undefined"==typeof k&&(k=!1);var l;if(d)var p="",t=document,A=document.getElementById("MVrectableContent"),p=_mv_getTableTop(e,mv_XMLFileArray[a].count(),b.length,h);window.onerror=m;if(0==b.length)return!0;h=null;if(d){var u=mv_makeNode(t,"table",{"class":"recTable",id:"MVrecTable"});h=mv_XMLFileArray[a].getHeadings();l=mv_writeTH(t,h);u.appendChild(l);winTxt=""}for(var m=[],q,v=mv_Map.Layers.item(e),
B=v.SVGLayerProp.StyleProp,r=0;r<b.length;r++){l=b[r];a==e&&(l=l.parentNode);if(c){var n=l.selectSingleNode("ext").firstChild.nodeValue.split(",");if(0==r)var w=parseFloat(n[0]),x=parseFloat(n[1]),y=parseFloat(n[2]),z=parseFloat(n[3]);w=Math.min(w,parseFloat(n[0]));x=Math.max(x,parseFloat(n[1]));y=Math.min(y,parseFloat(n[2]));z=Math.max(z,parseFloat(n[3]))}if(f||k)q=l.getAttributeNode("id").value,q=mv_getRecIdsFromXMLFile(l.selectSingleNode("ts"),q),f&&(m=m.concat(q));d&&(l=mv_writeRec(t,l,h,k,winTxt,
0==r%2?!0:!1,{},q,B),u.appendChild(l))}mv_Map.UseScaleInfo=!1;c?mv_zoomToExtent(w,x,y,z,g):f&&v.isTiled()&&v.TileRules.getSpecificTiles(e,m);mv_Map.UseScaleInfo=!0;f&&(mv_SelRecColors=new MV.ColorList({recIds:m,prop:B,doColor:!0}));d&&(A.innerHTML=p,A.appendChild(u))}function mv_selRecError(){mv_alert("Syntax Error")}
function mv_makeSQLString(b){for(b=b.replace(/<>/g,"!=");-1!=b.indexOf("\t");)b=b.replace(/\t/g," ");for(;-1!=b.indexOf("like");){var a=b.substr(b.indexOf("like")+6,b.length),a=a.substring(0,a.indexOf('"')),e=b.substring(0,b.indexOf("like")-1);-1!=e.lastIndexOf(" ")&&(e=e.substr(e.lastIndexOf(" ")+1,e.length));var c=e+' like "'+a+'"',d="";0==a.indexOf("%")?(a=a.substr(1,a.length),"%"==a.substr(a.length-1,1)?(a=a.substring(0,a.indexOf("%")),d="contains("+e+",'"+a+"')"):d="'"+a+"' = substring("+e+",string-length("+
e+") - "+(a.length-1)+")"):(-1!=a.indexOf("%")&&(a=a.substring(0,a.indexOf("%"))),d="starts-with("+e+",'"+a+"')");b=b.replace(c,d)}return b}function mv_writeTH(b,a,e){for(var c=mv_makeNode(b,"tr",{}),d,f=0;f<a.length;f++)d=a[f],0!=d.Visible&&(d=mv_makeFullNode(b,"th",{},d.Alias),null!=e&&d.setAttribute("class",e),c.appendChild(d));return c}
function mv_writeRec(b,a,e,c,d,f,g,k,h){var m=mv_makeNode(b,"tr",{});0==f&&mv_setAttr(m,{"class":"recTableBGAlter"});c&&(c=a.selectSingleNode("ext").firstChild.nodeValue,mv_setAttr(m,{onmouseover:d+"mv_recOver('"+h+"','"+c+"','"+k+"',this,window,event);",onmouseout:d+"mv_recOut(this);"}));a=a.selectSingleNode("c");for(k=0;k<a.childNodes.length;k++)if(c=e[k],f=a.childNodes.item(k),1==f.nodeType){h="";f.hasChildNodes()&&(h=f.firstChild.nodeValue);if(""!=h){try{"number"==c.Datatype&&-1==mv_Doc.Language.indexOf("en")&&
(h=h.replace(".",","))}catch(l){}h=[h,!0,!0,d]}h=mv_makeFullNode(b,"td",g,h);m.appendChild(h)}return m};