var DMP_AUTH_STATUS="VALID";var ReturnGeometryType={NONE:2,CENTRIOD:3,CENTROID:3,GEOMETRY:1,LATLON:4};function DMCException(c,a){this.msgCode=a;this.description=c;this.message=c;this.getMessage=b;this.toString=b;function b(){return c}}function DMCQueryControl(A,p){var h="http://parcelstream.com/Query.aspx";if(A!=null){h=A}var o="y_coord";var E="x_coord";var d=p;var s=null;var C=-1;var y=1;var k=0;var c="@@@@";var r=s;var v=200;var a=null;var n=null;var D=null;var u="json";var F=0;var g=false;var G=-1;var w=false;var j=20;var x=null;var f=null;var q=null;var b=null;var B=null;var e=0;var z=ReturnGeometryType.GEOMETRY;var l=null;var t=null;this.setKeyField=function(H){t=H};this.getKeyField=function(){return t};this.setLatitudeField=function(H){o=H};this.setLongitudeField=function(H){E=H};this.getSelectAttributeName=function(){return"attr"};this.getAttributeCondName=function(){return"attrConds"};this.setSelectAttributes=function(H){r=H};this.getSelectAttributes=function(){return r};this.setMaxOutputRecords=function(H){v=H};this.setOrderByAttribute=function(H){a=H};this.setWhereClause=function(H,I){n=H;D=I};this.setAPNFilter=function(H,I){f=H;q=I};this.setID=function(H){x=H};this.setGeometryFilter=function(H){b=H};this.setSpatialReference=function(H){B=H};this.setGeometryBufferDistance=function(H){e=H};this.setReturnGeometryType=function(H){z=H};this.setOutputType=function(H){u=H};this.setMinRecords=function(H){F=H};this.setNoSchema=function(H){g=H};this.setNoRecordsIfOverN=function(H){G=H};this.setIsTileOutSearch=function(H){w=H};this.setMaxRadius=function(H){j=H};this.getQueryServiceUrl=function(){return h};this.getResourceName=function(){return d};this.getDataSource=function(){return d};this.setDataSource=function(H){d=H};this.getQuery=function(){var H=h+"?";if(n!=null&&n.length>0){H+="attrConds=";if(typeof(n)=="string"){H+=this.encodeParameter(n)}else{for(var I=0;I<n.length;I++){var K=n[I];if(K==null||K==""){continue}H+=this.encodeParameter(K);if(I!=n.length-1){H+=c}}}}if(D!=null){H+="&andCond="+this.encodeParameter(D)}var J=r;if(z!=null&&z>=0){if(z==ReturnGeometryType.LATLON){J=J.toUpperCase();J=ReplaceString(J,"GEOMETRY",o+" AS _LATFIELD,"+E+" AS _LONFIELD")}else{H+="&returnGeoType="+z}}if(J!=null){H+="&attr="+this.encodeParameter(J)}if(v!=null){H+="&maxRecords="+v}if(d!=null&&d.length>0){H+="&DataSource="+this.encodeParameter(d)}if(a!=null){H+="&orderBy="+this.encodeParameter(a)}if(B!=null&&B.length>0){H+="&srs="+this.encodeParameter(B)}if(e!=null&&e>0){H+="&geoBufferDist="+e}if(b!=null){H+="&geoFilter="+this.encodeParameter(b)}if(x){H+="&ID="+this.encodeParameter(x)}else{if(f&&q){H+="&APN="+this.encodeParameter(f);H+="&FIPS="+this.encodeParameter(q)}}if(u!=null&&u.toLowerCase()!="json"){H+="&output="+this.encodeParameter(u)}if(F!=null&&F>0){H+="&minRecords="+this.encodeParameter(F)}if(g!=null&&g==true){H+="&noSchema=true"}if(G!=null&&G>1){H+="&noRecordsIfOverN="+this.encodeParameter(G)}if(w!=null&&w==true&&b!=null){H+="&isTileOutSearch=true";if(j!=null&&j>1){H+="&maxRadius="+this.encodeParameter(j)}if(o!=null){H+="&latField="+this.encodeParameter(o)}if(E!=null){H+="&lonField="+this.encodeParameter(E)}}return H};this.geocode=function(Q,P,O,K,I,H,L,M,J,N){if(l==null){l=new DMPGeocoder()}l.geocodeByAddress(Q,P,O,I,H,L,M,J,N)};var m=0;this.execute=function(J,M,H,I){var K=this.getQuery();try{var N=new _DMCQueryControlObserver(J,M,H,this.getResourceName(),t);if(I==null||typeof(I)=="undefined"){I="query"+I++}gLoadJSON(K,N,"onSuccess","onError",I)}catch(L){alert("Error DMCQueryCOntrol:"+L.description)}};this.encodeParameter=function(H){if(H!=null){return encodeURIComponent(H)}return""}}function _DMCQueryControlObserver(b,f,a,e,d){if(b==null){throw new DMCException("DMCQueryControlObserver: observer is undefined")}if(b[f]==null){throw new DMCException("DMCQueryControlObserver: observer must have a success method '"+f+"()' ")}if(b[a]==null){throw new DMCException("DMCQueryControlObserver: observer must have an error method '"+a+"()' ")}var c=this;this._observer=b;this._onSuccessMethod=f;this._onErrorMethod=a;this._dataSourceName=e;this.onSuccess=function(j,g,l){if(d==null&&typeof(b.getKeyField)!="undefined"){d=b.getKeyField()}var k=c._dataSourceName;if(b.getLayerName){k=b.getLayerName()}var h=JSON2RecordSet(j,d,k);b[f](h,e)};this.onError=function(h,j,g){b[a](h,j,g)};this.tryParse=function(h,g){if(h==null||g==null){return g}if(h=="int"){return parseInt(g)}else{if(h=="double"||h=="float"){return parseFloat(g)}else{if(h=="bool"){if(g=="1"||g=="true"){return true}else{return false}}else{return g}}}}}function DMPGeocoder(b){var c=1;var e="http://parcelstream.com/Geocode.aspx";if(b!=null){e=b}var a=["ID","DATASOURCE","ADDRESS","ZIP"];this.geocodeByAddress=function(j,q,p,g,f,k,l,h,o){if(o!=null&&o==true){o="true"}else{o=""}var m=e+"?";m+=d("address",g);m+=d("city",f);m+=d("state",k);m+=d("zip",l);m+=d("includeGeo",o);m+=d("minScore",h);try{var r=new _DMCQueryControlObserver(j,q,p,"",a);c=c++;gLoadJSON(m,r,"onSuccess","onError",c)}catch(n){alert("Error DMPGeocoder:"+n.description)}};function d(f,g){if(typeof(g)!="undefined"&&typeof(f)!="undefined"&&f!=null&&f!=""&&g!=""&&g!=null){return"&"+f+"="+encodeURIComponent(g)}return""}}function CPriority(){this.LOW=1000;this.MEDIUM=20;this.HIGH=2;this.HIGHEST=1}var Priority=new CPriority();if(typeof(Dmp)=="undefined"){Dmp=new Object()}Dmp.Event=function(c,a,b){this.eventType=c;this.consumed=false;this.source=a;this.data=(b?b:a);this.cancel=false;this.getSource=function(){return this.source};this.getStatus=function(){return this.eventType};this.getEventType=function(){return this.eventType};this.getData=function(){return this.data}};Dmp.EventManager=function(){this._event2PriorityArray=new Array();this._eventPassed=new Array();this.notify=function(c){if(c==null){throw new DMCException("Event object is NULL")}if(c.eventType==null){throw new DMCException("evtObj.eventType is NULL")}if(c.deadEvent){this.setDispatchedEvent(c.eventType,c)}var e=this._event2PriorityArray[c.eventType];if(e==null){return null}for(var b=0;b<e.length;b++){var f=e[b];var g=f.observer;var d=f.funcName;g[d](c);if(c.cancel==true){return}}};this.setDispatchedEvent=function(b,c){this._eventPassed[b]=c};this.addObserver=function(c,f,e,d,j){if(c==null||e==null){return}if(f==null){f="handleEvent"}if(d==null){d=20}if(c[f]==null){throw new DMCException("An observer must support "+f+" method.")}var h=this._eventPassed[e];if(h!=null&&typeof(j)!=undefined&&j!=true){c[f](h)}var g=this._event2PriorityArray[e];if(g==null){g=new Array();this._event2PriorityArray[e]=g}var k=this.indexOf(g,c);if(k<0){k=g.length;var b=new Object();b.observer=c;b.funcName=f;b.eventType=e;b.priority=d;g[k]=b}g.sort(a)};function a(c,d){if(c.priority==null){c.priority=20}if(d.priority==null){d.priority=20}if(c.priority<d.priority){return -1}else{if(c.priority>d.priority){return 1}else{return 0}}}this.indexOf=function(b,d){if(b==null||d==null){return -1}for(var c=0;c<b.length;c++){if(b[c].observer==d){return c}}return -1};this.remove=function(c,b){return this.removeObserver(c,b)};this.removeObserver=function(d,f){if(f==null){return}if(d==null){return removeAll(f)}var b=this._event2PriorityArray[f];if(b==null){return}var e=[];for(var c=0;c<b.length;c++){if(b[c].observer==d){continue}e.push(b[c])}this._event2PriorityArray[f]=e};this.removeAll=function(b){if(b==null){return}var c=this._event2PriorityArray[b];if(c==null){return}this._event2PriorityArray[b]=null}};function _gNotifyAsyncObs(_gid){try{var po=null;var eo=null;var str="po = window.PO"+_gid+"; window.PO"+_gid+" = null;";eval(str);eval("eo = window.EO"+_gid+"; window.PO"+_gid+" = null;");if(po==null){return}po._dmc_notifyEvent(eo.eventType,eo)}catch(ex){alert("_gNotifyAsyncObs: "+ex.description)}}function _dmc_notifyEvent(eventType,evtObj){if(eventType==null){eventType=evtObj.eventType}var funcName=this._dmcEventMethodNames[eventType];eval("this."+funcName+"(evtObj);")}if(typeof(Event)=="undefined"){Event=Dmp.Event}if(typeof(EventManager)=="undefined"){EventManager=Dmp.EventManager}function JSON2RecordSet(g,j,m){var w=false;if(j==null||j.length==0||(j.length==1&&j[0]=="")){j="_ridx";w=true}if(typeof(j)=="string"){j=[j]}var h=new Array();var c=[];if(g!=null){var t=null;try{t=g.Xml.Data.Row}catch(o){}if(t==null){t=new Array()}var v=null;if(g.Xml.Schema){v=g.Xml.Schema.ElementType.AttributeType}if(t&&t.length==null){t=[t]}if(v&&v.length==null){v=[v]}var x=[];if(v){for(var r=0;r<v.length;r++){var l=v[r].Datatype.type;c[v[r].name]=l;x[v[r].name]=v[r].basecolumn}}for(var r=0;r<t.length;r++){var f=t[r];var k=new Dmp.Record(j,m);if(w){k.setByName(j[0],(r+1)+"","string")}if(f._LATFIELD&&f._LONFIELD&&f.GEOMETRY==null){var s=tryParse("double",f._LATFIELD);var e=tryParse("double",f._LONFIELD);k.setByName("GEOMETRY",new DMCPoint(e,s),"geometry")}var q=0;for(property in f){if(property=="_LATFIELD"||property=="_LONFIELD"){continue}var u=x[property];if(u==null){u=property}var n=c[property];if(n==null){n="string"}var l=n=="wkt"?"geometry":n;k.setByName(u,tryParse(n,f[property]),l)}h.push(k)}}var p="QueryRecordset";if(m!=null&&m.length>0){p=m}var a=[];if(w){a.push(j[0])}for(var d in c){a.push(d)}var b=new Dmp.RecordSet(j,a);b.addRecordCollection(h);return(b)}function tryParse(b,a){if(b==null||a==null){return a}if(b=="int"){return parseInt(a)}else{if(b=="double"||b=="float"){return parseFloat(a)}else{if(b=="bool"){return(a=="1"||a=="true")}else{if(b=="wkt"){return WKT(a)}else{if(b=="date"){if(a==""){return null}a=a.replace(/00:00:00.0/,"");a=a.replace(/-/g,"/");a=new Date(a);if((a+"")=="NaN"){return null}return a}else{if(b=="string"){return a}else{return a}}}}}}}function deepCloneJSON(d){if(d==null){return d}var b=null;var a=getDataType(d);if(a=="associative array"){b=[];for(var e in d){b[e]=deepCloneJSON(d[e])}return b}else{if(a=="array"){b=[];for(var c=0;c<d.length;c++){b.push(deepCloneJSON(d[c]))}return b}else{return d}}}function getDataType(c){if(c==null){return null}var b=typeof(c);if(b.indexOf("object")<0){return b}try{for(var a in c){if(a!=null&&c[a]!=null){return"associative array"}break}}catch(d){}if(c.length>0){if(c[0]!=null){return"array"}}return b}function OrderedHashtable(){this._columnNames=[];this._columnNameIndices=[];this._fieldArray=[];this._dataTypes=[];this.setByName=function(c,b,a){if(c!=null){c=(""+c).toUpperCase()}this._fieldArray[c]=b;if(a&&this._dataTypes[c]==null){if(a=="wkt"){this._dataTypes[c]="geometry"}else{this._dataTypes[c]=a}}if(this._columnNameIndices[c]==null){this._columnNameIndices[c]=this._columnNames.length;this._columnNames.push(c)}};this.getByName=function(a){if(a!=null){a=(""+a).toUpperCase()}return this._fieldArray[a]};this.getDataTypeByName=function(a){return this._dataTypes[a]};this.clear=function(){this._fieldArray=[];this._columnNameIndices=[];this._columnNames=[]};this.getCount=function(){return this._columnNames.length};this.contains=function(a){if(a!=null){a=a.toUpperCase()}return this._columnNameIndices[a]!=null};this.remove=function(d){if(d!=null){d=(""+d).toUpperCase()}var a;if((a=this._columnNameIndices[d])==null){throw new DMCException("GridControl.remove: trying to remove an inexisting field : "+d)}delete this._fieldArray[d];delete this._columnNameIndices[d];this._columnNames.splice(a,1);for(var b=a;b<this._columnNames.length;b++){var c=this._columnNames[b];this._columnNameIndices[c]=b}};this.removeAll=function(e){var d=[];for(var b=0;b<e.length;b++){var f=e[b];if(f!=null){f=(""+f).toUpperCase()}var g;if((g=this._columnNameIndices[f])==null){d.push(f);continue}this._fieldArray[f]=null;this._columnNameIndices[f]=null;this._columnNames.splice(g,1)}for(var a=0;a<this._columnNames.length;a++){var h=this._columnNames[a];this._columnNameIndices[h]=a}if(d.length>0){var c="GridControl.removeAll: failed to remove "+d.join()+"\n\twhen removing: "+e.join();throw new DMCException(c)}};this.getByIndex=function(a){return this._fieldArray[this._columnNames[a]]};this.getNameByIndex=function(a){return this._columnNames[a]};this.getNames=function(){var b=[];var a;for(a in this._fieldArray){b.push(a)}return b}}Dmp.Record=function(a,b){this.base=OrderedHashtable;this.base();this.FIELD_DELIMITER="+*+";this._resourceName=b;this._keyArray=a;this._properties=[];this.setResourceName=function(c){this._resourceName=c};this.getKeyField=function(){return this._keyArray[0]};this.getResourceName=function(){return this._resourceName};this.getRowNumber=function(){return this.getProperty("RowNumber")};this.setKeyField=function(c){this._keyArray=[c]};this.setCompositeKeyField=function(c){this._keyArray=c};this.getCompositeKeyField=function(){return this._keyArray};this.getKey=function(){var c=this.getByName(this._keyArray[0]);for(var d=1;d<this._keyArray.length;d++){c+=this.FIELD_DELIMITER+this.getByName(this._keyArray[d])}return c};this.getCompositeKey=function(){var f=[];for(var d=0;d<this._keyArray.length;d++){var e=this._keyArray[d];var c=this.getByName(e);f[e]=c}return f};this.clone=function(){var f=new Dmp.Record(this._keyArray,this._resourceName);for(var e in this._columnNames){f._columnNames[e]=this._columnNames[e]}for(var d in this._columnNameIndices){f._columnNameIndices[d]=this._columnNameIndices[d]}for(var c in this._fieldArray){f._fieldArray[c]=this._fieldArray[c]}f._keyArray=this._keyArray;return f};this.isSameRecord=function(f){for(var d in this._columnNames){if(f._columnNames[d]!=this._columnNames[d]){return false}}for(var c in this._columnNameIndices){if(f._columnNameIndices[c]!=this._columnNameIndices[c]){return false}}for(var e in this._fieldArray){if(f._fieldArray[e]!=this._fieldArray[e]){return false}}if(f._keyArray!=this._keyArray){return false}return true};this.getProperty=function(c){return this._properties[c]};this.removeProperty=function(c){delete this._properties[c]};this.hasProperty=function(c){return this._properties[c]!=null};this.setProperty=function(c,d){this._properties[c]=d};this.getProperties=function(){return this._properties}};if(typeof(Record)=="undefined"){Record=Dmp.Record}Dmp.RecordSet=function(c,f,h){var d=this;this.className="RecordSet";this._records=new OrderedHashtable();this._keyArray=c;this.base=Dmp.EventManager;this.base();var e="Cannot add additional records to collection";var b=2000;if(typeof(h)!=undefined&&h!=null){b=h}this.setExceedMaxRecordsMessage=function(j){e=j+" Exceeded maximum allowable records: "+b};this._listOfColumnNames=f;this.getKeyFields=function(){return this._keyArray};this.clear=function(){this._records=new OrderedHashtable()};this.setCompositeKeyField=function(j){this._keyArray=j};this.getColumnNames=function(){return this._listOfColumnNames};this.newRecord=function(j){return new Dmp.Record(this._keyArray,j)};this.setRecord=function(n,m){if(d.getCount()>b){alert(e);return}var o=n.getKey();var l=this._records.contains(o);var k=null;if(l&&!m){k=this._records.getByName(o).clone()}this._records.setByName(o,n);if(!m){if(l){var j=new Dmp.Event("recordUpdated",this,n);j.oldRecord=k;j.newRecord=n;this.notify(j)}else{this.notify(new Dmp.Event("recordAdded",this,n))}}return n};this.getRecord=function(j){var k=this._records.getByName(j);if(!k){return null}else{return k}};this.removeRecord=function(l,k){var j=this._records.getByName(l);if(!j){return}this._records.remove(l);if(!k){this.notify(new Dmp.Event("recordRemoved",this,j))}return j};this.clone=function(){var j=new Dmp.RecordSet(this._keyArray,this.getColumnNames());for(var k=0;k<this._records.getCount();k++){j.setRecord(this._records.getByIndex(k).clone())}return j};this.addRecordCollection=function(k){var n=new Array();var m=new Array();var p=true;for(var j=0;j<k.length;j++){var o=this._records.contains(k[j].getKey());var l=this.setRecord(k[j],p);if(o){m.push(l)}else{if(d.getCount()>b){alert(e);break}n.push(l)}}if(n.length>0){this.notify(new Dmp.Event("recordCollectionAdded",this,n))}return m};this.toArray=function(){var j=[];for(var k=0;k<this._records.getCount();k++){j.push(this._records.getByIndex(k))}return j};this.removeRecordCollection=function(m){var n=true;var j=[];for(var k=0;k<m.length;k++){if(this.getRecord(m[k])){var l=this.removeRecord(m[k],n);j.push(l)}}this.notify(new Dmp.Event("recordCollectionRemoved",this,j));return j};this.clearRecords=function(k){var l=this.toArray();if(!k){var j=null;j=new Dmp.Event("beforeRecordsCleared",this,l);this.notify(j);if(j.cancel==true){return false}}this._records.clear();if(!k){this.notify(new Dmp.Event("recordsCleared",this,l))}return true};this.getKeys=function(){var l=[];var j;for(j in this._records._fieldArray){l.push(j)}return l};this.toRecordArray=function(){var j=[];var l=this.getByCount();for(var k=0;k<l;k++){j.push(this.getByIndex(k))}return j};this.importData=function(n,z){this.clearRecords();if(!n){return}var x=[];var B=true;try{var A=[];this._keyArray=[];var y=n.selectSingleNode("Xml/Schema");var v=y.getAttribute("keys");if(v){this._keyArray=v.split(",")}var F=n.selectNodes("Xml/Schema/ElementType/AttributeType");for(var r=0;r<F.length;r++){var m=F[r];var E=m.getAttribute("basecolumn");A[E]=m.selectSingleNode("Datatype").getAttribute("type");if(v==null&&m.getAttribute("keycolumn")=="true"){this._keyArray.push(E)}}var o=n.selectNodes("Xml/Data/Row");for(var s=0;s<o.length;s++){var K=o[s];var I=null;var C=z;if(!C){var C=K.getAttribute("__resName");if(C==null){C="_importedFromFile"}}I=new Dmp.Record(this._keyArray,C);if(this._keyArray.length>1){I.setCompositeKeyField(this._keyArray)}for(var H in A){var l=K.getAttribute(H);if(l!=null){var J=A[H];l=tryParse(J,l)}I.setByName(H,XMLAbstraction.decode(l),J)}x.push(I);this.setRecord(I,B)}var D=n.selectNodes("Xml/Properties/Properties");for(var s=0;s<D.length;s++){var u=D[s];var I=null;var G=u.getAttribute("__key");if(G==null){continue}var p=this.getRecord(G);if(p==null){continue}var q=u.attributes;for(var t=0;t<q.length;t++){var L=q[t].nodeName;if(L=="RowNumber"||L=="__key"){continue}p.setProperty(L,XMLAbstraction.decode(u.getAttribute(L)))}}}catch(w){throw new Exception("RecordSet.importData(): malformatted xmlDOM: "+n==null?null:n.xml)}this.notify(new Dmp.Event("recordCollectionAdded",this,x))};this.exportData=function(){if(this.getCount()<=0){return null}var x=gGetDomFromString("");var D=x.createElement("Xml");var l=x.createElement("Schema");var o=x.createElement("Data");var m=x.createElement("Properties");D.appendChild(l);D.appendChild(o);D.appendChild(m);var y=[];for(var u=0;u<this._keyArray.length;u++){y[this._keyArray[u]]=true}l.setAttribute("keys",this._keyArray.join(","));var p=this.getByIndex(0);var n=[];for(var w=0;w<this.getCount();w++){var p=this.getByIndex(w);for(var u=0;u<p.getCount();u++){var k=p.getNameByIndex(u);var t=p.getByIndex(u);if(n[k]){continue}else{n[k]=true}var z=x.createElement("ElementType");z.setAttribute("name","row");var B=x.createElement("AttributeType");z.appendChild(B);B.setAttribute("name",k);B.setAttribute("number",u+1);B.setAttribute("basecolumn",k);if(y[k]){B.setAttribute("keycolumn","true")}var s;if(typeof t=="number"){s="float"}else{if(t==null||typeof t=="string"){s="string"}else{if(typeof t=="boolean"){s="bool"}else{if(a(t)){s="date"}else{if(t.TYPE=="POLYGON"||t.TYPE.indexOf("LINE")>=0||t.TYPE=="POINT"){s="wkt"}else{throw new DMCException("RecordSet.exportData(): not supported value type : "+t)}}}}}var F=x.createElement("Datatype");F.setAttribute("type",s);B.appendChild(F);l.appendChild(z)}}for(var u=0;u<this.getCount();u++){var p=this.getByIndex(u);var A=x.createElement("Row");for(var w=0;w<p.getCount();w++){A.setAttribute(p.getNameByIndex(w),XMLAbstraction.encode(""+p.getByIndex(w)))}A.setAttribute("__resName",p.getResourceName());o.appendChild(A)}for(var u=0;u<this.getCount();u++){var p=this.getByIndex(u);var E=p.getProperties();var q=null;for(var C in E){if(C=="RowNumber"){continue}if(q==null){q=x.createElement("Properties")}q.setAttribute(C,XMLAbstraction.encode(E[C]))}if(q==null){continue}q.setAttribute("__key",p.getKey());m.appendChild(q)}return D};function g(j){var k=/^\s+$/;return((j==null)||(j.length==0)||k.test(j))}function a(k){var j=new Date(k);return !g(k)&&!isNaN(j)}this.getCount=function(){return this._records.getCount()};this.getByIndex=function(j){return this._records.getByIndex(j)};this.getEmptyRecordSet=function(){return new Dmp.RecordSet(this._keyArray,this._listOfColumnNames)}};if(typeof(RecordSet)=="undefined"){RecordSet=Dmp.RecordSet}if(typeof(Dmp.Utils)=="undefined"){Dmp.Utils=new Object()}Dmp.Utils.pause=function(a){var b=window.showModalDialog("../AJAX-Spring/Util/_dmcsleepWindow.html",a,"dialogLeft:2000px;dialogTop:2000px;dialogHeight:1px;dialogWidth:1px;")};if(typeof(pause)=="undefined"){pause=Dmp.Utils.pause}function gSleep(b){try{var c=new XMLHttpRequest();c.open("GET","someFakeDocument.xml",false);c.send("")}catch(a){}}function gLoadJSON(f,c,h,a,g){function e(){}var d=null;if(g){d=g}else{d=getGUID()}_gDMCObserverLounge[d]=c;var b=f;if(f.indexOf("?")>0){b+="&"}else{b+="?"}b+='obsId=_gDMCObserverLounge["'+d+'"]';b+="&obsSuccessMethod="+h;b+="&obsErrorMethod="+a;b+="&output=JSON";_gDmcLoadScript(b,e,g)}var _gDMCLOGIN_URL="http://maps.digitalmapcentral.com/production/init";function ProcessError(a){if(a.indexOf("User not found")>=0){document.location.href=_gDMCLOGIN_URL;return}alert(a)}var _gDMCObserverLounge=new Array();function _gDMCNotifyJSON(obsID){var observer=_gDMCObserverLounge[obsID];if(observer==null){observer=eval(obsID)}return observer}function _gDmcLoadScript(a,c,b){if(document.all){_gDmcLoadScriptIE(a,c,b)}else{_gDmcLoadScriptMOZILLA(a,c,b)}}function _gDmcLoadScriptMOZILLA(e,c,h){var g=document.getElementsByTagName("head").item(0);var d=document.createElement("script");d.setAttribute("language","JavaScript1.2");d.setAttribute("src",e);if(h){d.setAttribute("id",h)}var b=0;if(c){d.addEventListener("load",c,false)}else{function a(){b=100}d.addEventListener("load",a,false)}g.appendChild(d);if(!c){try{while(b<50){gSleep(200);b++}}catch(f){}}}function _gDmcLoadScriptIE(d,b,f){var e=document.getElementsByTagName("head").item(0);var c=document.createElement("script");c.setAttribute("src",d);if(f){c.setAttribute("id",f)}if(b==null){if(c.readyState!="loaded"){var a=0;c.onreadystatechange=function(){if(this.readyState=="loaded"){c.onreadystatechange=null;a=100}};while(a<50&&c.readyState!="loaded"&&c.readyState!="complete"){Dmp.Utils.pause(100);a++}}}else{if(c.readyState=="loaded"||c.readyState=="complete"){b()}else{if(c.readyState!="loaded"){c.onreadystatechange=function(){if(this.readyState=="loaded"){b();c.onreadystatechange=null}}}else{alert("Cannot load data url:"+d)}}}e.appendChild(c)}function _gDmcRemoveScriptTagById(b){var a=document.getElementsByTagName("head").item(0);var c=document.getElementById(b);if(c){a.removeChild(c);return}else{}return false}if(typeof(Dmp.Geometry)=="undefined"){Dmp.Geometry=new Object()}function DMCtoVEGeometry(d,f){if(!f){f=d}if(!f.TYPE){throw new DMCException("DMCtoVEGeometry: input is not a DMC javascript geometry")}try{var a=f.getPoints();var g=[];for(var b=0;b<a.length;b++){g.push(new VELatLong(a[b].getY(),a[b].getX()))}if(f.TYPE=="POLYGON"||f.TYPE=="BOUNDS"){return new VEShape(VEShapeType.Polygon,g)}else{if(f.TYPE=="CIRCLE"){var c=new VEShape(VEShapeType.Pushpin,g[0]);return c}else{if(f.TYPE=="LINESTRING"){return new VEShape(VEShapeType.Polyline,g)}else{if(f.TYPE=="POINT"){return new VEShape(VEShapeType.Pushpin,g)}}}}}catch(h){}throw new DMCException("DMCtoVEGeometry: input is an not a DMC javascript geometry")}function DMCPoint3D(b,c,a){this.x=b;this.y=c;this.z=a;this.dot=function(d){return this.x*d.x+this.y*d.y+this.z*d.z}}function DMCBounds(b){this.TYPE="BOUNDS";this.xMin;this.yMin;this.xMax;this.yMax;if(b&&b.length>0){this.xMin=this.xMax=b[0].x;this.yMin=this.yMax=b[0].y;for(var a=1;a<b.length;a++){if(b[a].x<this.xMin){this.xMin=b[a].x}else{if(b[a].x>this.xMax){this.xMax=b[a].x}}if(b[a].y<this.yMin){this.yMin=b[a].y}else{if(b[a].y>this.yMax){this.yMax=b[a].y}}}}this.setBounds=function(d,e,f,c){this.xMin=d;this.yMin=e;this.xMax=f;this.yMax=c};this.min=function(){return new DMCPoint(this.xMin,this.yMin)};this.getMin=this.min;this.max=function(){return new DMCPoint(this.xMax,this.yMax)};this.getMax=this.max;this.equals=function(c){return c.xMin==this.xMin&&c.xMax==this.xMax&&c.yMin==this.yMin&&c.yMax==this.yMax};this.contains=function(c){return c.x>=this.xMin&&c.x<=this.xMax&&c.y>=this.yMin&&c.y<=this.yMax};this.containsBounds=function(c){return c.xMin>=this.xMin&&c.xMax<=this.xMax&&c.yMin>=this.yMin&&c.yMax<=this.yMax};this.intersects=function(c){if((!((this.xMax<c.xMin)||(this.xMin>c.xMax)))&&(!((this.yMax<c.yMin)||(this.yMin>c.yMax)))){return true}return false};this.extend=function(c){if(c.x>this.xMax){this.xMax=c.x}else{if(c.x<this.xMin){this.xMin=c.x}}if(c.y>this.yMax){this.yMax=c.y}else{if(c.y<this.yMin){this.yMin=c.y}}};this.intersection=function(c){var f,e,g,h;var d=0;if(c.xMin>=this.xMin&&c.xMin<=this.xMax){f=c.xMin;++d}if(c.xMax>=this.xMin&&c.xMax<=this.xMax){g=c.xMax;++d}if(d<2){if(this.xMin>=c.xMin&&this.xMin<=c.xMax){f=this.xMin;++d}if(this.xMax>=c.xMin&&this.xMax<=c.xMax){g=this.xMax;++d}}if(d<2){return new DMCBounds([new DMCPoint(0,0),new DMCPoint(0,0)])}d=0;if(c.yMin>=this.yMin&&c.yMin<=this.yMax){e=c.yMin;++d}if(c.yMax>=this.yMin&&c.yMax<=this.yMax){h=c.yMax;++d}if(d<2){if(this.yMin>=c.yMin&&this.yMin<=c.yMax){e=this.yMin;++d}if(this.yMax>=c.yMin&&this.yMax<=c.yMax){h=this.yMax;++d}}if(d<2){return new DMCBounds([new DMCPoint(0,0),new DMCPoint(0,0)])}return new DMCBounds([new DMCPoint(f,e),new DMCPoint(g,h)])};this.getSouthEast=function(){return new DMCPoint(this.xMax,this.yMin)};this.getSouthWest=function(){return new DMCPoint(this.xMin,this.yMin)};this.getNorthEast=function(){return new DMCPoint(this.xMax,this.yMax)};this.getNorthWest=function(){return new DMCPoint(this.xMin,this.yMax)};this.toSpan=function(){return new DMCPoint(this.xMax-this.xMin,this.yMax-this.yMin)};this.isValidLat=function(){return this.yMin<=-90&&this.yMax>=90};this.isValidLng=function(){return this.max<=-180&&this.yMax>=180};this.isEmpty=function(){return this.xMin>=this.xMax||this.yMin>=this.yMax};this.getCenter=function(){return new DMCPoint((this.xMax+this.xMin)/2,(this.yMax+this.yMin)/2,true)};this.getPoints=function(){return[new DMCPoint(this.xMin,this.yMin),new DMCPoint(this.xMin,this.yMax),new DMCPoint(this.xMax,this.yMax),new DMCPoint(this.xMax,this.yMin),new DMCPoint(this.xMin,this.yMin)]};this.toString=function(){var c=new DMCPolygon(this.getPoints());return c.toString()}}function DMCPoint(b,c,a){this.TYPE="POINT";this.x=b;this.y=c;if(!a){this.y=Math.max(-90,this.y);this.y=Math.min(90,this.y);this.x=Math.max(-180,this.x);this.x=Math.min(180,this.x)}this.toString=function(){return"POINT("+this.x+" "+this.y+")"};this.getX=function(){return this.x};this.getY=function(){return this.y};this.setX=function(d){this.x=d};this.setY=function(d){this.y=d};this.getLat=function(){return this.y};this.getLng=function(){return this.x};this.getPoints=function(){return[this]};this.setPoints=function(e){var d=null;if(typeof(e.length)!="undefined"&&e.length>0){d=e[0]}else{d=e}if(d!=null){this.x=d.x;this.y=d.y}};this.getLatRadians=function(){return this.y*Math.PI/180};this.getLngRadians=function(){return this.x*Math.PI/180};this.equals=function(d){return this.y==d.y&&this.x==d.x};this.intersects=function(g){if(g==null){throw new DMCException("DMCPoint.intersects can not take a null parameter")}if(g.TYPE=="POINT"){return this.equals(g)}if(g.TYPE=="POLYGON"||g.TYPE=="CIRCLE"){var e=g.contains(this);return e}if(g.TYPE=="BOUNDS"){var e=g.contains(this);return e}if(g.TYPE=="LINESTRING"){var d=false;var f=Math.EPSILON;for(var h=0;h<g.getVertexCount()-1;h++){var d=pointCloseToSegment(g.getVertex(h),g.getVertex(h+1),this,f);if(d){break}}return d}throw new DMCException("Other geometry types no supported.")};this.getCentroid=function(){return new DMCPoint(this.x,this.y,a)};this.getCenter=function(){return new DMCPoint(this.x,this.y,a)};this.getHandles=function(){var e=[];var d={TYPE:"WHOLE",INDEX:0,GEOMETRY:this};e.push(d);return e};this.modifyByHandle=function(d,e){this.x=e.x;this.y=e.y};this.projectToPixels=function(d){return d.latLngToPixel(this)}}function _pointArray1DtoPointArray(c){var b=[];for(var a=0;a<c.length;a+=2){b.push(new DMCPoint(c[a],c[a+1]))}return b}function DMCPoly(a,b){this.points=a;if(!this.points){this.points=[]}this.TYPE=b;var c=this;this.getVertexCount=function(){return this.points.length};this.getVertex=function(d){return this.points[d]};this.getPoints=function(){return this.points};this.setPoints=function(d){this.points=d};this.getBounds=function(){return new DMCBounds(this.points)};this.getArea=function(){return 0};this.getLength=function(){return _getLength(this.points)};this.intersects=function(d){throw new DMCException("Intersects implemenation is not supported to DMCLineString")};this.getHandles=function(){var j=[];var e=this.points.length;for(var d=0;d<(e-1);d++){var g=this.points[d];var h=this.points[d+1];var f=new DMCPoint((g.x+h.x)/2,(g.y+h.y)/2,true);j.push({TYPE:"INSERT_VERTEX",PT_INDEX:d,INDEX:j.length-1,GEOMETRY:f})}for(var d=0;d<e;d++){var k=new DMCPoint(this.points[d].x,this.points[d].y);j.push({TYPE:"VERTEX",PT_INDEX:d,INDEX:j.length-1,GEOMETRY:k})}j.push({TYPE:"WHOLE",INDEX:j.length-1,GEOMETRY:this.getClone()});return j};this.modifyByHandle=function(e,k,h){var j=e.PT_INDEX;if(e.TYPE=="VERTEX"){var l=this.points[j];l.x=k.x;l.y=k.y;if(this.TYPE=="POLYGON"){if(j==0){var l=this.points[this.points.length-1];l.x=k.x;l.y=k.y}else{if(j==this.points.length-1){var l=this.points[0];l.x=k.x;l.y=k.y}}}}else{if(e.TYPE=="WHOLE"){var f=k.x-h.x;var g=k.y-h.y;for(var d=0;d<this.points.length;d++){this.points[d].x+=f;this.points[d].y+=g}}else{if(e.TYPE=="INSERT_VERTEX"){return c.insertVertex(e.GEOMETRY,j+1)}}}};this.insertVertex=function(d,f){var e=this.points.length;if(f<0||f>e){return false}var h=[];for(var g=0;g<e;g++){if(g==f){h.push(d)}h.push(this.points[g])}this.points=h;return true};this.projectToPixels=function(f){var d=[];for(var e=0;e<this.points.length;e++){d.push(f.latLngToPixel(this.points[e]))}return new DMCLineString(d)}}function DMCLineString(a){this.base=DMCPoly;this.base(a,"LINESTRING");this.toString=function(){var b=this.TYPE+"(";for(var c=0;c<this.points.length;c++){if(c!=0){b+=","}b+=this.points[c].x+" "+this.points[c].y}b+=")";return b};this.getCenter=function(){var c=a.length;var b;var e=0;var d=0;for(b in a){e+=a[b].getX();d+=a[b].getY()}if((a[0].getX()==a[c-1].getX())&&(a[0].getY()==a[c-1].getY())){c=c-1;e-=a[0].getX();d-=a[0].getY()}return new DMCPoint(e/c,d/c)};this.getClone=function(){var b=[];for(var c=0;c<this.points.length;c++){b.push(new DMCPoint(this.points[c].x,this.points[c].y))}return new DMCLineString(b)}}DMCLineString.prototype=new DMCPoly();function DMCPolygon(a){this.base=DMCPoly;this.base(a,"POLYGON");this.getClone=function(){var b=[];for(var c=0;c<this.points.length;c++){b.push(new DMCPoint(this.points[c].x,this.points[c].y))}return new DMCPolygon(b)};this.toString=function(){var b="POLYGON((";for(var c=0;c<this.points.length;c++){if(c!=0){b+=","}b+=this.points[c].x+" "+this.points[c].y}b+="))";return b};this.getArea=function(){var c=this.points;var d=c.length;var g=new Array();var h=new Array();var e=0;var f=Math.floor((c[0].getX()+180)/6)+1;for(var b=0;b<d;b++){LatLonToUTMXY(DegToRad(c[b].getY()),DegToRad(c[b].getX()),f,h);g[b]=new DMCPoint(h[0],h[1],true)}for(var b=0;b<d-1;b++){e+=g[b].getX()*g[b+1].getY()-g[b].getY()*g[b+1].getX()}delete g;delete h;return Math.abs(0.5*e)};this.getAreaForInput=function(c){if((typeof(c)=="undefined")||(c==null)){return 0}var d=c;var b=d.length;var f=0;for(var e=0;e<b-1;e++){f+=d[e].getX()*d[e+1].getY()-d[e].getY()*d[e+1].getX()}return Math.abs(0.5*f)};this.getCenter=function(){var b=this.getCentroid();if(b==null){return null}if(this.contains(b)){return b}var c=this.adjustCenter(this.points,b);return c};this.getAveragePosition=function(){if(this.points==null){return null}var c=this.points.length;if(c<2){return null}var b=0;var d=0;for(var e=0;e<c-1;e++){b+=this.points[e].getX();d+=this.points[e].getY()}return new DMCPoint(b/(c-1),d/(c-1),true)};this.getCentroid=function(){if(this.points==null){return null}if(this.points.length<2){return null}var g=1e-20;var t=this.getAreaForInput(this.points);if(t<g){var f=this.getAveragePosition();return f}var j=this.points.length-1;var e=this.points[0].getX();var p=this.points[0].getY();var q=this.points[0].getY();var c=this.points[0].getY();var b=this.points[0].getX();var o=this.points[0].getX();for(var n=0;n<=j;n++){if(this.points[n].getY()>q){q=this.points[n].getY()}else{if(this.points[n].getY()<c){c=this.points[n].getY()}}if(this.points[n].getX()>b){b=this.points[n].getX()}else{if(this.points[n].getX()<o){o=this.points[n].getX()}}this.points[n].setX(this.points[n].getX()-e);this.points[n].setY(this.points[n].getY()-p)}var d=0;var k=0;var r;for(var n=0;n<j;n++){r=(this.points[n].getX()*this.points[n+1].getY()-this.points[n+1].getX()*this.points[n].getY());d+=((this.points[n].getX()+this.points[n+1].getX())*r);k+=((this.points[n].getY()+this.points[n+1].getY())*r)}var s=(0.166666666666667)*(1/t);d*=s;k*=s;for(var n=0;n<=j;n++){this.points[n].setX(this.points[n].getX()+e);this.points[n].setY(this.points[n].getY()+p)}d+=e;k+=p;var h=new DMCPoint(d,k,true);if((d<o)||(d>b)||(k<c)||(k>q)){h=this.getAveragePosition()}return h};this.adjustCenter=function(B,f){if((typeof(f)=="undefined")||(f==null)){return null}if((typeof(B)=="undefined")||(B==null)){return new DMCPoint(f.getX(),f.getY(),true)}var s=1e-20;var b=B.length;if(b<4){return new DMCPoint(f.getX(),f.getY(),true)}var v=b-1;var r=-1e+20;var q=1e+20;for(var n=0;n<=v;n++){if(B[n].getY()>r){r=B[n].getY()}if(B[n].getY()<q){q=B[n].getY()}}var k=f.getX();var x=f.getY();var e=new Array();var d=new Array();var h=0;if((x>q+s)&&(x<r-s)){h=this.horizontalSegments(B,e,d,x,0)}else{return new DMCPoint(k,x,true)}var E=-1;var y=1e+20;var c=-1;for(var n=0;n<h;n++){var u=Math.abs(d[n]-k);if(u<y){y=u;c=d[n];E=n}}if(E>=0){var t=new DMCPoint(c,x,true);return t}var C=4;var A=new Array(C+C);var g=r-x;if(g<s){g=0}var p=q-x;if(p>-s){p=0}var w=g/C;var D=p/C;var m=w;var z=D;for(var n=0;n<C;n++){A[n+n]=x+z;A[n+n+1]=x+m;m+=w;z+=D}for(var n=0;n<C+C;n++){var h=0;if((A[n]>q+s)&&(A[n]<r-s)){h=this.horizontalSegments(B,e,d,A[n],0)}var E=-1;var y=1e+20;var c=-1;for(var o=0;o<h;o++){var u=Math.abs(d[o]-k);if(u<y){y=u;c=d[o];E=o}}if(E>=0){var t=new DMCPoint(c,A[n],true);return t}}return new DMCPoint(k,x,true)};this.getCenterForPlacement=function(H,s,f){if((typeof(H)=="undefined")||(H==null)){return null}if(s<0){s=0}if(f<0){f=0}var N=1e-20;var b=H.length;if(b<4){return null}var o=new DMCPolygon(H);var d=this.getAreaForInput(H);if(d<N){var n=o.getAveragePosition();return n}var v=b-1;var p=H[0].getY();var w=H[0].getY();var z=H[0].getX();var B=H[0].getX();for(var t=0;t<=v;t++){if(H[t].getY()>p){p=H[t].getY()}else{if(H[t].getY()<w){w=H[t].getY()}}if(H[t].getX()>z){z=H[t].getX()}else{if(H[t].getX()<B){B=H[t].getX()}}}var D=o.getCentroid();var g=D.getX();var E=D.getY();var x=1.5;var r=false;var m=new Array();var k=new Array();var q=0;if((E>w+f/2+N)&&(E<p-f/2-N)){q=this.horizontalSegments(H,m,k,E,f)}else{r=true}var C=false;var J=-1;var L=-1;for(var t=0;t<q;t++){if(m[t]>J){J=m[t];L=t}if(m[t]>x*s){g=k[t];r=true;break}}var A=-10000000000;var P=-10000000000;var O=E;if(L>=0){A=J;P=k[L]}var I=8;if(!r){if(J>x*s){g=k[L];C=true}else{var G=new Array(I+I);var M=p-E;if(M<N){M=0}var F=w-E;if(F>-N){F=0}var y=M/I;var K=F/I;var h=y;var c=K;for(var t=0;t<I;t++){G[t+t]=E+c;G[t+t+1]=E+h;h+=y;c+=K}for(var t=0;t<I+I;t++){var q=0;if((G[t]>w+f/2+N)&&(G[t]<p-f/2-N)){q=this.horizontalSegments(H,m,k,G[t],f)}var J=-1;var L=-1;for(var u=0;u<q;u++){if(m[u]>J){J=m[u];L=u}}if(J>x*s){g=k[L];E=G[t];C=true;break}if(J>A){A=J;P=k[L];O=G[t]}}if((!C)&&(A>s)){g=P;E=O}delete G}}else{C=true}delete m;delete k;var e=new DMCPoint(g,E,true);if((g<B)||(g>z)||(E<w)||(E>p)){e=o.getAveragePosition()}return e};this.horizontalSegments=function(o,h,f,c,k){var d=0;var g=o.length;if(g<2){return 0}var l=1e-08;var t=k;if(t<l){t=l}var r=new Array();var s=0;for(var j=0;j<g-1;j++){var e=o[j].getY();var n=o[j+1].getY();var q=false;if((Math.abs(e-c)<t)&&(Math.abs(n-c)<t)){delete r;return 0}if(e<(c+l)){if(n>c){q=true}}else{if(e>(c-l)){if(n<c){q=true}}}if(q==true){var b=o[j].getX();var m=o[j+1].getX();var p=b+((c-e)*(m-b)/(n-e));r[s]=p;s++}}if(s%2==1){alert("Odd number of intersections!!")}if(s>0){r.sort(sortNumber);d=0;for(var j=0;j<s-1;j=j+2){h[d]=r[j+1]-r[j];f[d]=(r[j+1]+r[j])/2;d++}}delete r;return d};this.intersects=function(b){if(b==null){throw new DMCException("DMCPolygon.intersects can not take a null parameter")}if(b.TYPE=="POINT"){return this.contains(b)}else{if(b.TYPE=="BOUNDS"){var c=this.getBounds();return b.intersects(c)}}throw new DMCException("Only Point in polygon is supported")};this.contains=function(g){if(g==null){throw new DMCException("DMCPolygon.intersects can not take a null parameter")}if(g.TYPE!="POINT"){throw new DMCException("DMCPolygon.intersects expects only point geometry")}var h=0;var b=0;var f=this.points.length;var c=f-1;for(b,c;b<f;c=b++){var d=g.getY();var e=g.getX();if((((this.points[b].getY()<=d)&&(d<this.points[c].getY()))||((this.points[c].getY()<=d)&&(d<this.points[b].getY())))&&(e<(this.points[c].getX()-this.points[b].getX())*(d-this.points[b].getY())/(this.points[c].getY()-this.points[b].getY())+this.points[b].getX())){h=!h}}return h};this.getVertexCount=function(){return this.points.length};this.getVertex=function(b){return this.points[b]};this.isClockWise=function(){if((this.points==null)||(this.points.length<4)){return false}var e=false;var g=this.points.length;var d=this.points[0].getY();var f=0;for(var b=1;b<g-1;b++){if(this.points[b].getY()<d){d=this.points[b].getY();f=b}}var h=this.points[(f+g-2)%(g-1)].getX();var c=this.points[(f+1)%(g-1)].getX();if(h>c){e=true}else{e=false}return e}}DMCPolygon.prototype=new DMCPoly();function DMCCircle(b,a){this.TYPE="CIRCLE";this.dmcMap=a;this.points=new Array();this.points[0]=new DMCPoint(b[0].getX(),b[0].getY(),true);this.points[1]=new DMCPoint(b[1].getX(),b[1].getY(),true);this.getVertexCount=function(){return this.points.length};this.getVertex=function(c){return this.points[c]};this.calculatePolygon=function(){if(this.points==null||this.points.length<1){return null}var o=false;if(this.points[0].getLat()<0){o=true}var n=Math.floor((this.points[0].getX()+180)/6)+1;var v=new Array();var g=null;if(this.dmcMap!=null){g=new Array();g[0]=new DMCPoint(this.points[0].getX(),this.points[0].getY(),true);g[1]=new DMCPoint(this.points[1].getX(),this.points[1].getY(),true);for(var m=0;m<2;m++){var p=new Array();LatLonToUTMXY(DegToRad(g[m].getY()),DegToRad(g[m].getX()),n,p);g[m].setX(p[0]);g[m].setY(p[1])}}else{g=this.points}var t=100;var q=(Math.PI*2)/t;var v=new Array(t+1);var f=g[1].x-g[0].x;var k=g[1].y-g[0].y;var e=Math.sqrt(f*f+k*k);var j=g[0];var s=(g[1].getY()-g[0].getY())/e;var l=(g[1].getX()-g[0].getX())/e;v[0]=new DMCPoint(e,0,true);v[t]=new DMCPoint(e,0,true);var u=0;for(var m=1;m<t;m++){u+=q;var c=e*Math.cos(u);var d=e*Math.sin(u);v[m]=new DMCPoint(c,d,true)}for(var m=0;m<=t;m++){var c=v[m].getX()*l-v[m].getY()*s;var d=v[m].getY()*l+v[m].getX()*s;v[m].setX(j.x+c);v[m].setY(j.y+d)}if(this.dmcMap!=null){for(var m=0;m<=t;m++){var r=new Array();UTMXYToLatLon(v[m].getX(),v[m].getY(),n,o,r);v[m].setX(RadToDeg(r[1]));v[m].setY(RadToDeg(r[0]))}}var h=new DMCPolygon(v);return h};this.polygon=this.calculatePolygon();this.getCenter=function(){return new DMCPoint(this.points[0].getX(),this.points[0].getY(),true)};this.intersects=function(c){if(c==null){throw new DMCException("DMCCircle.intersects can not take a null parameter")}if(c.TYPE=="POINT"){return this.contains(c)}else{if(c.TYPE=="BOUNDS"){var d=this.getBounds();return c.intersects(d)}}throw new DMCException("Only Point in circle is supported")};this.contains=function(l){if(l==null){throw new DMCException("DMCCircle.intersects can not take a null parameter")}if(l.TYPE!="POINT"){throw new DMCException("DMCPolygon.intersects expects only point geometry")}if(this.points==null||this.points.length<1){return false}var h=null;var f=l;if(this.dmcMap!=null){h=new Array();h[0]=new DMCPoint(this.points[0].getX(),this.points[0].getY(),true);h[1]=new DMCPoint(this.points[1].getX(),this.points[1].getY(),true);h[2]=new DMCPoint(l.getX(),l.getY(),true);for(var d=0;d<3;d++){var n=Math.floor((h[d].getX()+180)/6)+1;var o=new Array();LatLonToUTMXY(DegToRad(h[d].getY()),DegToRad(h[d].getX()),n,o);h[d].setX(o[0]);h[d].setY(o[1])}f=h[2]}else{h=this.points}var j=h[1].getX()-h[0].getX();var k=h[1].getY()-h[0].getY();var m=j*j+k*k;var g=f.getX()-h[0].getX();var c=f.getY()-h[0].getY();var e=g*g+c*c;if(e<=m){return true}else{return false}};this.getPoints=function(){return this.points};this.clearBoundPoly=function(){this.polygon=null};this.getBoundPoly=function(){if(this.polygon==null){this.polygon=this.calculatePolygon()}return this.polygon};this.getBounds=function(){if(this.points==null||this.points.length!=2){throw new DMCException("DMCCircle: do not get bounds of an empty circle!")}var f=false;if(this.points[0].getLat()<0){f=true}var l=Math.floor((this.points[0].getX()+180)/6)+1;var g=null;if(this.dmcMap!=null){g=new Array();g[0]=new DMCPoint(this.points[0].getX(),this.points[0].getY(),true);g[1]=new DMCPoint(this.points[1].getX(),this.points[1].getY(),true);for(var d=0;d<2;d++){var n=new Array();LatLonToUTMXY(DegToRad(g[d].getY()),DegToRad(g[d].getX()),l,n);g[d].setX(n[0]);g[d].setY(n[1])}}else{g=this.points}var h=g[1].x-g[0].x;var j=g[1].y-g[0].y;var m=Math.sqrt(h*h+j*j);var c=new Array();c[0]=new DMCPoint(g[0].x+m,g[0].y,true);c[1]=new DMCPoint(g[0].x,g[0].y+m,true);c[2]=new DMCPoint(g[0].x-m,g[0].y,true);c[3]=new DMCPoint(g[0].x,g[0].y-m,true);if(this.dmcMap!=null){for(var d=0;d<4;d++){var k=new Array();UTMXYToLatLon(c[d].getX(),c[d].getY(),l,f,k);c[d].setX(RadToDeg(k[1]));c[d].setY(RadToDeg(k[0]))}}var e=new DMCBounds(c);return e};this.getBoundsInPixel=function(){if(this.points==null||this.points.length!=2){throw new DMCException("DMCCircle: do not get bounds of an empty circle!")}var f=false;if(this.points[0].getLat()<0){f=true}var l=Math.floor((this.points[0].getX()+180)/6)+1;var g=null;if(this.dmcMap!=null){g=new Array();g[0]=new DMCPoint(this.points[0].getX(),this.points[0].getY(),true);g[1]=new DMCPoint(this.points[1].getX(),this.points[1].getY(),true);for(var d=0;d<2;d++){var n=new Array();LatLonToUTMXY(DegToRad(g[d].getY()),DegToRad(g[d].getX()),l,n);g[d].setX(n[0]);g[d].setY(n[1])}}else{g=this.points}var h=g[1].x-g[0].x;var j=g[1].y-g[0].y;var m=Math.sqrt(h*h+j*j);var c=new Array();c[0]=new DMCPoint(g[0].x+m,g[0].y,true);c[1]=new DMCPoint(g[0].x,g[0].y+m,true);c[2]=new DMCPoint(g[0].x-m,g[0].y,true);c[3]=new DMCPoint(g[0].x,g[0].y-m,true);if(this.dmcMap!=null){for(var d=0;d<4;d++){var k=new Array();UTMXYToLatLon(c[d].getX(),c[d].getY(),l,f,k);c[d].setX(RadToDeg(k[1]));c[d].setY(RadToDeg(k[0]))}this.dmcMap.latLngPointsToPixelPoints(c)}var e=new DMCBounds(c);return e};this.getArea=function(){if(this.points==null||this.points.length!=2){return 0}var d=this.points;var e=d.length;var k=new Array();var l=new Array();var h=0;var j=Math.floor((d[0].getX()+180)/6)+1;for(var c=0;c<e;c++){LatLonToUTMXY(DegToRad(d[c].getY()),DegToRad(d[c].getX()),j,l);k[c]=new DMCPoint(l[0],l[1],true)}var g=k[1].getX()-k[0].getX();var f=k[1].getY()-k[0].getY();var h=Math.PI*(g*g+f*f);delete k;delete l;return h};this.getLength=function(){if(this.points==null||this.points.length!=2){return 0}var d=this.points;var e=d.length;var l=new Array();var m=new Array();var h=0;var j=Math.floor((d[0].getX()+180)/6)+1;for(var c=0;c<e;c++){LatLonToUTMXY(DegToRad(d[c].getY()),DegToRad(d[c].getX()),j,m);l[c]=new DMCPoint(m[0],m[1],true)}var g=l[1].getX()-l[0].getX();var f=l[1].getY()-l[0].getY();var k=2*Math.PI*Math.sqrt(g*g+f*f);delete l;delete m;return k};this.getCentroid=function(){return new DMCPoint(this.points[0].getX(),this.points[0].getY())};this.toString=function(){if(this.points==null||this.points.length<2){return""}var c="CIRCLE(("+this.points[0].x+" "+this.points[0].y+","+this.points[1].x+" "+this.points[1].y+"))";return c}}function WKT(g){try{var h=new RegExp(/(?:\()([^)(]*)(?:\))/g);var f=h.exec(g);var a=null;if(f!=null&&f.length>0){a=f[0].substring(1,f[0].length-1)}h=new RegExp(/[^(]*/g);var d=h.exec(g);var b=null;if(d!=null&&d.length>0){b=d[0].replace(/ /,"")}if(a==null||a==""||b==null||b==""){return null}var c=__parseWKTPointsString(a);if(b=="POINT"){if(c.length!=2){throw null}return new DMCPoint(c[0],c[1])}else{if(b=="LINESTRING"){if(c.length<4){throw null}return new DMCLineString(_pointArray1DtoPointArray(c))}else{if(b=="POLYGON"||b=="MULTIPOLYGON"){if(c.length<4){throw null}return new DMCPolygon(_pointArray1DtoPointArray(c))}else{if(b=="CIRCLE"){if(c.length<2){throw null}return new DMCCircle(_pointArray1DtoPointArray(c))}else{return null}}}}}catch(j){return null}}function __parseWKTPointsString(e){var d=e.split(",");var c=[];for(var b=0;b<d.length;b++){var a=d[b].split(" ");a=__deleteBlankStringFromArray(a);if(a.length!=2){throw"unsupported/malformatted wkt format:"+e}c.push(parseFloat(a[0]));c.push(parseFloat(a[1]))}return c}function __deleteBlankStringFromArray(e){var f=[];for(var a=0;a<e.length;a++){var c=true;var b=e[a].split(" ");for(var d=0;d<b.length;d++){if(b[d].length!=0){c=false;break}}if(!c){f.push(_trim(e[a]))}}return f}function _lTrim(a){return a.replace(/^\s*/,"")}function _rTrim(a){return a.replace(/\s*$/,"")}function _trim(a){return _rTrim(_lTrim(a))}function _getLength(d){var f=0;var c=d.length;var h=new Array();var g=new Array();var e=Math.floor((d[0].getX()+180)/6)+1;for(var a=0;a<c;a++){LatLonToUTMXY(DegToRad(d[a].getY()),DegToRad(d[a].getX()),e,h);g[a]=new DMCPoint(h[0],h[1],true)}for(var a=0;a<c-1;a++){var b=Math.pow((g[a].getX()-g[a+1].getX()),2)+Math.pow((g[a].getY()-g[a+1].getY()),2);f=f+Math.sqrt(b)}return f}function createPolygonFromEnvelope(d,a,e,f){var b=[new DMCPoint(d,a),new DMCPoint(e,a),new DMCPoint(e,f),new DMCPoint(d,f),new DMCPoint(d,a)];var c=new DMCPolygon(b);return c}function distanceBetweenLatLongs(a,h){var g=6372795.477598;var d=b(a);var e=b(h);var c=d.dot(e);var f=Math.acos(c);return g*f;function b(j){var p=j.getLatRadians();var o=j.getLngRadians();var m=Math.sin(p);var n=Math.cos(p);var k=n*Math.cos(o);var l=n*Math.sin(o);return new DMCPoint3D(k,l,m)}}Dmp.Geometry.distance=function(e,a){var c=e.x-a.x;var d=e.y-a.y;var b=Math.sqrt(c*c+d*d);return b};if(typeof(distance)=="undefined"){distance=Dmp.Geometry.distance}function sortNumber(c,d){return(c-d)}function pointCloseToSegment(h,j,b,d){var k=j.getX()-h.getX();var f=j.getY()-h.getY();var m=Math.sqrt(k*k+f*f);var g=b.getX()-h.getX();var c=b.getY()-h.getY();var n=g*g+c*c;if(m<Math.EPSILON){if(n<d*d){return true}else{return false}}else{var l=(k*g+f*c)/m;var e=n-l*l;if((l>=-d)&&(l<=m+d)&&(e<d*d)){return true}else{return false}}}function DMCtoGoogGeometry(f,l,b,h,d,k){if(!f.TYPE){throw new DMCException("DMCtoGoogGeometry: input is not a DMC javascript geometry")}try{var a=f.getPoints();var g=[];for(var c=0;c<a.length;c++){g.push(new GLatLng(a[c].getY(),a[c].getX()))}if(f.TYPE=="POINT"){return g[0]}else{if(f.TYPE=="BOUNDS"||f.TYPE=="POLYGON"){return new GPolygon(g,l,b,h,d,k)}else{if(f.TYPE.indexOf("LINE")>=0){return new GPolyline(g,l,b,h)}}}}catch(j){}throw new DMCException("DMCtoGoogGeometry: input is an not a DMC javascript geometry ("+f.TYPE+")")}function FixForFirefox2(){var c=0;var a="Firefox/";var b=navigator.userAgent.indexOf(a);if(b!=-1){c=parseFloat(navigator.userAgent.substring(b+a.length))}if(c>=1.5){Msn.Drawing.Graphic.CreateGraphic=function(e,d){return new Msn.Drawing.SVGGraphic(e,d)}}}function SetDMPKey(a){_DMP_KEY=a}var _G_COUNTER=0;var _DMP_KEY="user";var _OUTPUT_TYPE="PNG";var _G_DMP_SERVER_NAME="http://parcelstream.com";var G_NUM_SERVERS=4;var _G_MULTIDOMAIN_SERVER_NAME=new Array();for(var i=0;i<G_NUM_SERVERS;i++){_G_MULTIDOMAIN_SERVER_NAME[i]="t"+i}var _gExpectedFilter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='";function _gOverrideAppendChildIE7(c,d,e,f){if(c.tagName!="IMG"){return this._dmcAppendChild(c,d,e,f)}if(c.src.indexOf(_G_DMP_SERVER_NAME)<0&&!containsDomainName(c.src)){return this._dmcAppendChild(c,d,e,f)}var a=c.style.filter;if(a==null||a==""){return this._dmcAppendChild(c,d,e,f)}a+="";var b="alpha(opacity=100);";if(a.indexOf(b)>=0){c.style.filter=""}return this._dmcAppendChild(c,d,e,f)}function _gOverrideAppendChildIE6(g,j,n,c){if(g.tagName=="DIV"&&g.innerHTML==""){var a=g.style.filter;if(a!=null){a+="";if(a!=""){if(a.indexOf(_gExpectedFilter+_G_DMP_SERVER_NAME)>=0||containsDomainName(a,_gExpectedFilter,_gExpectedFilter.length)){var f=a.indexOf("http://");var b=a.indexOf("',",f);var k=a.substring(f,b);var h=false;if(k!=null&&k.toLowerCase().indexOf("png")>-1){h=true}if(h){var m=", alpha(opacity=100)";var e=""+g.style.filter;var d=e.split(m);if(d.length==2){g.style.filter=d[0]+d[1]}}else{var l=document.createElement("IMG");l.src=k;l.style.left=g.style.left;l.style.top=g.style.top;l.style.width=g.style.width;l.style.height=g.style.height;l.style.border=g.style.border;l.style.zIndex=g.style.zIndex;l.style.position=g.style.position;g=l}}}}}this._dmcAppendChild(g,j,n,c)}var _b_dmc_hasInitCalled=false;function gInitializeDMPLayers(b){if(_b_dmc_hasInitCalled){return}_b_dmc_hasInitCalled=true;if(document.all){var a=document.getElementById(b.ID).firstChild;if(a==null){alert("Error in DMP API. Please contact Digital Map Products Inc. Support.");return}a._dmcAppendChild=a.appendChild;if(navigator.userAgent.indexOf("MSIE 7.0")>=0){a.appendChild=_gOverrideAppendChildIE7}else{a.appendChild=_gOverrideAppendChildIE6}}}function SetParcelLayerVisibility(c,b){if(c==null){alert("Please pass Virtual Earth map instance as a parameter to the ToggleDMPParcelLayer() function. ");return}var a=c.parcelLayer;if(a){a.setVisible(b)}}function AddDMPParcelLayer(c,a){if(c==null){alert("Please pass Virtual Earth map instance as a parameter to the AddDMPParcelLayer() function. ");return}else{if(typeof(c.parcelLayer)!="undefined"){alert("This map already has a parcel layer defined in it. ");return}}gInitializeDMPLayers(c);var b=new TiledLayer(c,["Parcels"]);b.setMinZoomLevel(16);b.setMaxZoomLevel(19);b.setFormat("image/png");if(a){b.setZIndex(a)}b.initialize();c.parcelLayer=b}function containsDomainName(b,f,e){var c,d;if(f==null){f="";e=0}else{if(e==null||e<0){e=0}}for(var a=0;a<G_NUM_SERVERS;a++){d=_G_DMP_SERVER_NAME.substr(0,7)+_G_MULTIDOMAIN_SERVER_NAME[a]+"."+_G_DMP_SERVER_NAME.substr(7);if(e<f.length){c=f.substr(0,e)+d+f.substr(e)}else{c=f+d}if(b.toLowerCase().indexOf(c.toLowerCase())!=-1){return true}}return false}function GoogleTiledLayer(u,k,v){var a="http://t%2.parcelstream.com/";if(!v){v=a+"VEParcelTileServer.aspx"}var h=u;var t=null;var r=true;var q=k;var d=17;var n=19;var c=1;var l=new GCopyrightCollection();var j=false;var s=null;var w=null;var m=[];var g="image/png";var e="Layer"+new Date().getTime()+"_"+(_G_COUNTER++);this.setFormat=function(y){g=y;if(j){if(h!=null){p();x()}}};this.getFormat=function(){return g};this.addCopyright=function(y){l.addCopyright(y)};this.getCopyrights=function(z,y){return l.getCopyrights(z,y)};this.getProperty=function(y){return m[y]};this.setProperty=function(y,z){if(y!=null&&y!=""){m[y]=z}};this.getVisible=function(){return r};this.setMinZoomLevel=function(y){d=y};this.setMaxZoomLevel=function(y){n=y};this.getMinZoomLevel=function(){return d};this.getMaxZoomLevel=function(){return n};this.setOpacity=function(y){if(y!=null&&y>=0&&y<=1){c=y}if(j){if(h!=null){p();x()}}};this.getOpacity=function(){return c};this.setStyleLayerDescriptorUrl=function(y){s=y};this.getStyleLayerDescriptorUrl=function(){return s};this.setStyleLayerDescriptorText=function(y){w=y};this.getStyleLayerDescriptorText=function(){return w};this.setVisible=function(y){try{r=y;if(r){p();x()}else{t.hide()}}catch(z){}};this.initialize=function(){if(j){return}x();j=true};function x(){var y=new GTileLayer(l,d,n);y.getTileUrl=f;y.isPng=function(){if(g=="image/png"){return true}else{return false}};y.getOpacity=function(){return c};t=new GTileLayerOverlay(y);h.addOverlay(t)}function p(){if(h!=null){h.removeOverlay(t)}}function f(D,C){if(!r||C<d||C>n){return""}var z=v.replace("%2",""+Math.floor(Math.random()*G_NUM_SERVERS));var A=z+"?tileid="+b(D.x,D.y,C);if(q!=null&&q!=""&&q.length>0){A+="&layers="+o(q.join(","))}if(s!=null){A+="&SLD="+o(s)}if(g!=null){A+="&format="+encodeURIComponent(g)}if(w!=null){A+="&SLD_BODY="+o(w)}A+="&IsEncoded=true&SRS=EPSG:4326&REQUEST=MAP";for(var B in m){var y=m[B];if(y!=null&&y!=""){if(typeof(y)!=="undefined"&&typeof(y)!=="function"){A+=("&"+B+"="+encodeURIComponent(y))}}}return A}function b(A,B,D){var E="";for(var z=D;z>0;z--){var y="0";var C=1<<(z-1);if((A&C)!=0){y++}if((B&C)!=0){y++;y++}E+=y}return E}function o(y){return encodeURIComponent(y).replace(/%/g,"._-")}}function GoogleWMSLayer(s,h,t){var g=t;if(!g){g=_G_DMP_SERVER_NAME+"/VEParcelTileServer.aspx"}var f=s;var r=null;var o=true;var n=h;var c=17;var l=19;var j=false;var p=null;var u=null;var k=[];var a="image/png";var d="Layer"+new Date().getTime()+"_"+(_G_COUNTER++);this.setFormat=function(v){a=v};this.getFormat=function(){return a};this.getProperty=function(v){return k[v]};this.setProperty=function(v,w){if(v!=null&&v!=""){k[v]=w}if(j){this.onviewchange()}};this.setStyleLayerDescriptorUrl=function(v){p=v;if(j){this.onviewchange()}};this.getStyleLayerDescriptorUrl=function(){return p};this.setStyleLayerDescriptorText=function(v){u=v;if(j){this.onviewchange()}};this.getStyleLayerDescriptorText=function(){return u};this.getVisible=function(){return o};this.setMinZoomLevel=function(v){c=v;if(j){this.onviewchange()}};this.setMaxZoomLevel=function(v){l=v;if(j){this.onviewchange()}};this.getMinZoomLevel=function(){return c};this.getMaxZoomLevel=function(){return l};this.setVisible=function(v){o=v;try{if(o){this.onviewchange()}else{r.hide()}}catch(w){}};this.onviewchange=function(D){if(r){f.removeOverlay(r)}if(!q.getVisible()){return}var E=f.getZoom();if(c>E||l<E){return}var z=f.getBounds();var v=f.getSize();var y=z.getSouthWest();var F=z.getNorthEast();var w="?bbox="+y.lng()+","+y.lat()+","+F.lng()+","+F.lat();var A="";A+=g+w;var C=encodeURIComponent;if((m>=5.5)&&(m<7)&&(document.body.filters)&&(typeof(t)=="undefined"||t==null)&&a!=null&&a.toLowerCase().indexOf("png")>-1){C=b;A+="&IsEncoded=true"}A+="&width="+v.width;A+="&height="+v.height;if(n!=null&&n!=""&&n.length>0){A+="&layers="+C(n.join(","))}if(p!=null){A+="&SLD="+C(p)}if(a!=null){A+="&format="+C(a)}if(u!=null){A+="&SLD_BODY="+C(u)}A+="&SRS=EPSG:4326&REQUEST=MAP";for(var B in k){var x=k[B];if(x!=null&&x!=""){if(typeof(x)!=="undefined"&&typeof(x)!=="function"){A+=("&"+B+"="+C(x))}}}r=new GGroundOverlay(A,z);f.addOverlay(r)};var e=navigator.appVersion.split("MSIE");var m=parseFloat(e[1]);var q=this;this.initialize=function(){if(j){return}GEvent.bind(f,"moveend",q,q.onviewchange);q.onviewchange();j=true};function b(v){return encodeURIComponent(v).replace(/%/g,"._-")}}function TiledLayer(c,d,a){var b=null;if(typeof(GMap2)!="undefined"&&c instanceof GMap2){b=new GoogleTiledLayer(c,d,a);this.addCopyright=function(e){b.addCopyright(e)};this.getCopyrights=function(f,e){return b.getCopyrights(f,e)}}else{if(typeof(VEMap)!="undefined"&&c instanceof VEMap){b=new VETiledLayer(c,d,a);this.setZIndex=function(e){b.setZIndex(e)};this.getZIndex=function(){return b.getZIndex()}}else{return null}}this.setFormat=function(e){b.setFormat(e)};this.getFormat=function(){return b.getFormat()};this.setProperty=function(e,f){b.setProperty(e,f)};this.getProperty=function(e){return b.getProperty(e)};this.setVisible=function(e){b.setVisible(e)};this.getVisible=function(){return b.getVisible()};this.setMinZoomLevel=function(e){b.setMinZoomLevel(e)};this.getMinZoomLevel=function(){return b.getMinZoomLevel()};this.setMaxZoomLevel=function(e){b.setMaxZoomLevel(e)};this.getMaxZoomLevel=function(){return b.getMaxZoomLevel()};this.setOpacity=function(e){b.setOpacity(e)};this.getOpacity=function(){return b.getOpacity()};this.setStyleLayerDescriptorUrl=function(e){b.setStyleLayerDescriptorUrl(e)};this.getStyleLayerDescriptorUrl=function(){return b.getStyleLayerDescriptorUrl()};this.setStyleLayerDescriptorText=function(e){b.setStyleLayerDescriptorText(e)};this.getStyleLayerDescriptorText=function(){return b.getStyleLayerDescriptorText()};this.initialize=function(){b.initialize()};this.draw=function(){}}function VETiledLayer(g,k,t){gInitializeDMPLayers(g);var a="http://t%2.parcelstream.com/";if(!t){t=a+"VEParcelTileServer.aspx"}var j=true;var q=k;var e=17;var n=19;var d=1;var o=false;var l=100;var r=null;var u=null;var m=[];var s="image/png";var f="Layer"+new Date().getTime()+"_"+(_G_COUNTER++);this.setFormat=function(w){s=w};this.getFormat=function(){return s};this.setZIndex=function(w){l=w};this.getZIndex=function(){return l};this.getProperty=function(w){return m[w]};this.setProperty=function(w,x){if(w!=null&&w!=""){m[w]=x}};this.getVisible=function(){return j};this.setMinZoomLevel=function(w){e=w;if(o){if(g!=null){h();v()}}};this.setMaxZoomLevel=function(w){n=w;if(o){if(g!=null){h();v()}}};this.getMinZoomLevel=function(){return e};this.getMaxZoomLevel=function(){return n};this.setOpacity=function(w){if(w!=null&&w>=0&&w<=1){d=w}if(o){if(g!=null){h();v()}}};this.getOpacity=function(){return d};this.setStyleLayerDescriptorUrl=function(w){r=w;if(o){if(g!=null){h();v()}}};this.getStyleLayerDescriptorUrl=function(){return r};this.setStyleLayerDescriptorText=function(w){u=w;if(o){if(g!=null){h();v()}}};this.getStyleLayerDescriptorText=function(){return u};this.setVisible=function(w){try{j=w;if(this.getVisible()){if(c(g.ShowTileLayer)){g.ShowTileLayer(f)}else{if(c(g.ShowLayer)){h();v()}}}else{if(c(g.HideTileLayer)){g.HideTileLayer(f)}else{if(c(g.HideLayer)){h()}}}}catch(x){}};_this=this;this.initialize=function(){if(o){return}v();o=true};function v(){var x=p();var w=new VETileSourceSpecification(f,x);w.NumServers=G_NUM_SERVERS;w.MinZoomLevel=e;w.MaxZoomLevel=n;w.Opacity=d;w.ZIndex=l;if(c(g.AddTileLayer)){if(g!=null){g.AddTileLayer(w,true)}}else{if(c(g.AddLayer)){g.AddTileSource(w);var y=new VELayerSpecification(VELayerType.VETileSource,f,f);y.ZIndex=l;y.Opacity=d;g.AddLayer(y)}}}function h(){if(g!=null){try{if(c(g.DeleteTileLayer)){g.DeleteTileLayer(f)}else{if(c(g.DeleteLayer)&&c(g.DeleteTileSource)){g.DeleteLayer(f);g.DeleteTileSource(f)}}}catch(w){}}}function c(w){return(typeof(w)!="undefined"&&w!=null)}function p(){var x=t+"?tileid=%4";if(q!=null&&q!=""&&q.length>0){x+="&layers="+b(q.join(","))}if(r!=null){x+="&SLD="+b(r)}if(s!=null){x+="&format="+encodeURIComponent(s)}if(u!=null){x+="&SLD_BODY="+b(u)}x+="&IsEncoded=true&SRS=EPSG:4326&REQUEST=MAP";for(var y in m){var w=m[y];if(w!=null&&w!=""){if(typeof(w)!=="undefined"&&typeof(w)!=="function"){x+=("&"+y+"="+encodeURIComponent(w))}}}x+="&OverrideMapStyle="+b("<OverrideMapStyle><FORCE>1</FORCE></OverrideMapStyle>");return x}function b(w){return encodeURIComponent(w).replace(/%/g,"._-")}}function VEWMSLayer(g,k,u){gInitializeDMPLayers(g);var s=u;if(!s){s=_G_DMP_SERVER_NAME+"/VEParcelTileServer.aspx"}var c=null;var j=true;var q=k;var d=17;var n=19;var e=1;var l=false;var r=null;var v=null;var m=[];var a=2;var t="image/png";var p="Layer"+new Date().getTime()+"_"+(_G_COUNTER++);this.setFormat=function(x){t=x};this.getFormat=function(){return t};this.setZIndex=function(x){a=x};this.getZIndex=function(){return a};this.getProperty=function(x){return m[x]};this.setProperty=function(x,y){if(x!=null&&x!=""){m[x]=y}};this.setStyleLayerDescriptorUrl=function(x){r=x};this.getStyleLayerDescriptorUrl=function(){return r};this.setStyleLayerDescriptorText=function(x){v=x};this.getStyleLayerDescriptorText=function(){return v};this.getVisible=function(){return j};this.setMinZoomLevel=function(x){d=x};this.setMaxZoomLevel=function(x){n=x};this.getMinZoomLevel=function(){return d};this.getMaxZoomLevel=function(){return n};this.setOpacity=function(x){if(x!=null&&x>=0&&x<=1){e=x}};this.getOpacity=function(){return e};this.setVisible=function(x){try{j=x;if(this.getVisible()){this.onviewchange(null)}else{var A=w();var y=A.firstChild;if(c!=null){y.removeChild(c);c=null}}}catch(z){}};this.onviewchange=function(P){if(!_this.getVisible()){return}var L=w();var z=L.firstChild;if(c!=null){z.removeChild(c);c=null}var R=g.GetZoomLevel();if(d>R||n<R){return}var O=g.GetWidth();var C=g.GetHeight();var F=0;var H=0;var y=F+g.GetWidth();var B=H+g.GetHeight();var M=g.PixelToLatLong(new VEPixel(F,B));var D=g.PixelToLatLong(new VEPixel(y,H));var A=M.Longitude;var J=M.Latitude;var G=D.Longitude;var Q=D.Latitude;var K="";K+=s;K+="?bbox="+A+","+J+","+G+","+Q;var S=encodeURIComponent;if((o>=5.5)&&(o<7)&&(document.body.filters)&&(typeof(u)=="undefined"||u==null)&&t!=null&&t.toLowerCase().indexOf("png")>-1){S=b;K+="&IsEncoded=true"}K+="&width="+O;K+="&height="+C;if(q!=null&&q!=""&&q.length>0){K+="&layers="+S(q.join(","))}if(r!=null){K+="&SLD="+S(r)}if(t!=null){K+="&format="+S(t)}if(v!=null){K+="&SLD_BODY="+S(v)}K+="&SRS=EPSG:4326&REQUEST=MAP";for(var N in m){var E=m[N];if(E!=null&&E!=""){if(typeof(E)!=="undefined"&&typeof(E)!=="function"){K+=("&"+N+"="+S(E))}}}c=document.createElement("IMG");c.setAttribute("id","MDE"+p);c.id="MDE"+p;z.appendChild(c);var I=0-parseInt(z.style.top);var x=0-parseInt(z.style.left);c.style.left=x+"px";c.style.top=I+"px";c.style.position="absolute";c.style.width=O+"px";c.style.height=C+"px";c.style.opacity=e;c.style.filter="alpha(opacity="+(e*100)+")";c.style.zIndex=a;c.setAttribute("src",K);if(t!=null&&t.toLowerCase().indexOf("png")>-1){c=h(c)}};var f=navigator.appVersion.split("MSIE");var o=parseFloat(f[1]);function h(y){if((o>=5.5)&&(o<7)&&(document.body.filters)){var B=y.id;var D=(y.id)?"id='"+y.id+"' ":"";var x=(y.className)?"class='"+y.className+"' ":"";var C=(y.title)?"title='"+y.title+"' ":"title='"+y.alt+"' ";var A="display:inline-block;"+y.style.cssText;var z="<span "+D+x+C+' style="width:'+y.width+"px; height:"+y.height+"px;"+A+";filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+y.src+"', sizingMethod='scale');\"></span>";y.outerHTML=z;return document.getElementById(B)}return y}function w(){return document.getElementById(g.ID)}_this=this;this.initialize=function(){if(l){return}g.AttachEvent("onchangeview",this.onviewchange);this.onviewchange();l=true};function b(x){return encodeURIComponent(x).replace(/%/g,"._-")}}function WMSLayer(c,d,a){var b=null;if(typeof(GMap2)!="undefined"&&c instanceof GMap2){b=new GoogleWMSLayer(c,d,a)}else{if(typeof(VEMap)!="undefined"&&c instanceof VEMap){b=new VEWMSLayer(c,d,a);this.setZIndex=function(e){b.setZIndex(e)};this.getZIndex=function(){return b.getZIndex()};this.setOpacity=function(e){b.setOpacity(e)};this.getOpacity=function(){return b.getOpacity()}}else{return null}}this.setFormat=function(e){b.setFormat(e)};this.getFormat=function(){return b.getFormat()};this.setProperty=function(e,f){b.setProperty(e,f)};this.getProperty=function(e){return b.getProperty(e)};this.setVisible=function(e){b.setVisible(e)};this.getVisible=function(){return b.getVisible()};this.setMinZoomLevel=function(e){b.setMinZoomLevel(e)};this.getMinZoomLevel=function(){return b.getMinZoomLevel()};this.setMaxZoomLevel=function(e){b.setMaxZoomLevel(e)};this.getMaxZoomLevel=function(){return b.getMaxZoomLevel()};this.setStyleLayerDescriptorUrl=function(e){b.setStyleLayerDescriptorUrl(e)};this.getStyleLayerDescriptorUrl=function(){return b.getStyleLayerDescriptorUrl()};this.setStyleLayerDescriptorText=function(e){b.setStyleLayerDescriptorText(e)};this.getStyleLayerDescriptorText=function(){return b.getStyleLayerDescriptorText()};this.initialize=function(){b.initialize()};this.draw=function(){};this.onviewchange=b.onviewchange};function BingMap(options){var _self=this;var _loaded=false;var _defaultOptions={container:"mapsearch-mainmap",fixedMap:false,mapView:VEMapStyle.Shaded,displayListingsOnLoad:true,displayOfficesOnLoad:true,poiEnabled:false,showParcelLines:true,fireOnChange:true,startingMidLat:0,startingMidLon:0,startingZoom:15,showBubble:true,showMinimap:false};var _veMap=null;var _layers={};var _mapContainer=null;var _polyDeferred=[];var _polyPoints={};var _polyValueChanged=false;var _boundaryCount=0;var _mapH=0;var _mapW=0;var _parcelSet=0;var _bePinSet=false;var _mapState={};var _mapMoveOrigin=null;var _pinLayerVisible={all:true};var _pinLayerState=[];var _pinLookups=[];var _poiEnabled=false;var _drawingTempShape=null;var _drawingStartPin=null;var _drawingPan=false;var _drawingPoints=[];function getToggleBubbleHtml(count,curPosition,displayName){var html=new StringBuilder();var displayNames;if(displayName.substring(displayName.length-1,1)=="y"){displayNames=displayName.substring(0,displayName.length-2)+"ies"}else{displayNames=displayName+"s"}html.append('<tr><td valign="top"><table cellspacing="0" cellpadding="0" border="0" class="txt_blk_graybg" width="100%">');html.append('<tr><td colspan="3">Multiple '+displayNames+" found here</td></tr>");html.append('<tr><td align=left width="30%">');if(curPosition>0){html.append('<a href="javascript:;" onclick="javascript:Search.togglePinBubble('+(curPosition-1)+","+curPosition+' )">&lt; Prev</a>')}html.append("</td><td align=center width=40%>");html.append("<b>"+(curPosition+1)+" of "+count+"</b>");html.append("</td><td align=right width=30%>");if(curPosition<count-1){html.append('<a href="javascript:;" onclick="javascript:Search.togglePinBubble('+(curPosition+1)+","+curPosition+')">Next &gt;</a>')}html.append("</td></tr></table></td></tr>");return html.toString()}function meanAverageGridCluster(baseLayer){var i,j;var gridCells;var gridSize=30;var shapeCount=0;if(baseLayer!=null){if(baseLayer.gridSize){gridSize=baseLayer.gridSize}shapeCount=baseLayer.GetShapeCount()}if(shapeCount==0){return[]}if(_mapState.Style=="o"||_mapState.Style=="b"){if(baseLayer.layerType=="birdseye"){gridCells=[];var bePins=new VEClusterSpecification();bePins.Shapes=[];for(i=0;i<shapeCount;i++){bePins.Shapes.push(baseLayer.GetShapeByIndex(i))}gridCells.push(bePins)}else{return[]}}else{var numXCells=parseInt(Math.ceil(_mapW/gridSize),10);var numYCells=parseInt(Math.ceil(_mapH/gridSize),10);gridCells=new Array(numXCells*numYCells);for(i=0;i<shapeCount;i++){var shape=baseLayer.GetShapeByIndex(i);var latLong=(shape.GetPoints())[0];var pixel=_veMap.LatLongToPixel(latLong);var xPixel=pixel.x;var yPixel=pixel.y;if(_mapW>=xPixel&&_mapH>=yPixel&&xPixel>=0&&yPixel>=0){var a=Math.floor(xPixel/gridSize);var b=Math.floor(yPixel/gridSize);var key=a+b*numXCells;var spec=gridCells[key];if(spec==null){spec=new VEClusterSpecification();spec.Shapes=[];gridCells[key]=spec}spec.Shapes.push(shape)}}}var cluster=[];for(i=0,len=gridCells.length;i<len;i++){var cell=gridCells[i];if(cell!=null&&cell.Shapes.length>0){var size=cell.Shapes.length;var latSum=0;var lonSum=0;for(j=0;j<size;j++){var point=cell.Shapes[j].GetPoints()[0];latSum+=point.Latitude;lonSum+=point.Longitude}cell.LatLong=new VELatLong(latSum/size,lonSum/size);cluster.push(cell)}}return cluster}function clusteringCallback(clusters){for(var i=0,clusterCount=clusters.length;i<clusterCount;++i){var clusterSpec=clusters[i];var clusterShape=clusterSpec.GetClusterShape();var shapes=clusterSpec.Shapes;var firstShape=shapes[0];var pinInfo=BingMap.PinInfo[firstShape.PinType];var imgUrl;if(pinInfo){if(shapes.length==1){imgUrl=pinInfo.ImageOn}else{if(pinInfo.PinType==BingMap.PinType.ListingSold){imgUrl=BingMap.PinInfo[BingMap.PinType.ListingSoldMultiple].ImageOn}else{if(pinInfo.PinType==BingMap.PinType.ListingActive||pinInfo.PinType==BingMap.PinType.ListingNew||pinInfo.PinType==BingMap.PinType.ListingOpenHouse||pinInfo.PinType==BingMap.PinType.ListingPending){imgUrl=BingMap.PinInfo[BingMap.PinType.ListingMultiple].ImageOn}else{imgUrl=pinInfo.ImageOn}}}}else{imgUrl=firstShape.PinType+".gif"}var desc=firstShape.GetDescription();if(!desc||desc==""||desc=="{FROM_BIRDSEYE}"){var pinIDs=new StringBuilder();for(var j=0,shapeCountj=shapes.length;j<shapeCountj;j++){if(j>0){pinIDs.append(",")}pinIDs.append(shapes[j].PinID)}clusterShape.PinID=pinIDs.toString();clusterShape.SetDescription(desc)}else{if(shapes.length>1){var multiDesc=new StringBuilder();for(var k=0,shapeCountk=shapes.length;k<shapeCountk;k++){multiDesc.append('<table width="100%" valign="top" cellspacing="1" cellpadding="1" class="txt_blk" ');if(k>0){multiDesc.append('style="display:none;"')}multiDesc.append(' id="pin_'+k+'">');multiDesc.append(getToggleBubbleHtml(shapeCountk,k,BingMap.PinInfo[shapes[k].PinType].DisplayName));multiDesc.append("<tr><td>"+shapes[k].GetDescription()+"</td></tr>");multiDesc.append("</table>")}clusterShape.SetDescription(multiDesc.toString())}else{clusterShape.SetDescription(firstShape.GetDescription())}}clusterShape.SetCustomIcon(POIImagePath+"POI/"+imgUrl);clusterShape.PinType=firstShape.PinType}}function getLayer(layerType,isPinLayer,cluster,gridSize){if(!_layers[layerType]){var newLayer=new VEShapeLayer();newLayer.isPinLayer=isPinLayer;newLayer.layerType=layerType;if(typeof cluster=="undefined"||cluster==null){cluster=true}if(cluster){newLayer.gridSize=gridSize||30;var options=new VEClusteringOptions();options.Callback=clusteringCallback;newLayer.SetClusteringConfiguration(meanAverageGridCluster,options)}_veMap.AddShapeLayer(newLayer);_layers[layerType]=newLayer}return _layers[layerType]}function gotoFirst(loc){try{if(loc.indexOf(", USA")==-1&&loc.indexOf("mx")==-1){loc+=", USA"}if(loc!=""&&loc!="undefined"){_veMap.Find(null,loc,VEFindType.Businesses,null,null,null,null,null,true,true,null)}}catch(e){}}function updatePOI(removeExisting){var pinLayerName;if(_mapState.Zoom>=12){var pinTypes="";for(var i=5;i<22;i++){pinLayerName="poi-"+i;if(_pinLayerVisible[pinLayerName]){if(pinTypes.length>0){pinTypes+=","}pinTypes+=i}else{if(removeExisting){getLayer(pinLayerName,true).DeleteAllShapes()}}}if(pinTypes.length===0){if(!_poiEnabled){$(_mapContainer).trigger({type:"poichange",poiEnabled:true});_poiEnabled=true}}else{var url=Utils.AppPath+"/Include/AJAX/MapSearch/GetPOI.aspx?neLat="+_mapState.NELat+"&neLong="+_mapState.NELon+"&swLat="+_mapState.SWLat+"&swLong="+_mapState.SWLon+"&types="+pinTypes;$.ajax({mode:"abort",port:"poi",type:"GET",url:url,cache:true,dataType:"json",success:function(data){for(var i=0,len=data.length;i<len;i++){var pinType=data[i].PinType;var pinLayerName="poi-"+pinType;_self.startAddingPins(pinLayerName);for(var j=0,poiLen=data[i].POI.length;j<poiLen;j++){var poi=data[i].POI[j];_self.addPin(pinLayerName,"poi-"+pinType+"-"+j,poi.Latitude,poi.Longitude,pinType,poi.DisplayName,poi.Html)}_self.endAddingPins(pinLayerName)}if(!_poiEnabled){$(_mapContainer).trigger({type:"poichange",poiEnabled:true});_poiEnabled=true}}})}}else{if(_poiEnabled){for(var j=5;j<22;j++){pinLayerName="poi-"+j;getLayer(pinLayerName,true).DeleteAllShapes()}_poiEnabled=false;$(_mapContainer).trigger({type:"poichange",poiEnabled:false})}}}function toggleParcelLines(){if(_veMap){try{var zoomLevel=_veMap.GetZoomLevel();var mapStyle=_veMap.GetMapStyle();if(zoomLevel>=16&&mapStyle!=VEMapStyle.Birdseye){if(_parcelSet===0){if(typeof(_veMap.parcelLayer)=="undefined"){AddDMPParcelLayer(_veMap)}else{SetParcelLayerVisibility(_veMap,true)}_parcelSet=1}}else{_parcelSet=0;SetParcelLayerVisibility(_veMap,false)}if(zoomLevel>=17||mapStyle==VEMapStyle.Birdseye){$("#MSVE_navAction_ObliqueMapView").show()}else{$("#MSVE_navAction_ObliqueMapView").hide()}}catch(e){}}}function getBirdsEyeMapView(){var result;var be=_veMap.GetBirdseyeScene();if(be!=null){var tl=be.PixelToLatLong(new VEPixel(0,0));var br=be.PixelToLatLong(new VEPixel(be.GetWidth(),be.GetHeight()));switch(be.GetOrientation()){case VEOrientation.North:result=new VELatLongRectangle(tl,br,null,null);break;case VEOrientation.East:result=new VELatLongRectangle(new VELatLong(tl.Latitude,br.Longitude),new VELatLong(br.Latitude,tl.Longitude),null,null);break;case VEOrientation.South:result=new VELatLongRectangle(br,tl,null,null);break;case VEOrientation.West:result=new VELatLongRectangle(new VELatLong(br.Latitude,tl.Longitude),new VELatLong(tl.Latitude,br.Longitude),null,null);break}}else{result=new VELatLongRectangle(new VELatLong(0,0),new VELatLong(0,0),null,null)}return result}function getMapView(){var result;if(_veMap.GetMapStyle()==VEMapStyle.Birdseye){result=getBirdsEyeMapView()}else{var tl=_veMap.PixelToLatLong(new VEPixel(0,0));var br=_veMap.PixelToLatLong(new VEPixel(_mapW,_mapH));result=new VELatLongRectangle(tl,br)}return result}function onChangeStyle(e){if(options.mapView=="o"||options.mapView=="b"){_veMap.SetZoomLevel(19);toggleParcelLines()}}function onObliqueEnter(e){if(!_bePinSet&&(options.mapView=="o"||options.mapView=="b")){$(_mapContainer).trigger("birdseyeavailable");_bePinSet=true}}function onChangeView(e){var mapMoveOrigin=_mapMoveOrigin;_mapMoveOrigin=null;if(mapMoveOrigin=="Resize"){return}var mapStyle=_veMap.GetMapStyle();if(mapStyle!=_mapState.Style){_self.setView(mapStyle);return}if(mapStyle==VEMapStyle.Birdseye){return}var mv=getMapView();_mapState={NELat:mv.TopLeftLatLong.Latitude,NELon:mv.BottomRightLatLong.Longitude,SWLat:mv.BottomRightLatLong.Latitude,SWLon:mv.TopLeftLatLong.Longitude,Zoom:_veMap.GetZoomLevel(),PolyPoints:_polyPoints,Style:mapStyle};_loaded=true;$(_mapContainer).trigger("mapchange",[mapMoveOrigin]);if(options.showParcelLines){toggleParcelLines()}if(options.poiEnabled){updatePOI(true)}}function onShapeClick(e){if(e!=null&&e.elementID!=null){var shape=_veMap.GetShapeByID(e.elementID);_veMap.ShowInfoBox(shape);return true}}function setPinDisplay(pinLayerName){var pinLayerCanBeVisible=_pinLayerVisible.all&&_pinLayerVisible[pinLayerName];var pinLayerIsVisible=typeof(_pinLayerState[pinLayerName])!="undefined"?_pinLayerState[pinLayerName]:false;if(pinLayerCanBeVisible&&!pinLayerIsVisible){getLayer(pinLayerName,true).Show()}else{if(!pinLayerCanBeVisible){getLayer(pinLayerName,true).Hide()}}_pinLayerState[pinLayerName]=pinLayerCanBeVisible}function clearPins(pinLayerName){_pinLookups[pinLayerName]=[];_pinLookups[pinLayerName+"ids"]=[]}function getPins(pinLayerName){if(!_pinLookups[pinLayerName]){_pinLookups[pinLayerName]=[]}return _pinLookups[pinLayerName]}function setDescription(shape){var pinid=shape.PinID;if(pinid){var desc=shape.GetDescription();if(desc&&desc!="{FROM_BIRDSEYE}"){return true}if(desc=="{FROM_BIRDSEYE}"&&pinid=="1_"){return false}var divid=new Date().getTime()+"_bubble";shape.SetDescription('<div id="'+divid+'" style="width:100%; text-align:center;"><span style="height:50px;"><br/><br/><img src="'+imageBase+'/search/Images/spinner.gif" border="0" /> Loading...</span></div>');var url=Utils.AppPath+"/Include/AJAX/MapSearch/GetListingBubble.aspx?";if(pinid.substring(0,1)=="3"){url+="OfficeID="+pinid.replace(/3_/g,"")}else{url+="ListingID="+pinid.replace(/1_/g,"")}if(desc=="{FROM_BIRDSEYE}"){url+="&birdseye=true"}url+="&searchoverride="+options.cookieGuid;var qs=new Querystring();if(qs.contains("LayoutID")){url+="&LayoutID="+qs.get("LayoutID")+"&LayoutVersion="+qs.get("LayoutVersion")}$.get(url,null,function(resp){if(resp.indexOf("~~")>0){var desc=new StringBuilder();var arrDesc=resp.split("~~");for(var i=0,len=arrDesc.length;i<len;i++){desc.append('<table width="100%" valign="top" cellspacing="1" cellpadding="1" class="txt_blk" ');if(i>0){desc.append('style="display:none;"')}desc.append(' id="pin_'+i+'">');desc.append(getToggleBubbleHtml(len,i,BingMap.PinInfo[shape.PinType].DisplayName));desc.append("<tr><td>"+arrDesc[i]+"</td></tr>");desc.append("</table>")}resp=desc.toString()}$("#"+divid).parent().html(resp);shape.SetDescription(resp)})}return true}function onmouseover(e){if(options.showBubble&&e.elementID){return !setDescription(_veMap.GetShapeByID(e.elementID))}return true}function getBoundaryShape(latlongs){var boundaryShape=new VEShape(VEShapeType.Polygon,latlongs);boundaryShape.SetFillColor(new VEColor(131,185,187,0.1));boundaryShape.SetLineColor(new VEColor(186,0,255,1));boundaryShape.SetLineWidth(2);boundaryShape.HideIcon();return boundaryShape}function addShapesToLayer(shapes,layer,cb){layer.DeleteAllShapes();var points="";for(var i=0,len=shapes.length;i<len;i++){var shape=shapes[i];points+=shape.GetPoints()+",";layer.AddShape(shapes[i])}if(points.length>0){points=points.substring(0,points.length-1)}if(typeof cb=="function"){cb(shapes,points)}}function addShapesByPolyPoints(points,layer,cb){var latlongs=[];var ctr=0;try{var pointsSplit=points.split(",");for(var i=0,len=pointsSplit.length;i<len/2;i++){latlongs[i]=new VELatLong(parseFloat(pointsSplit[ctr]),parseFloat(pointsSplit[ctr+1]));ctr+=2}addShapesToLayer([getBoundaryShape(latlongs)],layer,cb)}catch(err){Utils.Logger.warn("Error adding polygon from points: "+err.message)}}function addShapesByBoundary(qsParams,layer,cb){if(typeof qsParams=="undefined"){return}$.ajax({type:"GET",url:Utils.AppPath+"/Include/AJAX/mapsearch/GetBoundary.aspx",data:qsParams,dataType:"json",success:function(polygons){var shapes=[];try{for(var i=0,len=polygons.length;i<len;i++){var latlongs=[];var polygon=polygons[i];var j=polygon.Points.length;if(j>0){do{var point=polygon.Points[j-1];latlongs.push(new VELatLong(parseFloat(point[1]),parseFloat(point[0])))}while(--j)}shapes.push(getBoundaryShape(latlongs))}}catch(ex){Utils.Logger.warn(ex.message)}addShapesToLayer(shapes,layer,cb)}})}function addShapes(polyLayer,polyType,polyValue,cb){if(!polyType||polyType==""||polyType=="points"){addShapesByPolyPoints(polyValue,polyLayer,cb)}else{var state="";if(polyType=="city"){state=defaultState;if(polyValue.indexOf(",")>-1){var citystate=polyValue.split(",");polyValue=citystate[0].trim();state=citystate[1].trim()}}addShapesByBoundary({val:polyValue,type:polyType,state:state},polyLayer,cb)}}function toggleMiniMap(){var $toggle=$("#minimap-toggle");var $img=$("#minimap-toggle img");if($toggle.is(".minimap-on")){_veMap.HideMiniMap();$toggle.css({bottom:0,left:0});$toggle.removeClass("minimap-on");$img.attr("src","/Images/Common/Map/images/mapcontrol/minimap_show.gif");$img.attr("alt","Show Mini Map");$img.attr("title","Show Mini Map")}else{_veMap.ShowMiniMap(0,_mapH-150);$("#MSVE_minimap_resize").hide();$toggle.addClass("minimap-on");$toggle.css({bottom:127,left:129});$img.attr("src","/Images/Common/Map/images/mapcontrol/minimap_hide.gif");$img.attr("alt","Hide Mini Map");$img.attr("title","Hide Mini Map")}}this.load=function(){options=$.extend({},_defaultOptions,options);if($.browser.mozilla){var interval=setInterval(function(){if((eval("typeof VEMap")!="undefined")&&(document.getElementById(options.container).attachEvent!=undefined)){clearInterval(interval);LoadMap()}},10)}else{LoadMap()}};function LoadMap(){_loaded=false;_pinLayerVisible.listing=options.displayListingsOnLoad;_pinLayerVisible.office=options.displayOfficesOnLoad;_pinLayerVisible.address=true;_mapContainer=document.getElementById(options.container);_mapH=$(_mapContainer).height();_mapW=$(_mapContainer).width();_veMap=new VEMap(options.container);_veMap.LoadMap(new VELatLong(options.startingMidLat,options.startingMidLong),options.startingZoom,options.mapView,options.fixedMap,VEMapMode.Mode2D,false);_self.setView(options.mapView);_veMap.SetMouseWheelZoomToCenter(false);_veMap.AttachEvent("onchangemapstyle",onChangeStyle);_veMap.AttachEvent("onobliqueenter",onObliqueEnter);_veMap.AttachEvent("onmouseover",onmouseover);_veMap.AttachEvent("onclick",onShapeClick);if(options.centerPin){_self.startAddingPins("address");_self.addPin("address","1",options.startingMidLat,options.startingMidLong,25,"","Center Pin");_self.endAddingPins("address");$(_mapContainer).pngFix()}if(options.fixedMap){$(_mapContainer).css("cursor","default");if(options.showParcelLines){toggleParcelLines()}_loaded=true}else{if(options.fireOnChange){_veMap.AttachEvent("onchangeview",onChangeView)}if(options.showMinimap){$("<div style='position: absolute; bottom: 0; left: 0; z-index: 1000; cursor: pointer;' id='minimap-toggle'><img alt='Show Mini Map' title='Show Mini Map' src='/Images/Common/Map/images/mapcontrol/minimap_show.gif' border='0'/></div>").click(toggleMiniMap).appendTo($(_mapContainer))}if(options.startingLocationNames&&options.startingLocationNames!=""){var names=options.startingLocationNames.split("|");var types=options.startingLocationTypes.split("|");var values=options.startingLocationValues.split("|");for(var i=0;i<names.length;i++){var polyName=names[i];var polyType=types[i].toLowerCase();if(polyType==="zip code"){polyType="zip"}var polyVal=values[i];if(!polyType||polyType==""||polyType=="neighborhood"||polyType=="points"||options.container=="community-main-map"){if(polyName.indexOf("Drawn Boundary")===0){var polyNameWords=polyName.split(" ");var boundaryIndex=parseInt(polyNameWords[polyNameWords.length-1]);if(boundaryIndex>_boundaryCount){_boundaryCount=boundaryIndex}}var dontSetMapView=true;if(options.startingLocationTypes.toLowerCase()==="points"||options.startingLocationTypes.toLowerCase()==="|points"){dontSetMapView=false}_self.gotoPoly(polyName,polyType,polyVal,dontSetMapView)}else{_self.gotoPolyDeferred(polyName,polyType,polyVal)}}}else{if(options.startingPolyValue&&options.startingPolyValue!=""){if(!options.startingPolyType||options.startingPolyType==""||options.startingPolyType=="neighborhood"||options.startingPolyType=="points"||options.container=="community-main-map"){var dontSetMapView=(options.startingMidLat!=options.defaultMidLat||options.startingMidLong!=options.defaultMidLong||options.startingZoom!=options.defaultZoom);_self.gotoPoly(options.startingPolyValue,options.startingPolyType,options.startingPolyValue,dontSetMapView)}else{_self.gotoPolyDeferred(options.startingPolyValue,options.startingPolyType,options.startingPolyValue)}}else{onChangeView()}}}}this.setOptions=function(opts){if(opts){options=$.extend({},options,opts);if(options.displayListingsOnLoad){_self.showPins("listing")}else{_self.hidePins("listing")}if(options.displayOfficesOnLoad){_self.showPins("office")}else{_self.hidePins("office")}_self.setView(options.mapView)}};this.isLoaded=function(){return _loaded};this.resize=function(w,h){if(typeof h=="undefined"){h=_mapH}if(w===0||h===0){return}if(w!=_mapW||h!=_mapH){_mapW=w;_mapH=h;var currCenter=_veMap.GetCenter();_mapMoveOrigin="Resize";_veMap.Resize(w,h);_veMap.PanToLatLong(currCenter);$(_mapContainer).width(w);$(_mapContainer).height(h);if($("#minimap-toggle.minimap-on").length>0){_veMap.ShowMiniMap(0,_mapH-150);$("#MSVE_minimap_resize").hide()}}};this.dispose=function(){$.each(_layers,function(layerName,layer){clearPins(layerName);layer=null});_pinLookups.length=0;if(_veMap){_veMap.Dispose();_veMap=null}};this.setCenterAndZoom=function(lat,lon,zoom){_veMap.SetCenterAndZoom(new VELatLong(lat,lon),zoom);_mapMoveOrigin="SetCenter";setTimeout(function(){if(_mapMoveOrigin=="SetCenter"){_mapMoveOrigin=null;$(_mapContainer).trigger("mapchange")}},500)};this.setView=function(view){var newView,oldView;oldView=_veMap.GetMapStyle();if(view=="r"||view=="s"){newView=VEMapStyle.Shaded}else{if(view=="h"){newView=VEMapStyle.Hybrid}else{if(view=="a"){newView=VEMapStyle.Aerial}else{if(view=="b"||view=="o"){newView=VEMapStyle.Birdseye}}}}if(newView!=oldView){_veMap.SetMapStyle(newView);if(oldView==VEMapStyle.Birdseye){_veMap.SetZoomLevel(17)}}if(newView==VEMapStyle.Birdseye){_veMap.SetShapesAccuracy(VEShapeAccuracy.Pushpin)}else{_veMap.SetShapesAccuracy(VEShapeAccuracy.None)}_mapState.Style=newView};this.getMapState=function(){return _mapState};this.showControls=function(){setTimeout(function(){if(_veMap){_veMap.ShowInfoBox();_veMap.ShowDashboard();_veMap.ShowScalebar()}},10)};this.hideControls=function(){setTimeout(function(){if(_veMap){_veMap.HideInfoBox();_veMap.HideDashboard();_veMap.HideScalebar()}},10)};this.hideScalebar=function(){setTimeout(function(){if(_veMap){_veMap.HideScalebar();_veMap.HideInfoBox()}},10)};this.showAllPins=function(){_pinLayerVisible.all=true;$.each(_layers,function(layerName,layer){if(layer.isPinLayer){setPinDisplay(layerName)}})};this.hideAllPins=function(){_pinLayerVisible.all=false;$.each(_layers,function(layerName,layer){if(layer.isPinLayer){setPinDisplay(layerName)}})};this.hidePins=function(pinLayerName){_pinLayerVisible[pinLayerName]=false;setPinDisplay(pinLayerName)};this.showPins=function(pinLayerName){_pinLayerVisible[pinLayerName]=true;setPinDisplay(pinLayerName)};this.hidePOI=function(pinType){var pinLayerName="poi-"+pinType;_pinLayerVisible[pinLayerName]=false;setPinDisplay(pinLayerName)};this.showPOI=function(pinType){var pinLayerName="poi-"+pinType;_pinLayerVisible[pinLayerName]=true;setPinDisplay(pinLayerName);if(getLayer(pinLayerName,true).GetShapeCount()===0){updatePOI(false)}};this.hideAllPOI=function(){$.each(_layers,function(layerName,layer){if(layer.isPinLayer&&layerName.indexOf("poi-")==0){_pinLayerVisible[layerName]=false;setPinDisplay(layerName)}})};this.showAllPOI=function(){var update=false;$.each(_layers,function(layerName,layer){if(layer.isPinLayer&&layerName.indexOf("poi-")==0){_pinLayerVisible[layerName]=true;setPinDisplay(layerName);if(layer.GetShapeCount()===0){update=true}}});if(update){updatePOI(false)}};this.pinsAreVisible=function(pinLayerName){var visible=_pinLayerVisible[pinLayerName];return(typeof visible=="boolean")&&visible};this.deleteAllPins=function(pinLayerName){getLayer(pinLayerName,true).DeleteAllShapes()};this.startAddingPins=function(pinLayerName,cluster){getLayer(pinLayerName,true,cluster).DeleteAllShapes();clearPins(pinLayerName)};this.addPin=function(pinLayerName,id,pinLat,pinLong,pinType,pinTitle,pinDesc){var shape=new VEShape(VEShapeType.Pushpin,new VELatLong(parseFloat(pinLat),parseFloat(pinLong)));if(pinTitle&&pinTitle.length>0){shape.SetTitle(pinTitle)}if(pinDesc&&pinDesc.length>0){shape.SetDescription(pinDesc)}var pinInfo=BingMap.PinInfo[pinType];var imgFilename=typeof(pinInfo)=="undefined"?pinType+".gif":pinInfo.ImageOn;shape.PinID=id;shape.PinType=pinType;shape.SetCustomIcon(POIImagePath+"POI/"+imgFilename);getPins(pinLayerName+"ids")[id]=shape;getPins(pinLayerName).push(shape)};this.endAddingPins=function(pinLayerName,bestview){var pins=getPins(pinLayerName);if(bestview){_mapMoveOrigin="SetMapView";_veMap.SetMapView(pins)}try{getLayer(pinLayerName,true).AddShape(pins)}catch(e){Utils.Logger.warn("Error adding "+pinLayerName+" pins to map: "+e.message)}setPinDisplay(pinLayerName)};this.addAddressPin=function(address){if(address.indexOf(", USA")==-1&&address.indexOf("mx")==-1){address+=", USA"}_veMap.Find(null,address,null,null,1,null,true,null,null,null,function(shapeLayer,findResults,places){var bestPlace=places[0];var location=bestPlace.LatLong;_self.startAddingPins("address");_self.addPin("address","1",location.Latitude,location.Longitude,BingMap.PinType.Address,"",bestPlace.Name);_self.endAddingPins("address");$(_mapContainer).pngFix()})};this.addLocationPin=function(latitude,longitude,address){if(address.indexOf(", USA")==-1&&address.indexOf("mx")==-1){address+=", USA"}_self.startAddingPins("address");_self.addPin("address","1",latitude,longitude,BingMap.PinType.Address,"",address);_self.endAddingPins("address",true);$(_mapContainer).pngFix()};this.showListingBubble=function(bubbleID){var pin=getPins("listingids")[bubbleID];if(pin&&setDescription(pin)){_veMap.ShowInfoBox(pin)}};this.hideListingBubble=function(){_veMap.HideInfoBox()};this.clearPolygons=function(change){for(var layer in _layers){if(layer.indexOf("poly-")==0){getLayer(layer,false,false).DeleteAllShapes()}}_polyPoints={};if(change){onChangeView()}};this.clearPolygon=function(polyName,change){getLayer("poly-"+polyName,false,false).DeleteAllShapes();delete _polyPoints[polyName];if(change){onChangeView()}};this.gotoPoly=function(polyName,polyType,polyValue,dontSetMapView,dontExecSearch){addShapes(getLayer("poly-"+polyName,false,false),polyType,polyValue,function(shapes,points){if(polyType.toLowerCase()!=="city"&&polyType.toLowerCase()!=="zip"){_polyPoints[polyName]=points}if(!dontSetMapView){_mapMoveOrigin="GotoPoly";if(shapes&&shapes.length>0){_veMap.SetMapView(shapes)}else{gotoFirst(polyValue)}setTimeout(function(){if(_mapMoveOrigin=="GotoPoly"){_mapMoveOrigin=null;$(_mapContainer).trigger("mapchange")}},500)}else{if(!dontExecSearch){onChangeView()}}})};this.gotoPolyDeferred=function(polyName,polyType,polyValue){_polyDeferred.push({Name:polyName,Type:polyType,Value:polyValue});_polyValueChanged=true;onChangeView()};function gotoPolyAsync(polyName,polyType,polyValue,dontSetMapView,dontExecSearch){polyValue=polyValue.toString();if(polyValue.indexOf("(")>0){polyValue=polyValue.substring(0,polyValue.indexOf("(")).trim()}window.setTimeout(function(){_self.gotoPoly(polyName,polyType,polyValue,true,true)},0)}this.gotoPolyDeferredAfter=function(){if(_polyValueChanged&&_polyDeferred&&_polyDeferred.length>0){_polyValueChanged=false;var ver=$.browser.version.substring(0,3);if(!($.browser.msie&&(ver=="6.0"||ver=="7.0"))){for(var i=0;i<_polyDeferred.length;i++){var polyDeferred=_polyDeferred[i];gotoPolyAsync(polyDeferred.Name,polyDeferred.Type,polyDeferred.Value,true,true)}}_polyDeferred=[]}};this.gotoPolyDeferredAfterForce=function(){if(_polyDeferred&&_polyDeferred.length>0){for(var i=0;i<_polyDeferred.length;i++){var polyDeferred=_polyDeferred[i];window.setTimeout(function(){var ver=$.browser.version.substring(0,3);if(!($.browser.msie&&(ver=="6.0"||ver=="7.0"))){var polyValue=polyDeferred.Value.toString();if(polyValue.indexOf("(")>0){polyValue=polyValue.substring(0,polyValue.indexOf("(")).trim()}_self.gotoPoly(polyDeferred.Name,polyDeferred.Type,polyValue,true,true)}},0)}_polyDeferred=[]}};function onmousewheel(e){window.scrollBy(0,-2*e.mouseWheelChange);return true}this.disableMouseZoom=function(){setTimeout(function(){if(_veMap){_veMap.AttachEvent("onmousewheel",onmousewheel)}},10)};this.enableMouseZoom=function(){setTimeout(function(){if(_veMap){_veMap.DetachEvent("onmousewheel",onmousewheel)}},10)};function getClickLatLong(e){var pixel=new VEPixel(e.mapX,e.mapY);var latLong=_veMap.PixelToLatLong(pixel);latLong.Latitude*=10000;latLong.Latitude=Math.floor(latLong.Latitude)/10000;latLong.Longitude*=10000;latLong.Longitude=Math.floor(latLong.Longitude)/10000;return latLong}function drawingClick(e){_drawingPoints.push(getClickLatLong(e))}function drawingMouseOut(e){var x=0;var y=0;var br=_veMap.LatLongToPixel(_veMap.GetMapView().BottomRightLatLong);if(e.mapX<15||e.mapX>br.x-15){if(e.mapX<15){x=-2}else{x=2}}if(e.mapY<15||e.mapY>br.y-15){if(e.mapY<15){y=-2}else{y=2}}if(x!=0||y!=0){_veMap.StartContinuousPan(x,y);_drawingPan=true}else{if(_drawingPan){_veMap.EndContinuousPan();_drawingPan=false}}}function drawingMouseOver(e){if(_drawingPan){_veMap.EndContinuousPan();_drawingPan=false}}function drawingMouseMove(e){if(_drawingPoints.length==0){return}var polyLayer=getLayer("poly",false,false);var points=_drawingPoints.slice(0);points.push(getClickLatLong(e));if(_drawingTempShape){polyLayer.DeleteShape(_drawingTempShape)}if(points.length<3){_drawingTempShape=new VEShape(VEShapeType.Polyline,points)}else{_drawingTempShape=new VEShape(VEShapeType.Polygon,points)}_drawingTempShape.SetFillColor(new VEColor(153,153,153,0.4));_drawingTempShape.SetLineColor(new VEColor(153,153,153,1));_drawingTempShape.SetLineWidth(2);_drawingTempShape.HideIcon();polyLayer.AddShape(_drawingTempShape);if(_drawingPoints.length==1){_veMap.AttachEvent("onmouseout",drawingMouseOut);_veMap.AttachEvent("onmouseover",drawingMouseOver);$(_mapContainer).trigger({type:"polypointchange",tipID:2})}if(_drawingPoints.length==3&&_drawingStartPin==null){_drawingStartPin=new VEShape(VEShapeType.Pushpin,_drawingPoints[0]);_drawingStartPin.SetCustomIcon("<img src='/Images/Common/Map/Images/mapcontrol/bttn-drawpolygon-end2.gif' onclick='Search.endDrawing()' />");_drawingStartPin.ShowDetailOnMouseOver=false;polyLayer.AddShape(_drawingStartPin);$(_mapContainer).trigger({type:"polypointchange",tipID:3})}}this.startDrawing=function(){getLayer("listing",true,true).DeleteAllShapes();_self.hideAllPins();_drawingPoints=[];$(_mapContainer).css("cursor","crosshair");_veMap.AttachEvent("onmouseup",drawingClick);_veMap.AttachEvent("onmousemove",drawingMouseMove);_veMap.DetachEvent("onchangeview",onChangeView);_veMap.vemapcontrol.EnableGeoCommunity(true);$(_mapContainer).trigger({type:"polypointchange",tipID:1})};this.endDrawing=function(cancel){_veMap.DetachEvent("onclick",drawingClick);_veMap.DetachEvent("onmousemove",drawingMouseMove);_veMap.DetachEvent("onmouseout",drawingMouseOut);_veMap.DetachEvent("onmouseover",drawingMouseOver);if(options.fireOnChange&&!options.fixedMap){_veMap.AttachEvent("onchangeview",onChangeView)}_veMap.vemapcontrol.EnableGeoCommunity(false);var polyLayer=getLayer("poly",false,false);polyLayer.DeleteAllShapes();if(_drawingPan){_veMap.EndContinuousPan();_drawingPan=false}_drawingStartPin=null;_drawingTempShape=null;$(_mapContainer).css("cursor","default");$(_mapContainer).trigger({type:"polypointchange",tipID:0});var boundaryData=null;if(!cancel&&_drawingPoints.length>=3){_drawingPoints.push(_drawingPoints[0]);boundaryData={Name:"Drawn Boundary "+ ++_boundaryCount,Type:"points",Value:_drawingPoints.toString()}}else{onChangeView()}_self.showAllPins();return boundaryData};this.plotComps=function(latLons){var arrLatLon=latLons.split(",");var len=arrLatLon.length;var latLon,lat,lon;_self.startAddingPins("comp",false);for(var i=0;i<len;i++){if(arrLatLon[i]==""){continue}latLon=arrLatLon[i].split(" ");lat=latLon[0];lon=latLon[1];if(lat!=""&&lon!=""&&lat!="undefined"&&lon!="undefined"){_self.addPin("comp","comp_"+i,lat,lon,"listing_"+(i+1),"","")}}_self.endAddingPins("comp",true);_self.showPins("comp")};var _locations;this.getDirections=function(locations){_locations=locations;var options=new VERouteOptions();options.RouteCallback=onGotRoute;options.ShowDisambiguation=true;options.DistanceUnit=VERouteDistanceUnit.Mile;_veMap.GetDirections(locations,options)};function formatTime(time){if(!time){return("")}if(time>60){var seconds=time%60;var minutes=time-seconds;minutes=minutes/60;if(minutes>60){var minLeft=minutes%60;var hours=minutes-minLeft;hours=hours/60;return(hours+" hrs, "+minLeft+" mins, "+seconds+" secs")}else{return(minutes+" mins, "+seconds+" secs")}}else{return(time+" secs")}}function onGotRoute(route){var routeInfo=new StringBuilder();var legs=route.RouteLegs;var turnNum=0;var $route=$("#dd-route");routeInfo.append('<table width="100%" border="0" cellspacing="2" cellpadding="2" class="dd_txt">');routeInfo.append('<tr><td colspan="4" class="dd_tableHeader1">');routeInfo.append("Total Distance: ");routeInfo.append(route.Distance.toFixed(1));routeInfo.append(" miles");routeInfo.append("<br/>Total Time: ");routeInfo.append(formatTime(route.Time));routeInfo.append("</td></tr>");for(var i=0,len=legs.length;i<len;i++){var leg=legs[i];var turn=null;var legNum=i+1;routeInfo.append('<tr><td colspan="4" class="dd_tableHeader2" nowrap="nowrap"><b>From: </b>');routeInfo.append(_locations[i]);routeInfo.append("<br/><b>To: </b>");routeInfo.append($("#dd-inputs-end").val());routeInfo.append("<br/><b>Time: </b>");routeInfo.append(formatTime(leg.Time));routeInfo.append("</td></tr>");$("#routeFrom").val(_locations[i]);$("#routeTo").val($("#dd-inputs-end").val());for(var j=0,len2=leg.Itinerary.Items.length;j<len2;j++){turn=leg.Itinerary.Items[j];routeInfo.append("<tr>");if(i==0&&j==0){routeInfo.append('<td align="center"><img src="/images/common/map/images/DrivingDirection/pin_Start.gif"/></td>')}else{if(i==len-1&&j==len2-1){routeInfo.append('<td align="center"><img src="/images/common/map/images/DrivingDirection/pin_End.gif"/></td>')}else{routeInfo.append('<td align="center"><div class="dd_number">');routeInfo.append(turnNum);routeInfo.append("</div></td>")}}routeInfo.append('<td class="hseparator">');routeInfo.append(turn.Text);routeInfo.append("</td>");routeInfo.append("<td>");if(turn.Distance!=null){routeInfo.append(turn.Distance.toFixed(1))}routeInfo.append("</td></tr>");turnNum++}}routeInfo.append("</table>");$route.html(routeInfo.toString())}}BingMap.PinType={ListingActive:1,ListingOther:2,Office:3,ListingMultiple:4,Childcare:5,Schools:6,Restaurants:7,Shopping:8,Grocery:9,Bank:10,Park:11,Hospital:12,Transport:13,Lodging:14,Worship:15,Police:16,Fire:17,Library:18,PostOffice:19,Cultural:20,Multiple:21,ListingOpenHouse:22,ListingSold:23,Address:24,ListingNew:25,ListingPending:26,ListingSoldMultiple:27};BingMap.PinInfo=[{},{PinType:BingMap.PinType.ListingActive,ShortName:"activelisting",DisplayName:"Listing",ImageOn:"listing_active.gif",ImageOff:"listing_active_off.gif",ImageDisabled:null},{PinType:BingMap.PinType.ListingOther,ShortName:"otherlisting",DisplayName:"Other Listing",ImageOn:"listing_other.gif",ImageOff:"listing_other_off.gif",ImageDisabled:null},{PinType:BingMap.PinType.Office,ShortName:"office",DisplayName:"Office",ImageOn:"office.gif",ImageOff:"office_off.gif",ImageDisabled:null},{PinType:BingMap.PinType.ListingMultiple,ShortName:"multiplelistings",DisplayName:"Multiple Listings",ImageOn:"listing_multiple.gif",ImageOff:"listing_multiple_off.gif",ImageDisabled:null},{PinType:BingMap.PinType.Childcare,ShortName:"childcare",DisplayName:"Preschool",ImageOn:"childcare_on.gif",ImageOff:"childcare_off.gif",ImageDisabled:"childcare_dis.gif"},{PinType:BingMap.PinType.Schools,ShortName:"schools",DisplayName:"School",ImageOn:"schools_on.gif",ImageOff:"schools_off.gif",ImageDisabled:"schools_dis.gif"},{PinType:BingMap.PinType.Restaurants,ShortName:"restaurants",DisplayName:"Restaurant",ImageOn:"restaurants_on.gif",ImageOff:"restaurants_off.gif",ImageDisabled:"restaurants_dis.gif"},{PinType:BingMap.PinType.Shopping,ShortName:"shopping",DisplayName:"Shopping",ImageOn:"shopping_on.gif",ImageOff:"shopping_off.gif",ImageDisabled:"shopping_dis.gif"},{PinType:BingMap.PinType.Grocery,ShortName:"grocery",DisplayName:"Grocery",ImageOn:"grocery_on.gif",ImageOff:"grocery_off.gif",ImageDisabled:"grocery_dis.gif"},{PinType:BingMap.PinType.Bank,ShortName:"bank",DisplayName:"Bank",ImageOn:"bank_on.gif",ImageOff:"bank_off.gif",ImageDisabled:"bank_dis.gif"},{PinType:BingMap.PinType.Park,ShortName:"park",DisplayName:"Entertainment/Recreation",ImageOn:"park_on.gif",ImageOff:"park_off.gif",ImageDisabled:"park_dis.gif"},{PinType:BingMap.PinType.Hospital,ShortName:"hospital",DisplayName:"Medical",ImageOn:"hospital_on.gif",ImageOff:"hospital_off.gif",ImageDisabled:"hospital_dis.gif"},{PinType:BingMap.PinType.Transport,ShortName:"transport",DisplayName:"Transportation",ImageOn:"transport_on.gif",ImageOff:"transport_off.gif",ImageDisabled:"transport_dis.gif"},{PinType:BingMap.PinType.Lodging,ShortName:"lodging",DisplayName:"Hotel",ImageOn:"lodging_on.gif",ImageOff:"lodging_off.gif",ImageDisabled:"lodging_dis.gif"},{PinType:BingMap.PinType.Worship,ShortName:"worship",DisplayName:"Worship",ImageOn:"worship_on.gif",ImageOff:"worship_off.gif",ImageDisabled:"worship_dis.gif"},{PinType:BingMap.PinType.Police,ShortName:"police",DisplayName:"Police Department",ImageOn:"police_on.gif",ImageOff:"police_off.gif",ImageDisabled:"police_dis.gif"},{PinType:BingMap.PinType.Fire,ShortName:"fire",DisplayName:"Fire Department",ImageOn:"fire_on.gif",ImageOff:"fire_off.gif",ImageDisabled:"fire_dis.gif"},{PinType:BingMap.PinType.Library,ShortName:"library",DisplayName:"Library",ImageOn:"library_on.gif",ImageOff:"library_off.gif",ImageDisabled:"library_dis.gif"},{PinType:BingMap.PinType.PostOffice,ShortName:"postoffice",DisplayName:"Mailing/Freight",ImageOn:"postoffice_on.gif",ImageOff:"postoffice_off.gif",ImageDisabled:"postoffice_dis.gif"},{PinType:BingMap.PinType.Cultural,ShortName:"cultural",DisplayName:"Cultural",ImageOn:"cultural_on.gif",ImageOff:"cultural_off.gif",ImageDisabled:"cultural_dis.gif"},{PinType:BingMap.PinType.Multiple,ShortName:"multiple",DisplayName:"Multiple",ImageOn:"multiple_on.gif",ImageOff:"multiple_off.gif",ImageDisabled:"multiple_dis.gif"},{PinType:BingMap.PinType.ListingOpenHouse,ShortName:"openhouselisting",DisplayName:"Open House",ImageOn:"listing_openhouse.gif",ImageOff:"listing_openhouse_off.gif",ImageDisabled:null},{PinType:BingMap.PinType.ListingSold,ShortName:"soldlisting",DisplayName:"Sold Listing",ImageOn:"listing_sold.gif",ImageOff:"listing_sold_off.gif",ImageDisabled:null},{PinType:BingMap.PinType.Address,ShortName:"address",DisplayName:"Address",ImageOn:"red-flag-only.png",ImageOff:null,ImageDisabled:null},{PinType:BingMap.PinType.ListingNew,ShortName:"newlisting",DisplayName:"New Listing",ImageOn:"listing_newlisting.gif",ImageOff:"listing_newlisting_off.gif",ImageDisabled:null},{PinType:BingMap.PinType.ListingPending,ShortName:"pendinglisting",DisplayName:"Pending Listing",ImageOn:"listing_pending.gif",ImageOff:"listing_pending_off.gif",ImageDisabled:null},{PinType:BingMap.PinType.ListingSoldMultiple,ShortName:"multiplesoldlistings",DisplayName:"Multiple Sold Listings",ImageOn:"listing_sold_multiple.gif",ImageOff:"listing_sold_multiple_off.gif",ImageDisabled:null},{PinType:BingMap.PinType.BlueHouse,ShortName:"bluehouse",DisplayName:"Subject Property",ImageOn:"blue-house.gif",ImageOff:"blue-house.gif",ImageDisabled:null}];(function(c){c.fn.elementready=function(e){var d=this.selector;if(!a[d]){a[d]=setInterval(function(){b(d,e)},25)}return this};var a=[];function b(d,e){c(d).each(function(){var f=c(this);if(f.attr("er")!="ready"){f.attr("er","ready");e.apply(this,[c])}a[d]=null});if(c.isReady&&a[d]!=null){clearInterval(a[d]);a[d]=null}}})(jQuery);var timeoutID=0;var searchStyleSet=false;var loginStyleSet=false;var navItems=new Array();var navNames=new Array();function rollover(a,b){a.src=b.src}function toggleImg(a,b){a.src=b}function rollover2(whichimg,overimg){eval('document.images["'+whichimg+'"].src = '+overimg+".src")}function showMyMenu(e,b){var a=document.getElementById(e);if(!a){return}var d=document.getElementById(b);if(d){if(e=="divNav1"){clearTimeout(timeoutID);if(!searchStyleSet&&document.all){searchStyleSet=true}}else{if(e=="divNav3"){if(!loginStyleSet){loginStyleSet=true;var c=document.getElementById("divNav3Login");if(orientation=="top"){c.style.top=0-d.offsetHeight-c.offsetHeight+"px"}}}}}if(orientation!="none"){if(e=="divNav3"){document.getElementById("divNav3Login").style.visibility="visible"}else{a.style.visibility="visible"}}}function hideMyMenu(a){var b=document.getElementById(a);if(!b){return}if(a=="divNav1"){timeoutID=setTimeout("document.getElementById('"+a+"').style.visibility = 'hidden'",800)}else{b.style.visibility="hidden"}if(a=="divNav3"){document.getElementById("divNav3Login").style.visibility="hidden"}}function setPosition(g,f){var c=document.getElementById(g);if(!c){return}var a=document.getElementById(f);if(a){if(document.all){var e=false;if(navItems.length==0){navItems[0]=f;navNames[0]=g}else{var b=0;for(;b<navItems.length;b++){if(navItems[b]==f){e=true;break}}if(e==false){navNames[b]=g;navItems[b]=f}}clearTimeout(timeoutID);for(b=0;b<navNames.length;b++){if(g==navNames[b]){c.style.visibility="visible";var d=document.getElementById(g.replace("divNav","subNav"));if(d){d.style.display="block"}}else{document.getElementById(navNames[b]).style.visibility="hidden"}}}else{var e=false;if(navItems.length==0){navItems[0]=f;navNames[0]=g}else{var b=0;for(;b<navItems.length;b++){if(navItems[b]==f){e=true;break}}if(e==false){navItems[b]=f;navNames[b]=g}}clearTimeout(timeoutID);for(b=0;b<navNames.length;b++){if(g==navNames[b]){c.style.visibility="visible";var d=document.getElementById(g.replace("divNav","subNav"));if(d){d.style.display="block"}}else{document.getElementById(navNames[b]).style.visibility="hidden"}}}}}function hideMenu(a){var b=document.getElementById(a);if(!b){return}timeoutID=setTimeout("document.getElementById('"+a+"').style.visibility = 'hidden'",400)};
