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 DrivingDirections(){var d=[];var o=this;function b(r,s){var u=false;for(var t=r.length-1;t>=0;t--){if(r.options[t].value==s){u=true;break}}if(u){alert("Location already in the Selected Location list.")}return u}function a(){var t=document.getElementById("mapsearch-directions-locations-list");if(t.length==-1){alert("There are no locations which can be moved!")}else{if(t.length>0){var u=t.selectedIndex;if(u==-1){alert("You must select a location to be moved!")}else{if(u>0){var r=t[u-1].text;var v=t[u].text;var w=t[u-1].value;var s=t[u].value;t[u].text=r;t[u].value=w;t[u-1].text=v;t[u-1].value=s;t.selectedIndex=u-1;q(t)}}}}}function n(){var t=document.getElementById("mapsearch-directions-locations-list");if(t.length==-1){alert("There are no locations which can be moved!")}else{if(t.length>0){var u=t.selectedIndex;if(u==-1){alert("You must select a location to be moved!")}else{if(u!=t.length-1){var r=t[u+1].text;var v=t[u].text;var w=t[u+1].value;var s=t[u].value;t[u].text=r;t[u].value=w;t[u+1].text=v;t[u+1].value=s;t.selectedIndex=u+1;q(t)}}}}}function q(r){var s;for(i=r.length-1;i>=0;i--){s=r.options[i].text;r.options[i].text=s.replace(s.substring(0,s.indexOf(": ")),String.fromCharCode(i+65))}}function g(){var r=document.getElementById("mapsearch-directions-locations-list");for(i=r.length-1;i>=0;i--){if(r.options[i].selected){r.options[i]=null}}q(r)}function p(r){$("#"+r).val("").blur()}function k(s){var r="mapsearch-directions-"+s+"-";p(r+"street");p(r+"city");p(r+"state");p(r+"zip")}function c(r){var t=false;var s=$("#"+r);if(s.length>0){var u=s.val();t=(u!=""&&u!=s.attr("title"))}return t}function h(r){var t="mapsearch-directions-"+r+"-";var s=((c(t+"city")&&c(t+"state"))||(c(t+"zip")));if(!s){alert("City and State or Zip is required for "+r+" location")}return s}function l(r){if(c(r)){return $("#"+r).val()+" "}else{return""}}function f(s){var r="";var t="mapsearch-directions-"+s+"-";r+=l(t+"street");r+=l(t+"city");r+=l(t+"state");r+=l(t+"zip");if(r!=""){if(!h(s)){return"INVALID"}}return r}function m(){k("start");document.getElementById("mapsearch-directions-locations-list").options.length=0}function e(){var s=document.getElementById("mapsearch-directions-locations-list");if(s){d=[];var t=0;var u=f("start");if(u!="INVALID"){if(u!=""){d[0]=u;t=1}for(var r=0,v=s.length;r<v;r++){d[t]=s.options[r].value.replace("#","").replace("&","");t++}if(d.length>1){var w="location="+encodeURIComponent($.toJSON(o.getLocations()));OpenDrivingDirections(w)}else{alert("Enter more than one location to get directions")}}}}function j(){var r=f("add");if(r!="INVALID"){if(r==""){alert("Please Enter Location to Add")}else{o.AddLocationToList(r);k("Add")}}}this.load=function(){$("#mapsearch-directions-button-moveup").click(a);$("#mapsearch-directions-button-movedown").click(n);$("#mapsearch-directions-button-remove").click(g);$("#mapsearch-directions-button-clear").click(m);$("#mapsearch-directions-button-get").click(e);$("#mapsearch-directions-button-add").click(j)};this.printDirections=function(r){OpenDrivingDirections(r)};this.AddLocationToList=function(t){$("#mapsearch-left-accordion").accordion("activate",1);var r=document.getElementById("mapsearch-directions-locations-list");if(r){var u=r.length;if(u>=20){alert("We only support Driving Directions for 20 locations")}t=t.replace("  ","");if(!b(r,t)){var s=new Option(String.fromCharCode(u+65)+": "+t,t);r.options[u]=s}}};this.getLocations=function(){return d}};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 MapSearch(options){var _self=this;var _map;var _submitEnabled=false;var _submitTimer=null;var _mapTimer=null;var _resizeTimer=null;var _containers=null;var _qs=new Querystring();var _activeView="map";var _activeSortID;var _displaySort=true;var _lastLocationSubmitted="";var _lastLocationSearchTab="";var _movingToolbar=false;var _setMapView=false;var _disposed=false;var _poiEnabled=false;var _clsid=-1;var _firstSubmit=true;var _submitting=false;var _advisoryPositionBottom=false;var _justLoaded=false;var _pageInfo={resultCount:0,totalCount:0,maxCount:0,page:0,resultsPerPage:10,cache:true,pageCache:{},clear:function(){this.page=0;this.pageCache={}}};var _defaultOptions={statuses:{active:"1,10",pending:"5",sold:"2"},mapExpandDiff:225,resultsPerPage:10,poiEnabled:true,showParcelLines:true,showMinimap:true,submitEnabledOnLoad:true,getOfficePins:true};function loadNeighborhoods(mapState){var divN=document.getElementById("divNeighborhood");var selN=document.getElementById("Neighborhood");if(!divN||!selN){return}selN.length=0;var selVal=$("#selNeighborhood").val();$("#selNeighborhood").val("");if(mapState.Zoom>=10&&mapState.Style!=VEMapStyle.Birdseye){$(selN).hide();$("#NeighborhoodLoading").html("<img src='"+imageBase+"spinner.gif' height='12'/>").show();$("#divNeighborhoodInfo").html("Retrieving Neighborhoods in this Area").show();$.ajax({mode:"abort",port:"neighborhoods",type:"GET",url:Utils.AppPath+"/Include/AJAX/MapSearch/GetLocations.aspx",data:{type:"neighborhood",q:"*",nelat:mapState.NELat,nelon:mapState.NELon,swlat:mapState.SWLat,swlon:mapState.SWLon,limit:5000},dataType:"json",success:function(neighborhoods){try{if(neighborhoods.length===0){$("#divNeighborhoodInfo").html("No Neighborhoods Found");$("#icNeighborhoodInfo").attr("title","No Neighborhoods Found");$(selN).blur();return}var city=$(":input[name='Criteria/City']",$(_containers.criteria)).val().toLowerCase();if(city.indexOf(",")>0){city=city.substring(0,city.indexOf(","))}var filtered;if(city.length===0){filtered=neighborhoods}else{filtered=[];for(var i=0,len=neighborhoods.length;i<len;i++){var n=neighborhoods[i];if(n.City&&n.City.length>0){if(n.City.toLowerCase()==city){filtered.push(n)}}else{filtered.push(n)}}}if(filtered.length>0){$("#icNeighborhoodInfo").attr("title","The list below shows all neighborhoods in the nearby map area. Select a neighborhood to see it outlined on the map or zoom out the map to see more neighborhoods.");$(selN).append("<option value=''>- Select Neighborhood -</option>");for(var j=0,lenj=filtered.length;j<lenj;j++){var neighborhood=filtered[j];var opt=document.createElement("option");opt.text=neighborhood.Name;opt.value=neighborhood.BoundaryID;if(neighborhood.BoundaryID==selVal){opt.selected="selected"}addOption(selN,opt)}$("#divNeighborhoodInfo").hide();$(selN).show()}else{$("#divNeighborhoodInfo").html("No Neighborhoods Found");$("#icNeighborhoodInfo").attr("title","No Neighborhoods Found")}$(selN).blur()}catch(err){Utils.Logger.warn("Error loading neighborhoods: "+err.message)}finally{$("#NeighborhoodLoading").hide()}}})}else{$(selN).hide();$("#divNeighborhoodInfo").html("Zoom in to view Neighborhoods").show();$("#icNeighborhoodInfo").attr("title","Zoom in to view Neighborhoods").show()}}function getSearchTabSelector(childSelector){var selector;var searchTab=$("#SearchTab").val();if(searchTab=="basicSearch"||searchTab=="advancedSearch"){selector="#basicSearch "+childSelector+",#advancedSearch "+childSelector}else{selector="#"+searchTab+" "+childSelector}return selector}function getHiddenInput(inputName){var searchTab=$("#SearchTab").val();if(searchTab=="advancedSearch"){searchTab="basicSearch"}searchTab="#"+searchTab;var $input=$(searchTab+" input[name='"+inputName+"']");if($input.length==0){$(searchTab).append("<input type='hidden' name='"+inputName+"' value='' />");$input=$(searchTab+" input[name='"+inputName+"']")}return $input}this.addLocation=function(data,dontSubmit){var loc=data.Name;if(data.City&&data.City!==""){data.Name+=", "+data.City}if(data.State&&data.State!==""){loc=data.Name+", "+data.State}if(loc.indexOf("(")==-1&&data.Type.toLowerCase()!=="points"){loc+=" ("+data.Type+")"}var locType=data.Type;var $Location=getHiddenInput("Criteria/Location");var $LocationType=getHiddenInput("Criteria/LocationType");var $LocationValue=getHiddenInput("Criteria/LocationValue");var allLocations=$Location.val().split("|");var allLocationTypes=$LocationType.val().split("|");var allLocationValues=$LocationValue.val().split("|");var alreadyInAll=false;for(var i=0;i<allLocations.length;i++){var thisLoc=allLocations[i];var thisLocType=allLocationTypes[i];if(thisLoc===loc&&thisLocType===locType){alreadyInAll=true;break}}if(!alreadyInAll){allLocations.push(loc);allLocationTypes.push(locType);var locVal=data.Name;if(data.Type.toLowerCase()=="city"){if(data.State&&data.State.length>0){locVal+=","+data.State}}else{if(data.Type.toLowerCase()=="neighborhood"||data.Type.toLowerCase()=="boundary"){locVal=data.BID}else{if(data.Type.toLowerCase()==="points"){locVal=data.Value}}}allLocationValues.push(locVal);$Location.val(allLocations.join("|"));$LocationType.val(allLocationTypes.join("|"));$LocationValue.val(allLocationValues.join("|"));_setMapView=true;if(data.Type.toLowerCase()=="city"){_map.gotoPolyDeferred(loc,"city",locVal)}else{if(data.Type.toLowerCase()=="zip code"){_map.gotoPolyDeferred(loc,"zip",locVal)}else{if(data.Type.toLowerCase()=="neighborhood"){_map.gotoPoly(loc,"neighborhood",locVal,true,dontSubmit)}else{if(data.Type.toLowerCase()==="points"){_map.gotoPoly(loc,"points",locVal,true,dontSubmit)}else{if(data.BID&&data.BID>0){_map.gotoPoly(loc,"boundary",locVal,true,dontSubmit)}else{var name=data.Name;if(data.State&&data.State.length>0){name+=","+data.State}gotoLocation(name,data.Type)}}}}}}};function removeLocation(loc){var $Location=getHiddenInput("Criteria/Location");var $LocationType=getHiddenInput("Criteria/LocationType");var $LocationValue=getHiddenInput("Criteria/LocationValue");var allLocations=$Location.val().split("|");var allLocationTypes=$LocationType.val().split("|");var allLocationValues=$LocationValue.val().split("|");var newAllLocations=[];var newAllLocationTypes=[];var newAllLocationValues=[];for(var i=0;i<allLocations.length;i++){var thisLoc=allLocations[i];var thisLocType=allLocationTypes[i];var thisLocVal=allLocationValues[i];if(thisLoc!==loc){newAllLocations.push(thisLoc);newAllLocationTypes.push(thisLocType);newAllLocationValues.push(thisLocVal)}else{var lowerLocType=thisLocType.toLowerCase();if(lowerLocType==="points"){_map.clearPolygon(loc,false)}if(lowerLocType==="city"||lowerLocType==="zip code"||lowerLocType==="neighborhood"||lowerLocType==="boundary"){_map.clearPolygon(loc,false)}}}$Location.val(newAllLocations.join("|"));$LocationType.val(newAllLocationTypes.join("|"));$LocationValue.val(newAllLocationValues.join("|"))}function removeCriteria(criterion){if(criterion.name==="Criteria/Location"){removeLocation(criterion.val);submit(true)}else{var names=criterion.name.split("|");for(var i=0;i<names.length;i++){$(getSearchTabSelector("*[name='"+names[i]+"']"),$(_containers.criteria)).each(function(){if(this.type==="checkbox"){if(this.value===criterion.val){$(this).attr("checked",false)}}else{if(this.nodeName.toLowerCase()==="select"&&(this.name==="HardCodedCriterion"||this.name==="ExtendedCriterion")){if($(this).val()===criterion.val){$(this).val("")}}else{$(this).val("")}}})}submit(false)}}function getFormData(mapState,mapMoved){var data={};if($(".customer-listings-view").length){data.useCookieFormDom="1";_setMapView=true}var hasLocationCriteria=false;$(getSearchTabSelector(":input"),$(_containers.criteria)).each(function(){if(!this.name){return true}if(this.value.length===0){return true}if((this.type=="radio"||this.type=="checkbox")&&!this.checked){return true}if(this.disabled){return true}if(this.name=="PolygonType"){return true}var elValue=this.value;if(this.name=="Criteria/City"&&elValue!=""){hasLocationCriteria=true;if(elValue.indexOf(",")>-1){var citystate=elValue.split(",");elValue=citystate[0];if(data["Criteria/StateOrProvinceCode"]){data["Criteria/StateOrProvinceCode"].push(citystate[1])}else{data["Criteria/StateOrProvinceCode"]=[citystate[1]]}}}if(this.name=="Criteria/Status"){if(elValue=="1"){elValue=options.statuses.active}else{if(elValue=="2"){elValue=options.statuses.sold}else{if(elValue=="5"){elValue=options.statuses.pending}}}}if((this.name=="Criteria/ZipCode"||this.name=="Criteria/ZipCodeAdvanced")&&elValue!=""){hasLocationCriteria=true}var elName=this.name;if($(this).attr("multiple")){$.each(this.options,function(){if($(this).attr("selected")){if(data[elName]){data[elName].push($(this).val())}else{data[elName]=[$(this).val()]}}})}else{if(data[this.name]){data[this.name].push(elValue)}else{data[this.name]=[elValue]}}});if(!data["Criteria/Status"]){if($(getSearchTabSelector("input[name='Criteria/Status']")).length>0){data["Criteria/Status"]=-1}else{data["Criteria/Status"]=1}}data["Criteria/SearchMapNELat"]=mapState.NELat;data["Criteria/SearchMapNELong"]=mapState.NELon;data["Criteria/SearchMapSWLat"]=mapState.SWLat;data["Criteria/SearchMapSWLong"]=mapState.SWLon;data["Criteria/Zoom"]=mapState.Zoom;if(mapState.PolyPoints){var points="";for(var key in mapState.PolyPoints){points+=mapState.PolyPoints[key]+"%"}data["Criteria/PolyPoints"]=points}if((data.AutoAdjustMap=="on"&&!mapMoved&&!_setMapView)||(_justLoaded&&data["Criteria/PolyPoints"]==undefined&&data["Criteria/Location"]!=undefined&&!_qs.contains("ListingSearch")&&!_qs.contains("ListingSearchID"))){data.IgnoreMap=true;_setMapView=true}else{data.IgnoreMap=_setMapView}_justLoaded=false;if(!_activeSortID||_activeSortID<1){_activeSortID=$("#mapsearch-sort-list").val()}data.ListingSortID=_activeSortID;data.view=_activeView;data["Criteria/SearchType"]="map";data.SearchTab=$("#SearchTab").val();data.GetOfficePins=options.getOfficePins;data.ExpandMap=$("#mapsearch-toolbar-expand-input").val();data.CLSID=_clsid;data.ResultsPerPage=_pageInfo.resultsPerPage;if(_qs.contains("LayoutID")){data.LayoutID=_qs.get("LayoutID");data.LayoutVersion=_qs.get("LayoutVersion")}if(_activeView!="map"){$(".ms_tab_on",$(_containers.viewTabs)).removeClass("ms_tab_on").addClass("ms_tab_off");$("#mapsearch-viewtab-"+_activeView).removeClass("ms_tab_off").addClass("ms_tab_on");$("#mapsearch-mainmap-toolbar").css("visibility","hidden");$("#mapsearch-results-header").css("visibility","hidden");$("#mapsearch-results-all").offset({top:$("#mapsearch-mainmap-toolbar").offset().top,left:$("#mapsearch-results-all").offset().left})}return data}function setCount(results){var totalCount,displayedCount;if(typeof results!="undefined"&&results!=null){totalCount=results.count;displayedCount=0;if(results.lst&&results.lst.length>0){displayedCount=results.lst.length}_pageInfo.resultCount=displayedCount;_pageInfo.totalCount=totalCount;_pageInfo.maxCount=results.maxcount}else{totalCount=-1;displayedCount=-1}var msg="";if(isNaN(totalCount)||totalCount==-1){msg="An error has occurred retrieving your results.  Please try again."}else{if(isNaN(displayedCount)||displayedCount<=0){msg=Utils.Format.addCommas(totalCount)+" properties found"}else{msg=Utils.Format.addCommas(displayedCount)+" of "+Utils.Format.addCommas(totalCount)+" properties displayed";if(displayedCount<totalCount){msg+=". Use the criteria to refine your search."}}}setCountText(msg);try{$(_containers.count).animate({backgroundColor:"transparent"},1000)}catch(ex){$(_containers.count).css({backgroundColor:"transparent"})}}function setCountText(msg){$(".mapsearch-count-total",$(_containers.count)).html(msg)}function unbindListingGrid(){var $grid=$("#mapsearch-results-body");$("div[mapconfig]",$grid).each(function(){var map=$(this).data("map");if(map){map.dispose()}});$("a.smallMapRoad",$grid).unbind("click");$("a.smallMapAerial",$grid).unbind("click");$("a.smallMapHybrid",$grid).unbind("click");$("div[lid]",$grid).unbind("mouseenter").unbind("mouseleave")}function getPageLinks(cursor,pagesPerRange,totalPages){var p=[];var start=pagesPerRange*(Math.floor(cursor/pagesPerRange));if((start+pagesPerRange)>totalPages){start-=(start+pagesPerRange)-totalPages}if(start<0){start=0}for(var i=start;i<(start+pagesPerRange)&&(i<totalPages);i++){var page=i+1;if(i==cursor){p.push("<span class='current-page'>{0}</span>".format(page));continue}p.push("<a href='JavaScript:Search.gotoPage("+page+");  "+addScrollToTop()+"'  name='map-results-page-"+page+"' title='Goto page "+page+"'>"+page+"</a>")}return p.join(" | ")}function addScrollToTop(){return(_activeView!="map")?"window.scrollTo(0, 0);":""}function setPager(results){if(typeof results=="undefined"||results==null){return}results.resultsPerPage=_pageInfo.resultsPerPage;var count=results.count;if(results.lst&&results.lst.length>0){count=results.lst.length}var totalPages=Math.ceil(count/results.resultsPerPage);var first=(results.page*results.resultsPerPage);$(".mapsearch-results-paging-properties").html(count+" of "+Utils.Format.addCommas(_pageInfo.totalCount)+" properties displayed");var pageLinks=[];pageLinks.push("Page "+getPageLinks(_pageInfo.page,5,totalPages)+" ");pageLinks.push(" of "+totalPages+"&nbsp;&nbsp;&nbsp;&nbsp;");if(_pageInfo.page===0){pageLinks.push("<span>Prev</span> | ")}else{pageLinks.push("<a href='JavaScript:Search.prevPage(); "+addScrollToTop()+"' name='ms-results-prev' title='Previous Page'>Prev</a> | ")}if(_pageInfo.page==totalPages-1){pageLinks.push("<span>Next</span>")}else{pageLinks.push("<a href='JavaScript:Search.nextPage(); "+addScrollToTop()+"'  name='ms-results-next' title='Next Page'>Next</a>")}_pageInfo.totalPages=totalPages;_pageInfo.count=count;_pageInfo.pageLinksHtml=pageLinks.join("");$("#mapsearch-mainmap").trigger("pageinfochange",[{pageInfo:_pageInfo}]);$(".mapsearch-results-paging-pages").html(_pageInfo.pageLinksHtml)}function positionAdvisory(toggleTop){if(_movingToolbar){return}_movingToolbar=true;var $advisory=$("#mapsearch-advisory-box");var containerHeight;if(_activeView=="map"){containerHeight=$("#mapsearch-mainmap").height()}else{containerHeight=$("#mapsearch-mainmap-results").height();toggleTop=false}var positionLeft=($("#mapsearch-mainmap-results").width()-$advisory.width())/2-5;if($.browser.msie&&parseInt($.browser.version.substring(0,1))<7){positionLeft=positionLeft/2-5}var middleTop=(containerHeight-$advisory.height())/2+50;var bottomTop=$("#mapsearch-maptoolbar").position().top-$advisory.height()*2+13;var advisoryTop=$advisory.position().top;var positionTop;if(_activeView=="map"){positionTop=bottomTop}else{positionTop=0}$advisory.animate({top:positionTop,left:positionLeft},"slow","swing",function(){_movingToolbar=false})}function showAdvisory(){var msg="";if(_pageInfo.maxCount>0&&_pageInfo.resultCount>0&&_pageInfo.resultCount<=_pageInfo.maxCount){hideAdvisory()}else{if(isNaN(_pageInfo.resultCount)||_pageInfo.resultCount==-1){setAdvisoryText("An error has occurred retrieving your results."," Please try again.")}else{if(_pageInfo.totalCount==1){setAdvisoryText("1 Property Found")}else{if(_pageInfo.totalCount==0){setAdvisoryText("<div id='box-count'>0</div> Properties Found","To view properties please change your search criteria on the left")}else{setAdvisoryText("<div id='box-count'>"+Utils.Format.addCommas(_pageInfo.totalCount)+"</div> Properties Found Display limit is "+_pageInfo.maxCount,"To view properties please change your search criteria on the left")}}}}}function showCalculating(){$("#mapsearch-commingling-info").hide();$(".mapsearch-count-displayed",$(_containers.count)).hide();setCountText("Searching...");setAdvisoryText("<span id='box-searching'>Searching...</span>","In a moment we'll show you the matching properties.")}function hideAdvisory(){if($.browser.msie&&parseInt($.browser.version.substring(0,1),10)<7){$("#mapsearch-advisory-box").hide()}else{$("#mapsearch-advisory-box").fadeTo("slow",0).hide()}}function setAdvisoryText(msg1,msg2){positionAdvisory();$("#mapsearch-advisory-box-total").html(msg1);$("#mapsearch-advisory-box-count").html(msg2);var $box=$("#mapsearch-advisory-box");if($.browser.msie&&parseInt($.browser.version.substring(0,1),10)<7){$("#mapsearch-advisory-box").show()}else{$("#mapsearch-advisory-box").show().fadeTo("slow",0.9)}}var _showListingGridBubbleDelay=250;function bindListingGridToBubbles(){$("#mapsearch-results-body div[lid]").mouseenter(function(){showListingBubbleDelayed($(this).attr("lid"))})}function showListingBubbleDelayed(id){var timeoutId=setTimeout(function(){showListingBubble(id)},_showListingGridBubbleDelay);$("#mapsearch-results-body div[lid='"+id+"']").mouseleave(function(){hideListingBubble(id,timeoutId)})}function showListingBubble(id){_map.showListingBubble("1_"+id)}function hideListingBubble(id,timeoutId){clearTimeout(timeoutId);_map.hideListingBubble();$("#mapsearch-results-body div[lid='"+id+"']").unbind("mouseleave")}function showListingGrid(results){unbindListingGrid();$("#mapsearch-results-body").html(results.listingsHtml).pngFix().unblock();if(_activeView=="map"){bindListingGridToBubbles();$("#mapsearch-results-header").show()}else{$("#mapsearch-results-header").hide();$("#mapsearch-results-body div.lsrcExtendedInfoBoxHead h5").click(function(){var listingid=$(this).attr("lid");var $box=$("#mapsearch-results-body .lsrEIB_"+listingid);if($box.is(":visible")){$box.hide("slow");$(this).html("<span class='arrow arrow-left'></span>View additional info")}else{$(this).html("<span class='arrow arrow-down'></span>Hide additional info");$box.show("slow",function(){var $mapBox=$("div[mapconfig]",this);if($mapBox.length>0&&!$mapBox.data("map")){var $parent=$mapBox.parent();var config=eval("("+$mapBox.attr("mapconfig")+")");var centerPin=(typeof config.centerPin=="undefined"||config.centerPin);var map=new BingMap({startingMidLat:config.lat,startingMidLong:config.lon,startingZoom:config.zoom||17,mapView:config.view||VEMapStyle.Hybrid,centerPin:centerPin,showBubble:false,container:$mapBox.attr("id")});map.load();$mapBox.data("map",map);$("a.smallMapRoad",$parent).click(function(){map.setView("r")});$("a.smallMapAerial",$parent).click(function(){map.setView("a")});$("a.smallMapHybrid",$parent).click(function(){map.setView("h")})}})}})}setPager(results)}function updateListingCountError(xmlRequest,textStatus,errorThrown){if(textStatus!=="abort"){_submitting=false;if(textStatus&&textStatus.length>0){Utils.Logger.warn("Error getting results: "+textStatus)}if(errorThrown&&errorThrown.message&&errorThrown.message.length>0){Utils.Logger.warn("Error getting results: "+errorThrown.message)}setCount(null);hideAdvisory();$("#mapsearch-results-body").unblock()}}function updateListingCount(results){if(!results){return}_submitting=false;setCount(results);_pageInfo.clear();var setMapView=_setMapView;_setMapView=false;if(results.lst&&results.lst.length>0){_map.startAddingPins("listing");for(var i=0,len=results.lst.length;i<len;i++){var lst=results.lst[i];if(lst.lat&&!isNaN(lst.lat)){_map.addPin("listing","1_"+lst.lid,lst.lat,lst.lon,lst.ptid,"Listing",lst.bub)}}_map.endAddingPins("listing",setMapView);showListingGrid(results);var commingling=document.getElementById("mapsearch-commingling");_clsid=results.clsid;if(commingling){var boardLen=results.board.length;var selBoard=document.getElementById("mapsearch-commingling-list");if(boardLen>1&&selBoard){selBoard.length=0;$.each(results.board,function(){var newOpt=new Option(this.clsname+" ("+this.count+") ",this.clsid);if(this.clsid==_clsid){newOpt.selected=true}selBoard.options[selBoard.options.length]=newOpt});commingling.style.display="inline";$("#mapsearch-commingling-info").show()}else{commingling.style.display="none";$("#mapsearch-commingling-info").hide()}}else{commingling.style.display="none";$("#mapsearch-commingling-info").hide()}hideAdvisory();if(results.disclaimer){$("#mapsearch-disclaimers").html(results.disclaimer);$("#mapsearch-disclaimers img").attr("alt","MLS logo")}else{$("#mapsearch-disclaimers").html("")}$("#mapsearch-results").show();$(".mapsearch-results-paging").show()}else{_map.deleteAllPins("listing");if((results.maxcount>0&&results.count>results.maxcount)||results.count==0){showAdvisory()}else{hideAdvisory()}$("#mapsearch-disclaimers").html("");$("#mapsearch-results").hide();$(".mapsearch-results-paging").hide();$("#mapsearch-commingling").hide()}if(results.office&&results.office.length>0){_map.startAddingPins("office");for(var j=0,officelen=results.office.length;j<officelen;j++){var office=results.office[j];if(office.latitude&&office.latitude!=""&&!isNaN(office.latitude)){_map.addPin("office","3_"+office.officeid,office.latitude,office.longitude,3,"Office")}}_map.endAddingPins("office")}else{_map.deleteAllPins("office")}var hideDaysOnMarket=false;$(".IDXRules_DontDisplayFields").each(function(){var dontDisplayVal=$(this).text();if(dontDisplayVal.indexOf("DaysOnMarket")>=0){hideDaysOnMarket=true}});var optDateListed=$("#mapsearch-sort-list option[value='5']");if($.browser.msie||$.browser.opera||$.browser.webkit){if(hideDaysOnMarket==true){$(optDateListed).remove()}else{if(optDateListed==null){$("#mapsearch-sort-list").append("<option value='5'>Date Listed</option>")}}}else{if(hideDaysOnMarket==true){$(optDateListed).hide()}else{$(optDateListed).show()}}}function submit(setMapView,mapState,mapMoved){if(_submitTimer!==null){clearTimeout(_submitTimer);_submitTimer=null}if(_submitEnabled&&_map.isLoaded()){_submitting=true;setTimeout(function(){_submitting=false},15000);if(!_setMapView){_setMapView=setMapView||false}if(_firstSubmit){var locations=$(getHiddenInput("Criteria/Location")).val();if(locations&&locations.length>0){_setMapView=true}_firstSubmit=false}mapState=mapState||_map.getMapState();var searchTab=$("#SearchTab").val();if(searchTab!="addressSearch"&&searchTab!="mapsearch-criteria-addresssearch"){_map.deleteAllPins("address")}try{$(_containers.count).animate({backgroundColor:"#ffd73b"},1000)}catch(ex){$(_containers.count).css({backgroundColor:"#ffd73b"})}$("#mapsearch-results-body").block({message:null});showCalculating();$.ajax({mode:"abort",port:"mapsearch",type:"POST",url:Utils.AppPath+"/Include/AJAX/MapSearch/GetListingPins.aspx?searchoverride="+options.cookieGuid,data:getFormData(mapState,mapMoved),traditional:true,cache:false,dataType:"json",success:updateListingCount,error:updateListingCountError});_map.gotoPolyDeferredAfter();$(document).trigger("criteriaitemchange",[{}]);return}_submitTimer=setTimeout(function(){submit(setMapView,mapState)},100)}function saveMapState(mapState){$.ajax({mode:"abort",port:"mapstate",type:"POST",url:Utils.AppPath+"/Include/AJAX/MapSearch/SaveMapState.ashx?searchoverride="+options.cookieGuid,data:getFormData(mapState),traditional:true,cache:false,dataType:"json"})}function onMapChange(evt,mapMoveOrigin){if(_mapTimer!==null){clearTimeout(_mapTimer)}if(_submitEnabled&&_map.isLoaded()){var mapState=_map.getMapState();if(mapMoveOrigin==="SetMapView"){saveMapState(mapState)}else{loadNeighborhoods(mapState);submit(false,mapState,true)}return}_mapTimer=setTimeout(function(){onMapChange(evt,mapMoveOrigin)},100)}function togglePOIIcon(icon,toggleDisplay){var alt,imgUrl;if(toggleDisplay){icon.display=!icon.display}if(!_poiEnabled){alt="Points of Interest disabled. Please zoom in to enable.";imgUrl=icon.ImageDisabled}else{if(icon.display){alt="Remove "+icon.DisplayName+" Icons from Map";imgUrl=icon.ImageOn}else{alt="Display "+icon.DisplayName+" Icons on Map";imgUrl=icon.ImageOff}}var $img=$("#poi-icon-"+icon.ShortName);if($img.length>0){$img.attr({alt:alt,title:alt,src:POIImagePath+"POI/"+imgUrl})}else{$("<img id='poi-icon-"+icon.ShortName+"' style='border: 0; padding: 4px; cursor: pointer;' alt='"+alt+"' title='"+alt+"' src='"+POIImagePath+"POI/"+imgUrl+"' \\>").appendTo("#mapsearch-poi-icons").click(function(){togglePOIIcon(icon,true);if(icon.display){_map.showPOI(icon.PinType)}else{_map.hidePOI(icon.PinType)}})}}function showOrClearPOI(show){for(var i=5;i<21;i++){BingMap.PinInfo[i].display=show;togglePOIIcon(BingMap.PinInfo[i])}if(show){_map.showAllPOI()}else{_map.hideAllPOI()}}function onPOIChange(e){_poiEnabled=e.poiEnabled;for(var i=5;i<21;i++){togglePOIIcon(BingMap.PinInfo[i])}}function setListingOfficePOIIcon($span,selected,toggle,click){var pin=$span.data("pin");if(toggle){pin.selected=!pin.selected}else{pin.selected=selected}var alt,imgUrl;if(pin.selected){alt="Remove "+pin.name+"s from the Map";imgUrl=POIImagePath+"POI/"+pin.pinInfo.ImageOn}else{alt="Add "+pin.name+"s to the Map";imgUrl=POIImagePath+"POI/"+pin.pinInfo.ImageOff}var $img=$("img",$span);if($img.length>0){$img.attr({alt:alt,title:alt,src:imgUrl})}else{$span.append("<img border='0' style='float: left; margin-right: 3px;' alt='"+alt+"' title='"+alt+"' src='"+imgUrl+"' \\>"+pin.name)}if(click&&pin.onclick&&typeof pin.onclick=="function"){pin.onclick(pin.selected)}$span.data("pin",pin)}function setListingOfficePOIIcons(){var pins=[];$(getSearchTabSelector("input[name='Criteria/Status'][type='checkbox']"),$(_containers.criteria)).each(function(){var self=this;var statusVal=this.value;var statusText=$("label[for='"+this.id+"']",$(_containers.criteria)).text();var pinInfo;if(!statusText||statusText==""){var next=this.nextSibling;while(next){var v=$.trim(next.nodeType!=1?next.nodeValue:$(next).text());if(v!=""){statusText=v;break}next=next.nextSibling}}if(statusVal=="1"){pinInfo=BingMap.PinInfo[BingMap.PinType.ListingActive];if(!statusText||statusText==""){statusText="Active"}}else{if(statusVal=="2"){pinInfo=BingMap.PinInfo[BingMap.PinType.ListingSold];if(!statusText||statusText==""){statusText="Sold"}}else{if(statusVal=="5"){pinInfo=BingMap.PinInfo[BingMap.PinType.ListingPending];if(!statusText||statusText==""){statusText="Pending"}}}}if(pinInfo){pins.push({val:statusVal,name:statusText,pinInfo:pinInfo,selected:this.checked,onclick:function(isActive){self.checked=isActive;submit()}})}});if(pins.length===0){pins.push({val:1,name:"Listing",pinInfo:BingMap.PinInfo[BingMap.PinType.ListingActive],selected:_map.pinsAreVisible("listing"),onclick:function(isActive){if(isActive){_map.showPins("listing")}else{_map.hidePins("listing")}}})}if(options.getOfficePins){pins.push({val:0,name:"Office",pinInfo:BingMap.PinInfo[BingMap.PinType.Office],selected:_map.pinsAreVisible("office"),onclick:function(isActive){if(isActive){_map.showPins("office")}else{_map.hidePins("office")}}})}$("#mapsearch-poi-listingoffice").html("");for(var i=0;i<pins.length;i++){var pin=pins[i];var $span=$("<span id='poi-icon-status-"+pin.val+"' style='float: left; padding: 4px; cursor: pointer;'></span>").data("pin",pin).click(function(){setListingOfficePOIIcon($(this),false,true,true)}).appendTo("#mapsearch-poi-listingoffice");setListingOfficePOIIcon($span,pin.selected)}}function updateSortIcons(){$("#mapsearch-results-header a[sort]").each(function(){var $this=$(this);var sorts=eval($this.attr("sort"));$this.text($this.text().replace("\u25b2","").replace("\u25bc",""));if(_activeSortID==sorts[0][0]){$this.text($this.text()+"\u25b2")}else{if(_activeSortID==sorts[1][0]){$this.text($this.text()+"\u25bc")}}})}function updateListingStatusMessage(){var statusHtml="";$(":input[name='Criteria/Status'][checked]",$(_containers.criteria)).each(function(){if(this.value=="1"){statusHtml+="Active,"}else{if(this.value=="5"){statusHtml+="Pending,"}else{if(this.value=="2"){statusHtml+="Sold,"}}}});if(statusHtml.length>0){statusHtml=statusHtml.substring(0,statusHtml.length-1);$("#selectedStatus").html(statusHtml).attr("title",statusHtml)}}function getListingHtml(first){$("#mapsearch-results-body").block({message:null});var data={view:_activeView,first:first||0,count:10,clsid:_clsid,ListingSortID:_activeSortID};if($(".customer-listings-view").length){data.useCookieFormDom="1"}if(_qs.contains("LayoutID")){data.LayoutID=_qs.get("LayoutID");data.LayoutVersion=_qs.get("LayoutVersion")}$.ajax({mode:"abort",port:"listingshtml",type:"POST",url:Utils.AppPath+"/Include/AJAX/MapSearch/GetListings.aspx?searchoverride="+options.cookieGuid,data:data,cache:false,dataType:"json",error:updateListingCountError,success:function(results){results.count=_pageInfo.resultCount;results.page=_pageInfo.page;showListingGrid(results)}})}this.isLoaded=function(){return _map?_map.isLoaded():false};this.clearCriteria=function(opt_settings){_submitEnabled=false;$(":input",$(_containers.criteria)).each(function(){var type=this.type,tag=this.tagName.toLowerCase(),name=this.name;if(type=="text"||type=="password"||tag=="textarea"||name=="Criteria/LocationType"||name=="Criteria/Location"||name=="Criteria/LocationValue"){this.value=""}else{if(type=="checkbox"){if(!this.disabled){this.checked=false}}else{if(type=="radio"&&name.indexOf("Groups")==-1){this.checked=false}else{if(tag=="select"){if($(this).attr("multiple")){$.each(this.options,function(){$(this).removeAttr("selected")})}else{this.selectedIndex=0}if(name=="Criteria/ListingTypeID"){_self.toggleListingType(this)}if(name=="dd_Features"){_self.toggleFeature(this)}}}}}});if($(":input[name='Criteria/Status']",$(_containers.criteria)).length>0){if($(":input[name='Criteria/Status'][checked]",$(_containers.criteria)).length===0){$(":input[name='Criteria/Status'][value='1']",$(_containers.criteria)).attr("checked",true);$(":input[name='Criteria/Status'][id='mapsearch-criteria-status-active']",$(_containers.criteria)).attr("checked",true);updateListingStatusMessage()}}_map.clearPolygons();_lastLocationSubmitted="";_submitEnabled=true;$(document).trigger("criteriachange",[{activeTab:$("#SearchTab").val()}]);if(opt_settings&&opt_settings.shouldNotResetMap){return}_map.setCenterAndZoom(options.defaultMidLat,options.defaultMidLong,options.defaultZoom)};function closeBirdseye(){$("#mapsearch-birdseye").hide();_map.showControls();var map=$("#mapsearch-birdseye").data("map");if(map){map.dispose();map=null}$("#mapsearch-birdseye-map").unbind("birdseyeavailable").unbind("mapviewnotsupported")}function toggleOpenHouse(){var checked=$("input[name='HardCodedCriterion'][value='349']:checked",$($(_containers.criteria))).length>0;$("input[name*='OpenHouse']").each(function(){this.disabled=!checked})}function addControlEvents(){var sortList=document.getElementById("mapsearch-sort-list");_activeSortID=$(sortList).val();$(sortList).change(function(){_activeSortID=$(this).val();updateSortIcons();submit()});$("#mapsearch-results-header a[sort]").each(function(){var $this=$(this);var sorts=eval($this.attr("sort"));var $sortList=$(sortList);if($("option[value='"+sorts[0][0]+"']",$sortList).length===0){sortList.options[sortList.options.length]=new Option(sorts[0][1],sorts[0][0])}if($("option[value='"+sorts[1][0]+"']",$sortList).length===0){sortList.options[sortList.options.length]=new Option(sorts[1][1],sorts[1][0])}$this.css("cursor","pointer");$this.click(function(){if(_activeSortID==sorts[0][0]){_activeSortID=sorts[1][0]}else{_activeSortID=sorts[0][0]}$(sortList).val(_activeSortID);updateSortIcons();submit()})});updateSortIcons();$("#mapsearch-commingling-list").change(function(){_clsid=$(this).val();submit(false)});$("div",$(_containers.viewTabs)).click(function(){var $this=$(this);var oldView=_activeView;_activeView=$this.attr("id").replace("mapsearch-viewtab-","");if(_activeView!=oldView){$(".ms_tab_on",$(_containers.viewTabs)).removeClass("ms_tab_on").addClass("ms_tab_off");$this.removeClass("ms_tab_off").addClass("ms_tab_on");getListingHtml(_pageInfo.page*_pageInfo.resultsPerPage);if(oldView=="map"||_activeView=="map"){if($("#mapsearch-mainmap-toolbar").css("visibility")==="visible"){$("#mapsearch-mainmap-toolbar").css("visibility","hidden");$("#mapsearch-results-header").css("visibility","hidden");$("#mapsearch-results-all").offset({top:$("#mapsearch-mainmap-toolbar").offset().top,left:$("#mapsearch-results-all").offset().left})}else{$("#mapsearch-mainmap-toolbar").css("visibility","visible");$("#mapsearch-results-header").css("visibility","visible");$("#mapsearch-results-all").offset({top:$("#mapsearch-mainmap-toolbar").offset().top+$("#mapsearch-mainmap-toolbar").height(),left:$("#mapsearch-results-all").offset().left});_map.gotoPolyDeferredAfterForce()}}showAdvisory();var mapState=_map.getMapState();saveMapState(mapState)}$(document).trigger("criteriachange",[{activeTab:$("#SearchTab").val(),view:_activeView}])});$("#mapsearch-birdseye-close").click(closeBirdseye);$("#mapsearch-maptoolbar-expand").click(function(){var expand=($("#mapsearch-toolbar-expand-input").val()=="true");var expandText;var height=$("#mapsearch-mainmap").height();if(expand){expandText="Expand Map";height-=options.mapExpandDiff}else{height+=options.mapExpandDiff;expandText="Contract Map"}_map.resize($("#mapsearch-maptoolbar").width(),height);$("#mapsearch-toolbar-expand-text").text(expandText);$("#mapsearch-toolbar-expand-input").val(!expand)});$("#mapsearch-maptoolbar-display input").click(function(){if(this.checked){_map.showAllPins()}else{_map.hideAllPins()}});$("#mapsearch-maptoolbar-draw").click(function(){if($(this).is(".drawing")){_self.endDrawing(true)}else{_self.startDrawing()}});$("#mapsearch-maptoolbar-poi").click(function(){$("#mapsearch-poi").toggle("slow")});$("#mapsearch-poi-close").click(function(){$("#mapsearch-poi").hide("slow")});$("#mapsearch-poi-show").click(function(event){event.preventDefault();showOrClearPOI(true)});$("#mapsearch-poi-clear").click(function(event){event.preventDefault();showOrClearPOI(false)});$("#mapsearch-mainmap").bind("polypointchange",function(e){if(e.tipID==1){setAdvisoryText("You are in Drawing mode.","Click on the starting point of your search area to start drawing.")}else{if(e.tipID==2){setAdvisoryText("Click on the next point.",'You can click on "Cancel Drawing" at any time to come out of drawing mode.')}else{if(e.tipID==3){setAdvisoryText("Now continue drawing your search area...","Or click on the End Drawing point on the map to finish drawing.")}}}})}function gotoLocation(loc,locType){if(!loc){loc=""}var searchTab=$("#SearchTab").val();var searchTabChanged=(_lastLocationSearchTab&&_lastLocationSearchTab!=""&&searchTab!=_lastLocationSearchTab);_lastLocationSearchTab=searchTab;if(loc==""){submit(searchTabChanged);return}else{if(locType.toLowerCase()=="address"){if($("#"+searchTab+" :input[name='Criteria/FilterByAddress']").val()=="1"){submit(true)}else{_map.addAddressPin(loc)}}else{submit(true)}}}function formatLocationItem(data,includeType){var item="";if(data){item=data.Name;if(data.City&&data.City.length>0){item+=", "+data.City}if(data.State&&data.State.length>0){item+=", "+data.State}if(includeType){item+=" ("+data.Type+")"}}return item}function extractLocationType(location,acceptedLocationTypes){var match="";var start=location.lastIndexOf("(");var end=location.lastIndexOf(")");if(start!=-1&&end!=-1){match=location.substring(start+1,end)}if(!acceptedLocationTypes||acceptedLocationTypes.length===0||acceptedLocationTypes.toLowerCase().indexOf(match.toLowerCase())!=-1){return match}else{return""}}function addStartingLocations(locationNames,locationTypes,locationValues){if(locationNames&&locationNames.length!==""){getHiddenInput("Criteria/Location").val(locationNames);getHiddenInput("Criteria/LocationType").val(locationTypes);getHiddenInput("Criteria/LocationValue").val(locationValues)}$("input.location,input[name='Criteria/City'],input[name='Criteria/ZipCodeAdvanced']").val("")}function criteriaOnLoad(){_justLoaded=true;var $criteria=$(_containers.criteria);var $criteriaForm=$(_containers.criteriaForm);var $searchSummary=$(_containers.searchSummary);_displaySort=!(document.getElementById("SearchVendor")&&document.getElementById("SearchVendor").value.length>0);if(_displaySort){$("#mapsearch-sort").show()}else{$("#mapsearch-sort").hide()}$(".toggleadvanced").before("<div id='mapsearch-criteria-actions-2-container' style='display: none;'><div id='mapsearch-criteria-actions-2'><div class='button-clear' tabindex='0' title='Clear Criteria'>Clear Criteria</div><a id='search-criteria-button' class='button-submit ms_button1' href='JavaScript:;' title='Search' name='ms-search-button'><span class='icon-search'></span>Search</a><div class='clearfloats'></div></div></div>");$("#customerLoginSpinner").hide();$(".button-clear",$criteriaForm).click(_self.clearCriteria).keypress(function(event){if(event.keyCode=="13"){event.preventDefault();_self.clearCriteria()}});$(".button-clear",$searchSummary).click(_self.clearCriteria).keypress(function(event){if(event.keyCode=="13"){event.preventDefault();_self.clearCriteria()}});$(".button-submit",$criteriaForm).click(function(){if(!_submitting){submit(false)}}).keypress(function(event){if(event.keyCode=="13"){if(!_submitting){submit(false)}}});$("input[name='SearchTab']",$criteria).remove();_self.toggleCriteria();$(".toggleadvanced").click(function(){toggleAdvancedCriteria()});$("select[name='Criteria/ListingTypeID']",$criteria).each(function(){_self.toggleListingType(this,true)});$("input[type='text'][name='Criteria/Location']",$criteria).each(function(){$(this).attr("name","Criteria/LocationBox")});addStartingLocations(options.startingLocationNames,options.startingLocationTypes,options.startingLocationValues);_submitEnabled=options.submitEnabledOnLoad;$criteria.pngFix();$(":input[name]",$criteria).each(function(){if(this.name=="Criteria/ListingNumber"){$(this).unbind("change");$(this).change(function(){gotoLocation(this.value,"ListingNumber")})}else{if(this.type=="checkbox"&&!this.onclick){$(this).click(function(){_self.onChangeSubmit(this)})}else{if(this.type!="checkbox"&&!this.onchange&&!$(this).is(".location")){$(this).change(function(){_self.onChangeSubmit(this)})}}}$(this).focus(function(){if(this.select){this.select()}});$(this).change(function(){if(this.type=="checkbox"||this.type=="radio"){$(":input[name='"+this.name+"'][value='"+this.value+"']",$criteria).attr("checked",this.checked)}else{if(this.nodeName=="SELECT"){$(":input[name='"+this.name+"']").has("option[value='"+$(this).val()+"']").val($(this).val())}else{$("input[name='"+this.name+"']",$criteria).val($(this).val())}}})});$("select.featuresdd[not(onchange)]",$criteria).change(function(){var $featureList=$("#"+$(this).val(),$criteria);$featureList.prevAll().hide();$featureList.nextAll().hide();$featureList.show()});$(".location",$criteria).each(function(){var $el=$(this);var $hiddenType=$("input[type='hidden'][rel='"+$el.attr("id")+"']",$criteria);var locationType=$el.attr("locationType");if(typeof(locationType)=="undefined"){locationType=""}var showType=(locationType==""||locationType.indexOf(",")!=-1);if(showType&&$el.val()){var initialLocationType=$hiddenType.val();if(initialLocationType&&initialLocationType.length>0&&$el.val().indexOf("("+initialLocationType+")")==-1){$el.val($el.val()+" ("+initialLocationType+")")}}$el.autocomplete(Utils.AppPath+"/Include/AJAX/MapSearch/GetLocations.aspx",{dataType:"json",minChars:2,width:"auto",extraParams:{type:locationType},max:100,matchSubset:false,cacheLength:0,parse:function(data){var parsed=[];var countMls=0;var countZip=0;var countCity=0;var countCounty=0;var countNeighborhood=0;var countSubdivision=0;var countLakeName=0;var lastCityOrZip=-1;if(data!=null){for(var i=0,len=data.length;i<len;i++){var d=data[i];var dType=d.Type.toLowerCase();if(dType=="mls #"){countMls++}else{if(dType=="zip code"){countZip++}else{if(dType=="city"){countCity++}else{if(dType=="county"){countCounty++}else{if(dType=="neighborhood"){countNeighborhood++}else{if(dType=="subdivision"){countSubdivision++}else{if(dType=="lake name"){countLakeName++}}}}}}}if(dType=="city"||dType=="zip code"){lastCityOrZip=i}parsed.push({data:d,value:d.Name,result:formatLocationItem(d,showType)})}}if(locationType==""||(locationType.indexOf(",")!=-1&&locationType.toLowerCase().indexOf("address")!=-1)){var val=$el.val().trim();if(val.length>0){var embeddedType=extractLocationType(val,locationType);if(embeddedType.length===0){var addressSpliceIndex=lastCityOrZip+1;if(locationType.toLowerCase().indexOf("*address")!=-1){var arLocationTypes=locationType.toLowerCase().split(",");addressSpliceIndex=0;for(var i=0;i<arLocationTypes.length;i++){var type=arLocationTypes[i];if(type!="*address"){if(type=="mls #"){addressSpliceIndex+=countMls}else{if(type=="zip code"){addressSpliceIndex+=countZip}else{if(type=="city"){addressSpliceIndex+=countCity}else{if(type=="county"){addressSpliceIndex+=countCounty}else{if(type=="neighborhood"){addressSpliceIndex+=countNeighborhood}else{if(type=="subdivision"){addressSpliceIndex+=countSubdivision}else{if(type=="lake name"){addressSpliceIndex+=countLakeName}}}}}}}}else{break}}}var addressData={Name:val,Type:"Address"};parsed.splice(addressSpliceIndex,0,{data:addressData,value:addressData.Name,result:formatLocationItem(addressData,showType)})}}}return parsed},formatItem:function(data){return"<nobr>"+formatLocationItem(data,showType)+"</nobr>"}}).result(function(event,data,formatted){var embeddedZip="";if(!data||!data.Type||data.Type==""){var val=$el.val().trim();if(val.length>0){var type=extractLocationType(val,locationType);if(type.length===0){var regexZip=/^\d{5}$/;var valWords=val.replace(","," ").trim().replace(/\s+/g," ").split(" ");if(valWords.length==1){if(regexZip.test(val)){type="Zip Code"}else{type="Address"}}else{var lastWord=valWords[valWords.length-1];if(regexZip.test(lastWord)){if(val.indexOf(",")==-1){valWords.splice(valWords.length-1,0,",");val=valWords.join(" ").replace(" , ",", ")}type="Address";embeddedZip=lastWord}else{if(lastWord.toLowerCase()=="county"){val=val.substring(0,val.length-6).trim();type="County"}else{if(lastWord.length==2&&$.inArray(lastWord.toUpperCase(),Utils.Lookups.stateCodes)!=-1){if(val.indexOf(",")==-1&&lastWord.toUpperCase()!=="CT"){valWords.splice(valWords.length-1,0,",");val=valWords.join(" ").replace(" , ",", ")}if(val.split(",").length==2){type="City"}else{type="Address"}}else{type="Address"}}}}if(locationType&&locationType!=""){var acceptable=false;var locationTypes=locationType.split(",");for(var i=0;i<locationTypes.length;i++){if(type.toLowerCase()==locationTypes[i].toLowerCase()){acceptable=true;break}}if(!acceptable){type=locationType.split(",")[0]}}if(locationType==""||locationType.indexOf(",")!=-1){$el.val(val+" ("+type+")")}}data={Name:val,Type:type}}}if(data&&data.Type){$el.val("");if(embeddedZip.length>0){data.Name=embeddedZip;data.Type="Zip Code"}_self.addLocation(data)}else{gotoLocation()}}).change(function(){setTimeout(function(){$el.search()},100)})});$("[type='text'][name*='Price']",$criteria).each(function(){if(this.value!=""){this.value="$"+Utils.Format.addCommas(this.value)}$(this).autocomplete("numeric",{maxChars:8,formatResult:function(row){return"$"+Utils.Format.addCommas(row)},formatItem:function(row){return"$"+Utils.Format.addCommas(row)},highlight:false,selectFirst:false}).result(function(event,data,formatted){$(this).change()})});$("[type='text'][name*='SquareFootage']",$criteria).each(function(){this.value=Utils.Format.addCommas(this.value);$(this).autocomplete("numeric",{maxChars:5,formatResult:function(row){return Utils.Format.addCommas(row)},formatItem:function(row){return Utils.Format.addCommas(row)},highlight:false,selectFirst:false}).result(function(event,data,formatted){$(this).change()})});$("[type='text'][name*='Acreage']",$criteria).each(function(){this.value=Utils.Format.addCommas(this.value);$(this).autocomplete("numeric",{maxChars:7,formatResult:function(row){return Utils.Format.addCommas(row)},formatItem:function(row){return Utils.Format.addCommas(row)},highlight:false,selectFirst:false}).result(function(event,data,formatted){$(this).change()})});$("[type='text'][name='Criteria/City']",$criteria).autocomplete(Utils.AppPath+"/Include/AJAX/MapSearch/GetLocations.aspx",{dataType:"json",extraParams:{type:"City"},minChars:2,max:50,width:"auto",cacheLength:50,parse:function(data){var parsed=[];for(var i=0,len=data.length;i<len;i++){var d=data[i];parsed[parsed.length]={data:d,value:d.Name,result:formatLocationItem(d,false)}}return parsed},formatItem:function(data){return"<nobr>"+formatLocationItem(data,false)+"</nobr>"},delay:100}).result(function(event,data,formatted){if(!data){var val=$(this).val();if(val&&val.length>0){var state=defaultState;var comma=val.lastIndexOf(",");if(comma!=-1){state=val.substring(comma+1);val=val.substring(0,comma)}data={Name:val,Type:"City",State:state};$(this).val(val+", "+state)}else{data={Name:""}}}$(this).val("");_self.addLocation(data)}).change(function(){$(this).search()});$("input[name='HardCodedCriterion'][value='349']",$criteria).click(toggleOpenHouse);$("input[name*='OpenHouse']",$criteria).datepicker();toggleOpenHouse();updateListingStatusMessage();$("input[name='Criteria/Status'][type='checkbox']",$criteria).click(function(){var $span=$("#poi-icon-status-"+this.value.toLowerCase());if($span.length>0){setListingOfficePOIIcon($span,this.checked)}});$(".advanced :input").each(function(){if(!this.name){return true}if(this.type=="hidden"){return true}if(this.value.length===0){return true}if((this.type=="radio"||this.type=="checkbox")&&!this.checked){return true}if(this.disabled){return true}if(this.type=="radio"&&this.name.indexOf("Groups")===0){return true}if(this.name=="Criteria/Status"&&this.value.indexOf("2")==-1&&this.value.indexOf("5")==-1){return true}showAdvancedCriteria();return false});$(document).trigger("criteriachange",[{activeTab:$("#SearchTab").val()}]);var $accordion=$("#mapsearch-left-accordion");if($accordion.length>0){$accordion.accordion("option","collapsible",false);$accordion.accordion("activate",0)}if(typeof ToggleOnMarketSearchCriteria=="function"){ToggleOnMarketSearchCriteria()}}function dispose(){if(!_disposed){_map.dispose();_map=null;options=null;unbindListingGrid();var birdseyeMap=$("#mapsearch-birdseye").data("map");if(birdseyeMap){birdseyeMap.dispose();birdseyeMap=null}_disposed=true}}function toggleAdvancedCriteria(){var $advanced=$(".advanced",$(_containers.criteriaForm));if($advanced.is(":visible")){hideAdvancedCriteria()}else{showAdvancedCriteria()}}function showAdvancedCriteria(){var $advanced=$(".advanced",$(_containers.criteriaForm));$advanced.show();$("span.arrow",$(_containers.criteriaForm)).removeClass("arrow-left").addClass("arrow-down");$("#mapsearch-criteria-actions-2-container").show();$("div.wide a",$(_containers.criteriaForm)).html("LESS SEARCH CRITERIA");$("div.toggleadvanced .micro-help-text",$(_containers.criteriaForm)).html("Click here to hide advanced criteria")}function hideAdvancedCriteria(){var $advanced=$(".advanced",$(_containers.criteriaForm));$advanced.hide();$("span.arrow",$(_containers.criteriaForm)).removeClass("arrow-down").addClass("arrow-left");$("#mapsearch-criteria-actions-2-container").hide();$("div.wide a",$(_containers.criteriaForm)).html("MORE SEARCH CRITERIA");$("div.toggleadvanced .micro-help-text",$(_containers.criteriaForm)).html("Click here to view advanced criteria")}this.load=function(){options=$.extend({},_defaultOptions,options);_submitEnabled=false;_clsid=(options.startingCLSID==undefined)?-1:options.startingCLSID;$("#mapsearch-mainmap").bind("mapchange",onMapChange);$("#mapsearch-mainmap").bind("poichange",onPOIChange);_map=new BingMap(options);_map.load();_map.disableMouseZoom();for(var i=5;i<21;i++){togglePOIIcon(BingMap.PinInfo[i])}$(document).bind("criteriachange",function(e,eventData){setListingOfficePOIIcons(eventData.activeTab)});$(document).bind("loginupdate",function(e,eventData){if(eventData.canReloadView){getListingHtml(_pageInfo.page*_pageInfo.resultsPerPage)}});$(document).bind("removecriteria",function(e,eventData){removeCriteria(eventData)});_containers={criteria:document.getElementById("mapsearch-criteria-layout"),criteriaForm:document.getElementById("mapsearch-criteria"),count:document.getElementById("mapsearch-count"),viewTabs:document.getElementById("mapsearch-viewtabs"),searchSummary:document.getElementById("search-summary")};var defaultView=options.defaultView;if(defaultView=="detail"||defaultView=="list"){_activeView="list"}else{if(defaultView=="gallery"){_activeView="gallery"}else{_activeView="map"}}addControlEvents();$(window).resize(function(){if(_resizeTimer){clearTimeout(_resizeTimer)}_resizeTimer=setTimeout(function(){if(_map){_map.resize($("#mapsearch-maptoolbar").width())}positionAdvisory();_resizeTimer=null},100)});$(window).unload(dispose);$(document).bind("criteriachange",function(){$("#mapsearch-container .info-hover").hoverinfo()});$("#mapsearch-directions :input[title]").titlelabel();var url=Utils.AppPath+"/include/ajax/mapsearch/getsearchcriteria.aspx";var qs=[];if(options.cookieGuid!=""){qs.push("searchoverride="+options.cookieGuid)}if(_qs.contains("LayoutID")){qs.push("LayoutID="+_qs.get("LayoutID"));qs.push("LayoutVersion="+_qs.get("LayoutVersion"))}if(_qs.contains("ListingSearchID")){qs.push("ListingSearchID="+_qs.get("ListingSearchID"))}if(_qs.contains("search")){qs.push("search="+_qs.get("search"))}if(qs.length>0){url+="?"+qs.join("&")}$(_containers.criteria).load(url,qs,criteriaOnLoad)};this.setOptions=function(opts){if(opts){options=$.extend({},options,opts);_map.setOptions(options);_pageInfo.resultsPerPage=options.resultsPerPage||_pageInfo.resultsPerPage}};this.enableSubmit=function(){_submitEnabled=true};this.startDrawing=function(){$("#mapsearch-maptoolbar-draw").addClass("drawing").html("Cancel Drawing");if(document.getElementById("selNeighborhood")){document.getElementById("selNeighborhood").value="";document.getElementById("Neighborhood").selectedIndex=0}_map.startDrawing()};this.endDrawing=function(cancel){$("#mapsearch-maptoolbar-draw").removeClass("drawing").html("Draw Search Area");var boundaryData=_map.endDrawing(cancel);if(boundaryData){_self.addLocation(boundaryData)}};this.toggleFeature=function(obj){if(obj){for(var i=0,len=obj.length;i<len;i++){$("#feature_"+i).hide()}$("#feature_"+obj.selectedIndex).show()}};this.toggleListingType=function(obj,dontSubmit){if(obj){var inputs,name,i,len;for(i=0,len=obj.length;i<len;i++){inputs=document.getElementById("propertyType_"+i).getElementsByTagName("input");for(var j=0,lenj=inputs.length;j<lenj;j++){name=inputs[j].getAttribute("name");if(name.toLowerCase()=="criteria/propertytypeid"){inputs[j].setAttribute("name","Criteria/PropertyTypeID_X")}if(name.toLowerCase()=="criteria/defaultpropertytypeid"){inputs[j].setAttribute("name","Criteria/DefaultPropertyTypeID_X")}}hide("propertyType_"+i)}inputs=document.getElementById("propertyType_"+obj.selectedIndex).getElementsByTagName("input");for(i=0,len=inputs.length;i<len;i++){name=inputs[i].getAttribute("name");if(name.toLowerCase()=="criteria/propertytypeid_x"){inputs[i].setAttribute("name","Criteria/PropertyTypeID")}if(name.toLowerCase()=="criteria/defaultpropertytypeid_x"){inputs[i].setAttribute("name","Criteria/DefaultPropertyTypeID")}}$("input[name='Criteria/PropertyTypeID']").blur();display("propertyType_"+obj.selectedIndex);if(typeof(dontSubmit)=="undefined"||!dontSubmit){submit()}}};this.setListingStatus=function(obj){updateListingStatusMessage();submit()};this.toggleCriteria=function(activeTab){var passedInActiveTab=activeTab;var $searchTab=$("#SearchTab");var $criteria=$(_containers.criteria);if($searchTab.length===0){return}var isLegacyCriteria=($("#basicSearch").length>0);var newBasicSearch=$(".searchtab",$criteria).eq(0).attr("id");var expandAdvanced=false;if(!activeTab){var searchTabVal=$searchTab.val();if(searchTabVal=="2"||searchTabVal=="advanced"||searchTabVal=="advancedSearch"){if(isLegacyCriteria){activeTab="advancedSearch"}else{activeTab=newBasicSearch;expandAdvanced=true}}else{if(searchTabVal=="3"||searchTabVal=="mlsID"||searchTabVal=="mlsIDSearch"){if(isLegacyCriteria){activeTab="mlsIDSearch"}else{activeTab=$(".searchtab:has(input[name='Criteria/ListingNumber'])",$criteria).eq(0).attr("id")}}else{if(searchTabVal=="4"||searchTabVal=="address"||searchTabVal=="addressSearch"){if(isLegacyCriteria){activeTab="addressSearch"}else{activeTab=$(".searchtab:has(input[name='Criteria/FullAddress'])",$criteria).eq(0).attr("id")}}else{if(searchTabVal=="5"||searchTabVal=="school"||searchTabVal=="schoolSearch"){if(isLegacyCriteria){activeTab="schoolSearch"}else{activeTab=$(".searchtab:has(input[name='Criteria/School'])",$criteria).eq(0).attr("id")}}else{if(searchTabVal=="6"){activeTab="foreclosureSearch"}else{if(searchTabVal=="1"||searchTabVal=="basic"||searchTabVal=="basicSearch"){if(isLegacyCriteria){activeTab="basicSearch"}else{activeTab=newBasicSearch}}else{if(searchTabVal!=""){activeTab=searchTabVal}}}}}}}if(!activeTab){if(isLegacyCriteria){activeTab="basicSearch"}else{activeTab=newBasicSearch}}}else{if(isLegacyCriteria&&activeTab.indexOf("Search")==-1){activeTab+="Search"}}if(activeTab&&activeTab.length>0){var $el=$("#"+activeTab);if($el.length>0){if(!isLegacyCriteria){$(".searchtab",$criteria).removeClass("active");$el.addClass("active");if(expandAdvanced){showAdvancedCriteria()}$(":input[type!='hidden']:visible:first",$el).focus()}else{if(activeTab=="basicSearch"){$("#advancedSearch,#mlsIDSearch,#addressSearch,#schoolSearch,#foreclosureSearch,#tab_adv_on,#tab_basic_off").hide();$("#tab_adv_off,#tab_basic_on,#basicSearch").show()}else{if(activeTab=="advancedSearch"){$("#basicSearch,#mlsIDSearch,#addressSearch,#schoolSearch,#foreclosureSearch,#tab_basic_on,#tab_adv_off").hide();$("#tab_basic_off,#tab_adv_on,#advancedSearch").show()}else{if(activeTab=="mlsIDSearch"){$("#basicSearch,#advancedSearch,#addressSearch,#schoolSearch,#foreclosureSearch").hide();$("#mlsIDSearch").show()}else{if(activeTab=="addressSearch"){$("#basicSearch,#advancedSearch,#mlsIDSearch,#schoolSearch,#foreclosureSearch,").hide();$("#addressSearch").show()}else{if(activeTab=="foreclosureSearch"){$("#basicSearch,#advancedSearch,#mlsIDSearch,#schoolSearch").hide();$("#foreclosureSearch").show()}else{if(activeTab=="schoolSearch"){$("#basicSearch,#advancedSearch,#mlsIDSearch,#addressSearch,#foreclosureSearch").hide();$("#schoolSearch").show()}}}}}}}var leftOffset=$("#mapsearch-left").offset().top;if(leftOffset<$(window).scrollTop()){$("body,html").animate({scrollTop:leftOffset},1000,function(){$(document).trigger("criteriachange",[{activeTab:activeTab}])})}$searchTab.val(activeTab);if(passedInActiveTab){$(document).trigger("criteriachange",[{activeTab:activeTab}])}}}};this.onChangeSubmit=function(obj,validation){if(obj&&obj.name&&obj.name.toLowerCase().indexOf("price")>-1&&obj.type==="text"){validation="money"}if(validation=="mmddyyyy"){validation="date"}if(!validation||validation.length===0){if($(obj).is(".numeric")){validation="numeric"}else{if($(obj).is(".money")){validation="money"}else{if($(obj).is(".date")){validation="date"}else{if($(obj).is(".year")){validation="year"}}}}}var objVal=null;if(obj){if(obj.value.length>0){if(validation=="numeric"){obj.value=Utils.Format.addCommas(obj.value)}else{if(validation=="money"){obj.value="$"+Utils.Format.addCommas(obj.value)}}}objVal=obj.value}else{return}var isValid=false;if(obj.value.length>0){if(validation=="numeric"){isValid=IsNumeric(objVal)}else{if(validation=="money"){isValid=IsMoney(objVal)}else{if(validation=="date"){isValid=IsDate(objVal)}else{if(validation=="year"){isValid=(IsNumeric(objVal)&&objVal.length==4&&new Date().getFullYear()>=objVal)}else{isValid=true}}}}}else{isValid=true}if(isValid){submit()}else{alert("Invalid entry. Please enter a "+validation+" value.");setTimeout(function(){obj.focus();obj.select()},25)}};this.GotoZip=function(zip){var data={Name:zip,Type:"Zip Code",Value:zip};$("input[name='Criteria/ZipCode'],input[name='Criteria/ZipCodeAdvanced']",$(_containers.criteria)).val("");_self.addLocation(data)};this.GotoCity=function(city){var data={Name:city,Type:"City",Value:city};$("input[name='Criteria/City']",$(_containers.criteria)).val("");_self.addLocation(data)};this.addressGoto=function(prefix){if(prefix===null||prefix==""){var searchTab=$("#SearchTab").val();if(searchTab=="5"||searchTab=="subdivisionSearch"){prefix="SS"}else{if(searchTab=="4"||searchTab=="addressSearch"){prefix="AS"}else{return}}}prefix="#"+prefix;var street=$(prefix+"_StreetName").val();var city=$(prefix+"_City").val();var state=$(prefix+"_State").val();var zip=$(prefix+"_ZipCode").val();var address="";if(city.length>0){address=city}if(state.length>0){address+=","+state}if(address.length>0){address+=",usa"}if(address.length===0&&zip.length>0){address=zip}if(address.length===0){return}if(street.length>0){address=street+","+address}if(street.length>0){gotoLocation(address,"Address")}};this.prevPage=function(){getListingHtml(--_pageInfo.page*_pageInfo.resultsPerPage)};this.nextPage=function(){getListingHtml(++_pageInfo.page*_pageInfo.resultsPerPage)};this.gotoPage=function(page){page=page<=0?1:page;_pageInfo.page=page-1;getListingHtml(_pageInfo.page*_pageInfo.resultsPerPage)};this.togglePinBubble=function(newID,currID){$("#pin_"+newID).show();$("#pin_"+currID).hide()};this.openBirdseye=function(listingid,latitude,longitude){$("#mapsearch-birdseye .ms_panel_text").html("Bird's Eye View");$("#mapsearch-birdseye").show();var map=new BingMap({startingMidLat:latitude,startingMidLong:longitude,startingZoom:19,mapView:VEMapStyle.Birdseye,fireOnChange:false,showParcelLines:options.showParceLines,container:"mapsearch-birdseye-map"});$("#mapsearch-birdseye-map").bind("birdseyeavailable",function(){map.startAddingPins("birdseye");map.addPin("birdseye","1_"+listingid,latitude,longitude,1,"Listing","{FROM_BIRDSEYE}");map.endAddingPins("birdseye");map.showPins("birdseye")}).bind("mapviewnotsupported",function(){$("#mapsearch-birdseye .ms_panel_text").html("Bird's Eye View - Not Supported Here")});map.load();$("#mapsearch-birdseye").data("map",map);_map.hideControls()}}function toggling(a){if(document.getElementById(a)){if(document.getElementById(a).style.display==""){document.getElementById(a).style.display="none"}else{document.getElementById(a).style.display=""}}}function toggleOpenHouseRange(){if(document.getElementById("OpenHouses").checked){document.getElementById("OpenHouseStartDtm").disabled=false;document.getElementById("OpenHouseStopDtm").disabled=false}else{document.getElementById("OpenHouseStartDtm").disabled=true;document.getElementById("OpenHouseStopDtm").disabled=true}}function lcs(){return true}function setArrows(){$(".search-criteria-panel-header").each(function(a){if(!$("span.arrow",this).hasClass("arrow arrow-left")){$("span.arrow",$(".search-criteria-panel-header")).addClass("arrow-left")}});$(".search-criteria-panel-header").click(function(){if($("span.arrow",this).hasClass("arrow arrow-left")){$("span.arrow",this).removeClass("arrow-left").addClass("arrow-down")}else{$("span.arrow",this).addClass("arrow arrow-left").removeClass("arrow-down")}$(this).next().toggle("fast");return false})}function toggleSearchAreas(a,b){$(a).show();$(b).hide()};(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);(function(a){a.fn.hoverinfo=function(b){b=a.extend({},a.fn.hoverinfo.defaults,b);return this.each(function(){var c;var e=a(this);var d=e.attr(b.infoIdAttr);if(d!=undefined&&d.length>0){c=a("#"+d).addClass("caption1 info-hover-panel")}else{c=e.children(":first").addClass("caption1 info-hover-panel").appendTo(a("body")).hide()}if(a.fn.bgiframe){c.bgiframe()}e.hover(function(f){if(c.attr("class").indexOf("show-left")>=0){c.css("left",(f.pageX-(c.width()+18))+"px")}else{c.css("left",(f.pageX+8)+"px")}c.css("top",(f.pageY+8)+"px").fadeIn("fast")},function(){c.fadeOut("fast")});e.css("display","inline")})};a.fn.hoverinfo.defaults={infoIdAttr:"infoId"}})(jQuery);(function(a){a.fn.titlelabel=function(c){var b={label:"title",nullClass:"empty"};var c=a.extend(b,c);return this.each(function(){var d=a(this);if(this.tagName=="SELECT"){d.change(function(){var e=d.find("option:selected");if(e.val()==""){d.addClass(c.nullClass)}else{d.removeClass(c.nullClass)}});d.change()}else{d.focus(function(){if(d.val()==d.attr(c.label)){d.val("");d.removeClass(c.nullClass)}});d.blur(function(){if(d.val()==""||d.val()==d.attr(c.label)){d.val(d.attr(c.label));d.addClass(c.nullClass)}});d.blur()}})}})(jQuery);(function(a){a.fn.bgIframe=a.fn.bgiframe=function(c){if(a.browser.msie&&a.browser.version.substring(0,3)=="6.0"){c=a.extend({top:"auto",left:"auto",width:"auto",height:"auto",opacity:true,src:"javascript:false;"},c||{});var b=function(e){return e&&e.constructor==Number?e+"px":e},d='<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+c.src+'"style="display:block;position:absolute;z-index:-1;'+(c.opacity!==false?"filter:Alpha(Opacity='0');":"")+"top:"+(c.top=="auto"?"expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+'px')":b(c.top))+";left:"+(c.left=="auto"?"expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+'px')":b(c.left))+";width:"+(c.width=="auto"?"expression(this.parentNode.offsetWidth+'px')":b(c.width))+";height:"+(c.height=="auto"?"expression(this.parentNode.offsetHeight+'px')":b(c.height))+';"/>';return this.each(function(){if(a("> iframe.bgiframe",this).length==0){this.insertBefore(document.createElement(d),this.firstChild)}})}return this}})(jQuery);(function(a){a.fn.extend({autocomplete:function(b,d){var c=typeof b=="string";d=a.extend({},a.Autocompleter.defaults,{url:c?b:null,data:c?null:b,delay:c?a.Autocompleter.defaults.delay:10,max:d&&!d.scroll?10:150},d);d.highlight=d.highlight||function(e){return e};d.formatMatch=d.formatMatch||d.formatItem;return this.each(function(){new a.Autocompleter(this,d)})},result:function(b){return this.bind("result",b)},search:function(b){return this.trigger("search",[b])},flushCache:function(){return this.trigger("flushCache")},setOptions:function(b){return this.trigger("setOptions",[b])},unautocomplete:function(){return this.trigger("unautocomplete")}});a.Autocompleter=function(x,v){var w={UP:38,DOWN:40,DEL:46,TAB:9,RETURN:13,ESC:27,COMMA:188,PAGEUP:33,PAGEDOWN:34,BACKSPACE:8};var r=a(x).attr("autocomplete","off").addClass(v.inputClass);var s,g;var l="";var b=a.Autocompleter.Cache(v);var p=0;var o;var q={blurid:null,mouseDownOnSelect:false};var u=a.Autocompleter.Select(v,x,n,q);var m;a.browser.opera&&a(x.form).bind("submit.autocomplete",function(){if(m){m=false;return false}});r.bind((a.browser.opera?"keypress":"keydown")+".autocomplete",function(A){p=1;o=A.keyCode;switch(A.keyCode){case w.UP:A.preventDefault();if(u.visible()){u.prev()}else{f(0,true)}break;case w.DOWN:A.preventDefault();if(u.visible()){u.next()}else{f(0,true)}break;case w.PAGEUP:A.preventDefault();if(u.visible()){u.pageUp()}else{f(0,true)}break;case w.PAGEDOWN:A.preventDefault();if(u.visible()){u.pageDown()}else{f(0,true)}break;case v.multiple&&a.trim(v.multipleSeparator)==","&&w.COMMA:case w.RETURN:if(n()){A.preventDefault();m=true;return false}break;case w.TAB:case w.ESC:u.hide();break;default:clearTimeout(s);s=setTimeout(f,v.delay);break}}).focus(function(){p++}).blur(function(){p=0;if(!q.mouseDownOnSelect){e()}}).click(function(){if(p++>1&&!u.visible()){f(0,true)}}).bind("search",function(){var A=(arguments.length>1)?arguments[1]:null;function B(C,D){var F;if(D&&D.length){if(D.length==1){F=D[0]}else{for(var G=0;G<D.length;G++){var E=D[G].result.toLowerCase();if(E.indexOf("(")!=-1){E=E.substring(0,E.indexOf("("))}E=E.trim();if(E==C.toLowerCase().trim()){F=D[G];break}}}}if(typeof A=="function"){A(F)}else{r.trigger("result",F&&[F.data,F.value])}}a.each(j(r.val()),function(C,D){t(D,B,B)})}).bind("flushCache",function(){b.flush()}).bind("setOptions",function(){a.extend(v,arguments[1]);if("data" in arguments[1]){b.populate()}}).bind("unautocomplete",function(){u.unbind();r.unbind();a(x.form).unbind(".autocomplete")});function n(){var C=u.selected();if(!C){return false}var G=C.result;l=G;if(v.multiple){var D=j(r.val());if(D.length>1){var F=v.multipleSeparator.length;var E=a(x).selection().start;var A,B=0;a.each(D,function(H,I){B+=I.length;if(E<=B){A=H;return false}B+=F});D[A]=G;G=D.join(v.multipleSeparator)}G+=v.multipleSeparator}r.val(G);y();r.trigger("result",[C.data,C.value]);return true}function f(A,C){if(o==w.DEL){u.hide();return}var B=r.val();if(!C&&B==l){return}l=B;B=d(B);if(B.length>=v.minChars){r.addClass(v.loadingClass);if(!v.matchCase){B=B.toLowerCase()}t(B,k,y)}else{h();u.hide()}}function j(A){if(!A){return[""]}if(!v.multiple){return[a.trim(A)]}return a.map(A.split(v.multipleSeparator),function(B){return a.trim(A).length?a.trim(B):null})}function d(A){if(!v.multiple){return A}var B=j(A);if(B.length==1){return B[0]}var C=a(x).selection().start;if(C==A.length){B=j(A)}else{B=j(A.replace(A.substring(C),""))}return B[B.length-1]}function z(B,A){if(v.autoFill&&(d(r.val()).toLowerCase()==B.toLowerCase())&&o!=w.BACKSPACE){r.val(r.val()+A.substring(d(l).length));a(x).selection(l.length,l.length+A.length)}}function e(){clearTimeout(s);s=setTimeout(y,200)}function y(){var A=u.visible();u.hide();clearTimeout(s);h();if(v.mustMatch){r.search(function(B){if(!B){if(v.multiple){var C=j(r.val()).slice(0,-1);r.val(C.join(v.multipleSeparator)+(C.length?v.multipleSeparator:""))}else{r.val("");r.trigger("result",null)}}})}}function k(B,A){if(A&&A.length&&p){h();u.display(A,B);z(B,A[0].value);u.show()}else{y()}}function t(F,G,I){if(!v.matchCase){F=F.toLowerCase()}var B=b.load(F);if(B&&B.length){G(F,B)}else{if(v.url=="numeric"){var A=stripCharsNotInBag(F,"0123456789");var D="";B=[];for(i=0,len=v.maxChars-A.length;i<=len;i++){var C=A+D;var E={value:C,data:C,result:v.formatResult&&v.formatResult(C)||C};B.push(E);D+="0"}G(A,B)}else{if((typeof v.url=="string")&&(v.url.length>0)){var H={timestamp:+new Date()};a.each(v.extraParams,function(J,K){H[J]=typeof K=="function"?K():K});a.ajax({mode:"abort",port:"autocomplete"+x.name,dataType:v.dataType,url:v.url,data:a.extend({q:d(F),limit:v.max},H),success:function(J){var K=v.parse&&v.parse(J)||c(J);b.add(F,K);G(F,K)}})}else{u.emptyList();I(F)}}}}function c(B){var D=[];var E=B.split("\n");for(var C=0;C<E.length;C++){var A=a.trim(E[C]);if(A){A=A.split("|");D[D.length]={data:A,value:A[0],result:v.formatResult&&v.formatResult(A,A[0])||A[0]}}}return D}function h(){r.removeClass(v.loadingClass)}};a.Autocompleter.defaults={inputClass:"ac_input",resultsClass:"ac_results",loadingClass:"ac_loading",minChars:1,delay:400,matchCase:false,matchSubset:true,matchContains:false,cacheLength:10,max:100,mustMatch:false,extraParams:{},selectFirst:true,formatItem:function(b){return b[0]},formatMatch:null,autoFill:false,width:0,multiple:false,multipleSeparator:", ",highlight:function(c,b){return c.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)("+b.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi,"\\$1")+")(?![^<>]*>)(?![^&;]+;)","gi"),"<strong>$1</strong>")},scroll:true,scrollHeight:180};a.Autocompleter.Cache=function(c){var b={};var g=0;function d(k,l){if(!c.matchCase){k=k.toLowerCase()}var j=k.indexOf(l);if(c.matchContains=="word"){j=k.toLowerCase().search("\\b"+l.toLowerCase())}if(j==-1){return false}return j==0||c.matchContains}function f(k,j){if(g>c.cacheLength){h()}if(!b[k]){g++}b[k]=j}function e(){if(!c.data){return false}var o={},p=0;if(!c.url){c.cacheLength=1}o[""]=[];for(var k=0,n=c.data.length;k<n;k++){var l=c.data[k];l=(typeof l=="string")?[l]:l;var j=c.formatMatch(l,k+1,c.data.length);if(j===false){continue}var m=j.charAt(0).toLowerCase();if(!o[m]){o[m]=[]}var q={value:j,data:l,result:c.formatResult&&c.formatResult(l)||j};o[m].push(q);if(p++<c.max){o[""].push(q)}}a.each(o,function(r,s){c.cacheLength++;f(r,s)})}setTimeout(e,25);function h(){b={};g=0}return{flush:h,add:f,populate:e,load:function(j){if(!c.cacheLength||!g){return null}if(!c.url&&c.matchContains){var o=[];for(var m in b){if(m.length>0){var n=b[m];a.each(n,function(k,p){if(d(p.value,j)){o.push(p)}})}}return o}else{if(b[j]){return b[j]}else{if(c.matchSubset){for(var l=j.length-1;l>=c.minChars;l--){var n=b[j.substr(0,l)];if(n){var o=[];a.each(n,function(k,p){if(d(p.value,j)){o[o.length]=p}});return o}}}}}return null}}};a.Autocompleter.Select=function(q,r,p,m){var e={ACTIVE:"ac_over"};var j,l=-1,b,g="",n=true,f,o;function k(){if(!n){return}f=a("<div/>").hide().addClass(q.resultsClass).css("position","absolute").appendTo(document.body);o=a("<ul/>").appendTo(f).mouseover(function(u){if(s(u).nodeName&&s(u).nodeName.toUpperCase()=="LI"){l=a("li",o).removeClass(e.ACTIVE).index(s(u));a(s(u)).addClass(e.ACTIVE)}}).click(function(u){a(s(u)).addClass(e.ACTIVE);p();return false}).mousedown(function(){m.mouseDownOnSelect=true;return false}).mouseup(function(){m.mouseDownOnSelect=false;return false});if(q.width>0){f.css("width",q.width)}n=false}function s(v){var u=v.target;while(u&&u.tagName!="LI"){u=u.parentNode}if(!u){return[]}return u}function d(v){j.slice(l,l+1).removeClass(e.ACTIVE);c(v);var u=j.slice(l,l+1).addClass(e.ACTIVE);if(q.scroll){var w=0;j.slice(0,l).each(function(){w+=this.offsetHeight});if((w+u[0].offsetHeight-o.scrollTop())>o[0].clientHeight){o.scrollTop(w+u[0].offsetHeight-o.innerHeight())}else{if(w<o.scrollTop()){o.scrollTop(w)}}}}function c(u){l+=u;if(l<0){l=j.size()-1}else{if(l>=j.size()){l=0}}}function t(u){return q.max&&q.max<u?q.max:u}function h(){o.empty();var x=t(b.length);for(var u=0;u<x;u++){if(!b[u]){continue}var v=q.formatItem(b[u].data,u+1,x,b[u].value,g);if(v===false){continue}var w=a("<li/>").html(q.highlight(v,g)).addClass(u%2==0?"ac_even":"ac_odd").appendTo(o)[0];a.data(w,"ac_data",b[u])}j=o.find("li");if(q.selectFirst){j.slice(0,1).addClass(e.ACTIVE);l=0}if(a.fn.bgiframe){o.bgiframe()}}return{display:function(u,v){k();b=u;g=v;h()},next:function(){d(1)},prev:function(){d(-1)},pageUp:function(){if(l!=0&&l-8<0){d(-l)}else{d(-8)}},pageDown:function(){if(l!=j.size()-1&&l+8>j.size()){d(j.size()-1-l)}else{d(8)}},hide:function(){f&&f.hide();j&&j.removeClass(e.ACTIVE);l=-1},visible:function(){return f&&f.is(":visible")},current:function(){return this.visible()&&(j.filter("."+e.ACTIVE)[0]||q.selectFirst&&j[0])},show:function(){var w=a(r).offset();f.css({width:typeof q.width=="string"||q.width>0?q.width:a(r).width(),top:w.top+r.offsetHeight,left:w.left}).show();if(q.scroll){o.scrollTop(0);o.css({maxHeight:q.scrollHeight,overflow:"auto"});if(a.browser.msie&&typeof document.body.style.maxHeight==="undefined"){var u=0;j.each(function(){u+=this.offsetHeight});var v=u>q.scrollHeight;o.css("height",v?q.scrollHeight:u);if(!v){j.width(o.width()-parseInt(j.css("padding-left"))-parseInt(j.css("padding-right")))}}}},selected:function(){var u=j&&j.filter("."+e.ACTIVE).removeClass(e.ACTIVE);return u&&u.length&&a.data(u[0],"ac_data")},emptyList:function(){o&&o.empty()},unbind:function(){f&&f.remove()}}};a.fn.selection=function(d,b){if(d!==undefined){return this.each(function(){if(this.createTextRange){var k=this.createTextRange();if(b===undefined||d==b){k.move("character",d);k.select()}else{k.collapse(true);k.moveStart("character",d);k.moveEnd("character",b);k.select()}}else{if(this.setSelectionRange){this.setSelectionRange(d,b)}else{if(this.selectionStart){this.selectionStart=d;this.selectionEnd=b}}}})}var f=this[0];if(f.createTextRange){var e=document.selection.createRange(),c=f.value,h="<->",g=e.text.length;e.text=h;var j=f.value.indexOf(h);f.value=c;this.selection(j,j+g);return{start:j,end:j+g}}else{if(f.selectionStart!==undefined){return{start:f.selectionStart,end:f.selectionEnd}}}}})(jQuery);(function(c){var b=(c.browser.msie?"paste":"input")+".mask";var a=(window.orientation!=undefined);c.mask={definitions:{"9":"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"}};c.fn.extend({caret:function(f,d){if(this.length==0){return}if(typeof f=="number"){d=(typeof d=="number")?d:f;return this.each(function(){if(this.setSelectionRange){this.focus();this.setSelectionRange(f,d)}else{if(this.createTextRange){var g=this.createTextRange();g.collapse(true);g.moveEnd("character",d);g.moveStart("character",f);g.select()}}})}else{if(this[0].setSelectionRange){f=this[0].selectionStart;d=this[0].selectionEnd}else{if(document.selection&&document.selection.createRange){var e=document.selection.createRange();f=0-e.duplicate().moveStart("character",-100000);d=f+e.text.length}}return{begin:f,end:d}}},unmask:function(){return this.trigger("unmask")},mask:function(j,d){if(!j&&this.length>0){var l=c(this[0]);var h=l.data("tests");return c.map(l.data("buffer"),function(o,n){return h[n]?o:null}).join("")}d=c.extend({placeholder:"_",completed:null},d);var m=c.mask.definitions;var h=[];var f=j.length;var e=null;var g=j.length;c.each(j.split(""),function(n,o){if(o=="?"){g--;f=n}else{if(m[o]){h.push(new RegExp(m[o]));if(e==null){e=h.length-1}}else{h.push(null)}}});return this.each(function(){var r=c(this);var y=c.map(j.split(""),function(B,A){if(B!="?"){return m[B]?d.placeholder:B}});var t=false;var n=r.val();r.data("buffer",y).data("tests",h);function v(A){while(++A<=g&&!h[A]){}return A}function q(A){while(!h[A]&&--A>=0){}for(var B=A;B<g;B++){if(h[B]){y[B]=d.placeholder;var C=v(B);if(C<g&&h[B].test(y[C])){y[B]=y[C]}else{break}}}z();r.caret(Math.max(e,A))}function x(A){for(var B=A,E=d.placeholder;B<g;B++){if(h[B]){var C=v(B);var D=y[B];y[B]=E;if(C<g&&h[C].test(D)){E=D}else{break}}}}function o(C){var A=c(this).caret();var B=C.keyCode;t=(B<16||(B>16&&B<32)||(B>32&&B<41));if((A.begin-A.end)!=0&&(!t||B==8||B==46)){p(A.begin,A.end)}if(B==8||B==46||(a&&B==127)){q(A.begin+(B==46?0:-1));return false}else{if(B==27){r.val(n);r.caret(0,u());return false}}}function w(E){if(t){t=false;return(E.keyCode==8)?false:null}E=E||window.event;var A=E.charCode||E.keyCode||E.which;var F=c(this).caret();if(E.ctrlKey||E.altKey||E.metaKey){return true}else{if((A>=32&&A<=125)||A>186){var C=v(F.begin-1);if(C<g){var D=String.fromCharCode(A);if(h[C].test(D)){x(C);y[C]=D;z();var B=v(C);c(this).caret(B);if(d.completed&&B==g){d.completed.call(r)}}}}}return false}function p(C,B){for(var A=C;A<B&&A<g;A++){if(h[A]){y[A]=d.placeholder}}}function z(){return r.val(y.join("")).val()}function u(F){var A=r.val();var D=-1;for(var B=0,C=0;B<g;B++){if(h[B]){y[B]=d.placeholder;while(C++<A.length){var E=A.charAt(C-1);if(h[B].test(E)){y[B]=E;D=B;break}}if(C>A.length){break}}else{if(y[B]==A[C]&&B!=f){C++;D=B}}}if(!F&&D+1<f){r.val("");p(0,g)}else{if(F||D+1>=f){z();if(!F){r.val(r.val().substring(0,D+1))}}}return(f?B:e)}if(!r.attr("readonly")){r.one("unmask",function(){r.unbind(".mask").removeData("buffer").removeData("tests")}).bind("focus.mask",function(){n=r.val();var A=u();z();setTimeout(function(){if(A==j.length){r.caret(0,A)}else{r.caret(A)}},0)}).bind("blur.mask",function(){u();if(r.val()!=n){r.change()}}).bind("keydown.mask",o).bind("keypress.mask",w).bind(b,function(){setTimeout(function(){r.caret(u(true))},0)})}u()})}})})(jQuery);(function(a){a.fn.alphanumeric=function(b){b=a.extend({ichars:"!@#$%^&*()+=[]\\';,/{}|\":<>?~`.- ",nchars:"",allow:""},b);return this.each(function(){if(b.nocaps){b.nchars+="ABCDEFGHIJKLMNOPQRSTUVWXYZ"}if(b.allcaps){b.nchars+="abcdefghijklmnopqrstuvwxyz"}s=b.allow.split("");for(i=0;i<s.length;i++){if(b.ichars.indexOf(s[i])!=-1){s[i]="\\"+s[i]}}b.allow=s.join("|");var d=new RegExp(b.allow,"gi");var c=b.ichars+b.nchars;c=c.replace(d,"");a(this).keypress(function(f){if(!f.charCode){k=String.fromCharCode(f.which)}else{k=String.fromCharCode(f.charCode)}if(c.indexOf(k)!=-1){f.preventDefault()}if(f.ctrlKey&&k=="v"){f.preventDefault()}});a(this).bind("contextmenu",function(){return false})})};a.fn.numeric=function(c){var b="abcdefghijklmnopqrstuvwxyz";b+=b.toUpperCase();c=a.extend({nchars:b},c);return this.each(function(){a(this).alphanumeric(c)})};a.fn.alpha=function(b){var c="1234567890";b=a.extend({nchars:c},b);return this.each(function(){a(this).alphanumeric(b)})}})(jQuery);/*
* jQuery blockUI plugin
* Version 2.33 (29-MAR-2010)
* @requires jQuery v1.2.3 or later
*
* Examples at: http://malsup.com/jquery/block/
* Copyright (c) 2007-2008 M. Alsup
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
* Thanks to Amir-Hossein Sobhi for some excellent contributions!
*/
(function(l){if(/1\.(0|1|2)\.(0|1|2)/.test(l.fn.jquery)||/^1.1/.test(l.fn.jquery)){alert("blockUI requires jQuery v1.2.3 or later!  You are using v"+l.fn.jquery);return}l.fn._fadeIn=l.fn.fadeIn;var b=function(){};var a=document.documentMode||0;var k=l.browser.msie&&((l.browser.version<8&&!a)||a<8);var j=l.browser.msie&&/MSIE 6.0/.test(navigator.userAgent)&&!a;l.blockUI=function(p){h(window,p)};l.unblockUI=function(p){c(window,p)};l.growlUI=function(t,s,q,p){var r=l('<div class="growlUI"></div>');if(t){r.append("<h1>"+t+"</h1>")}if(s){r.append("<h2>"+s+"</h2>")}if(q==undefined){q=3000}l.blockUI({message:r,fadeIn:700,fadeOut:1000,centerY:false,timeout:q,showOverlay:false,onUnblock:p,css:l.blockUI.defaults.growlCSS})};l.fn.block=function(p){return this.unblock({fadeOut:0}).each(function(){if(l.css(this,"position")=="static"){this.style.position="relative"}if(l.browser.msie){this.style.zoom=1}h(this,p)})};l.fn.unblock=function(p){return this.each(function(){c(this,p)})};l.blockUI.version=2.33;l.blockUI.defaults={message:"<h1>Please wait...</h1>",title:null,draggable:true,theme:false,css:{padding:0,margin:0,width:"30%",top:"40%",left:"35%",textAlign:"center",color:"#000",border:"3px solid #aaa",backgroundColor:"#fff",cursor:"wait"},themedCSS:{width:"30%",top:"40%",left:"35%"},overlayCSS:{backgroundColor:"#000",opacity:0.6,cursor:"wait"},growlCSS:{width:"350px",top:"10px",left:"",right:"10px",border:"none",padding:"5px",opacity:0.6,cursor:"default",color:"#fff",backgroundColor:"#000","-webkit-border-radius":"10px","-moz-border-radius":"10px","border-radius":"10px"},iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank",forceIframe:false,baseZ:1000,centerX:true,centerY:true,allowBodyStretch:true,bindEvents:true,constrainTabKey:true,fadeIn:200,fadeOut:400,timeout:0,showOverlay:true,focusInput:true,applyPlatformOpacityRules:true,onBlock:null,onUnblock:null,quirksmodeOffsetHack:4};var d=null;var m=[];function h(q,p){var v=(q==window);var B=p&&p.message!==undefined?p.message:undefined;p=l.extend({},l.blockUI.defaults,p||{});p.overlayCSS=l.extend({},l.blockUI.defaults.overlayCSS,p.overlayCSS||{});var L=l.extend({},l.blockUI.defaults.css,p.css||{});var D=l.extend({},l.blockUI.defaults.themedCSS,p.themedCSS||{});B=B===undefined?p.message:B;if(v&&d){c(window,{fadeOut:0})}if(B&&typeof B!="string"&&(B.parentNode||B.jquery)){var r=B.jquery?B[0]:B;var I={};l(q).data("blockUI.history",I);I.el=r;I.parent=r.parentNode;I.display=r.style.display;I.position=r.style.position;if(I.parent){I.parent.removeChild(r)}}var M=p.baseZ;var C=(l.browser.msie||p.forceIframe)?l('<iframe class="blockUI" style="z-index:'+(M++)+';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="'+p.iframeSrc+'"></iframe>'):l('<div class="blockUI" style="display:none"></div>');var O=l('<div class="blockUI blockOverlay" style="z-index:'+(M++)+';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>');var N,A;if(p.theme&&v){A='<div class="blockUI blockMsg blockPage ui-dialog ui-widget ui-corner-all" style="z-index:'+M+';display:none;position:fixed"><div class="ui-widget-header ui-dialog-titlebar blockTitle">'+(p.title||"&nbsp;")+'</div><div class="ui-widget-content ui-dialog-content"></div></div>'}else{if(p.theme){A='<div class="blockUI blockMsg blockElement ui-dialog ui-widget ui-corner-all" style="z-index:'+M+';display:none;position:absolute"><div class="ui-widget-header ui-dialog-titlebar blockTitle">'+(p.title||"&nbsp;")+'</div><div class="ui-widget-content ui-dialog-content"></div></div>'}else{if(v){A='<div class="blockUI blockMsg blockPage" style="z-index:'+M+';display:none;position:fixed"></div>'}else{A='<div class="blockUI blockMsg blockElement" style="z-index:'+M+';display:none;position:absolute"></div>'}}}N=l(A);if(B){if(p.theme){N.css(D);N.addClass("ui-widget-content")}else{N.css(L)}}if(!p.applyPlatformOpacityRules||!(l.browser.mozilla&&/Linux/.test(navigator.platform))){O.css(p.overlayCSS)}O.css("position",v?"fixed":"absolute");if(l.browser.msie||p.forceIframe){C.css("opacity",0)}var w=[C,O,N],P=v?l("body"):l(q);l.each(w,function(){this.appendTo(P)});if(p.theme&&p.draggable&&l.fn.draggable){N.draggable({handle:".ui-dialog-titlebar",cancel:"li"})}var G=k&&(!l.boxModel||l("object,embed",v?null:q).length>0);if(j||G){if(v&&p.allowBodyStretch&&l.boxModel){l("html,body").css("height","100%")}if((j||!l.boxModel)&&!v){var u=e(q,"borderTopWidth"),H=e(q,"borderLeftWidth");var x=u?"(0 - "+u+")":0;var F=H?"(0 - "+H+")":0}l.each([C,O,N],function(z,t){var Q=t[0].style;Q.position="absolute";if(z<2){v?Q.setExpression("height","Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.boxModel?0:"+p.quirksmodeOffsetHack+') + "px"'):Q.setExpression("height",'this.parentNode.offsetHeight + "px"');v?Q.setExpression("width",'jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"'):Q.setExpression("width",'this.parentNode.offsetWidth + "px"');if(F){Q.setExpression("left",F)}if(x){Q.setExpression("top",x)}}else{if(p.centerY){if(v){Q.setExpression("top",'(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"')}Q.marginTop=0}else{if(!p.centerY&&v){var R=(p.css&&p.css.top)?parseInt(p.css.top):0;var S="((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "+R+') + "px"';Q.setExpression("top",S)}}}})}if(B){if(p.theme){N.find(".ui-widget-content").append(B)}else{N.append(B)}if(B.jquery||B.nodeType){l(B).show()}}if((l.browser.msie||p.forceIframe)&&p.showOverlay){C.show()}if(p.fadeIn){var E=p.onBlock?p.onBlock:b;var J=(p.showOverlay&&!B)?E:b;var y=B?E:b;if(p.showOverlay){O._fadeIn(p.fadeIn,J)}if(B){N._fadeIn(p.fadeIn,y)}}else{if(p.showOverlay){O.show()}if(B){N.show()}if(p.onBlock){p.onBlock()}}n(1,q,p);if(v){d=N[0];m=l(":input:enabled:visible",d);if(p.focusInput){setTimeout(i,20)}}else{g(N[0],p.centerX,p.centerY)}if(p.timeout){var K=setTimeout(function(){v?l.unblockUI(p):l(q).unblock(p)},p.timeout);l(q).data("blockUI.timeout",K)}}function c(u,t){var p=(u==window);var r=l(u);var q=r.data("blockUI.history");var v=r.data("blockUI.timeout");if(v){clearTimeout(v);r.removeData("blockUI.timeout")}t=l.extend({},l.blockUI.defaults,t||{});n(0,u,t);var s;if(p){s=l("body").children().filter(".blockUI").add("body > .blockUI")}else{s=l(".blockUI",l(u))}if(p){d=m=null}if(t.fadeOut){s.fadeOut(t.fadeOut);setTimeout(function(){o(s,q,t,u)},t.fadeOut)}else{o(s,q,t,u)}}function o(q,p,s,r){q.each(function(t,u){if(this.parentNode){this.parentNode.removeChild(this)}});if(p&&p.el){p.el.style.display=p.display;p.el.style.position=p.position;if(p.parent){p.parent.appendChild(p.el)}l(r).removeData("blockUI.history")}if(typeof s.onUnblock=="function"){s.onUnblock(r,s)}}function n(s,t,r){var p=t==window,q=l(t);if(!s&&(p&&!d||!p&&!q.data("blockUI.isBlocked"))){return}if(!p){q.data("blockUI.isBlocked",s)}if(!r.bindEvents||(s&&!r.showOverlay)){return}var u="mousedown mouseup keydown keypress";s?l(document).bind(u,r,f):l(document).unbind(u,f)}function f(s){if(s.keyCode&&s.keyCode==9){if(d&&s.data.constrainTabKey){var p=m;var q=!s.shiftKey&&s.target==p[p.length-1];var r=s.shiftKey&&s.target==p[0];if(q||r){setTimeout(function(){i(r)},10);return false}}}if(l(s.target).parents("div.blockMsg").length>0){return true}return l(s.target).parents().children().filter("div.blockUI").length==0}function i(q){if(!m){return}var p=m[q===true?m.length-1:0];if(p){p.focus()}}function g(w,q,r){var v=w.parentNode,z=w.style;var u=((v.offsetWidth-w.offsetWidth)/2)-e(v,"borderLeftWidth");var A=((v.offsetHeight-w.offsetHeight)/2)-e(v,"borderTopWidth");if(q){z.left=u>0?(u+"px"):"0"}if(r){z.top=A>0?(A+"px"):"0"}}function e(q,r){return parseInt(l.css(q,r))||0}})(jQuery);jQuery.ui||(function(e){var a=e.fn.remove,g=e.browser.mozilla&&(parseFloat(e.browser.version)<1.9);e.ui={version:"1.7.2",plugin:{add:function(l,k,m){var n=e.ui[l].prototype;for(var j in m){n.plugins[j]=n.plugins[j]||[];n.plugins[j].push([k,m[j]])}},call:function(m,n,k){var l=m.plugins[n];if(!l||!m.element[0].parentNode){return}for(var j=0;j<l.length;j++){if(m.options[l[j][0]]){l[j][1].apply(m.element,k)}}}},contains:function(j,k){return document.compareDocumentPosition?j.compareDocumentPosition(k)&16:j!==k&&j.contains(k)},hasScroll:function(l,k){if(e(l).css("overflow")=="hidden"){return false}var j=(k&&k=="left")?"scrollLeft":"scrollTop",m=false;if(l[j]>0){return true}l[j]=1;m=(l[j]>0);l[j]=0;return m},isOverAxis:function(l,j,k){return(l>j)&&(l<(j+k))},isOver:function(k,j,n,m,l,o){return e.ui.isOverAxis(k,n,l)&&e.ui.isOverAxis(j,m,o)},keyCode:{BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38}};if(g){var d=e.attr,h=e.fn.removeAttr,b="http://www.w3.org/2005/07/aaa",f=/^aria-/,c=/^wairole:/;e.attr=function(k,m,j){var l=j!==undefined;return(m=="role"?(l?d.call(this,k,m,"wairole:"+j):(d.apply(this,arguments)||"").replace(c,"")):(f.test(m)?(l?k.setAttributeNS(b,m.replace(f,"aaa:"),j):d.call(this,k,m.replace(f,"aaa:"))):d.apply(this,arguments)))};e.fn.removeAttr=function(j){return(f.test(j)?this.each(function(){this.removeAttributeNS(b,j.replace(f,""))}):h.call(this,j))}}e.fn.extend({remove:function(){e("*",this).add(this).each(function(){e(this).triggerHandler("remove")});return a.apply(this,arguments)},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","").unbind("selectstart.ui")},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false})},scrollParent:function(){var j;if((e.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){j=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(e.curCSS(this,"position",1))&&(/(auto|scroll)/).test(e.curCSS(this,"overflow",1)+e.curCSS(this,"overflow-y",1)+e.curCSS(this,"overflow-x",1))}).eq(0)}else{j=this.parents().filter(function(){return(/(auto|scroll)/).test(e.curCSS(this,"overflow",1)+e.curCSS(this,"overflow-y",1)+e.curCSS(this,"overflow-x",1))}).eq(0)}return(/fixed/).test(this.css("position"))||!j.length?e(document):j}});e.extend(e.expr[":"],{data:function(k,j,l){return !!e.data(k,l[3])},focusable:function(k){var l=k.nodeName.toLowerCase(),j=e.attr(k,"tabindex");return(/input|select|textarea|button|object/.test(l)?!k.disabled:"a"==l||"area"==l?k.href||!isNaN(j):!isNaN(j))&&!e(k)["area"==l?"parents":"closest"](":hidden").length},tabbable:function(j){var k=e.attr(j,"tabindex");return(isNaN(k)||k>=0)&&e(j).is(":focusable")}});function i(m,j,n,o){function l(q){var p=e[m][j][q]||[];return(typeof p=="string"?p.split(/,?\s+/):p)}var k=l("getter");if(o.length==1&&typeof o[0]=="string"){k=k.concat(l("getterSetter"))}return(e.inArray(n,k)!=-1)}e.widget=function(l,j){var k=l.split(".")[0];l=l.split(".")[1];e.fn[l]=function(o){var n=(typeof o=="string"),m=Array.prototype.slice.call(arguments,1);if(n&&o.substring(0,1)=="_"){return this}if(n&&i(k,l,o,m)){var p=e.data(this[0],l);return(p?p[o].apply(p,m):undefined)}return this.each(function(){var q=e.data(this,l);(!q&&!n&&e.data(this,l,new e[k][l](this,o))._init());(q&&n&&e.isFunction(q[o])&&q[o].apply(q,m))})};e[k]=e[k]||{};e[k][l]=function(m,n){var o=this;this.namespace=k;this.widgetName=l;this.widgetEventPrefix=e[k][l].eventPrefix||l;this.widgetBaseClass=k+"-"+l;this.options=e.extend({},e.widget.defaults,e[k][l].defaults,e.metadata&&e.metadata.get(m)[l],n);this.element=e(m).bind("setData."+l,function(q,r,p){if(q.target==m){return o._setData(r,p)}}).bind("getData."+l,function(q,p){if(q.target==m){return o._getData(p)}}).bind("remove",function(){return o.destroy()})};e[k][l].prototype=e.extend({},e.widget.prototype,j);e[k][l].getterSetter="option"};e.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").removeAttr("aria-disabled")},option:function(m,j){var l=m,k=this;if(typeof m=="string"){if(j===undefined){return this._getData(m)}l={};l[m]=j}e.each(l,function(n,o){k._setData(n,o)})},_getData:function(j){return this.options[j]},_setData:function(j,k){this.options[j]=k;if(j=="disabled"){this.element[k?"addClass":"removeClass"](this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").attr("aria-disabled",k)}},enable:function(){this._setData("disabled",false)},disable:function(){this._setData("disabled",true)},_trigger:function(p,o,j){var l=this.options[p],n=(p==this.widgetEventPrefix?p:this.widgetEventPrefix+p);o=e.Event(o);o.type=n;if(o.originalEvent){for(var k=e.event.props.length,m;k;){m=e.event.props[--k];o[m]=o.originalEvent[m]}}this.element.trigger(o,j);return !(e.isFunction(l)&&l.call(this.element[0],o,j)===false||o.isDefaultPrevented())}};e.widget.defaults={disabled:false};e.ui.mouse={_mouseInit:function(){var j=this;this.element.bind("mousedown."+this.widgetName,function(k){return j._mouseDown(k)}).bind("click."+this.widgetName,function(k){if(j._preventClickEvent){j._preventClickEvent=false;k.stopImmediatePropagation();return false}});if(e.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");this.element.attr("unselectable","on")}this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);(e.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable))},_mouseDown:function(k){k.originalEvent=k.originalEvent||{};if(k.originalEvent.mouseHandled){return}(this._mouseStarted&&this._mouseUp(k));this._mouseDownEvent=k;var l=this,j=(k.which==1),m=(typeof this.options.cancel=="string"?e(k.target).parents().add(k.target).filter(this.options.cancel).length:false);if(!j||m||!this._mouseCapture(k)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){l.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(k)&&this._mouseDelayMet(k)){this._mouseStarted=(this._mouseStart(k)!==false);if(!this._mouseStarted){k.preventDefault();return true}}this._mouseMoveDelegate=function(n){return l._mouseMove(n)};this._mouseUpDelegate=function(n){return l._mouseUp(n)};e(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);(e.browser.safari||k.preventDefault());k.originalEvent.mouseHandled=true;return true},_mouseMove:function(j){if(e.browser.msie&&!j.button){return this._mouseUp(j)}if(this._mouseStarted){this._mouseDrag(j);return j.preventDefault()}if(this._mouseDistanceMet(j)&&this._mouseDelayMet(j)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,j)!==false);(this._mouseStarted?this._mouseDrag(j):this._mouseUp(j))}return !this._mouseStarted},_mouseUp:function(j){e(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=(j.target==this._mouseDownEvent.target);this._mouseStop(j)}return false},_mouseDistanceMet:function(j){return(Math.max(Math.abs(this._mouseDownEvent.pageX-j.pageX),Math.abs(this._mouseDownEvent.pageY-j.pageY))>=this.options.distance)},_mouseDelayMet:function(j){return this.mouseDelayMet},_mouseStart:function(j){},_mouseDrag:function(j){},_mouseStop:function(j){},_mouseCapture:function(j){return true}};e.ui.mouse.defaults={cancel:null,distance:1,delay:0}})(jQuery);jQuery.effects||(function(e){e.effects={version:"1.7.2",save:function(f,h){for(var g=0;g<h.length;g++){if(h[g]!==null){f.data("ec.storage."+h[g],f[0].style[h[g]])}}},restore:function(f,h){for(var g=0;g<h.length;g++){if(h[g]!==null){f.css(h[g],f.data("ec.storage."+h[g]))}}},setMode:function(f,g){if(g=="toggle"){g=f.is(":hidden")?"show":"hide"}return g},getBaseline:function(g,f){var i,h;switch(g[0]){case"top":i=0;break;case"middle":i=0.5;break;case"bottom":i=1;break;default:i=g[0]/f.height}switch(g[1]){case"left":h=0;break;case"center":h=0.5;break;case"right":h=1;break;default:h=g[1]/f.width}return{x:h,y:i}},createWrapper:function(h){if(h.parent().is(".ui-effects-wrapper")){return h.parent()}var f={width:h.outerWidth(true),height:h.outerHeight(true),"float":h.css("float")};h.wrap('<div class="ui-effects-wrapper" style="font-size:100%;background:transparent;border:none;margin:0;padding:0"></div>');var i=h.parent();if(h.css("position")=="static"){i.css({position:"relative"});h.css({position:"relative"})}else{var g=h.css("top");if(isNaN(parseInt(g,10))){g="auto"}var j=h.css("left");if(isNaN(parseInt(j,10))){j="auto"}i.css({position:h.css("position"),top:g,left:j,zIndex:h.css("z-index")}).show();h.css({position:"relative",top:0,left:0})}i.css(f);return i},removeWrapper:function(f){if(f.parent().is(".ui-effects-wrapper")){return f.parent().replaceWith(f)}return f},setTransition:function(i,h,g,f){f=f||{};e.each(h,function(j,k){unit=i.cssUnit(k);if(unit[0]>0){f[k]=unit[0]*g+unit[1]}});return f},animateClass:function(f,i,g,h){var j=(typeof g=="function"?g:(h?h:null));var k=(typeof g=="string"?g:null);return this.each(function(){var q={};var m=e(this);var l=m.attr("style")||"";if(typeof l=="object"){l=l.cssText}if(f.toggle){m.hasClass(f.toggle)?f.remove=f.toggle:f.add=f.toggle}var o=e.extend({},(document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle));if(f.add){m.addClass(f.add)}if(f.remove){m.removeClass(f.remove)}var r=e.extend({},(document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle));if(f.add){m.removeClass(f.add)}if(f.remove){m.addClass(f.remove)}for(var p in r){if(typeof r[p]!="function"&&r[p]&&p.indexOf("Moz")==-1&&p.indexOf("length")==-1&&r[p]!=o[p]&&(p.match(/color/i)||(!p.match(/color/i)&&!isNaN(parseInt(r[p],10))))&&(o.position!="static"||(o.position=="static"&&!p.match(/left|top|bottom|right/)))){q[p]=r[p]}}m.animate(q,i,k,function(){if(typeof e(this).attr("style")=="object"){e(this).attr("style")["cssText"]="";e(this).attr("style")["cssText"]=l}else{e(this).attr("style",l)}if(f.add){e(this).addClass(f.add)}if(f.remove){e(this).removeClass(f.remove)}if(j){j.apply(this,arguments)}})})}};function d(h,j){var f=h[1]&&h[1].constructor==Object?h[1]:{};if(j){f.mode=j}var g=h[1]&&h[1].constructor!=Object?h[1]:(f.duration?f.duration:h[2]);g=e.fx.off?0:typeof g==="number"?g:e.fx.speeds[g]||e.fx.speeds._default;var i=f.callback||(e.isFunction(h[1])&&h[1])||(e.isFunction(h[2])&&h[2])||(e.isFunction(h[3])&&h[3]);return[h[0],f,g,i]}e.fn.extend({_show:e.fn.show,_hide:e.fn.hide,__toggle:e.fn.toggle,_addClass:e.fn.addClass,_removeClass:e.fn.removeClass,_toggleClass:e.fn.toggleClass,effect:function(f,i,g,h){return e.effects[f]?e.effects[f].call(this,{method:f,options:i||{},duration:g,callback:h}):null},show:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0]))){return this._show.apply(this,arguments)}else{return this.effect.apply(this,d(arguments,"show"))}},hide:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0]))){return this._hide.apply(this,arguments)}else{return this.effect.apply(this,d(arguments,"hide"))}},toggle:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0]))||(e.isFunction(arguments[0])||typeof arguments[0]=="boolean")){return this.__toggle.apply(this,arguments)}else{return this.effect.apply(this,d(arguments,"toggle"))}},addClass:function(f,g,h,i){return g?e.effects.animateClass.apply(this,[{add:f},g,h,i]):this._addClass(f)},removeClass:function(f,g,h,i){return g?e.effects.animateClass.apply(this,[{remove:f},g,h,i]):this._removeClass(f)},toggleClass:function(f,g,h,i){return((typeof g!=="boolean")&&g)?e.effects.animateClass.apply(this,[{toggle:f},g,h,i]):this._toggleClass(f,g)},morph:function(h,g,f,j,i){return e.effects.animateClass.apply(this,[{add:g,remove:h},f,j,i])},switchClass:function(){return this.morph.apply(this,arguments)},cssUnit:function(h){var f=this.css(h),g=[];e.each(["em","px","%","pt"],function(k,j){if(f.indexOf(j)>0){g=[parseFloat(f),j]}});return g}});e.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","color","outlineColor"],function(g,f){e.fx.step[f]=function(h){if(h.state==0){h.start=b(h.elem,f);h.end=c(h.end)}h.elem.style[f]="rgb("+[Math.max(Math.min(parseInt((h.pos*(h.end[0]-h.start[0]))+h.start[0],10),255),0),Math.max(Math.min(parseInt((h.pos*(h.end[1]-h.start[1]))+h.start[1],10),255),0),Math.max(Math.min(parseInt((h.pos*(h.end[2]-h.start[2]))+h.start[2],10),255),0)].join(",")+")"}});function c(f){var g;if(f&&f.constructor==Array&&f.length==3){return f}if(g=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(f)){return[parseInt(g[1],10),parseInt(g[2],10),parseInt(g[3],10)]}if(g=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(f)){return[parseFloat(g[1])*2.55,parseFloat(g[2])*2.55,parseFloat(g[3])*2.55]}if(g=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(f)){return[parseInt(g[1],16),parseInt(g[2],16),parseInt(g[3],16)]}if(g=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(f)){return[parseInt(g[1]+g[1],16),parseInt(g[2]+g[2],16),parseInt(g[3]+g[3],16)]}if(g=/rgba\(0, 0, 0, 0\)/.exec(f)){return a.transparent}return a[e.trim(f).toLowerCase()]}function b(h,g){var f;do{f=e.curCSS(h,g);if(f!=""&&f!="transparent"||e.nodeName(h,"body")){break}g="backgroundColor"}while(h=h.parentNode);return c(f)}var a={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]};e.easing.jswing=e.easing.swing;e.extend(e.easing,{def:"easeOutQuad",swing:function(j,h,g,i,f){return e.easing[e.easing.def](j,h,g,i,f)},easeInQuad:function(j,h,g,i,f){return i*(h/=f)*h+g},easeOutQuad:function(j,h,g,i,f){return -i*(h/=f)*(h-2)+g},easeInOutQuad:function(j,h,g,i,f){if((h/=f/2)<1){return i/2*h*h+g}return -i/2*((--h)*(h-2)-1)+g},easeInCubic:function(j,h,g,i,f){return i*(h/=f)*h*h+g},easeOutCubic:function(j,h,g,i,f){return i*((h=h/f-1)*h*h+1)+g},easeInOutCubic:function(j,h,g,i,f){if((h/=f/2)<1){return i/2*h*h*h+g}return i/2*((h-=2)*h*h+2)+g},easeInQuart:function(j,h,g,i,f){return i*(h/=f)*h*h*h+g},easeOutQuart:function(j,h,g,i,f){return -i*((h=h/f-1)*h*h*h-1)+g},easeInOutQuart:function(j,h,g,i,f){if((h/=f/2)<1){return i/2*h*h*h*h+g}return -i/2*((h-=2)*h*h*h-2)+g},easeInQuint:function(j,h,g,i,f){return i*(h/=f)*h*h*h*h+g},easeOutQuint:function(j,h,g,i,f){return i*((h=h/f-1)*h*h*h*h+1)+g},easeInOutQuint:function(j,h,g,i,f){if((h/=f/2)<1){return i/2*h*h*h*h*h+g}return i/2*((h-=2)*h*h*h*h+2)+g},easeInSine:function(j,h,g,i,f){return -i*Math.cos(h/f*(Math.PI/2))+i+g},easeOutSine:function(j,h,g,i,f){return i*Math.sin(h/f*(Math.PI/2))+g},easeInOutSine:function(j,h,g,i,f){return -i/2*(Math.cos(Math.PI*h/f)-1)+g},easeInExpo:function(j,h,g,i,f){return(h==0)?g:i*Math.pow(2,10*(h/f-1))+g},easeOutExpo:function(j,h,g,i,f){return(h==f)?g+i:i*(-Math.pow(2,-10*h/f)+1)+g},easeInOutExpo:function(j,h,g,i,f){if(h==0){return g}if(h==f){return g+i}if((h/=f/2)<1){return i/2*Math.pow(2,10*(h-1))+g}return i/2*(-Math.pow(2,-10*--h)+2)+g},easeInCirc:function(j,h,g,i,f){return -i*(Math.sqrt(1-(h/=f)*h)-1)+g},easeOutCirc:function(j,h,g,i,f){return i*Math.sqrt(1-(h=h/f-1)*h)+g},easeInOutCirc:function(j,h,g,i,f){if((h/=f/2)<1){return -i/2*(Math.sqrt(1-h*h)-1)+g}return i/2*(Math.sqrt(1-(h-=2)*h)+1)+g},easeInElastic:function(f,k,h,i,j){var l=1.70158;var g=0;var m=i;if(k==0){return h}if((k/=j)==1){return h+i}if(!g){g=j*0.3}if(m<Math.abs(i)){m=i;var l=g/4}else{var l=g/(2*Math.PI)*Math.asin(i/m)}return -(m*Math.pow(2,10*(k-=1))*Math.sin((k*j-l)*(2*Math.PI)/g))+h},easeOutElastic:function(f,k,h,i,j){var l=1.70158;var g=0;var m=i;if(k==0){return h}if((k/=j)==1){return h+i}if(!g){g=j*0.3}if(m<Math.abs(i)){m=i;var l=g/4}else{var l=g/(2*Math.PI)*Math.asin(i/m)}return m*Math.pow(2,-10*k)*Math.sin((k*j-l)*(2*Math.PI)/g)+i+h},easeInOutElastic:function(f,k,h,i,j){var l=1.70158;var g=0;var m=i;if(k==0){return h}if((k/=j/2)==2){return h+i}if(!g){g=j*(0.3*1.5)}if(m<Math.abs(i)){m=i;var l=g/4}else{var l=g/(2*Math.PI)*Math.asin(i/m)}if(k<1){return -0.5*(m*Math.pow(2,10*(k-=1))*Math.sin((k*j-l)*(2*Math.PI)/g))+h}return m*Math.pow(2,-10*(k-=1))*Math.sin((k*j-l)*(2*Math.PI)/g)*0.5+i+h},easeInBack:function(f,j,g,h,i,k){if(k==undefined){k=1.70158}return h*(j/=i)*j*((k+1)*j-k)+g},easeOutBack:function(f,j,g,h,i,k){if(k==undefined){k=1.70158}return h*((j=j/i-1)*j*((k+1)*j+k)+1)+g},easeInOutBack:function(f,j,g,h,i,k){if(k==undefined){k=1.70158}if((j/=i/2)<1){return h/2*(j*j*(((k*=(1.525))+1)*j-k))+g}return h/2*((j-=2)*j*(((k*=(1.525))+1)*j+k)+2)+g},easeInBounce:function(j,h,g,i,f){return i-e.easing.easeOutBounce(j,f-h,0,i,f)+g},easeOutBounce:function(j,h,g,i,f){if((h/=f)<(1/2.75)){return i*(7.5625*h*h)+g}else{if(h<(2/2.75)){return i*(7.5625*(h-=(1.5/2.75))*h+0.75)+g}else{if(h<(2.5/2.75)){return i*(7.5625*(h-=(2.25/2.75))*h+0.9375)+g}else{return i*(7.5625*(h-=(2.625/2.75))*h+0.984375)+g}}}},easeInOutBounce:function(j,h,g,i,f){if(h<f/2){return e.easing.easeInBounce(j,h*2,0,i,f)*0.5+g}return e.easing.easeOutBounce(j,h*2-f,0,i,f)*0.5+i*0.5+g}})})(jQuery);(function(a){a.widget("ui.accordion",{_init:function(){var b=this.options,c=this;this.running=0;if(b.collapsible==a.ui.accordion.defaults.collapsible&&b.alwaysOpen!=a.ui.accordion.defaults.alwaysOpen){b.collapsible=!b.alwaysOpen}if(b.navigation){var d=this.element.find("a").filter(b.navigationFilter);if(d.length){if(d.filter(b.header).length){this.active=d}else{this.active=d.parent().parent().prev();d.addClass("ui-accordion-content-active")}}}this.element.addClass("ui-accordion ui-widget ui-helper-reset");if(this.element[0].nodeName=="UL"){this.element.children("li").addClass("ui-accordion-li-fix")}this.headers=this.element.find(b.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){a(this).addClass("ui-state-hover")}).bind("mouseleave.accordion",function(){a(this).removeClass("ui-state-hover")}).bind("focus.accordion",function(){a(this).addClass("ui-state-focus")}).bind("blur.accordion",function(){a(this).removeClass("ui-state-focus")});this.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");this.active=this._findActive(this.active||b.active).toggleClass("ui-state-default").toggleClass("ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top");this.active.next().addClass("ui-accordion-content-active");a("<span/>").addClass("ui-icon "+b.icons.header).prependTo(this.headers);this.active.find(".ui-icon").toggleClass(b.icons.header).toggleClass(b.icons.headerSelected);if(a.browser.msie){this.element.find("a").css("zoom","1")}this.resize();this.element.attr("role","tablist");this.headers.attr("role","tab").bind("keydown",function(e){return c._keydown(e)}).next().attr("role","tabpanel");this.headers.not(this.active||"").attr("aria-expanded","false").attr("tabIndex","0").next().hide();if(!this.active.length){this.headers.eq(0).attr("tabIndex","0")}else{this.active.attr("aria-expanded","true").attr("tabIndex","0")}if(!a.browser.safari){this.headers.find("a").attr("tabIndex","-1")}if(b.event){this.headers.bind((b.event)+".accordion",function(e){return c._clickHandler.call(c,e,this)})}},destroy:function(){var c=this.options;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role").unbind(".accordion").removeData("accordion");this.headers.unbind(".accordion").removeClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("tabindex");this.headers.find("a").removeAttr("tabindex");this.headers.children(".ui-icon").remove();var b=this.headers.next().css("display","").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active");if(c.autoHeight||c.fillHeight){b.css("height","")}},_setData:function(b,c){if(b=="alwaysOpen"){b="collapsible";c=!c}a.widget.prototype._setData.apply(this,arguments)},_keydown:function(e){var d=this.options,f=a.ui.keyCode;if(d.disabled||e.altKey||e.ctrlKey){return}var g=this.headers.length;var c=this.headers.index(e.target);var b=false;switch(e.keyCode){case f.RIGHT:case f.DOWN:b=this.headers[(c+1)%g];break;case f.LEFT:case f.UP:b=this.headers[(c-1+g)%g];break;case f.SPACE:case f.ENTER:return this._clickHandler({target:e.target},e.target)}if(b){a(b).attr("tabIndex","0");b.focus();return false}return true},resize:function(){var b=this.options,c;if(b.fillSpace){if(a.browser.msie){var e=this.element.parent().css("overflow");this.element.parent().css("overflow","hidden")}c=this.element.parent().height();if(a.browser.msie){this.element.parent().css("overflow",e)}this.headers.each(function(){c-=a(this).outerHeight()});var d=0;this.headers.next().each(function(){d=Math.max(d,a(this).innerHeight()-a(this).height())}).height(Math.max(0,c-d)).css("overflow","auto")}else{if(b.autoHeight){c=0;this.headers.next().each(function(){c=Math.max(c,a(this).outerHeight())}).height(c)}}},activate:function(b){var c=this._findActive(b)[0];this._clickHandler({target:c},c)},_findActive:function(b){return b?typeof b=="number"?this.headers.filter(":eq("+b+")"):this.headers.not(this.headers.not(b)):b===false?a([]):this.headers.filter(":eq(0)")},_clickHandler:function(h,i){var e=this.options;if(e.disabled){return false}if(!h.target&&e.collapsible){this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").find(".ui-icon").removeClass(e.icons.headerSelected).addClass(e.icons.header);this.active.next().addClass("ui-accordion-content-active");var j=this.active.next(),b={options:e,newHeader:a([]),oldHeader:e.active,newContent:a([]),oldContent:j},c=(this.active=a([]));this._toggle(c,j,b);return false}var d=a(h.currentTarget||i);var g=d[0]==this.active[0];if(this.running||(!e.collapsible&&g)){return false}this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").find(".ui-icon").removeClass(e.icons.headerSelected).addClass(e.icons.header);this.active.next().addClass("ui-accordion-content-active");if(!g){d.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").find(".ui-icon").removeClass(e.icons.header).addClass(e.icons.headerSelected);d.next().addClass("ui-accordion-content-active")}var c=d.next(),j=this.active.next(),b={options:e,newHeader:g&&e.collapsible?a([]):d,oldHeader:this.active,newContent:g&&e.collapsible?a([]):c.find("> *"),oldContent:j.find("> *")},f=this.headers.index(this.active[0])>this.headers.index(d[0]);this.active=g?a([]):d;this._toggle(c,j,b,g,f);return false},_toggle:function(c,j,b,e,m){var h=this.options,d=this;this.toShow=c;this.toHide=j;this.data=b;var g=function(){if(!d){return}return d._completed.apply(d,arguments)};this._trigger("changestart",null,this.data);this.running=j.size()===0?c.size():j.size();if(h.animated){var k={};if(h.collapsible&&e){k={toShow:a([]),toHide:j,complete:g,down:m,autoHeight:h.autoHeight||h.fillSpace}}else{k={toShow:c,toHide:j,complete:g,down:m,autoHeight:h.autoHeight||h.fillSpace}}if(!h.proxied){h.proxied=h.animated}if(!h.proxiedDuration){h.proxiedDuration=h.duration}h.animated=a.isFunction(h.proxied)?h.proxied(k):h.proxied;h.duration=a.isFunction(h.proxiedDuration)?h.proxiedDuration(k):h.proxiedDuration;var i=a.ui.accordion.animations,f=h.duration,l=h.animated;if(!i[l]){i[l]=function(n){this.slide(n,{easing:l,duration:f||700})}}i[l](k)}else{if(h.collapsible&&e){c.toggle()}else{j.hide();c.show()}g(true)}j.prev().attr("aria-expanded","false").attr("tabIndex","0").blur();c.prev().attr("aria-expanded","true").attr("tabIndex","0").focus()},_completed:function(b){var c=this.options;this.running=b?0:--this.running;if(this.running){return}if(c.clearStyle){this.toShow.add(this.toHide).css({height:"",overflow:""})}this._trigger("change",null,this.data)}});a.extend(a.ui.accordion,{version:"1.7.2",defaults:{active:null,alwaysOpen:true,animated:"slide",autoHeight:true,clearStyle:false,collapsible:false,event:"click",fillSpace:false,header:"> li > :first-child,> :not(li):even",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:false,navigationFilter:function(){return this.href.toLowerCase()==location.href.toLowerCase()}},animations:{slide:function(b,j){b=a.extend({easing:"swing",duration:300},b,j);if(!b.toHide.size()){b.toShow.animate({height:"show"},b);return}if(!b.toShow.size()){b.toHide.animate({height:"hide"},b);return}var g=b.toShow.css("overflow"),i,d={},f={},c=["height","paddingTop","paddingBottom"],e;var h=b.toShow;e=h[0].style.width;h.width(parseInt(h.parent().width(),10)-parseInt(h.css("paddingLeft"),10)-parseInt(h.css("paddingRight"),10)-(parseInt(h.css("borderLeftWidth"),10)||0)-(parseInt(h.css("borderRightWidth"),10)||0));a.each(c,function(k,m){f[m]="hide";var l=(""+a.css(b.toShow[0],m)).match(/^([\d+-.]+)(.*)$/);d[m]={value:l[1],unit:l[2]||"px"}});b.toShow.css({height:0,overflow:"hidden"}).show();b.toHide.filter(":hidden").each(b.complete).end().filter(":visible").animate(f,{step:function(k,l){if(l.prop=="height"){i=(l.now-l.start)/(l.end-l.start)}b.toShow[0].style[l.prop]=(i*d[l.prop].value)+d[l.prop].unit},duration:b.duration,easing:b.easing,complete:function(){if(!b.autoHeight){b.toShow.css("height","")}b.toShow.css("width",e);b.toShow.css({overflow:g});b.complete()}})},bounceslide:function(b){this.slide(b,{easing:b.down?"easeOutBounce":"swing",duration:b.down?1000:200})},easeslide:function(b){this.slide(b,{easing:"easeinout",duration:700})}}})})(jQuery);(function($){$.extend($.ui,{datepicker:{version:"1.7.2"}});var PROP_NAME="datepicker";function Datepicker(){this.debug=false;this._curInst=null;this._keyEvent=false;this._disabledInputs=[];this._datepickerShowing=false;this._inDialog=false;this._mainDivId="ui-datepicker-div";this._inlineClass="ui-datepicker-inline";this._appendClass="ui-datepicker-append";this._triggerClass="ui-datepicker-trigger";this._dialogClass="ui-datepicker-dialog";this._disableClass="ui-datepicker-disabled";this._unselectableClass="ui-datepicker-unselectable";this._currentClass="ui-datepicker-current-day";this._dayOverClass="ui-datepicker-days-cell-over";this.regional=[];this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],dateFormat:"mm/dd/yy",firstDay:0,isRTL:false};this._defaults={showOn:"focus",showAnim:"show",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:false,hideIfNoPrevNext:false,navigationAsDateFormat:false,gotoCurrent:false,changeMonth:false,changeYear:false,showMonthAfterYear:false,yearRange:"-10:+10",showOtherMonths:false,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"normal",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:true,showButtonPanel:false};$.extend(this._defaults,this.regional[""]);this.dpDiv=$('<div id="'+this._mainDivId+'" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all ui-helper-hidden-accessible"></div>')}$.extend(Datepicker.prototype,{markerClassName:"hasDatepicker",log:function(){if(this.debug){console.log.apply("",arguments)}},setDefaults:function(settings){extendRemove(this._defaults,settings||{});return this},_attachDatepicker:function(target,settings){var inlineSettings=null;for(var attrName in this._defaults){var attrValue=target.getAttribute("date:"+attrName);if(attrValue){inlineSettings=inlineSettings||{};try{inlineSettings[attrName]=eval(attrValue)}catch(err){inlineSettings[attrName]=attrValue}}}var nodeName=target.nodeName.toLowerCase();var inline=(nodeName=="div"||nodeName=="span");if(!target.id){target.id="dp"+(++this.uuid)}var inst=this._newInst($(target),inline);inst.settings=$.extend({},settings||{},inlineSettings||{});if(nodeName=="input"){this._connectDatepicker(target,inst)}else{if(inline){this._inlineDatepicker(target,inst)}}},_newInst:function(target,inline){var id=target[0].id.replace(/([:\[\]\.])/g,"\\\\$1");return{id:id,input:target,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:inline,dpDiv:(!inline?this.dpDiv:$('<div class="'+this._inlineClass+' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))}},_connectDatepicker:function(target,inst){var input=$(target);inst.append=$([]);inst.trigger=$([]);if(input.hasClass(this.markerClassName)){return}var appendText=this._get(inst,"appendText");var isRTL=this._get(inst,"isRTL");if(appendText){inst.append=$('<span class="'+this._appendClass+'">'+appendText+"</span>");input[isRTL?"before":"after"](inst.append)}var showOn=this._get(inst,"showOn");if(showOn=="focus"||showOn=="both"){input.focus(this._showDatepicker)}if(showOn=="button"||showOn=="both"){var buttonText=this._get(inst,"buttonText");var buttonImage=this._get(inst,"buttonImage");inst.trigger=$(this._get(inst,"buttonImageOnly")?$("<img/>").addClass(this._triggerClass).attr({src:buttonImage,alt:buttonText,title:buttonText}):$('<button type="button"></button>').addClass(this._triggerClass).html(buttonImage==""?buttonText:$("<img/>").attr({src:buttonImage,alt:buttonText,title:buttonText})));input[isRTL?"before":"after"](inst.trigger);inst.trigger.click(function(){if($.datepicker._datepickerShowing&&$.datepicker._lastInput==target){$.datepicker._hideDatepicker()}else{$.datepicker._showDatepicker(target)}return false})}input.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).bind("setData.datepicker",function(event,key,value){inst.settings[key]=value}).bind("getData.datepicker",function(event,key){return this._get(inst,key)});$.data(target,PROP_NAME,inst)},_inlineDatepicker:function(target,inst){var divSpan=$(target);if(divSpan.hasClass(this.markerClassName)){return}divSpan.addClass(this.markerClassName).append(inst.dpDiv).bind("setData.datepicker",function(event,key,value){inst.settings[key]=value}).bind("getData.datepicker",function(event,key){return this._get(inst,key)});$.data(target,PROP_NAME,inst);this._setDate(inst,this._getDefaultDate(inst));this._updateDatepicker(inst);this._updateAlternate(inst)},_dialogDatepicker:function(input,dateText,onSelect,settings,pos){var inst=this._dialogInst;if(!inst){var id="dp"+(++this.uuid);this._dialogInput=$('<input type="text" id="'+id+'" size="1" style="position: absolute; top: -100px;"/>');this._dialogInput.keydown(this._doKeyDown);$("body").append(this._dialogInput);inst=this._dialogInst=this._newInst(this._dialogInput,false);inst.settings={};$.data(this._dialogInput[0],PROP_NAME,inst)}extendRemove(inst.settings,settings||{});this._dialogInput.val(dateText);this._pos=(pos?(pos.length?pos:[pos.pageX,pos.pageY]):null);if(!this._pos){var browserWidth=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;var browserHeight=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;var scrollX=document.documentElement.scrollLeft||document.body.scrollLeft;var scrollY=document.documentElement.scrollTop||document.body.scrollTop;this._pos=[(browserWidth/2)-100+scrollX,(browserHeight/2)-150+scrollY]}this._dialogInput.css("left",this._pos[0]+"px").css("top",this._pos[1]+"px");inst.settings.onSelect=onSelect;this._inDialog=true;this.dpDiv.addClass(this._dialogClass);this._showDatepicker(this._dialogInput[0]);if($.blockUI){$.blockUI(this.dpDiv)}$.data(this._dialogInput[0],PROP_NAME,inst);return this},_destroyDatepicker:function(target){var $target=$(target);var inst=$.data(target,PROP_NAME);if(!$target.hasClass(this.markerClassName)){return}var nodeName=target.nodeName.toLowerCase();$.removeData(target,PROP_NAME);if(nodeName=="input"){inst.append.remove();inst.trigger.remove();$target.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress)}else{if(nodeName=="div"||nodeName=="span"){$target.removeClass(this.markerClassName).empty()}}},_enableDatepicker:function(target){var $target=$(target);var inst=$.data(target,PROP_NAME);if(!$target.hasClass(this.markerClassName)){return}var nodeName=target.nodeName.toLowerCase();if(nodeName=="input"){target.disabled=false;inst.trigger.filter("button").each(function(){this.disabled=false}).end().filter("img").css({opacity:"1.0",cursor:""})}else{if(nodeName=="div"||nodeName=="span"){var inline=$target.children("."+this._inlineClass);inline.children().removeClass("ui-state-disabled")}}this._disabledInputs=$.map(this._disabledInputs,function(value){return(value==target?null:value)})},_disableDatepicker:function(target){var $target=$(target);var inst=$.data(target,PROP_NAME);if(!$target.hasClass(this.markerClassName)){return}var nodeName=target.nodeName.toLowerCase();if(nodeName=="input"){target.disabled=true;inst.trigger.filter("button").each(function(){this.disabled=true}).end().filter("img").css({opacity:"0.5",cursor:"default"})}else{if(nodeName=="div"||nodeName=="span"){var inline=$target.children("."+this._inlineClass);inline.children().addClass("ui-state-disabled")}}this._disabledInputs=$.map(this._disabledInputs,function(value){return(value==target?null:value)});this._disabledInputs[this._disabledInputs.length]=target},_isDisabledDatepicker:function(target){if(!target){return false}for(var i=0;i<this._disabledInputs.length;i++){if(this._disabledInputs[i]==target){return true}}return false},_getInst:function(target){try{return $.data(target,PROP_NAME)}catch(err){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(target,name,value){var inst=this._getInst(target);if(arguments.length==2&&typeof name=="string"){return(name=="defaults"?$.extend({},$.datepicker._defaults):(inst?(name=="all"?$.extend({},inst.settings):this._get(inst,name)):null))}var settings=name||{};if(typeof name=="string"){settings={};settings[name]=value}if(inst){if(this._curInst==inst){this._hideDatepicker(null)}var date=this._getDateDatepicker(target);extendRemove(inst.settings,settings);this._setDateDatepicker(target,date);this._updateDatepicker(inst)}},_changeDatepicker:function(target,name,value){this._optionDatepicker(target,name,value)},_refreshDatepicker:function(target){var inst=this._getInst(target);if(inst){this._updateDatepicker(inst)}},_setDateDatepicker:function(target,date,endDate){var inst=this._getInst(target);if(inst){this._setDate(inst,date,endDate);this._updateDatepicker(inst);this._updateAlternate(inst)}},_getDateDatepicker:function(target){var inst=this._getInst(target);if(inst&&!inst.inline){this._setDateFromField(inst)}return(inst?this._getDate(inst):null)},_doKeyDown:function(event){var inst=$.datepicker._getInst(event.target);var handled=true;var isRTL=inst.dpDiv.is(".ui-datepicker-rtl");inst._keyEvent=true;if($.datepicker._datepickerShowing){switch(event.keyCode){case 9:$.datepicker._hideDatepicker(null,"");break;case 13:var sel=$("td."+$.datepicker._dayOverClass+", td."+$.datepicker._currentClass,inst.dpDiv);if(sel[0]){$.datepicker._selectDay(event.target,inst.selectedMonth,inst.selectedYear,sel[0])}else{$.datepicker._hideDatepicker(null,$.datepicker._get(inst,"duration"))}return false;break;case 27:$.datepicker._hideDatepicker(null,$.datepicker._get(inst,"duration"));break;case 33:$.datepicker._adjustDate(event.target,(event.ctrlKey?-$.datepicker._get(inst,"stepBigMonths"):-$.datepicker._get(inst,"stepMonths")),"M");break;case 34:$.datepicker._adjustDate(event.target,(event.ctrlKey?+$.datepicker._get(inst,"stepBigMonths"):+$.datepicker._get(inst,"stepMonths")),"M");break;case 35:if(event.ctrlKey||event.metaKey){$.datepicker._clearDate(event.target)}handled=event.ctrlKey||event.metaKey;break;case 36:if(event.ctrlKey||event.metaKey){$.datepicker._gotoToday(event.target)}handled=event.ctrlKey||event.metaKey;break;case 37:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,(isRTL?+1:-1),"D")}handled=event.ctrlKey||event.metaKey;if(event.originalEvent.altKey){$.datepicker._adjustDate(event.target,(event.ctrlKey?-$.datepicker._get(inst,"stepBigMonths"):-$.datepicker._get(inst,"stepMonths")),"M")}break;case 38:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,-7,"D")}handled=event.ctrlKey||event.metaKey;break;case 39:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,(isRTL?-1:+1),"D")}handled=event.ctrlKey||event.metaKey;if(event.originalEvent.altKey){$.datepicker._adjustDate(event.target,(event.ctrlKey?+$.datepicker._get(inst,"stepBigMonths"):+$.datepicker._get(inst,"stepMonths")),"M")}break;case 40:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,+7,"D")}handled=event.ctrlKey||event.metaKey;break;default:handled=false}}else{if(event.keyCode==36&&event.ctrlKey){$.datepicker._showDatepicker(this)}else{handled=false}}if(handled){event.preventDefault();event.stopPropagation()}},_doKeyPress:function(event){var inst=$.datepicker._getInst(event.target);if($.datepicker._get(inst,"constrainInput")){var chars=$.datepicker._possibleChars($.datepicker._get(inst,"dateFormat"));var chr=String.fromCharCode(event.charCode==undefined?event.keyCode:event.charCode);return event.ctrlKey||(chr<" "||!chars||chars.indexOf(chr)>-1)}},_showDatepicker:function(input){input=input.target||input;if(input.nodeName.toLowerCase()!="input"){input=$("input",input.parentNode)[0]}if($.datepicker._isDisabledDatepicker(input)||$.datepicker._lastInput==input){return}var inst=$.datepicker._getInst(input);var beforeShow=$.datepicker._get(inst,"beforeShow");extendRemove(inst.settings,(beforeShow?beforeShow.apply(input,[input,inst]):{}));$.datepicker._hideDatepicker(null,"");$.datepicker._lastInput=input;$.datepicker._setDateFromField(inst);if($.datepicker._inDialog){input.value=""}if(!$.datepicker._pos){$.datepicker._pos=$.datepicker._findPos(input);$.datepicker._pos[1]+=input.offsetHeight}var isFixed=false;$(input).parents().each(function(){isFixed|=$(this).css("position")=="fixed";return !isFixed});if(isFixed&&$.browser.opera){$.datepicker._pos[0]-=document.documentElement.scrollLeft;$.datepicker._pos[1]-=document.documentElement.scrollTop}var offset={left:$.datepicker._pos[0],top:$.datepicker._pos[1]};$.datepicker._pos=null;inst.rangeStart=null;inst.dpDiv.css({position:"absolute",display:"block",top:"-1000px"});$.datepicker._updateDatepicker(inst);offset=$.datepicker._checkOffset(inst,offset,isFixed);inst.dpDiv.css({position:($.datepicker._inDialog&&$.blockUI?"static":(isFixed?"fixed":"absolute")),display:"none",left:offset.left+"px",top:offset.top+"px"});if(!inst.inline){var showAnim=$.datepicker._get(inst,"showAnim")||"show";var duration=$.datepicker._get(inst,"duration");var postProcess=function(){$.datepicker._datepickerShowing=true;if($.browser.msie&&parseInt($.browser.version,10)<7){$("iframe.ui-datepicker-cover").css({width:inst.dpDiv.width()+4,height:inst.dpDiv.height()+4})}};if($.effects&&$.effects[showAnim]){inst.dpDiv.show(showAnim,$.datepicker._get(inst,"showOptions"),duration,postProcess)}else{inst.dpDiv[showAnim](duration,postProcess)}if(duration==""){postProcess()}if(inst.input[0].type!="hidden"){inst.input[0].focus()}$.datepicker._curInst=inst}},_updateDatepicker:function(inst){var dims={width:inst.dpDiv.width()+4,height:inst.dpDiv.height()+4};var self=this;inst.dpDiv.empty().append(this._generateHTML(inst)).find("iframe.ui-datepicker-cover").css({width:dims.width,height:dims.height}).end().find("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a").bind("mouseout",function(){$(this).removeClass("ui-state-hover");if(this.className.indexOf("ui-datepicker-prev")!=-1){$(this).removeClass("ui-datepicker-prev-hover")}if(this.className.indexOf("ui-datepicker-next")!=-1){$(this).removeClass("ui-datepicker-next-hover")}}).bind("mouseover",function(){if(!self._isDisabledDatepicker(inst.inline?inst.dpDiv.parent()[0]:inst.input[0])){$(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");$(this).addClass("ui-state-hover");if(this.className.indexOf("ui-datepicker-prev")!=-1){$(this).addClass("ui-datepicker-prev-hover")}if(this.className.indexOf("ui-datepicker-next")!=-1){$(this).addClass("ui-datepicker-next-hover")}}}).end().find("."+this._dayOverClass+" a").trigger("mouseover").end();var numMonths=this._getNumberOfMonths(inst);var cols=numMonths[1];var width=17;if(cols>1){inst.dpDiv.addClass("ui-datepicker-multi-"+cols).css("width",(width*cols)+"em")}else{inst.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("")}inst.dpDiv[(numMonths[0]!=1||numMonths[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi");inst.dpDiv[(this._get(inst,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl");if(inst.input&&inst.input[0].type!="hidden"&&inst==$.datepicker._curInst){$(inst.input[0]).focus()}},_checkOffset:function(inst,offset,isFixed){var dpWidth=inst.dpDiv.outerWidth();var dpHeight=inst.dpDiv.outerHeight();var inputWidth=inst.input?inst.input.outerWidth():0;var inputHeight=inst.input?inst.input.outerHeight():0;var viewWidth=(window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth)+$(document).scrollLeft();var viewHeight=(window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight)+$(document).scrollTop();offset.left-=(this._get(inst,"isRTL")?(dpWidth-inputWidth):0);offset.left-=(isFixed&&offset.left==inst.input.offset().left)?$(document).scrollLeft():0;offset.top-=(isFixed&&offset.top==(inst.input.offset().top+inputHeight))?$(document).scrollTop():0;offset.left-=(offset.left+dpWidth>viewWidth&&viewWidth>dpWidth)?Math.abs(offset.left+dpWidth-viewWidth):0;offset.top-=(offset.top+dpHeight>viewHeight&&viewHeight>dpHeight)?Math.abs(offset.top+dpHeight+inputHeight*2-viewHeight):0;return offset},_findPos:function(obj){while(obj&&(obj.type=="hidden"||obj.nodeType!=1)){obj=obj.nextSibling}var position=$(obj).offset();return[position.left,position.top]},_hideDatepicker:function(input,duration){var inst=this._curInst;if(!inst||(input&&inst!=$.data(input,PROP_NAME))){return}if(inst.stayOpen){this._selectDate("#"+inst.id,this._formatDate(inst,inst.currentDay,inst.currentMonth,inst.currentYear))}inst.stayOpen=false;if(this._datepickerShowing){duration=(duration!=null?duration:this._get(inst,"duration"));var showAnim=this._get(inst,"showAnim");var postProcess=function(){$.datepicker._tidyDialog(inst)};if(duration!=""&&$.effects&&$.effects[showAnim]){inst.dpDiv.hide(showAnim,$.datepicker._get(inst,"showOptions"),duration,postProcess)}else{inst.dpDiv[(duration==""?"hide":(showAnim=="slideDown"?"slideUp":(showAnim=="fadeIn"?"fadeOut":"hide")))](duration,postProcess)}if(duration==""){this._tidyDialog(inst)}var onClose=this._get(inst,"onClose");if(onClose){onClose.apply((inst.input?inst.input[0]:null),[(inst.input?inst.input.val():""),inst])}this._datepickerShowing=false;this._lastInput=null;if(this._inDialog){this._dialogInput.css({position:"absolute",left:"0",top:"-100px"});if($.blockUI){$.unblockUI();$("body").append(this.dpDiv)}}this._inDialog=false}this._curInst=null},_tidyDialog:function(inst){inst.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(event){if(!$.datepicker._curInst){return}var $target=$(event.target);if(($target.parents("#"+$.datepicker._mainDivId).length==0)&&!$target.hasClass($.datepicker.markerClassName)&&!$target.hasClass($.datepicker._triggerClass)&&$.datepicker._datepickerShowing&&!($.datepicker._inDialog&&$.blockUI)){$.datepicker._hideDatepicker(null,"")}},_adjustDate:function(id,offset,period){var target=$(id);var inst=this._getInst(target[0]);if(this._isDisabledDatepicker(target[0])){return}this._adjustInstDate(inst,offset+(period=="M"?this._get(inst,"showCurrentAtPos"):0),period);this._updateDatepicker(inst)},_gotoToday:function(id){var target=$(id);var inst=this._getInst(target[0]);if(this._get(inst,"gotoCurrent")&&inst.currentDay){inst.selectedDay=inst.currentDay;inst.drawMonth=inst.selectedMonth=inst.currentMonth;inst.drawYear=inst.selectedYear=inst.currentYear}else{var date=new Date();inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear()}this._notifyChange(inst);this._adjustDate(target)},_selectMonthYear:function(id,select,period){var target=$(id);var inst=this._getInst(target[0]);inst._selectingMonthYear=false;inst["selected"+(period=="M"?"Month":"Year")]=inst["draw"+(period=="M"?"Month":"Year")]=parseInt(select.options[select.selectedIndex].value,10);this._notifyChange(inst);this._adjustDate(target)},_clickMonthYear:function(id){var target=$(id);var inst=this._getInst(target[0]);if(inst.input&&inst._selectingMonthYear&&!$.browser.msie){inst.input[0].focus()}inst._selectingMonthYear=!inst._selectingMonthYear},_selectDay:function(id,month,year,td){var target=$(id);if($(td).hasClass(this._unselectableClass)||this._isDisabledDatepicker(target[0])){return}var inst=this._getInst(target[0]);inst.selectedDay=inst.currentDay=$("a",td).html();inst.selectedMonth=inst.currentMonth=month;inst.selectedYear=inst.currentYear=year;if(inst.stayOpen){inst.endDay=inst.endMonth=inst.endYear=null}this._selectDate(id,this._formatDate(inst,inst.currentDay,inst.currentMonth,inst.currentYear));if(inst.stayOpen){inst.rangeStart=this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay));this._updateDatepicker(inst)}},_clearDate:function(id){var target=$(id);var inst=this._getInst(target[0]);inst.stayOpen=false;inst.endDay=inst.endMonth=inst.endYear=inst.rangeStart=null;this._selectDate(target,"")},_selectDate:function(id,dateStr){var target=$(id);var inst=this._getInst(target[0]);dateStr=(dateStr!=null?dateStr:this._formatDate(inst));if(inst.input){inst.input.val(dateStr)}this._updateAlternate(inst);var onSelect=this._get(inst,"onSelect");if(onSelect){onSelect.apply((inst.input?inst.input[0]:null),[dateStr,inst])}else{if(inst.input){inst.input.trigger("change")}}if(inst.inline){this._updateDatepicker(inst)}else{if(!inst.stayOpen){this._hideDatepicker(null,this._get(inst,"duration"));this._lastInput=inst.input[0];if(typeof(inst.input[0])!="object"){inst.input[0].focus()}this._lastInput=null}}},_updateAlternate:function(inst){var altField=this._get(inst,"altField");if(altField){var altFormat=this._get(inst,"altFormat")||this._get(inst,"dateFormat");var date=this._getDate(inst);dateStr=this.formatDate(altFormat,date,this._getFormatConfig(inst));$(altField).each(function(){$(this).val(dateStr)})}},noWeekends:function(date){var day=date.getDay();return[(day>0&&day<6),""]},iso8601Week:function(date){var checkDate=new Date(date.getFullYear(),date.getMonth(),date.getDate());var firstMon=new Date(checkDate.getFullYear(),1-1,4);var firstDay=firstMon.getDay()||7;firstMon.setDate(firstMon.getDate()+1-firstDay);if(firstDay<4&&checkDate<firstMon){checkDate.setDate(checkDate.getDate()-3);return $.datepicker.iso8601Week(checkDate)}else{if(checkDate>new Date(checkDate.getFullYear(),12-1,28)){firstDay=new Date(checkDate.getFullYear()+1,1-1,4).getDay()||7;if(firstDay>4&&(checkDate.getDay()||7)<firstDay-3){return 1}}}return Math.floor(((checkDate-firstMon)/86400000)/7)+1},parseDate:function(format,value,settings){if(format==null||value==null){throw"Invalid arguments"}value=(typeof value=="object"?value.toString():value+"");if(value==""){return null}var shortYearCutoff=(settings?settings.shortYearCutoff:null)||this._defaults.shortYearCutoff;var dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort;var dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames;var monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort;var monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames;var year=-1;var month=-1;var day=-1;var doy=-1;var literal=false;var lookAhead=function(match){var matches=(iFormat+1<format.length&&format.charAt(iFormat+1)==match);if(matches){iFormat++}return matches};var getNumber=function(match){lookAhead(match);var origSize=(match=="@"?14:(match=="y"?4:(match=="o"?3:2)));var size=origSize;var num=0;while(size>0&&iValue<value.length&&value.charAt(iValue)>="0"&&value.charAt(iValue)<="9"){num=num*10+parseInt(value.charAt(iValue++),10);size--}if(size==origSize){throw"Missing number at position "+iValue}return num};var getName=function(match,shortNames,longNames){var names=(lookAhead(match)?longNames:shortNames);var size=0;for(var j=0;j<names.length;j++){size=Math.max(size,names[j].length)}var name="";var iInit=iValue;while(size>0&&iValue<value.length){name+=value.charAt(iValue++);for(var i=0;i<names.length;i++){if(name==names[i]){return i+1}}size--}throw"Unknown name at position "+iInit};var checkLiteral=function(){if(value.charAt(iValue)!=format.charAt(iFormat)){throw"Unexpected literal at position "+iValue}iValue++};var iValue=0;for(var iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)=="'"&&!lookAhead("'")){literal=false}else{checkLiteral()}}else{switch(format.charAt(iFormat)){case"d":day=getNumber("d");break;case"D":getName("D",dayNamesShort,dayNames);break;case"o":doy=getNumber("o");break;case"m":month=getNumber("m");break;case"M":month=getName("M",monthNamesShort,monthNames);break;case"y":year=getNumber("y");break;case"@":var date=new Date(getNumber("@"));year=date.getFullYear();month=date.getMonth()+1;day=date.getDate();break;case"'":if(lookAhead("'")){checkLiteral()}else{literal=true}break;default:checkLiteral()}}}if(year==-1){year=new Date().getFullYear()}else{if(year<100){year+=new Date().getFullYear()-new Date().getFullYear()%100+(year<=shortYearCutoff?0:-100)}}if(doy>-1){month=1;day=doy;do{var dim=this._getDaysInMonth(year,month-1);if(day<=dim){break}month++;day-=dim}while(true)}var date=this._daylightSavingAdjust(new Date(year,month-1,day));if(date.getFullYear()!=year||date.getMonth()+1!=month||date.getDate()!=day){throw"Invalid date"}return date},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TIMESTAMP:"@",W3C:"yy-mm-dd",formatDate:function(format,date,settings){if(!date){return""}var dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort;var dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames;var monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort;var monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames;var lookAhead=function(match){var matches=(iFormat+1<format.length&&format.charAt(iFormat+1)==match);if(matches){iFormat++}return matches};var formatNumber=function(match,value,len){var num=""+value;if(lookAhead(match)){while(num.length<len){num="0"+num}}return num};var formatName=function(match,value,shortNames,longNames){return(lookAhead(match)?longNames[value]:shortNames[value])};var output="";var literal=false;if(date){for(var iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)=="'"&&!lookAhead("'")){literal=false}else{output+=format.charAt(iFormat)}}else{switch(format.charAt(iFormat)){case"d":output+=formatNumber("d",date.getDate(),2);break;case"D":output+=formatName("D",date.getDay(),dayNamesShort,dayNames);break;case"o":var doy=date.getDate();for(var m=date.getMonth()-1;m>=0;m--){doy+=this._getDaysInMonth(date.getFullYear(),m)}output+=formatNumber("o",doy,3);break;case"m":output+=formatNumber("m",date.getMonth()+1,2);break;case"M":output+=formatName("M",date.getMonth(),monthNamesShort,monthNames);break;case"y":output+=(lookAhead("y")?date.getFullYear():(date.getYear()%100<10?"0":"")+date.getYear()%100);break;case"@":output+=date.getTime();break;case"'":if(lookAhead("'")){output+="'"}else{literal=true}break;default:output+=format.charAt(iFormat)}}}}return output},_possibleChars:function(format){var chars="";var literal=false;for(var iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)=="'"&&!lookAhead("'")){literal=false}else{chars+=format.charAt(iFormat)}}else{switch(format.charAt(iFormat)){case"d":case"m":case"y":case"@":chars+="0123456789";break;case"D":case"M":return null;case"'":if(lookAhead("'")){chars+="'"}else{literal=true}break;default:chars+=format.charAt(iFormat)}}}return chars},_get:function(inst,name){return inst.settings[name]!==undefined?inst.settings[name]:this._defaults[name]},_setDateFromField:function(inst){var dateFormat=this._get(inst,"dateFormat");var dates=inst.input?inst.input.val():null;inst.endDay=inst.endMonth=inst.endYear=null;var date=defaultDate=this._getDefaultDate(inst);var settings=this._getFormatConfig(inst);try{date=this.parseDate(dateFormat,dates,settings)||defaultDate}catch(event){this.log(event);date=defaultDate}inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();inst.currentDay=(dates?date.getDate():0);inst.currentMonth=(dates?date.getMonth():0);inst.currentYear=(dates?date.getFullYear():0);this._adjustInstDate(inst)},_getDefaultDate:function(inst){var date=this._determineDate(this._get(inst,"defaultDate"),new Date());var minDate=this._getMinMaxDate(inst,"min",true);var maxDate=this._getMinMaxDate(inst,"max");date=(minDate&&date<minDate?minDate:date);date=(maxDate&&date>maxDate?maxDate:date);return date},_determineDate:function(date,defaultDate){var offsetNumeric=function(offset){var date=new Date();date.setDate(date.getDate()+offset);return date};var offsetString=function(offset,getDaysInMonth){var date=new Date();var year=date.getFullYear();var month=date.getMonth();var day=date.getDate();var pattern=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g;var matches=pattern.exec(offset);while(matches){switch(matches[2]||"d"){case"d":case"D":day+=parseInt(matches[1],10);break;case"w":case"W":day+=parseInt(matches[1],10)*7;break;case"m":case"M":month+=parseInt(matches[1],10);day=Math.min(day,getDaysInMonth(year,month));break;case"y":case"Y":year+=parseInt(matches[1],10);day=Math.min(day,getDaysInMonth(year,month));break}matches=pattern.exec(offset)}return new Date(year,month,day)};date=(date==null?defaultDate:(typeof date=="string"?offsetString(date,this._getDaysInMonth):(typeof date=="number"?(isNaN(date)?defaultDate:offsetNumeric(date)):date)));date=(date&&date.toString()=="Invalid Date"?defaultDate:date);if(date){date.setHours(0);date.setMinutes(0);date.setSeconds(0);date.setMilliseconds(0)}return this._daylightSavingAdjust(date)},_daylightSavingAdjust:function(date){if(!date){return null}date.setHours(date.getHours()>12?date.getHours()+2:0);return date},_setDate:function(inst,date,endDate){var clear=!(date);var origMonth=inst.selectedMonth;var origYear=inst.selectedYear;date=this._determineDate(date,new Date());inst.selectedDay=inst.currentDay=date.getDate();inst.drawMonth=inst.selectedMonth=inst.currentMonth=date.getMonth();inst.drawYear=inst.selectedYear=inst.currentYear=date.getFullYear();if(origMonth!=inst.selectedMonth||origYear!=inst.selectedYear){this._notifyChange(inst)}this._adjustInstDate(inst);if(inst.input){inst.input.val(clear?"":this._formatDate(inst))}},_getDate:function(inst){var startDate=(!inst.currentYear||(inst.input&&inst.input.val()=="")?null:this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));return startDate},_generateHTML:function(inst){var today=new Date();today=this._daylightSavingAdjust(new Date(today.getFullYear(),today.getMonth(),today.getDate()));var isRTL=this._get(inst,"isRTL");var showButtonPanel=this._get(inst,"showButtonPanel");var hideIfNoPrevNext=this._get(inst,"hideIfNoPrevNext");var navigationAsDateFormat=this._get(inst,"navigationAsDateFormat");var numMonths=this._getNumberOfMonths(inst);var showCurrentAtPos=this._get(inst,"showCurrentAtPos");var stepMonths=this._get(inst,"stepMonths");var stepBigMonths=this._get(inst,"stepBigMonths");var isMultiMonth=(numMonths[0]!=1||numMonths[1]!=1);var currentDate=this._daylightSavingAdjust((!inst.currentDay?new Date(9999,9,9):new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));var minDate=this._getMinMaxDate(inst,"min",true);var maxDate=this._getMinMaxDate(inst,"max");var drawMonth=inst.drawMonth-showCurrentAtPos;var drawYear=inst.drawYear;if(drawMonth<0){drawMonth+=12;drawYear--}if(maxDate){var maxDraw=this._daylightSavingAdjust(new Date(maxDate.getFullYear(),maxDate.getMonth()-numMonths[1]+1,maxDate.getDate()));maxDraw=(minDate&&maxDraw<minDate?minDate:maxDraw);while(this._daylightSavingAdjust(new Date(drawYear,drawMonth,1))>maxDraw){drawMonth--;if(drawMonth<0){drawMonth=11;drawYear--}}}inst.drawMonth=drawMonth;inst.drawYear=drawYear;var prevText=this._get(inst,"prevText");prevText=(!navigationAsDateFormat?prevText:this.formatDate(prevText,this._daylightSavingAdjust(new Date(drawYear,drawMonth-stepMonths,1)),this._getFormatConfig(inst)));var prev=(this._canAdjustMonth(inst,-1,drawYear,drawMonth)?'<a class="ui-datepicker-prev ui-corner-all" onclick="DP_jQuery.datepicker._adjustDate(\'#'+inst.id+"', -"+stepMonths+", 'M');\" title=\""+prevText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?"e":"w")+'">'+prevText+"</span></a>":(hideIfNoPrevNext?"":'<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+prevText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?"e":"w")+'">'+prevText+"</span></a>"));var nextText=this._get(inst,"nextText");nextText=(!navigationAsDateFormat?nextText:this.formatDate(nextText,this._daylightSavingAdjust(new Date(drawYear,drawMonth+stepMonths,1)),this._getFormatConfig(inst)));var next=(this._canAdjustMonth(inst,+1,drawYear,drawMonth)?'<a class="ui-datepicker-next ui-corner-all" onclick="DP_jQuery.datepicker._adjustDate(\'#'+inst.id+"', +"+stepMonths+", 'M');\" title=\""+nextText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?"w":"e")+'">'+nextText+"</span></a>":(hideIfNoPrevNext?"":'<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+nextText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?"w":"e")+'">'+nextText+"</span></a>"));var currentText=this._get(inst,"currentText");var gotoDate=(this._get(inst,"gotoCurrent")&&inst.currentDay?currentDate:today);currentText=(!navigationAsDateFormat?currentText:this.formatDate(currentText,gotoDate,this._getFormatConfig(inst)));var controls=(!inst.inline?'<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_jQuery.datepicker._hideDatepicker();">'+this._get(inst,"closeText")+"</button>":"");var buttonPanel=(showButtonPanel)?'<div class="ui-datepicker-buttonpane ui-widget-content">'+(isRTL?controls:"")+(this._isInRange(inst,gotoDate)?'<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_jQuery.datepicker._gotoToday(\'#'+inst.id+"');\">"+currentText+"</button>":"")+(isRTL?"":controls)+"</div>":"";var firstDay=parseInt(this._get(inst,"firstDay"),10);firstDay=(isNaN(firstDay)?0:firstDay);var dayNames=this._get(inst,"dayNames");var dayNamesShort=this._get(inst,"dayNamesShort");var dayNamesMin=this._get(inst,"dayNamesMin");var monthNames=this._get(inst,"monthNames");var monthNamesShort=this._get(inst,"monthNamesShort");var beforeShowDay=this._get(inst,"beforeShowDay");var showOtherMonths=this._get(inst,"showOtherMonths");var calculateWeek=this._get(inst,"calculateWeek")||this.iso8601Week;var endDate=inst.endDay?this._daylightSavingAdjust(new Date(inst.endYear,inst.endMonth,inst.endDay)):currentDate;var defaultDate=this._getDefaultDate(inst);var html="";for(var row=0;row<numMonths[0];row++){var group="";for(var col=0;col<numMonths[1];col++){var selectedDate=this._daylightSavingAdjust(new Date(drawYear,drawMonth,inst.selectedDay));var cornerClass=" ui-corner-all";var calender="";if(isMultiMonth){calender+='<div class="ui-datepicker-group ui-datepicker-group-';switch(col){case 0:calender+="first";cornerClass=" ui-corner-"+(isRTL?"right":"left");break;case numMonths[1]-1:calender+="last";cornerClass=" ui-corner-"+(isRTL?"left":"right");break;default:calender+="middle";cornerClass="";break}calender+='">'}calender+='<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix'+cornerClass+'">'+(/all|left/.test(cornerClass)&&row==0?(isRTL?next:prev):"")+(/all|right/.test(cornerClass)&&row==0?(isRTL?prev:next):"")+this._generateMonthYearHeader(inst,drawMonth,drawYear,minDate,maxDate,selectedDate,row>0||col>0,monthNames,monthNamesShort)+'</div><table class="ui-datepicker-calendar"><thead><tr>';var thead="";for(var dow=0;dow<7;dow++){var day=(dow+firstDay)%7;thead+="<th"+((dow+firstDay+6)%7>=5?' class="ui-datepicker-week-end"':"")+'><span title="'+dayNames[day]+'">'+dayNamesMin[day]+"</span></th>"}calender+=thead+"</tr></thead><tbody>";var daysInMonth=this._getDaysInMonth(drawYear,drawMonth);if(drawYear==inst.selectedYear&&drawMonth==inst.selectedMonth){inst.selectedDay=Math.min(inst.selectedDay,daysInMonth)}var leadDays=(this._getFirstDayOfMonth(drawYear,drawMonth)-firstDay+7)%7;var numRows=(isMultiMonth?6:Math.ceil((leadDays+daysInMonth)/7));var printDate=this._daylightSavingAdjust(new Date(drawYear,drawMonth,1-leadDays));for(var dRow=0;dRow<numRows;dRow++){calender+="<tr>";var tbody="";for(var dow=0;dow<7;dow++){var daySettings=(beforeShowDay?beforeShowDay.apply((inst.input?inst.input[0]:null),[printDate]):[true,""]);var otherMonth=(printDate.getMonth()!=drawMonth);var unselectable=otherMonth||!daySettings[0]||(minDate&&printDate<minDate)||(maxDate&&printDate>maxDate);tbody+='<td class="'+((dow+firstDay+6)%7>=5?" ui-datepicker-week-end":"")+(otherMonth?" ui-datepicker-other-month":"")+((printDate.getTime()==selectedDate.getTime()&&drawMonth==inst.selectedMonth&&inst._keyEvent)||(defaultDate.getTime()==printDate.getTime()&&defaultDate.getTime()==selectedDate.getTime())?" "+this._dayOverClass:"")+(unselectable?" "+this._unselectableClass+" ui-state-disabled":"")+(otherMonth&&!showOtherMonths?"":" "+daySettings[1]+(printDate.getTime()>=currentDate.getTime()&&printDate.getTime()<=endDate.getTime()?" "+this._currentClass:"")+(printDate.getTime()==today.getTime()?" ui-datepicker-today":""))+'"'+((!otherMonth||showOtherMonths)&&daySettings[2]?' title="'+daySettings[2]+'"':"")+(unselectable?"":" onclick=\"DP_jQuery.datepicker._selectDay('#"+inst.id+"',"+drawMonth+","+drawYear+', this);return false;"')+">"+(otherMonth?(showOtherMonths?printDate.getDate():"&#xa0;"):(unselectable?'<span class="ui-state-default">'+printDate.getDate()+"</span>":'<a class="ui-state-default'+(printDate.getTime()==today.getTime()?" ui-state-highlight":"")+(printDate.getTime()>=currentDate.getTime()&&printDate.getTime()<=endDate.getTime()?" ui-state-active":"")+'" href="#">'+printDate.getDate()+"</a>"))+"</td>";printDate.setDate(printDate.getDate()+1);printDate=this._daylightSavingAdjust(printDate)}calender+=tbody+"</tr>"}drawMonth++;if(drawMonth>11){drawMonth=0;drawYear++}calender+="</tbody></table>"+(isMultiMonth?"</div>"+((numMonths[0]>0&&col==numMonths[1]-1)?'<div class="ui-datepicker-row-break"></div>':""):"");group+=calender}html+=group}html+=buttonPanel+($.browser.msie&&parseInt($.browser.version,10)<7&&!inst.inline?'<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>':"");inst._keyEvent=false;return html},_generateMonthYearHeader:function(inst,drawMonth,drawYear,minDate,maxDate,selectedDate,secondary,monthNames,monthNamesShort){minDate=(inst.rangeStart&&minDate&&selectedDate<minDate?selectedDate:minDate);var changeMonth=this._get(inst,"changeMonth");var changeYear=this._get(inst,"changeYear");var showMonthAfterYear=this._get(inst,"showMonthAfterYear");var html='<div class="ui-datepicker-title">';var monthHtml="";if(secondary||!changeMonth){monthHtml+='<span class="ui-datepicker-month">'+monthNames[drawMonth]+"</span> "}else{var inMinYear=(minDate&&minDate.getFullYear()==drawYear);var inMaxYear=(maxDate&&maxDate.getFullYear()==drawYear);monthHtml+='<select class="ui-datepicker-month" onchange="DP_jQuery.datepicker._selectMonthYear(\'#'+inst.id+"', this, 'M');\" onclick=\"DP_jQuery.datepicker._clickMonthYear('#"+inst.id+"');\">";for(var month=0;month<12;month++){if((!inMinYear||month>=minDate.getMonth())&&(!inMaxYear||month<=maxDate.getMonth())){monthHtml+='<option value="'+month+'"'+(month==drawMonth?' selected="selected"':"")+">"+monthNamesShort[month]+"</option>"}}monthHtml+="</select>"}if(!showMonthAfterYear){html+=monthHtml+((secondary||changeMonth||changeYear)&&(!(changeMonth&&changeYear))?"&#xa0;":"")}if(secondary||!changeYear){html+='<span class="ui-datepicker-year">'+drawYear+"</span>"}else{var years=this._get(inst,"yearRange").split(":");var year=0;var endYear=0;if(years.length!=2){year=drawYear-10;endYear=drawYear+10}else{if(years[0].charAt(0)=="+"||years[0].charAt(0)=="-"){year=drawYear+parseInt(years[0],10);endYear=drawYear+parseInt(years[1],10)}else{year=parseInt(years[0],10);endYear=parseInt(years[1],10)}}year=(minDate?Math.max(year,minDate.getFullYear()):year);endYear=(maxDate?Math.min(endYear,maxDate.getFullYear()):endYear);html+='<select class="ui-datepicker-year" onchange="DP_jQuery.datepicker._selectMonthYear(\'#'+inst.id+"', this, 'Y');\" onclick=\"DP_jQuery.datepicker._clickMonthYear('#"+inst.id+"');\">";for(;year<=endYear;year++){html+='<option value="'+year+'"'+(year==drawYear?' selected="selected"':"")+">"+year+"</option>"}html+="</select>"}if(showMonthAfterYear){html+=(secondary||changeMonth||changeYear?"&#xa0;":"")+monthHtml}html+="</div>";return html},_adjustInstDate:function(inst,offset,period){var year=inst.drawYear+(period=="Y"?offset:0);var month=inst.drawMonth+(period=="M"?offset:0);var day=Math.min(inst.selectedDay,this._getDaysInMonth(year,month))+(period=="D"?offset:0);var date=this._daylightSavingAdjust(new Date(year,month,day));var minDate=this._getMinMaxDate(inst,"min",true);var maxDate=this._getMinMaxDate(inst,"max");date=(minDate&&date<minDate?minDate:date);date=(maxDate&&date>maxDate?maxDate:date);inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();if(period=="M"||period=="Y"){this._notifyChange(inst)}},_notifyChange:function(inst){var onChange=this._get(inst,"onChangeMonthYear");if(onChange){onChange.apply((inst.input?inst.input[0]:null),[inst.selectedYear,inst.selectedMonth+1,inst])}},_getNumberOfMonths:function(inst){var numMonths=this._get(inst,"numberOfMonths");return(numMonths==null?[1,1]:(typeof numMonths=="number"?[1,numMonths]:numMonths))},_getMinMaxDate:function(inst,minMax,checkRange){var date=this._determineDate(this._get(inst,minMax+"Date"),null);return(!checkRange||!inst.rangeStart?date:(!date||inst.rangeStart>date?inst.rangeStart:date))},_getDaysInMonth:function(year,month){return 32-new Date(year,month,32).getDate()},_getFirstDayOfMonth:function(year,month){return new Date(year,month,1).getDay()},_canAdjustMonth:function(inst,offset,curYear,curMonth){var numMonths=this._getNumberOfMonths(inst);var date=this._daylightSavingAdjust(new Date(curYear,curMonth+(offset<0?offset:numMonths[1]),1));if(offset<0){date.setDate(this._getDaysInMonth(date.getFullYear(),date.getMonth()))}return this._isInRange(inst,date)},_isInRange:function(inst,date){var newMinDate=(!inst.rangeStart?null:this._daylightSavingAdjust(new Date(inst.selectedYear,inst.selectedMonth,inst.selectedDay)));newMinDate=(newMinDate&&inst.rangeStart<newMinDate?inst.rangeStart:newMinDate);var minDate=newMinDate||this._getMinMaxDate(inst,"min");var maxDate=this._getMinMaxDate(inst,"max");return((!minDate||date>=minDate)&&(!maxDate||date<=maxDate))},_getFormatConfig:function(inst){var shortYearCutoff=this._get(inst,"shortYearCutoff");shortYearCutoff=(typeof shortYearCutoff!="string"?shortYearCutoff:new Date().getFullYear()%100+parseInt(shortYearCutoff,10));return{shortYearCutoff:shortYearCutoff,dayNamesShort:this._get(inst,"dayNamesShort"),dayNames:this._get(inst,"dayNames"),monthNamesShort:this._get(inst,"monthNamesShort"),monthNames:this._get(inst,"monthNames")}},_formatDate:function(inst,day,month,year){if(!day){inst.currentDay=inst.selectedDay;inst.currentMonth=inst.selectedMonth;inst.currentYear=inst.selectedYear}var date=(day?(typeof day=="object"?day:this._daylightSavingAdjust(new Date(year,month,day))):this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));return this.formatDate(this._get(inst,"dateFormat"),date,this._getFormatConfig(inst))}});function extendRemove(target,props){$.extend(target,props);for(var name in props){if(props[name]==null||props[name]==undefined){target[name]=props[name]}}return target}function isArray(a){return(a&&(($.browser.safari&&typeof a=="object"&&a.length)||(a.constructor&&a.constructor.toString().match(/\Array\(\)/))))}$.fn.datepicker=function(options){if(!$.datepicker.initialized){$(document).mousedown($.datepicker._checkExternalClick).find("body").append($.datepicker.dpDiv);$.datepicker.initialized=true}var otherArgs=Array.prototype.slice.call(arguments,1);if(typeof options=="string"&&(options=="isDisabled"||options=="getDate")){return $.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this[0]].concat(otherArgs))}if(options=="option"&&arguments.length==2&&typeof arguments[1]=="string"){return $.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this[0]].concat(otherArgs))}return this.each(function(){typeof options=="string"?$.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this].concat(otherArgs)):$.datepicker._attachDatepicker(this,options)})};$.datepicker=new Datepicker();$.datepicker.initialized=false;$.datepicker.uuid=new Date().getTime();$.datepicker.version="1.7.2";window.DP_jQuery=$})(jQuery);function SearchSummary(){var f;var n={};var a=false;var r=[];var m=[{name:"Criteria/MinPrice|Criteria/MaxPrice",format:"Price: {Criteria/MinPrice} - {Criteria/MaxPrice}"},{name:"Criteria/MinBedrooms",format:"Beds: {Criteria/MinBedrooms}"},{name:"Criteria/MinBathrooms",format:"Baths: {Criteria/MinBathrooms}"},{name:"Criteria/SquareFootage|Criteria/MaxSquareFootage",format:"Sq Footage: {Criteria/SquareFootage} - {Criteria/MaxSquareFootage}"},{name:"Criteria/MinAcreage|Criteria/MaxAcreage",format:"Acreage: {Criteria/MinAcreage} - {Criteria/MaxAcreage}"},{name:"Criteria/City|Criteria/ZipCodeAdvanced",format:"{Criteria/City} - {Criteria/ZipCodeAdvanced}"},{name:"Criteria/OpenHouseStartDtm|Criteria/OpenHouseStopDtm",format:"Open House Dates: {Criteria/OpenHouseStartDtm} - {Criteria/OpenHouseStopDtm}"},{name:"Criteria/MinYearBuilt|Criteria/MaxYearBuilt",format:"Built: {Criteria/MinYearBuilt} - {Criteria/MaxYearBuilt}"},{name:"Criteria/CumulativeDaysOnMarket",format:"Days on Market: {Criteria/CumulativeDaysOnMarket}"},{name:"Criteria/AS_StreetName",format:"Street: {Criteria/AS_StreetName}"},{name:"Criteria/AS_City",format:"City: {Criteria/AS_City}"},{name:"Criteria/AS_StateOrProvinceCode",format:"State: {Criteria/AS_StateOrProvinceCode}"},{name:"Criteria/AS_ZipCodeAdvanced",format:"Zip: {Criteria/AS_ZipCodeAdvanced}"},{name:"Criteria/AS_FilterByAddress",format:"{Criteria/AS_FilterByAddress}"},{name:"Criteria/ListingNumber",format:"Listing Number: {Criteria/ListingNumber}"},{name:"Criteria/SoldDate",format:"Sold within: {Criteria/SoldDate}"},{name:"Criteria/PublicRemarks",format:"Remarks: {Criteria/PublicRemarks}"}];function g(){var s={};s.basicSearch="#basicSearch, #advancedSearch";s.advancedSearch="#basicSearch, #advancedSearch";if(s[f]){return s[f]}return"#"+f}function d(){return n[f]}var j={};function k(s){if(typeof(s)=="undefined"||s==""){return""}if(j[s]){return j[s]}j[s]=$("label[for='"+s+"']:first",d()).text();return j[s]}function i(w){var u=k(w.id);if(u!=""){return u}var t=w.nextSibling;while(t){var s=jQuery.trim(t.nodeType!=1?t.nodeValue:$(t).text());if(s!=""){return s}t=t.nextSibling}return""}function b(s){var t=$(s).parent().text();if(t!=""){t=jQuery.trim(t);t=jQuery.trim(t.substr(0,t.indexOf(":")));return t}return""}function c(v){var s="";var x=$(v).closest(".featureListBox");if(x.length>0){var t=x[0].id;if(t.indexOf("feature_")!=-1){var w=t.substring(t.indexOf("_")+1);var u=$("select[name='dd_Features']",d());if(u.length===0){u=$("select.featuresdd",d())}if(u.length===0){u=$("#mapsearch-criteria-features",d())}if(u.length>0){s=u[0].options[parseInt(w,10)].text}}}return s}function l(v){switch(v.type){case"text":return v.value;case"select-one":if(v.name=="Criteria/ListingTypeID"){a=true;var t=$("#propertyType_"+v.selectedIndex+" input:checked:enabled",d());return t.length===0?v.options[v.selectedIndex].text:""}var x="";if(v.name.indexOf("Groups/Group_")==0){x=b(v);if(x!=""){x+=": "}}return v.value==""?"":x+v.options[v.selectedIndex].text;case"checkbox":case"radio":var z=i(v);if(z===""){return z}if(v.name==="Criteria/PropertyTypeID"||v.name==="Criteria/ListingTypePropertyTypeID"){if(!$(v).is(":visible")){return""}var w=$("select[name='Criteria/ListingTypeID']",d());if(w.length>0){var y=w[0];var u=y.options[y.selectedIndex].text;if(u!==""){z=u+": "+z}}}else{if(v.name==="Criteria/Status"){z="Status: "+z}else{if(v.name.indexOf("Groups/Group_")!=-1){var s=c(v);if(s!==""){z=s+": "+z}}}}return z}return""}function p(w){var x={name:"",text:""};for(var z=0;z<m.length;z++){var s=m[z];if(s.name.indexOf(w.name)!=-1){var t=s.name.split("|");var A=s.format;for(var u=0;u<t.length;u++){var y=t[u];var v=$("select[name='"+y+"'],:input[name='"+y+"']",d());if(v.length>0){A=A.replace("{"+y+"}",l(v[0]))}r.push(y)}x.name=s.name;x.text=A.replace(/(((-|\/) {[\w/]+}(.)*)|({[\w/]+}(.)*(-|\/) ))/gi,"");break}}return x}function o(v){if(!v){return""}var t="remove-criteria";if(v.indexOf("|")!=-1){v=v.split("|")[0]}var s=$("*[name='"+v+"']");var u;if(s.length>0){u=s[0]}if(u&&u.nodeName.toLowerCase()==="select"&&$("option[value='']",$(u)).length==0){t=""}return t}function h(){var u=[];r=[];var v=$("input[name='Criteria/Location']",d());if(v.length>0){var t=v.val().split("|");for(var s=0;s<t.length;s++){if(t[s]&&t[s]!==""){u.push({text:t[s],name:"Criteria/Location",value:t[s]})}}}$("select, input[type='text']:enabled, input[type='checkbox']:checked:enabled",d()).each(function(){if(this.id==="Features"||this.id==="mapsearch-criteria-features"||(this.type==="select-one"&&this.name.indexOf("Groups/Group_")!=-1)){return}if(this.name==="Criteria/PropertyTypeID_X"||this.name=="Criteria/ListingTypePropertyTypeID_X"){return}if($.inArray(this.name,r)!=-1){return}var w=l(this);if(w===""){return}var x=p(this);if(x&&x.text!==""){u.push({text:x.text,name:x.name,value:this.value})}else{var y="";if(this.id&&w.indexOf(":")===-1){y=k(this.id)}if(y!==""&&y!==w){w=y+": "+w}u.push({text:w,name:this.name,value:this.value})}});return u}function q(){var w=h();var u="";if(w&&w.length>0){u="<ul>";for(var s=0;s<w.length;s++){var y=w[s];if(y.text&&y.text!==""){var v=w[s].name;var t=w[s].value;if(!t){t=""}u+="<li";var x=o(v);if(x&&x.length>0){u+=" class='"+x+"'"}u+=" fieldname='"+v+"'";u+=" fieldval='"+escape(t)+"'>"+w[s].text+"</li>"}}u+="</ul>"}$("#search-summary-content").html(u);$("#search-summary-content li.remove-criteria").click(function(){var z=$(this);$(document).trigger("removecriteria",[{name:z.attr("fieldname"),val:unescape(z.attr("fieldval"))}])}).css("cursor","pointer")}function e(s){f=s;if(!d()){n[s]=$(g())}}this.load=function(t){e(t);var s=document.all?0:1;$(document).bind("criteriachange",function(u,v){if(!s){s=1;return}e(v.activeTab);q()});$(document).bind("criteriaitemchange",function(u,v){q()})}};var CustomerLogin=new (function(){var t=this;var f;var p=null;var b=null;var s=new Querystring();var i=new SearchSummary();this.savedSearchWindowName=null;this.overlayTopPosition=null;this.test=function(){alert("inside")};function r(){if(b===null){b=window.location.href.toLowerCase().indexOf("savesearch.aspx")>=0}return b}function h(){var u=readCookie("rBW-ListingSearch");return u?"search="+u:""}function d(){return p==null?"":"nextaction="+p}function a(){var u=[];u.push(h());u.push(d());var v=(window.location.href.lastIndexOf("?")===-1)?["?"]:[""];if(window.location.href.lastIndexOf("/")==window.location.href.length-1){v=["default.aspx?"]}$.each(u,function(){if(this!=""){if(v.length>1){v.push(escape("%26"))}v.push(this)}});return v.join("")}function k(u){var v=g()+"/account/"+u+".aspx?formtype="+u+"&onregister=CustomerLogin.register&onsignin=CustomerLogin.signin&onresize=CustomerLogin.resizeoverlay&onloginsuccess=CustomerLogin.showlogininfo&onsuccess="+encodeURIComponent(window.location.href+a());return v}this.isLoggedIn=m;function m(){if(typeof(f)!="undefined"){if(typeof(f.firstName)!="undefined"&&f.firstName!=""){return true}}return false}function o(){if(j()&&readCookie("rBW-ListingSearch")!=""){return true}return false}function e(u){return g()+"/account/savesearch.aspx?overlay=1&expandcb="+(u?1:0)+(s.contains("ListingSearch")?"&ListingSearchID="+s.get("ListingSearch"):"")+"&onresize=CustomerLogin.resizeoverlay"}function l(){if(p==null){return}if(p=="savesearch"){$("#hiddenLink").attr("href",e(false));$("#hiddenLink").click()}if(p=="getalerts"){$("#hiddenLink").attr("href",e(true));$("#hiddenLink").click()}p=null}function j(){return window.location.href.toString().toLowerCase().indexOf("brokeroffice.admin")>=0}function g(){return j()?"/brokeroffice.admin/agent/public":Utils.AppPath}this.showlogininfo=function(u,v){$(document).trigger("loginupdate",[{isLoggedIn:true,loginName:u,canReloadView:true,reloadPage:v}])};this.hideLoginInfo=function(){var u=typeof(vowStatusId)!=="undefined"&&(vowStatusId===1||vowStatusId===4);$(document).trigger("loginupdate",[{isLoggedIn:false,canReloadView:true,reloadPage:u}])};this.saveSearch=function(){if(m()||o()){$("#hiddenLink").attr("href",e(false));$("#hiddenLink").click()}else{p="savesearch";$("#hiddenLink").attr("href",k("login"));$("#hiddenLink").click()}};this.getEmailAlerts=function(){if(m()||o()){$("#hiddenLink").attr("href",e(true));$("#hiddenLink").click()}else{p="getalerts";$("#hiddenLink").attr("href",k("login"));$("#hiddenLink").click()}};this.mySavedSearches=function(){var u=g()+"/account/savedsearchlist.aspx";if(typeof t.savedSearchWindowName!="undefined"&&t.savedSearchWindowName){window.open(u,t.savedSearchWindowName)}else{window.location.href=u}};this.mySavedProperties=function(){window.location.href=g()+"/account/savedlistinglist.aspx"};this.register=function(){$("#customer-login-register").click()};this.signin=function(){$("#customer-login-signin").click()};this.load=function(u){q(u)};this.signOut=function(){if($("#customer-login iframe").length==0){$("#customer-login").append("<iframe name='customerLogoffFrame' style='display:none' onload='CustomerLogin.hideLoginInfo();' />")}window.open(g()+"/account/customerlogout.aspx","customerLogoffFrame")};this.resizeoverlay=function(u,v){$("#cboxIframe").css("width",u+"px");$("#cboxIframe").css("height",v+"px");$("#cboxLoadedContent").css("width",u+"px");$("#cboxLoadedContent").css("height",v+"px");$(".iframe").colorbox.resize({innerWidth:u,innerHeight:v});if(t.overlayTopPosition){setTimeout(function(){$("#colorbox").css("top",parseInt(t.overlayTopPosition)+"px")},10)}};this.repositionOverlay=function(){if(t.overlayTopPosition){setTimeout(function(){$("#colorbox").css("top",parseInt(t.overlayTopPosition)+"px")},10)}};function n(u){var v=document.getElementById(u);var w=null;if(v){w=v.contentWindow||v.contentDocument}return w}function c(){var u=n("cboxIframe");if(u&&typeof(u.resize)!="undefined"){u.resize()}}function q(u){var v=$('[data-loginoverlaytype="fixed"]'),x=v.length>0,y=v.length>0?v.attr("data-loginoverlaytop"):false;f=u;$(document).bind("cbox_open",function(){$("body").css("overflow","hidden")});$(document).bind("cbox_closed",function(){$("body").css("overflow","auto")});$(document).bind("loginupdate",function(z,A){if(A.reloadPage){window.location.reload()}if(A.isLoggedIn){f.firstName=A.loginName;$("#customer-login .welcome h2 span").html(A.loginName);$(".customerLoggedIn").show();$(".customerLoggedOff").hide();$("a[href*='/Account/CustomerLogout.aspx']").show();if(p){l()}else{$(".iframe").colorbox.close()}}else{f.firstName="";$("#customer-login .welcome h2 span").html("");$(".customerLoggedIn").hide();$(".customerLoggedOff").show();$("a[href*='/Account/CustomerLogout.aspx']").hide()}});$(window).resize(function(){c()});$("#mapsearch-left-customer").css("height","auto");$("#customerLoginSpinner").fadeOut();if(m()){t.showlogininfo(f.firstName)}else{if(o()){t.hideLoginInfo();$("#customer-login-welcome").hide();$(".secondary-nav").hide()}else{t.hideLoginInfo()}}$("#customer-login").show();$("#customer-login-register").attr("href",k("signup"));$("#customer-login-signin").attr("href",k("login"));$(".iframe").colorbox({width:"400",height:"200",iframe:true,close:"",fixed:x,top:y});$().bind("cbox_load",function(){$("#cboxIframe").attr("scrolling","yes");setTimeout(function(){$("#cboxClose span").css("display","block")},1000)});$().bind("cbox_complete",function(){});var w=false;$(document).bind("criteriachange",function(z,A){if(!w){i.load(A.activeTab);if(s.contains("ListingSearch")){$("#search-summary h2").after("<p class='saved-search-info'>You are viewing a saved search</p>").hide().show("fast")}w=true}});if(r()){$("#customer-login-signout").hide();$("#save-search-link").hide();$("#email-alert-link").hide()}if(m()&&s.contains("nextaction")){p=s.get("nextaction");l()}}})();function Querystring(a){this.params={};if(a==null){a=location.search.substring(1,location.search.length)}if(a.length==0){return}a=a.replace(/\+/g," ");var f=a.split("&");for(var b=0;b<f.length;b++){var e=f[b].split("=");var d=decodeURIComponent(e[0]);var c=(e.length==2)?decodeURIComponent(e[1]):d;this.params[d]=c}}Querystring.prototype.get=function(c,a){var b=this.params[c];a=a||"";return(b!=null)?b:a};Querystring.prototype.contains=function(a){var b=this.params[a];return(b!=null)};var _onLoginAction=null;var _qs=new Querystring();function saveSearch(a){if(a){$(document).ready(function(){if(_isMemberLoggedIn){$(".save-search").attr("href",getSaveSearchUrl(0))}else{$(".save-search").attr("href",getHref("login"))}$(".save-search").colorbox({width:400,height:200,opacity:0.7,close:"<span></span>",iframe:true,scrollbars:false,speed:0,transition:"none"});$(".save-search").click()})}else{document.getElementById("ListingSearch/SaveSearch").value=1;document.forms.ListingSearch.submit()}}function getHref(a){var b=getAppRoot()+"/account/"+a+".aspx?formtype="+a+"&onregister=register&onsignin=signin&onresize=resizeoverlay&onloginsuccess=showlogininfo&onsuccess="+escape(escape(window.location.href+getRedirectParams()));return b}function resizeoverlay(a,b){$(".cboxIframe").contents().find("html").css("overflow","hidden");$(".cboxIframe").css("width",a+"px");$(".cboxIframe").css("height",b+"px");$("#cboxLoadedContent").css("width",a+"px");$("#cboxLoadedContent").css("height",b+"px");$(".cboxIframe").colorbox.resize({innerWidth:a,innerHeight:b})}function getSaveSearchUrl(a){try{var c=(_qs.contains("ListingSearch")?"&ListingSearchID="+_qs.get("ListingSearch"):"");if(a>0){c="&ListingSearchID="+a}return getAppRoot()+"/account/savesearch.aspx?overlay=1"+c+"&onresize=resizeoverlay"}catch(b){}}function isAdminApp(){return window.location.href.toString().toLowerCase().indexOf("fnistools.com")>=0}function getAppRoot(){return isAdminApp()?"/brokeroffice.admin/agent/public":Utils.AppPath}function isLoggedIn(){if(typeof(_customerInfo)!="undefined"){if(typeof(_customerInfo.firstName)!="undefined"&&_customerInfo.firstName!=""){return true}}return false}function register(){$(".cboxIframe").attr("src",getHref("signup"))}function signin(){$(".cboxIframe").attr("src",getHref("login"));$(".save-search").colorbox({width:400,height:200,opacity:0.7,close:"<span></span>",iframe:true,scrollbars:false,speed:0,transition:"none"});$(".save-search").click()}function showlogininfo(a){$(".cboxIframe").attr("src",getSaveSearchUrl())}function isProxyLoggedIn(){if(isAdminApp()&&readCookie("rBW-ListingSearch")!=""){return true}return false}function getRedirectParams(){var a=[];a.push(getSearchCookie());a.push(getNextAction());var b=(window.location.href.lastIndexOf("?")===-1)?["?"]:[""];if(window.location.href.lastIndexOf("/")==window.location.href.length-1){b=["default.aspx?"]}$.each(a,function(){if(this!=""){if(b.length>1){b.push(escape("%26"))}b.push(this)}});return b.join("")}function getSearchCookie(){var a=readCookie("rBW-ListingSearch");return a?"search="+a:""}function getNextAction(){return _onLoginAction==null?"":"nextaction="+_onLoginAction};
