var serializeFunction=function(){var data={};
var olClass=eval(this.CLASS_NAME);
var obj=olClass.prototype.serializable;
if(obj!=null){var index;
var args=obj.args;
if(args){for(index=0;
index<args.length;
++index){data[args[index]]=OpenLayers.Class.serialize(this[args[index]])
}}var props=obj.props;
if(props){for(index=0;
index<props.length;
++index){data[props[index]]=OpenLayers.Class.serialize(this[props[index]])
}}}data.CLASS_NAME=this.CLASS_NAME;
return data
};
OpenLayers.Class.recursionDepth=20;
OpenLayers.Class.serialize=function(E,F){var D;
F=(F!=undefined)?F+1:0;
if(!(E instanceof Function)){if(F<=OpenLayers.Class.recursionDepth){if(E&&E.serialize instanceof Function){D=E.serialize()
}else{if(E instanceof Array){D=new Array(E.length);
for(var B=0;
B<E.length;
++B){D[B]=OpenLayers.Class.serialize(E[B],F)
}}else{if(E instanceof Object){D={};
var C;
for(var A in E){C=OpenLayers.Class.serialize(E[A],F);
if(C!==undefined){D[A]=OpenLayers.Class.serialize(E[A],F)
}}}else{D=E
}}}}}return D
};
OpenLayers.Class.deserialize=function(struct,depth){var instance,index,key;
depth=(depth!=undefined)?depth+1:1;
if(struct instanceof Function){var msg="Cannot serialize functions";
OpenLayers.Console.error(msg)
}else{if(depth<=OpenLayers.Class.recursionDepth){if(!struct){instance=struct
}else{if(!struct.CLASS_NAME||!(struct.CLASS_NAME.indexOf("OpenLayers")==0||struct.CLASS_NAME.indexOf("MW")==0)){if(struct instanceof Array){instance=new Array(struct.length);
for(index=0;
index<struct.length;
++index){instance[index]=OpenLayers.Class.deserialize(struct[index],depth)
}}else{if(struct instanceof Object){instance={};
for(key in struct){instance[key]=OpenLayers.Class.deserialize(struct[key],depth)
}}else{instance=struct
}}}else{var olClass=eval(struct.CLASS_NAME);
if(!olClass.prototype.serializable){var msg="Unable to deserialize.  CLASS_NAME: "+struct.CLASS_NAME;
throw Error(msg)
}var argArray=olClass.prototype.serializable.args;
var args=[];
if(argArray){for(index=0;
index<argArray.length;
++index){key=argArray[index];
if(struct[key]===undefined){var msg="Deserializing failed.  "+struct.CLASS_NAME+" requires argument: "+key;
throw Error(msg)
}args.push(OpenLayers.Class.deserialize(struct[key],depth))
}}var proto={};
var propArray=olClass.prototype.serializable.props;
if(propArray){for(index=0;
index<propArray.length;
++index){key=propArray[index];
proto[key]=OpenLayers.Class.deserialize(struct[key],depth)
}}if(struct.CLASS_NAME=="OpenLayers.Map"||struct.CLASS_NAME=="MW.Map"){instance=proto
}else{OpenLayers.Util.applyDefaults(proto,olClass.prototype);
instance=olClass.apply(proto,args);
instance=proto
}}}}}return instance
};
OpenLayers.Layer.Markers.prototype.initialize=function(B,A){OpenLayers.Layer.prototype.initialize.apply(this,arguments);
if(this.markers==null){this.markers=[]
}};
OpenLayers.Layer.Vector.prototype.initialize=function(C,B){this.EVENT_TYPES=OpenLayers.Layer.Vector.prototype.EVENT_TYPES.concat(OpenLayers.Layer.prototype.EVENT_TYPES);
OpenLayers.Layer.prototype.initialize.apply(this,arguments);
if(!this.renderer||!this.renderer.supported()){this.assignRenderer()
}if(!this.renderer||!this.renderer.supported()){this.renderer=null;
this.displayError()
}if(!this.styleMap){this.styleMap=new OpenLayers.StyleMap()
}if(this.features==null){this.features=[]
}this.selectedFeatures=[];
this.unrenderedFeatures={};
if(this.strategies){for(var D=0,A=this.strategies.length;
D<A;
D++){this.strategies[D].setLayer(this)
}}};
OpenLayers.Renderer.SVG.prototype.supported=function(){var A="http://www.w3.org/TR/SVG11/feature#";
return(document.implementation&&(document.implementation.hasFeature("org.w3c.svg","1.0")||document.implementation.hasFeature(A+"SVG","1.1")||document.implementation.hasFeature(A+"BasicStructure","1.1")))
};
OpenLayers.Popup.prototype.serializable={props:[],args:["lonlat","id","contentSize","contentHTML"]};
OpenLayers.Map.prototype.serializable={props:["layers","center","zoom","bounds","projection","units","maxResolution","numZoomLevels","maxExtent","resolutions","resolution"]};
OpenLayers.Bounds.prototype.serializable={props:[],args:["left","bottom","right","top"]};
OpenLayers.Layer.Image.prototype.serializable={props:["numZoomLevels","maxResolution","minResolution","maxExtent","wrapDateLine","displayOutsideMaxExtent","isBaseLayer","displayInLayerSwitcher","visibility","opacity"],args:["name","url","extent","size"]};
OpenLayers.Layer.Vector.prototype.serializable={props:["numZoomLevels","maxResolution","minResolution","maxExtent","wrapDateLine","displayOutsideMaxExtent","isBaseLayer","displayInLayerSwitcher","visibility","opacity","geometryType","isFixed","isVector","features","selectedFeatures","style"],args:["name"]};
OpenLayers.LonLat.prototype.serializable={props:[],args:["lon","lat"]};
OpenLayers.Geometry.LineString.prototype.serializable={args:["components"],props:["componentTypes"]};
OpenLayers.Geometry.LinearRing.prototype.serializable={args:["components"],props:["componentTypes"]};
OpenLayers.Geometry.Polygon.prototype.serializable={args:["components"],props:["componentTypes"]};
OpenLayers.Geometry.MultiPolygon.prototype.serializable={args:["components"],props:["componentTypes"]};
OpenLayers.Geometry.Point.prototype.serializable={args:["x","y"],props:[]};
OpenLayers.Feature.Vector.prototype.serializable={args:["geometry","attributes","style"],props:[]};
OpenLayers.Size.prototype.serializable={props:[],args:["w","h"]};
OpenLayers.Icon.prototype.serializable={props:[],args:["url","size","offset"]};
OpenLayers.Pixel.prototype.serializable={props:[],args:["x","y"]};
OpenLayers.Projection.prototype.serializable={props:["proj","projCode"],args:["projCode"]};
OpenLayers.Layer.Markers.prototype.serializable={props:["markers","numZoomLevels","maxResolution","minResolution","maxExtent","wrapDateLine","displayOutsideMaxExtent","isBaseLayer","displayInLayerSwitcher","visibility","opacity"],args:["name","options"]};
OpenLayers.Layer.TMS.prototype.serializable={args:["name","url","options"],props:["serviceVersion","tileOrigin","isBaseLayer","layername","type","numZoomLevels","maxResolution","minResolution","maxExtent","wrapDateLine","displayOutsideMaxExtent","displayInLayerSwitcher","visibility","opacity"]};
OpenLayers.Layer.WMS.prototype.serializable={args:["name","url","params","options"],props:["reproject","encodeBBOX","layername","type","numZoomLevels","maxResolution","minResolution","maxExtent","wrapDateLine","displayOutsideMaxExtent","isBaseLayer","displayInLayerSwitcher","visibility","opacity"]};
OpenLayers.Marker.prototype.serializable={props:[],args:["lonlat","icon"]};
OpenLayers.Popup.prototype.serialize=serializeFunction;
OpenLayers.Map.prototype.serialize=serializeFunction;
OpenLayers.Bounds.prototype.serialize=serializeFunction;
OpenLayers.Layer.Image.prototype.serialize=serializeFunction;
OpenLayers.Layer.Vector.prototype.serialize=serializeFunction;
OpenLayers.LonLat.prototype.serialize=serializeFunction;
OpenLayers.Geometry.LineString.prototype.serialize=serializeFunction;
OpenLayers.Geometry.Point.prototype.serialize=serializeFunction;
OpenLayers.Geometry.Polygon.prototype.serialize=serializeFunction;
OpenLayers.Geometry.MultiPolygon.prototype.serialize=serializeFunction;
OpenLayers.Geometry.LinearRing.prototype.serialize=serializeFunction;
OpenLayers.Feature.Vector.prototype.serialize=serializeFunction;
OpenLayers.Layer.Vector.prototype.serialize=serializeFunction;
OpenLayers.Size.prototype.serialize=serializeFunction;
OpenLayers.Marker.prototype.serialize=serializeFunction;
OpenLayers.Icon.prototype.serialize=serializeFunction;
OpenLayers.Pixel.prototype.serialize=serializeFunction;
OpenLayers.Projection.prototype.serialize=serializeFunction;
OpenLayers.Layer.Markers.prototype.serialize=serializeFunction;
OpenLayers.Layer.TMS.prototype.serialize=serializeFunction;
OpenLayers.Layer.WMS.prototype.serialize=serializeFunction;var Prototype={Version:"1.5.1_rc3",Browser:{IE:!!(window.attachEvent&&!window.opera),Opera:!!window.opera,WebKit:navigator.userAgent.indexOf("AppleWebKit/")>-1,Gecko:navigator.userAgent.indexOf("Gecko")>-1&&navigator.userAgent.indexOf("KHTML")==-1},BrowserFeatures:{XPath:!!document.evaluate,ElementExtensions:!!window.HTMLElement,SpecificElementExtensions:(document.createElement("div").__proto__!==document.createElement("form").__proto__)},ScriptFragment:"<script[^>]*>([\u0001-\uFFFF]*?)<\/script>",JSONFilter:/^\/\*-secure-\s*(.*)\s*\*\/\s*$/,emptyFunction:function(){},K:function(A){return A
}};
var Class={create:function(){return function(){this.initialize.apply(this,arguments)
}
}};
var Abstract=new Object();
Object.extend=function(A,C){for(var B in C){A[B]=C[B]
}return A
};
Object.extend(Object,{inspect:function(A){try{if(A===undefined){return"undefined"
}if(A===null){return"null"
}return A.inspect?A.inspect():A.toString()
}catch(B){if(B instanceof RangeError){return"..."
}throw B
}},toJSON:function(A){var C=typeof A;
switch(C){case"undefined":case"function":case"unknown":return ;
case"boolean":return A.toString()
}if(A===null){return"null"
}if(A.toJSON){return A.toJSON()
}if(A.ownerDocument===document){return 
}var B=[];
for(var E in A){var D=Object.toJSON(A[E]);
if(D!==undefined){B.push(E.toJSON()+": "+D)
}}return"{"+B.join(", ")+"}"
},keys:function(A){var B=[];
for(var C in A){B.push(C)
}return B
},values:function(B){var A=[];
for(var C in B){A.push(B[C])
}return A
},clone:function(A){return Object.extend({},A)
}});
Function.prototype.bind=function(){var A=this,C=$A(arguments),B=C.shift();
return function(){return A.apply(B,C.concat($A(arguments)))
}
};
Function.prototype.bindAsEventListener=function(C){var A=this,B=$A(arguments),C=B.shift();
return function(D){return A.apply(C,[(D||window.event)].concat(B).concat($A(arguments)))
}
};
Object.extend(Number.prototype,{toColorPart:function(){return this.toPaddedString(2,16)
},succ:function(){return this+1
},times:function(A){$R(0,this,true).each(A);
return this
},toPaddedString:function(C,B){var A=this.toString(B||10);
return"0".times(C-A.length)+A
},toJSON:function(){return isFinite(this)?this.toString():"null"
}});
Date.prototype.toJSON=function(){return'"'+this.getFullYear()+"-"+(this.getMonth()+1).toPaddedString(2)+"-"+this.getDate().toPaddedString(2)+"T"+this.getHours().toPaddedString(2)+":"+this.getMinutes().toPaddedString(2)+":"+this.getSeconds().toPaddedString(2)+'"'
};
var Try={these:function(){var C;
for(var B=0,D=arguments.length;
B<D;
B++){var A=arguments[B];
try{C=A();
break
}catch(E){}}return C
}};
var PeriodicalExecuter=Class.create();
PeriodicalExecuter.prototype={initialize:function(B,A){this.callback=B;
this.frequency=A;
this.currentlyExecuting=false;
this.registerCallback()
},registerCallback:function(){this.timer=setInterval(this.onTimerEvent.bind(this),this.frequency*1000)
},stop:function(){if(!this.timer){return 
}clearInterval(this.timer);
this.timer=null
},onTimerEvent:function(){if(!this.currentlyExecuting){try{this.currentlyExecuting=true;
this.callback(this)
}finally{this.currentlyExecuting=false
}}}};
Object.extend(String,{interpret:function(A){return A==null?"":String(A)
},specialChar:{"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r","\\":"\\\\"}});
Object.extend(String.prototype,{gsub:function(E,C){var A="",D=this,B;
C=arguments.callee.prepareReplacement(C);
while(D.length>0){if(B=D.match(E)){A+=D.slice(0,B.index);
A+=String.interpret(C(B));
D=D.slice(B.index+B[0].length)
}else{A+=D,D=""
}}return A
},sub:function(C,A,B){A=this.gsub.prepareReplacement(A);
B=B===undefined?1:B;
return this.gsub(C,function(D){if(--B<0){return D[0]
}return A(D)
})
},scan:function(B,A){this.gsub(B,A);
return this
},truncate:function(B,A){B=B||30;
A=A===undefined?"...":A;
return this.length>B?this.slice(0,B-A.length)+A:this
},strip:function(){return this.replace(/^\s+/,"").replace(/\s+$/,"")
},stripTags:function(){return this.replace(/<\/?[^>]+>/gi,"")
},stripScripts:function(){return this.replace(new RegExp(Prototype.ScriptFragment,"img"),"")
},extractScripts:function(){var B=new RegExp(Prototype.ScriptFragment,"img");
var A=new RegExp(Prototype.ScriptFragment,"im");
return(this.match(B)||[]).map(function(C){return(C.match(A)||["",""])[1]
})
},evalScripts:function(){return this.extractScripts().map(function(script){return eval(script)
})
},escapeHTML:function(){var A=arguments.callee;
A.text.data=this;
return A.div.innerHTML
},unescapeHTML:function(){var A=document.createElement("div");
A.innerHTML=this.stripTags();
return A.childNodes[0]?(A.childNodes.length>1?$A(A.childNodes).inject("",function(B,C){return B+C.nodeValue
}):A.childNodes[0].nodeValue):""
},toQueryParams:function(B){var A=this.strip().match(/([^?#]*)(#.*)?$/);
if(!A){return{}
}return A[1].split(B||"&").inject({},function(E,F){if((F=F.split("="))[0]){var C=decodeURIComponent(F.shift());
var D=F.length>1?F.join("="):F[0];
if(D!=undefined){D=decodeURIComponent(D)
}if(C in E){if(E[C].constructor!=Array){E[C]=[E[C]]
}E[C].push(D)
}else{E[C]=D
}}return E
})
},toArray:function(){return this.split("")
},succ:function(){return this.slice(0,this.length-1)+String.fromCharCode(this.charCodeAt(this.length-1)+1)
},times:function(C){var A="";
for(var B=0;
B<C;
B++){A+=this
}return A
},camelize:function(){var D=this.split("-"),A=D.length;
if(A==1){return D[0]
}var C=this.charAt(0)=="-"?D[0].charAt(0).toUpperCase()+D[0].substring(1):D[0];
for(var B=1;
B<A;
B++){C+=D[B].charAt(0).toUpperCase()+D[B].substring(1)
}return C
},capitalize:function(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase()
},underscore:function(){return this.gsub(/::/,"/").gsub(/([A-Z]+)([A-Z][a-z])/,"#{1}_#{2}").gsub(/([a-z\d])([A-Z])/,"#{1}_#{2}").gsub(/-/,"_").toLowerCase()
},dasherize:function(){return this.gsub(/_/,"-")
},inspect:function(B){var A=this.gsub(/[\x00-\x1f\\]/,function(C){var D=String.specialChar[C[0]];
return D?D:"\\u00"+C[0].charCodeAt().toPaddedString(2,16)
});
if(B){return'"'+A.replace(/"/g,'\\"')+'"'
}return"'"+A.replace(/'/g,"\\'")+"'"
},toJSON:function(){return this.inspect(true)
},unfilterJSON:function(A){return this.sub(A||Prototype.JSONFilter,"#{1}")
},evalJSON:function(sanitize){var json=this.unfilterJSON();
try{if(!sanitize||(/^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/.test(json))){return eval("("+json+")")
}}catch(e){}throw new SyntaxError("Badly formed JSON string: "+this.inspect())
},include:function(A){return this.indexOf(A)>-1
},startsWith:function(A){return this.indexOf(A)===0
},endsWith:function(A){var B=this.length-A.length;
return B>=0&&this.lastIndexOf(A)===B
},empty:function(){return this==""
},blank:function(){return/^\s*$/.test(this)
}});
if(Prototype.Browser.WebKit||Prototype.Browser.IE){Object.extend(String.prototype,{escapeHTML:function(){return this.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")
},unescapeHTML:function(){return this.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">")
}})
}String.prototype.gsub.prepareReplacement=function(B){if(typeof B=="function"){return B
}var A=new Template(B);
return function(C){return A.evaluate(C)
}
};
String.prototype.parseQuery=String.prototype.toQueryParams;
Object.extend(String.prototype.escapeHTML,{div:document.createElement("div"),text:document.createTextNode("")});
with(String.prototype.escapeHTML){div.appendChild(text)
}var Template=Class.create();
Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;
Template.prototype={initialize:function(A,B){this.template=A.toString();
this.pattern=B||Template.Pattern
},evaluate:function(A){return this.template.gsub(this.pattern,function(B){var C=B[1];
if(C=="\\"){return B[2]
}return C+String.interpret(A[B[3]])
})
}};
var $break=new Object();
var $continue=new Object();
var Enumerable={each:function(B){var A=0;
try{this._each(function(D){B(D,A++)
})
}catch(C){if(C!=$break){throw C
}}return this
},eachSlice:function(C,B){var A=-C,D=[],E=this.toArray();
while((A+=C)<E.length){D.push(E.slice(A,A+C))
}return D.map(B)
},all:function(B){var A=true;
this.each(function(D,C){A=A&&!!(B||Prototype.K)(D,C);
if(!A){throw $break
}});
return A
},any:function(B){var A=false;
this.each(function(D,C){if(A=!!(B||Prototype.K)(D,C)){throw $break
}});
return A
},collect:function(B){var A=[];
this.each(function(D,C){A.push((B||Prototype.K)(D,C))
});
return A
},detect:function(B){var A;
this.each(function(D,C){if(B(D,C)){A=D;
throw $break
}});
return A
},findAll:function(B){var A=[];
this.each(function(D,C){if(B(D,C)){A.push(D)
}});
return A
},grep:function(C,B){var A=[];
this.each(function(F,E){var D=F.toString();
if(D.match(C)){A.push((B||Prototype.K)(F,E))
}});
return A
},include:function(A){var B=false;
this.each(function(C){if(C==A){B=true;
throw $break
}});
return B
},inGroupsOf:function(B,A){A=A===undefined?null:A;
return this.eachSlice(B,function(C){while(C.length<B){C.push(A)
}return C
})
},inject:function(A,B){this.each(function(D,C){A=B(A,D,C)
});
return A
},invoke:function(B){var A=$A(arguments).slice(1);
return this.map(function(C){return C[B].apply(C,A)
})
},max:function(B){var A;
this.each(function(D,C){D=(B||Prototype.K)(D,C);
if(A==undefined||D>=A){A=D
}});
return A
},min:function(B){var A;
this.each(function(D,C){D=(B||Prototype.K)(D,C);
if(A==undefined||D<A){A=D
}});
return A
},partition:function(C){var B=[],A=[];
this.each(function(E,D){((C||Prototype.K)(E,D)?B:A).push(E)
});
return[B,A]
},pluck:function(B){var A=[];
this.each(function(D,C){A.push(D[B])
});
return A
},reject:function(B){var A=[];
this.each(function(D,C){if(!B(D,C)){A.push(D)
}});
return A
},sortBy:function(A){return this.map(function(C,B){return{value:C,criteria:A(C,B)}
}).sort(function(E,D){var C=E.criteria,B=D.criteria;
return C<B?-1:C>B?1:0
}).pluck("value")
},toArray:function(){return this.map()
},zip:function(){var B=Prototype.K,A=$A(arguments);
if(typeof A.last()=="function"){B=A.pop()
}var C=[this].concat(A).map($A);
return this.map(function(E,D){return B(C.pluck(D))
})
},size:function(){return this.toArray().length
},inspect:function(){return"#<Enumerable:"+this.toArray().inspect()+">"
}};
Object.extend(Enumerable,{map:Enumerable.collect,find:Enumerable.detect,select:Enumerable.findAll,member:Enumerable.include,entries:Enumerable.toArray});
var $A=Array.from=function(D){if(!D){return[]
}if(D.toArray){return D.toArray()
}else{var B=[];
for(var A=0,C=D.length;
A<C;
A++){B.push(D[A])
}return B
}};
if(Prototype.Browser.WebKit){$A=Array.from=function(D){if(!D){return[]
}if(!(typeof D=="function"&&D=="[object NodeList]")&&D.toArray){return D.toArray()
}else{var B=[];
for(var A=0,C=D.length;
A<C;
A++){B.push(D[A])
}return B
}}
}Object.extend(Array.prototype,Enumerable);
if(!Array.prototype._reverse){Array.prototype._reverse=Array.prototype.reverse
}Object.extend(Array.prototype,{_each:function(B){for(var A=0,C=this.length;
A<C;
A++){B(this[A])
}},clear:function(){this.length=0;
return this
},first:function(){return this[0]
},last:function(){return this[this.length-1]
},compact:function(){return this.select(function(A){return A!=null
})
},flatten:function(){return this.inject([],function(B,A){return B.concat(A&&A.constructor==Array?A.flatten():[A])
})
},without:function(){var A=$A(arguments);
return this.select(function(B){return !A.include(B)
})
},indexOf:function(A){for(var B=0,C=this.length;
B<C;
B++){if(this[B]==A){return B
}}return -1
},reverse:function(A){return(A!==false?this:this.toArray())._reverse()
},reduce:function(){return this.length>1?this:this[0]
},uniq:function(A){return this.inject([],function(D,C,B){if(0==B||(A?D.last()!=C:!D.include(C))){D.push(C)
}return D
})
},clone:function(){return[].concat(this)
},size:function(){return this.length
},inspect:function(){return"["+this.map(Object.inspect).join(", ")+"]"
},toJSON:function(){var A=[];
this.each(function(B){var C=Object.toJSON(B);
if(C!==undefined){A.push(C)
}});
return"["+A.join(", ")+"]"
}});
Array.prototype.toArray=Array.prototype.clone;
function $w(A){A=A.strip();
return A?A.split(/\s+/):[]
}if(Prototype.Browser.Opera){Array.prototype.concat=function(){var E=[];
for(var B=0,C=this.length;
B<C;
B++){E.push(this[B])
}for(var B=0,C=arguments.length;
B<C;
B++){if(arguments[B].constructor==Array){for(var A=0,D=arguments[B].length;
A<D;
A++){E.push(arguments[B][A])
}}else{E.push(arguments[B])
}}return E
}
}var Hash=function(A){if(A instanceof Hash){this.merge(A)
}else{Object.extend(this,A||{})
}};
Object.extend(Hash,{toQueryString:function(B){var A=[];
A.add=arguments.callee.addPair;
this.prototype._each.call(B,function(D){if(!D.key){return 
}var C=D.value;
if(C&&typeof C=="object"){if(C.constructor==Array){C.each(function(E){A.add(D.key,E)
})
}return 
}A.add(D.key,C)
});
return A.join("&")
},toJSON:function(A){var B=[];
this.prototype._each.call(A,function(D){var C=Object.toJSON(D.value);
if(C!==undefined){B.push(D.key.toJSON()+": "+C)
}});
return"{"+B.join(", ")+"}"
}});
Hash.toQueryString.addPair=function(A,C,B){A=encodeURIComponent(A);
if(C===undefined){this.push(A)
}else{this.push(A+"="+(C==null?"":encodeURIComponent(C)))
}};
Object.extend(Hash.prototype,Enumerable);
Object.extend(Hash.prototype,{_each:function(B){for(var A in this){var C=this[A];
if(C&&C==Hash.prototype[A]){continue
}var D=[A,C];
D.key=A;
D.value=C;
B(D)
}},keys:function(){return this.pluck("key")
},values:function(){return this.pluck("value")
},merge:function(A){return $H(A).inject(this,function(B,C){B[C.key]=C.value;
return B
})
},remove:function(){var A;
for(var B=0,C=arguments.length;
B<C;
B++){var D=this[arguments[B]];
if(D!==undefined){if(A===undefined){A=D
}else{if(A.constructor!=Array){A=[A]
}A.push(D)
}}delete this[arguments[B]]
}return A
},toQueryString:function(){return Hash.toQueryString(this)
},inspect:function(){return"#<Hash:{"+this.map(function(A){return A.map(Object.inspect).join(": ")
}).join(", ")+"}>"
},toJSON:function(){return Hash.toJSON(this)
}});
function $H(A){if(A instanceof Hash){return A
}return new Hash(A)
}if(function(){var A=0,C=function(D){this.key=D
};
C.prototype.key="foo";
for(var B in new C("bar")){A++
}return A>1
}()){Hash.prototype._each=function(C){var A=[];
for(var B in this){var D=this[B];
if((D&&D==Hash.prototype[B])||A.include(B)){continue
}A.push(B);
var E=[B,D];
E.key=B;
E.value=D;
C(E)
}}
}ObjectRange=Class.create();
Object.extend(ObjectRange.prototype,Enumerable);
Object.extend(ObjectRange.prototype,{initialize:function(C,A,B){this.start=C;
this.end=A;
this.exclusive=B
},_each:function(A){var B=this.start;
while(this.include(B)){A(B);
B=B.succ()
}},include:function(A){if(A<this.start){return false
}if(this.exclusive){return A<this.end
}return A<=this.end
}});
var $R=function(C,A,B){return new ObjectRange(C,A,B)
};
var Ajax={getTransport:function(){return Try.these(function(){return new XMLHttpRequest()
},function(){return new ActiveXObject("Msxml2.XMLHTTP")
},function(){return new ActiveXObject("Microsoft.XMLHTTP")
})||false
},activeRequestCount:0};
Ajax.Responders={responders:[],_each:function(A){this.responders._each(A)
},register:function(A){if(!this.include(A)){this.responders.push(A)
}},unregister:function(A){this.responders=this.responders.without(A)
},dispatch:function(D,B,C,A){this.each(function(E){if(typeof E[D]=="function"){try{E[D].apply(E,[B,C,A])
}catch(F){}}})
}};
Object.extend(Ajax.Responders,Enumerable);
Ajax.Responders.register({onCreate:function(){Ajax.activeRequestCount++
},onComplete:function(){Ajax.activeRequestCount--
}});
Ajax.Base=function(){};
Ajax.Base.prototype={setOptions:function(A){this.options={method:"post",asynchronous:true,contentType:"application/x-www-form-urlencoded",encoding:"UTF-8",parameters:""};
Object.extend(this.options,A||{});
this.options.method=this.options.method.toLowerCase();
if(typeof this.options.parameters=="string"){this.options.parameters=this.options.parameters.toQueryParams()
}}};
Ajax.Request=Class.create();
Ajax.Request.Events=["Uninitialized","Loading","Loaded","Interactive","Complete"];
Ajax.Request.prototype=Object.extend(new Ajax.Base(),{_complete:false,initialize:function(B,A){this.transport=Ajax.getTransport();
this.setOptions(A);
this.request(B)
},request:function(A){this.url=A;
this.method=this.options.method;
var C=Object.clone(this.options.parameters);
if(!["get","post"].include(this.method)){C._method=this.method;
this.method="post"
}this.parameters=C;
if(C=Hash.toQueryString(C)){if(this.method=="get"){this.url+=(this.url.include("?")?"&":"?")+C
}else{if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)){C+="&_="
}}}try{if(this.options.onCreate){this.options.onCreate(this.transport)
}Ajax.Responders.dispatch("onCreate",this,this.transport);
this.transport.open(this.method.toUpperCase(),this.url,this.options.asynchronous);
if(this.options.asynchronous){setTimeout(function(){this.respondToReadyState(1)
}.bind(this),10)
}this.transport.onreadystatechange=this.onStateChange.bind(this);
this.setRequestHeaders();
this.body=this.method=="post"?(this.options.postBody||C):null;
this.transport.send(this.body);
if(!this.options.asynchronous&&this.transport.overrideMimeType){this.onStateChange()
}}catch(B){this.dispatchException(B)
}},onStateChange:function(){var A=this.transport.readyState;
if(A>1&&!((A==4)&&this._complete)){this.respondToReadyState(this.transport.readyState)
}},setRequestHeaders:function(){var E={"X-Requested-With":"XMLHttpRequest","X-Prototype-Version":Prototype.Version,Accept:"text/javascript, text/html, application/xml, text/xml, */*"};
if(this.method=="post"){E["Content-type"]=this.options.contentType+(this.options.encoding?"; charset="+this.options.encoding:"");
if(this.transport.overrideMimeType&&(navigator.userAgent.match(/Gecko\/(\d{4})/)||[0,2005])[1]<2005){E.Connection="close"
}}if(typeof this.options.requestHeaders=="object"){var C=this.options.requestHeaders;
if(typeof C.push=="function"){for(var B=0,D=C.length;
B<D;
B+=2){E[C[B]]=C[B+1]
}}else{$H(C).each(function(F){E[F.key]=F.value
})
}}for(var A in E){this.transport.setRequestHeader(A,E[A])
}},success:function(){return !this.transport.status||(this.transport.status>=200&&this.transport.status<300)
},respondToReadyState:function(A){var C=Ajax.Request.Events[A];
var F=this.transport,B=this.evalJSON();
if(C=="Complete"){try{this._complete=true;
(this.options["on"+this.transport.status]||this.options["on"+(this.success()?"Success":"Failure")]||Prototype.emptyFunction)(F,B)
}catch(D){this.dispatchException(D)
}var E=this.getHeader("Content-type");
if(E&&E.strip().match(/^(text|application)\/(x-)?(java|ecma)script(;.*)?$/i)){this.evalResponse()
}}try{(this.options["on"+C]||Prototype.emptyFunction)(F,B);
Ajax.Responders.dispatch("on"+C,this,F,B)
}catch(D){this.dispatchException(D)
}if(C=="Complete"){this.transport.onreadystatechange=Prototype.emptyFunction
}},getHeader:function(A){try{return this.transport.getResponseHeader(A)
}catch(B){return null
}},evalJSON:function(){try{var A=this.getHeader("X-JSON");
return A?A.evalJSON():null
}catch(B){return null
}},evalResponse:function(){try{return eval((this.transport.responseText||"").unfilterJSON())
}catch(e){this.dispatchException(e)
}},dispatchException:function(A){(this.options.onException||Prototype.emptyFunction)(this,A);
Ajax.Responders.dispatch("onException",this,A)
}});
Ajax.Updater=Class.create();
Object.extend(Object.extend(Ajax.Updater.prototype,Ajax.Request.prototype),{initialize:function(A,C,B){this.container={success:(A.success||A),failure:(A.failure||(A.success?null:A))};
this.transport=Ajax.getTransport();
this.setOptions(B);
var D=this.options.onComplete||Prototype.emptyFunction;
this.options.onComplete=(function(F,E){this.updateContent();
D(F,E)
}).bind(this);
this.request(C)
},updateContent:function(){var B=this.container[this.success()?"success":"failure"];
var A=this.transport.responseText;
if(!this.options.evalScripts){A=A.stripScripts()
}if(B=$(B)){if(this.options.insertion){new this.options.insertion(B,A)
}else{B.update(A)
}}if(this.success()){if(this.onComplete){setTimeout(this.onComplete.bind(this),10)
}}}});
Ajax.PeriodicalUpdater=Class.create();
Ajax.PeriodicalUpdater.prototype=Object.extend(new Ajax.Base(),{initialize:function(A,C,B){this.setOptions(B);
this.onComplete=this.options.onComplete;
this.frequency=(this.options.frequency||2);
this.decay=(this.options.decay||1);
this.updater={};
this.container=A;
this.url=C;
this.start()
},start:function(){this.options.onComplete=this.updateComplete.bind(this);
this.onTimerEvent()
},stop:function(){this.updater.options.onComplete=undefined;
clearTimeout(this.timer);
(this.onComplete||Prototype.emptyFunction).apply(this,arguments)
},updateComplete:function(A){if(this.options.decay){this.decay=(A.responseText==this.lastText?this.decay*this.options.decay:1);
this.lastText=A.responseText
}this.timer=setTimeout(this.onTimerEvent.bind(this),this.decay*this.frequency*1000)
},onTimerEvent:function(){this.updater=new Ajax.Updater(this.container,this.url,this.options)
}});
function $(B){if(arguments.length>1){for(var A=0,D=[],C=arguments.length;
A<C;
A++){D.push($(arguments[A]))
}return D
}if(typeof B=="string"){B=document.getElementById(B)
}return Element.extend(B)
}if(Prototype.BrowserFeatures.XPath){document._getElementsByXPath=function(F,A){var C=[];
var E=document.evaluate(F,$(A)||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);
for(var B=0,D=E.snapshotLength;
B<D;
B++){C.push(E.snapshotItem(B))
}return C
};
document.getElementsByClassName=function(B,A){var C=".//*[contains(concat(' ', @class, ' '), ' "+B+" ')]";
return document._getElementsByXPath(C,A)
}
}else{document.getElementsByClassName=function(D,A){var C=($(A)||document.body).getElementsByTagName("*");
var F=[],G;
for(var B=0,E=C.length;
B<E;
B++){G=C[B];
if(Element.hasClassName(G,D)){F.push(Element.extend(G))
}}return F
}
}if(!window.Element){var Element={}
}Element.extend=function(E){var G=Prototype.BrowserFeatures;
if(!E||!E.tagName||E.nodeType==3||E._extended||G.SpecificElementExtensions||E==window){return E
}var B={},D=E.tagName,A=Element.extend.cache,C=Element.Methods.ByTag;
if(!G.ElementExtensions){Object.extend(B,Element.Methods),Object.extend(B,Element.Methods.Simulated)
}if(C[D]){Object.extend(B,C[D])
}for(var I in B){var H=B[I];
if(typeof H=="function"&&!(I in E)){E[I]=A.findOrStore(H)
}}E._extended=Prototype.emptyFunction;
return E
};
Element.extend.cache={findOrStore:function(A){return this[A]=this[A]||function(){return A.apply(null,[this].concat($A(arguments)))
}
}};
Element.Methods={visible:function(A){return $(A).style.display!="none"
},toggle:function(A){A=$(A);
Element[Element.visible(A)?"hide":"show"](A);
return A
},hide:function(A){$(A).style.display="none";
return A
},show:function(A){$(A).style.display="";
return A
},remove:function(A){A=$(A);
A.parentNode.removeChild(A);
return A
},update:function(B,A){A=typeof A=="undefined"?"":A.toString();
$(B).innerHTML=A.stripScripts();
setTimeout(function(){A.evalScripts()
},10);
return B
},replace:function(C,B){C=$(C);
B=typeof B=="undefined"?"":B.toString();
if(C.outerHTML){C.outerHTML=B.stripScripts()
}else{var A=C.ownerDocument.createRange();
A.selectNodeContents(C);
C.parentNode.replaceChild(A.createContextualFragment(B.stripScripts()),C)
}setTimeout(function(){B.evalScripts()
},10);
return C
},inspect:function(B){B=$(B);
var A="<"+B.tagName.toLowerCase();
$H({id:"id",className:"class"}).each(function(F){var E=F.first(),C=F.last();
var D=(B[E]||"").toString();
if(D){A+=" "+C+"="+D.inspect(true)
}});
return A+">"
},recursivelyCollect:function(A,C){A=$(A);
var B=[];
while(A=A[C]){if(A.nodeType==1){B.push(Element.extend(A))
}}return B
},ancestors:function(A){return $(A).recursivelyCollect("parentNode")
},descendants:function(A){return $A($(A).getElementsByTagName("*")).each(Element.extend)
},firstDescendant:function(A){A=$(A).firstChild;
while(A&&A.nodeType!=1){A=A.nextSibling
}return $(A)
},immediateDescendants:function(A){if(!(A=$(A).firstChild)){return[]
}while(A&&A.nodeType!=1){A=A.nextSibling
}if(A){return[A].concat($(A).nextSiblings())
}return[]
},previousSiblings:function(A){return $(A).recursivelyCollect("previousSibling")
},nextSiblings:function(A){return $(A).recursivelyCollect("nextSibling")
},siblings:function(A){A=$(A);
return A.previousSiblings().reverse().concat(A.nextSiblings())
},match:function(B,A){if(typeof A=="string"){A=new Selector(A)
}return A.match($(B))
},up:function(B,D,A){B=$(B);
if(arguments.length==1){return $(B.parentNode)
}var C=B.ancestors();
return D?Selector.findElement(C,D,A):C[A||0]
},down:function(B,C,A){B=$(B);
if(arguments.length==1){return B.firstDescendant()
}var D=B.descendants();
return C?Selector.findElement(D,C,A):D[A||0]
},previous:function(B,D,A){B=$(B);
if(arguments.length==1){return $(Selector.handlers.previousElementSibling(B))
}var C=B.previousSiblings();
return D?Selector.findElement(C,D,A):C[A||0]
},next:function(C,D,B){C=$(C);
if(arguments.length==1){return $(Selector.handlers.nextElementSibling(C))
}var A=C.nextSiblings();
return D?Selector.findElement(A,D,B):A[B||0]
},getElementsBySelector:function(){var A=$A(arguments),B=$(A.shift());
return Selector.findChildElements(B,A)
},getElementsByClassName:function(A,B){return document.getElementsByClassName(B,A)
},readAttribute:function(C,A){C=$(C);
if(Prototype.Browser.IE){if(!C.attributes){return null
}var B=Element._attributeTranslations;
if(B.values[A]){return B.values[A](C,A)
}if(B.names[A]){A=B.names[A]
}var D=C.attributes[A];
return D?D.nodeValue:null
}return C.getAttribute(A)
},getHeight:function(A){return $(A).getDimensions().height
},getWidth:function(A){return $(A).getDimensions().width
},classNames:function(A){return new Element.ClassNames(A)
},hasClassName:function(A,B){if(!(A=$(A))){return 
}var C=A.className;
if(C.length==0){return false
}if(C==B||C.match(new RegExp("(^|\\s)"+B+"(\\s|$)"))){return true
}return false
},addClassName:function(A,B){if(!(A=$(A))){return 
}Element.classNames(A).add(B);
return A
},removeClassName:function(A,B){if(!(A=$(A))){return 
}Element.classNames(A).remove(B);
return A
},toggleClassName:function(A,B){if(!(A=$(A))){return 
}Element.classNames(A)[A.hasClassName(B)?"remove":"add"](B);
return A
},observe:function(){Event.observe.apply(Event,arguments);
return $A(arguments).first()
},stopObserving:function(){Event.stopObserving.apply(Event,arguments);
return $A(arguments).first()
},cleanWhitespace:function(B){B=$(B);
var C=B.firstChild;
while(C){var A=C.nextSibling;
if(C.nodeType==3&&!/\S/.test(C.nodeValue)){B.removeChild(C)
}C=A
}return B
},empty:function(A){return $(A).innerHTML.blank()
},descendantOf:function(B,A){B=$(B),A=$(A);
while(B=B.parentNode){if(B==A){return true
}}return false
},scrollTo:function(A){A=$(A);
var B=Position.cumulativeOffset(A);
window.scrollTo(B[0],B[1]);
return A
},getStyle:function(B,C){B=$(B);
C=C=="float"?"cssFloat":C.camelize();
var D=B.style[C];
if(!D){var A=document.defaultView.getComputedStyle(B,null);
D=A?A[C]:null
}if(C=="opacity"){return D?parseFloat(D):1
}return D=="auto"?null:D
},getOpacity:function(A){return $(A).getStyle("opacity")
},setStyle:function(A,C,B){A=$(A);
var E=A.style;
for(var D in C){if(D=="opacity"){A.setOpacity(C[D])
}else{E[(D=="float"||D=="cssFloat")?(E.styleFloat===undefined?"cssFloat":"styleFloat"):(B?D:D.camelize())]=C[D]
}}return A
},setOpacity:function(A,B){A=$(A);
A.style.opacity=(B==1||B==="")?"":(B<0.00001)?0:B;
return A
},getDimensions:function(C){C=$(C);
var G=$(C).getStyle("display");
if(G!="none"&&G!=null){return{width:C.offsetWidth,height:C.offsetHeight}
}var B=C.style;
var F=B.visibility;
var D=B.position;
var A=B.display;
B.visibility="hidden";
B.position="absolute";
B.display="block";
var H=C.clientWidth;
var E=C.clientHeight;
B.display=A;
B.position=D;
B.visibility=F;
return{width:H,height:E}
},makePositioned:function(A){A=$(A);
var B=Element.getStyle(A,"position");
if(B=="static"||!B){A._madePositioned=true;
A.style.position="relative";
if(window.opera){A.style.top=0;
A.style.left=0
}}return A
},undoPositioned:function(A){A=$(A);
if(A._madePositioned){A._madePositioned=undefined;
A.style.position=A.style.top=A.style.left=A.style.bottom=A.style.right=""
}return A
},makeClipping:function(A){A=$(A);
if(A._overflow){return A
}A._overflow=A.style.overflow||"auto";
if((Element.getStyle(A,"overflow")||"visible")!="hidden"){A.style.overflow="hidden"
}return A
},undoClipping:function(A){A=$(A);
if(!A._overflow){return A
}A.style.overflow=A._overflow=="auto"?"":A._overflow;
A._overflow=null;
return A
}};
Object.extend(Element.Methods,{childOf:Element.Methods.descendantOf,childElements:Element.Methods.immediateDescendants});
if(Prototype.Browser.Opera){Element.Methods._getStyle=Element.Methods.getStyle;
Element.Methods.getStyle=function(A,B){switch(B){case"left":case"top":case"right":case"bottom":if(Element._getStyle(A,"position")=="static"){return null
}default:return Element._getStyle(A,B)
}}
}else{if(Prototype.Browser.IE){Element.Methods.getStyle=function(A,B){A=$(A);
B=(B=="float"||B=="cssFloat")?"styleFloat":B.camelize();
var C=A.style[B];
if(!C&&A.currentStyle){C=A.currentStyle[B]
}if(B=="opacity"){if(C=(A.getStyle("filter")||"").match(/alpha\(opacity=(.*)\)/)){if(C[1]){return parseFloat(C[1])/100
}}return 1
}if(C=="auto"){if((B=="width"||B=="height")&&(A.getStyle("display")!="none")){return A["offset"+B.capitalize()]+"px"
}return null
}return C
};
Element.Methods.setOpacity=function(A,D){A=$(A);
var C=A.getStyle("filter"),B=A.style;
if(D==1||D===""){B.filter=C.replace(/alpha\([^\)]*\)/gi,"");
return A
}else{if(D<0.00001){D=0
}}B.filter=C.replace(/alpha\([^\)]*\)/gi,"")+"alpha(opacity="+(D*100)+")";
return A
};
Element.Methods.update=function(C,B){C=$(C);
B=typeof B=="undefined"?"":B.toString();
var A=C.tagName.toUpperCase();
if(["THEAD","TBODY","TR","TD"].include(A)){var D=document.createElement("div");
switch(A){case"THEAD":case"TBODY":D.innerHTML="<table><tbody>"+B.stripScripts()+"</tbody></table>";
depth=2;
break;
case"TR":D.innerHTML="<table><tbody><tr>"+B.stripScripts()+"</tr></tbody></table>";
depth=3;
break;
case"TD":D.innerHTML="<table><tbody><tr><td>"+B.stripScripts()+"</td></tr></tbody></table>";
depth=4
}$A(C.childNodes).each(function(E){C.removeChild(E)
});
depth.times(function(){D=D.firstChild
});
$A(D.childNodes).each(function(E){C.appendChild(E)
})
}else{C.innerHTML=B.stripScripts()
}setTimeout(function(){B.evalScripts()
},10);
return C
}
}else{if(Prototype.Browser.Gecko){Element.Methods.setOpacity=function(A,B){A=$(A);
A.style.opacity=(B==1)?0.999999:(B==="")?"":(B<0.00001)?0:B;
return A
}
}}}Element._attributeTranslations={names:{colspan:"colSpan",rowspan:"rowSpan",valign:"vAlign",datetime:"dateTime",accesskey:"accessKey",tabindex:"tabIndex",enctype:"encType",maxlength:"maxLength",readonly:"readOnly",longdesc:"longDesc"},values:{_getAttr:function(A,B){return A.getAttribute(B,2)
},_flag:function(A,B){return $(A).hasAttribute(B)?B:null
},style:function(A){return A.style.cssText.toLowerCase()
},title:function(A){var B=A.getAttributeNode("title");
return B.specified?B.nodeValue:null
}}};
(function(){Object.extend(this,{href:this._getAttr,src:this._getAttr,disabled:this._flag,checked:this._flag,readonly:this._flag,multiple:this._flag})
}).call(Element._attributeTranslations.values);
Element.Methods.Simulated={hasAttribute:function(B,D){var A=Element._attributeTranslations,C;
D=A.names[D]||D;
C=$(B).getAttributeNode(D);
return C&&C.specified
}};
Element.Methods.ByTag={};
Object.extend(Element,Element.Methods);
if(!Prototype.BrowserFeatures.ElementExtensions&&document.createElement("div").__proto__){window.HTMLElement={};
window.HTMLElement.prototype=document.createElement("div").__proto__;
Prototype.BrowserFeatures.ElementExtensions=true
}Element.hasAttribute=function(A,B){if(A.hasAttribute){return A.hasAttribute(B)
}return Element.Methods.Simulated.hasAttribute(A,B)
};
Element.addMethods=function(C){var I=Prototype.BrowserFeatures,D=Element.Methods.ByTag;
if(arguments.length==2){var B=C;
C=arguments[1]
}if(!B){Object.extend(Element.Methods,C||{})
}else{if(B.constructor==Array){B.each(H)
}else{H(B)
}}function H(F){F=F.toUpperCase();
if(!Element.Methods.ByTag[F]){Element.Methods.ByTag[F]={}
}Object.extend(Element.Methods.ByTag[F],C)
}function A(M,K,F){F=F||false;
var L=Element.extend.cache;
for(var O in M){var N=M[O];
if(!F||!(O in K)){K[O]=L.findOrStore(N)
}}}function E(L){var F;
var K={OPTGROUP:"OptGroup",TEXTAREA:"TextArea",P:"Paragraph",FIELDSET:"FieldSet",UL:"UList",OL:"OList",DL:"DList",DIR:"Directory",H1:"Heading",H2:"Heading",H3:"Heading",H4:"Heading",H5:"Heading",H6:"Heading",Q:"Quote",INS:"Mod",DEL:"Mod",A:"Anchor",IMG:"Image",CAPTION:"TableCaption",COL:"TableCol",COLGROUP:"TableCol",THEAD:"TableSection",TFOOT:"TableSection",TBODY:"TableSection",TR:"TableRow",TH:"TableCell",TD:"TableCell",FRAMESET:"FrameSet",IFRAME:"IFrame"};
if(K[L]){F="HTML"+K[L]+"Element"
}if(window[F]){return window[F]
}F="HTML"+L+"Element";
if(window[F]){return window[F]
}F="HTML"+L.capitalize()+"Element";
if(window[F]){return window[F]
}window[F]={};
window[F].prototype=document.createElement(L).__proto__;
return window[F]
}if(I.ElementExtensions){A(Element.Methods,HTMLElement.prototype);
A(Element.Methods.Simulated,HTMLElement.prototype,true)
}if(I.SpecificElementExtensions){for(var J in Element.Methods.ByTag){var G=E(J);
if(typeof G=="undefined"){continue
}A(D[J],G.prototype)
}}Object.extend(Element,Element.Methods);
delete Element.ByTag
};
var Toggle={display:Element.toggle};
Abstract.Insertion=function(A){this.adjacency=A
};
Abstract.Insertion.prototype={initialize:function(B,C){this.element=$(B);
this.content=C.stripScripts();
if(this.adjacency&&this.element.insertAdjacentHTML){try{this.element.insertAdjacentHTML(this.adjacency,this.content)
}catch(D){var A=this.element.tagName.toUpperCase();
if(["TBODY","TR"].include(A)){this.insertContent(this.contentFromAnonymousTable())
}else{throw D
}}}else{this.range=this.element.ownerDocument.createRange();
if(this.initializeRange){this.initializeRange()
}this.insertContent([this.range.createContextualFragment(this.content)])
}setTimeout(function(){C.evalScripts()
},10)
},contentFromAnonymousTable:function(){var A=document.createElement("div");
A.innerHTML="<table><tbody>"+this.content+"</tbody></table>";
return $A(A.childNodes[0].childNodes[0].childNodes)
}};
var Insertion=new Object();
Insertion.Before=Class.create();
Insertion.Before.prototype=Object.extend(new Abstract.Insertion("beforeBegin"),{initializeRange:function(){this.range.setStartBefore(this.element)
},insertContent:function(A){A.each((function(B){this.element.parentNode.insertBefore(B,this.element)
}).bind(this))
}});
Insertion.Top=Class.create();
Insertion.Top.prototype=Object.extend(new Abstract.Insertion("afterBegin"),{initializeRange:function(){this.range.selectNodeContents(this.element);
this.range.collapse(true)
},insertContent:function(A){A.reverse(false).each((function(B){this.element.insertBefore(B,this.element.firstChild)
}).bind(this))
}});
Insertion.Bottom=Class.create();
Insertion.Bottom.prototype=Object.extend(new Abstract.Insertion("beforeEnd"),{initializeRange:function(){this.range.selectNodeContents(this.element);
this.range.collapse(this.element)
},insertContent:function(A){A.each((function(B){this.element.appendChild(B)
}).bind(this))
}});
Insertion.After=Class.create();
Insertion.After.prototype=Object.extend(new Abstract.Insertion("afterEnd"),{initializeRange:function(){this.range.setStartAfter(this.element)
},insertContent:function(A){A.each((function(B){this.element.parentNode.insertBefore(B,this.element.nextSibling)
}).bind(this))
}});
Element.ClassNames=Class.create();
Element.ClassNames.prototype={initialize:function(A){this.element=$(A)
},_each:function(A){this.element.className.split(/\s+/).select(function(B){return B.length>0
})._each(A)
},set:function(A){this.element.className=A
},add:function(A){if(this.include(A)){return 
}this.set($A(this).concat(A).join(" "))
},remove:function(A){if(!this.include(A)){return 
}this.set($A(this).without(A).join(" "))
},toString:function(){return $A(this).join(" ")
}};
Object.extend(Element.ClassNames.prototype,Enumerable);
var Selector=Class.create();
Selector.prototype={initialize:function(A){this.expression=A.strip();
this.compileMatcher()
},compileMatcher:function(){if(Prototype.BrowserFeatures.XPath&&!(/\[[\w-]*?:/).test(this.expression)){return this.compileXPathMatcher()
}var e=this.expression,ps=Selector.patterns,h=Selector.handlers,c=Selector.criteria,le,p,m;
if(Selector._cache[e]){this.matcher=Selector._cache[e];
return 
}this.matcher=["this.matcher = function(root) {","var r = root, h = Selector.handlers, c = false, n;"];
while(e&&le!=e&&(/\S/).test(e)){le=e;
for(var i in ps){p=ps[i];
if(m=e.match(p)){this.matcher.push(typeof c[i]=="function"?c[i](m):new Template(c[i]).evaluate(m));
e=e.replace(m[0],"");
break
}}}this.matcher.push("return h.unique(n);\n}");
eval(this.matcher.join("\n"));
Selector._cache[this.expression]=this.matcher
},compileXPathMatcher:function(){var E=this.expression,F=Selector.patterns,B=Selector.xpath,D,A;
if(Selector._cache[E]){this.xpath=Selector._cache[E];
return 
}this.matcher=[".//*"];
while(E&&D!=E&&(/\S/).test(E)){D=E;
for(var C in F){if(A=E.match(F[C])){this.matcher.push(typeof B[C]=="function"?B[C](A):new Template(B[C]).evaluate(A));
E=E.replace(A[0],"");
break
}}}this.xpath=this.matcher.join("");
Selector._cache[this.expression]=this.xpath
},findElements:function(A){A=A||document;
if(this.xpath){return document._getElementsByXPath(this.xpath,A)
}return this.matcher(A)
},match:function(A){return this.findElements(document).include(A)
},toString:function(){return this.expression
},inspect:function(){return"#<Selector:"+this.expression.inspect()+">"
}};
Object.extend(Selector,{_cache:{},xpath:{descendant:"//*",child:"/*",adjacent:"/following-sibling::*[1]",laterSibling:"/following-sibling::*",tagName:function(A){if(A[1]=="*"){return""
}return"[local-name()='"+A[1].toLowerCase()+"' or local-name()='"+A[1].toUpperCase()+"']"
},className:"[contains(concat(' ', @class, ' '), ' #{1} ')]",id:"[@id='#{1}']",attrPresence:"[@#{1}]",attr:function(A){A[3]=A[5]||A[6];
return new Template(Selector.xpath.operators[A[2]]).evaluate(A)
},pseudo:function(A){var B=Selector.xpath.pseudos[A[1]];
if(!B){return""
}if(typeof B==="function"){return B(A)
}return new Template(Selector.xpath.pseudos[A[1]]).evaluate(A)
},operators:{"=":"[@#{1}='#{3}']","!=":"[@#{1}!='#{3}']","^=":"[starts-with(@#{1}, '#{3}')]","$=":"[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']","*=":"[contains(@#{1}, '#{3}')]","~=":"[contains(concat(' ', @#{1}, ' '), ' #{3} ')]","|=":"[contains(concat('-', @#{1}, '-'), '-#{3}-')]"},pseudos:{"first-child":"[not(preceding-sibling::*)]","last-child":"[not(following-sibling::*)]","only-child":"[not(preceding-sibling::* or following-sibling::*)]",empty:"[count(*) = 0 and (count(text()) = 0 or translate(text(), ' \t\r\n', '') = '')]",checked:"[@checked]",disabled:"[@disabled]",enabled:"[not(@disabled)]",not:function(B){var H=B[6],G=Selector.patterns,A=Selector.xpath,E,B,C;
var F=[];
while(H&&E!=H&&(/\S/).test(H)){E=H;
for(var D in G){if(B=H.match(G[D])){C=typeof A[D]=="function"?A[D](B):new Template(A[D]).evaluate(B);
F.push("("+C.substring(1,C.length-1)+")");
H=H.replace(B[0],"");
break
}}}return"[not("+F.join(" and ")+")]"
},"nth-child":function(A){return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ",A)
},"nth-last-child":function(A){return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ",A)
},"nth-of-type":function(A){return Selector.xpath.pseudos.nth("position() ",A)
},"nth-last-of-type":function(A){return Selector.xpath.pseudos.nth("(last() + 1 - position()) ",A)
},"first-of-type":function(A){A[6]="1";
return Selector.xpath.pseudos["nth-of-type"](A)
},"last-of-type":function(A){A[6]="1";
return Selector.xpath.pseudos["nth-last-of-type"](A)
},"only-of-type":function(A){var B=Selector.xpath.pseudos;
return B["first-of-type"](A)+B["last-of-type"](A)
},nth:function(E,C){var F,G=C[6],B;
if(G=="even"){G="2n+0"
}if(G=="odd"){G="2n+1"
}if(F=G.match(/^(\d+)$/)){return"["+E+"= "+F[1]+"]"
}if(F=G.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(F[1]=="-"){F[1]=-1
}var D=F[1]?Number(F[1]):1;
var A=F[2]?Number(F[2]):0;
B="[((#{fragment} - #{b}) mod #{a} = 0) and ((#{fragment} - #{b}) div #{a} >= 0)]";
return new Template(B).evaluate({fragment:E,a:D,b:A})
}}}},criteria:{tagName:'n = h.tagName(n, r, "#{1}", c);   c = false;',className:'n = h.className(n, r, "#{1}", c); c = false;',id:'n = h.id(n, r, "#{1}", c);        c = false;',attrPresence:'n = h.attrPresence(n, r, "#{1}"); c = false;',attr:function(A){A[3]=(A[5]||A[6]);
return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}"); c = false;').evaluate(A)
},pseudo:function(A){if(A[6]){A[6]=A[6].replace(/"/g,'\\"')
}return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(A)
},descendant:'c = "descendant";',child:'c = "child";',adjacent:'c = "adjacent";',laterSibling:'c = "laterSibling";'},patterns:{laterSibling:/^\s*~\s*/,child:/^\s*>\s*/,adjacent:/^\s*\+\s*/,descendant:/^\s/,tagName:/^\s*(\*|[\w\-]+)(\b|$)?/,id:/^#([\w\-\*]+)(\b|$)/,className:/^\.([\w\-\*]+)(\b|$)/,pseudo:/^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|\s)/,attrPresence:/^\[([\w]+)\]/,attr:/\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\]]*?)\4|([^'"][^\]]*?)))?\]/},handlers:{concat:function(B,A){for(var C=0,D;
D=A[C];
C++){B.push(D)
}return B
},mark:function(A){for(var B=0,C;
C=A[B];
B++){C._counted=true
}return A
},unmark:function(A){for(var B=0,C;
C=A[B];
B++){C._counted=undefined
}return A
},index:function(A,D,F){A._counted=true;
if(D){for(var B=A.childNodes,E=B.length-1,C=1;
E>=0;
E--){node=B[E];
if(node.nodeType==1&&(!F||node._counted)){node.nodeIndex=C++
}}}else{for(var E=0,C=1,B=A.childNodes;
node=B[E];
E++){if(node.nodeType==1&&(!F||node._counted)){node.nodeIndex=C++
}}}},unique:function(B){if(B.length==0){return B
}var D=[],E;
for(var C=0,A=B.length;
C<A;
C++){if(!(E=B[C])._counted){E._counted=true;
D.push(Element.extend(E))
}}return Selector.handlers.unmark(D)
},descendant:function(A){var D=Selector.handlers;
for(var C=0,B=[],E;
E=A[C];
C++){D.concat(B,E.getElementsByTagName("*"))
}return B
},child:function(A){var F=Selector.handlers;
for(var E=0,D=[],G;
G=A[E];
E++){for(var B=0,C=[],H;
H=G.childNodes[B];
B++){if(H.nodeType==1&&H.tagName!="!"){D.push(H)
}}}return D
},adjacent:function(A){for(var C=0,B=[],E;
E=A[C];
C++){var D=this.nextElementSibling(E);
if(D){B.push(D)
}}return B
},laterSibling:function(A){var D=Selector.handlers;
for(var C=0,B=[],E;
E=A[C];
C++){D.concat(B,Element.nextSiblings(E))
}return B
},nextElementSibling:function(A){while(A=A.nextSibling){if(A.nodeType==1){return A
}}return null
},previousElementSibling:function(A){while(A=A.previousSibling){if(A.nodeType==1){return A
}}return null
},tagName:function(B,A,E,H){E=E.toUpperCase();
var D=[],F=Selector.handlers;
if(B){if(H){if(H=="descendant"){for(var C=0,G;
G=B[C];
C++){F.concat(D,G.getElementsByTagName(E))
}return D
}else{B=this[H](B)
}if(E=="*"){return B
}}for(var C=0,G;
G=B[C];
C++){if(G.tagName.toUpperCase()==E){D.push(G)
}}return D
}else{return A.getElementsByTagName(E)
}},id:function(B,A,H,F){var G=$(H),D=Selector.handlers;
if(!B&&A==document){return G?[G]:[]
}if(B){if(F){if(F=="child"){for(var C=0,E;
E=B[C];
C++){if(G.parentNode==E){return[G]
}}}else{if(F=="descendant"){for(var C=0,E;
E=B[C];
C++){if(Element.descendantOf(G,E)){return[G]
}}}else{if(F=="adjacent"){for(var C=0,E;
E=B[C];
C++){if(Selector.handlers.previousElementSibling(G)==E){return[G]
}}}else{B=D[F](B)
}}}}for(var C=0,E;
E=B[C];
C++){if(E==G){return[G]
}}return[]
}return(G&&Element.descendantOf(G,A))?[G]:[]
},className:function(B,A,C,D){if(B&&D){B=this[D](B)
}return Selector.handlers.byClassName(B,A,C)
},byClassName:function(C,B,F){if(!C){C=Selector.handlers.descendant([B])
}var H=" "+F+" ";
for(var E=0,D=[],G,A;
G=C[E];
E++){A=G.className;
if(A.length==0){continue
}if(A==F||(" "+A+" ").include(H)){D.push(G)
}}return D
},attrPresence:function(C,B,A){var E=[];
for(var D=0,F;
F=C[D];
D++){if(Element.hasAttribute(F,A)){E.push(F)
}}return E
},attr:function(A,H,G,I,B){if(!A){A=H.getElementsByTagName("*")
}var J=Selector.operators[B],D=[];
for(var E=0,C;
C=A[E];
E++){var F=Element.readAttribute(C,G);
if(F===null){continue
}if(J(F,I)){D.push(C)
}}return D
},pseudo:function(B,C,E,A,D){if(B&&D){B=this[D](B)
}if(!B){B=A.getElementsByTagName("*")
}return Selector.pseudos[C](B,E,A)
}},pseudos:{"first-child":function(B,F,A){for(var D=0,C=[],E;
E=B[D];
D++){if(Selector.handlers.previousElementSibling(E)){continue
}C.push(E)
}return C
},"last-child":function(B,F,A){for(var D=0,C=[],E;
E=B[D];
D++){if(Selector.handlers.nextElementSibling(E)){continue
}C.push(E)
}return C
},"only-child":function(B,G,A){var E=Selector.handlers;
for(var D=0,C=[],F;
F=B[D];
D++){if(!E.previousElementSibling(F)&&!E.nextElementSibling(F)){C.push(F)
}}return C
},"nth-child":function(B,C,A){return Selector.pseudos.nth(B,C,A)
},"nth-last-child":function(B,C,A){return Selector.pseudos.nth(B,C,A,true)
},"nth-of-type":function(B,C,A){return Selector.pseudos.nth(B,C,A,false,true)
},"nth-last-of-type":function(B,C,A){return Selector.pseudos.nth(B,C,A,true,true)
},"first-of-type":function(B,C,A){return Selector.pseudos.nth(B,"1",A,false,true)
},"last-of-type":function(B,C,A){return Selector.pseudos.nth(B,"1",A,true,true)
},"only-of-type":function(B,D,A){var C=Selector.pseudos;
return C["last-of-type"](C["first-of-type"](B,D,A),D,A)
},getIndices:function(B,A,C){if(B==0){return A>0?[A]:[]
}return $R(1,C).inject([],function(D,E){if(0==(E-A)%B&&(E-A)/B>=0){D.push(E)
}return D
})
},nth:function(A,L,N,K,C){if(A.length==0){return[]
}if(L=="even"){L="2n+0"
}if(L=="odd"){L="2n+1"
}var J=Selector.handlers,I=[],B=[],E;
J.mark(A);
for(var H=0,D;
D=A[H];
H++){if(!D.parentNode._counted){J.index(D.parentNode,K,C);
B.push(D.parentNode)
}}if(L.match(/^\d+$/)){L=Number(L);
for(var H=0,D;
D=A[H];
H++){if(D.nodeIndex==L){I.push(D)
}}}else{if(E=L.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(E[1]=="-"){E[1]=-1
}var O=E[1]?Number(E[1]):1;
var M=E[2]?Number(E[2]):0;
var P=Selector.pseudos.getIndices(O,M,A.length);
for(var H=0,D,F=P.length;
D=A[H];
H++){for(var G=0;
G<F;
G++){if(D.nodeIndex==P[G]){I.push(D)
}}}}}J.unmark(A);
J.unmark(B);
return I
},empty:function(B,F,A){for(var D=0,C=[],E;
E=B[D];
D++){if(E.tagName=="!"||(E.firstChild&&!E.innerHTML.match(/^\s*$/))){continue
}C.push(E)
}return C
},not:function(A,D,I){var G=Selector.handlers,J,C;
var H=new Selector(D).findElements(I);
G.mark(H);
for(var F=0,E=[],B;
B=A[F];
F++){if(!B._counted){E.push(B)
}}G.unmark(H);
return E
},enabled:function(B,F,A){for(var D=0,C=[],E;
E=B[D];
D++){if(!E.disabled){C.push(E)
}}return C
},disabled:function(B,F,A){for(var D=0,C=[],E;
E=B[D];
D++){if(E.disabled){C.push(E)
}}return C
},checked:function(B,F,A){for(var D=0,C=[],E;
E=B[D];
D++){if(E.checked){C.push(E)
}}return C
}},operators:{"=":function(B,A){return B==A
},"!=":function(B,A){return B!=A
},"^=":function(B,A){return B.startsWith(A)
},"$=":function(B,A){return B.endsWith(A)
},"*=":function(B,A){return B.include(A)
},"~=":function(B,A){return(" "+B+" ").include(" "+A+" ")
},"|=":function(B,A){return("-"+B.toUpperCase()+"-").include("-"+A.toUpperCase()+"-")
}},matchElements:function(F,G){var E=new Selector(G).findElements(),D=Selector.handlers;
D.mark(E);
for(var C=0,B=[],A;
A=F[C];
C++){if(A._counted){B.push(A)
}}D.unmark(E);
return B
},findElement:function(B,C,A){if(typeof C=="number"){A=C;
C=false
}return Selector.matchElements(B,C||"*")[A||0]
},findChildElements:function(E,G){var H=G.join(","),G=[];
H.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/,function(I){G.push(I[1].strip())
});
var D=[],F=Selector.handlers;
for(var C=0,B=G.length,A;
C<B;
C++){A=new Selector(G[C].strip());
F.concat(D,A.findElements(E))
}return(B>1)?F.unique(D):D
}});
function $$(){return Selector.findChildElements(document,$A(arguments))
}var Form={reset:function(A){$(A).reset();
return A
},serializeElements:function(C,A){var B=C.inject({},function(D,F){if(!F.disabled&&F.name){var E=F.name,G=$(F).getValue();
if(G!=null){if(E in D){if(D[E].constructor!=Array){D[E]=[D[E]]
}D[E].push(G)
}else{D[E]=G
}}}return D
});
return A?B:Hash.toQueryString(B)
}};
Form.Methods={serialize:function(B,A){return Form.serializeElements(Form.getElements(B),A)
},getElements:function(A){return $A($(A).getElementsByTagName("*")).inject([],function(B,C){if(Form.Element.Serializers[C.tagName.toLowerCase()]){B.push(Element.extend(C))
}return B
})
},getInputs:function(G,C,D){G=$(G);
var A=G.getElementsByTagName("input");
if(!C&&!D){return $A(A).map(Element.extend)
}for(var E=0,H=[],F=A.length;
E<F;
E++){var B=A[E];
if((C&&B.type!=C)||(D&&B.name!=D)){continue
}H.push(Element.extend(B))
}return H
},disable:function(A){A=$(A);
Form.getElements(A).invoke("disable");
return A
},enable:function(A){A=$(A);
Form.getElements(A).invoke("enable");
return A
},findFirstElement:function(A){return $(A).getElements().find(function(B){return B.type!="hidden"&&!B.disabled&&["input","select","textarea"].include(B.tagName.toLowerCase())
})
},focusFirstElement:function(A){A=$(A);
A.findFirstElement().activate();
return A
},request:function(B,A){B=$(B),A=Object.clone(A||{});
var C=A.parameters;
A.parameters=B.serialize(true);
if(C){if(typeof C=="string"){C=C.toQueryParams()
}Object.extend(A.parameters,C)
}if(B.hasAttribute("method")&&!A.method){A.method=B.method
}return new Ajax.Request(B.readAttribute("action"),A)
}};
Object.extend(Form,Form.Methods);
Form.Element={focus:function(A){$(A).focus();
return A
},select:function(A){$(A).select();
return A
}};
Form.Element.Methods={serialize:function(A){A=$(A);
if(!A.disabled&&A.name){var B=A.getValue();
if(B!=undefined){var C={};
C[A.name]=B;
return Hash.toQueryString(C)
}}return""
},getValue:function(A){A=$(A);
var B=A.tagName.toLowerCase();
return Form.Element.Serializers[B](A)
},clear:function(A){$(A).value="";
return A
},present:function(A){return $(A).value!=""
},activate:function(A){A=$(A);
try{A.focus();
if(A.select&&(A.tagName.toLowerCase()!="input"||!["button","reset","submit"].include(A.type))){A.select()
}}catch(B){}return A
},disable:function(A){A=$(A);
A.blur();
A.disabled=true;
return A
},enable:function(A){A=$(A);
A.disabled=false;
return A
}};
Object.extend(Form.Element,Form.Element.Methods);
Object.extend(Element.Methods.ByTag,{FORM:Object.clone(Form.Methods),INPUT:Object.clone(Form.Element.Methods),SELECT:Object.clone(Form.Element.Methods),TEXTAREA:Object.clone(Form.Element.Methods)});
var Field=Form.Element;
var $F=Form.Element.getValue;
Form.Element.Serializers={input:function(A){switch(A.type.toLowerCase()){case"checkbox":case"radio":return Form.Element.Serializers.inputSelector(A);
default:return Form.Element.Serializers.textarea(A)
}},inputSelector:function(A){return A.checked?A.value:null
},textarea:function(A){return A.value
},select:function(A){return this[A.type=="select-one"?"selectOne":"selectMany"](A)
},selectOne:function(B){var A=B.selectedIndex;
return A>=0?this.optionValue(B.options[A]):null
},selectMany:function(D){var A,E=D.length;
if(!E){return null
}for(var C=0,A=[];
C<E;
C++){var B=D.options[C];
if(B.selected){A.push(this.optionValue(B))
}}return A
},optionValue:function(A){return Element.extend(A).hasAttribute("value")?A.value:A.text
}};
Abstract.TimedObserver=function(){};
Abstract.TimedObserver.prototype={initialize:function(A,B,C){this.frequency=B;
this.element=$(A);
this.callback=C;
this.lastValue=this.getValue();
this.registerCallback()
},registerCallback:function(){setInterval(this.onTimerEvent.bind(this),this.frequency*1000)
},onTimerEvent:function(){var A=this.getValue();
var B=("string"==typeof this.lastValue&&"string"==typeof A?this.lastValue!=A:String(this.lastValue)!=String(A));
if(B){this.callback(this.element,A);
this.lastValue=A
}}};
Form.Element.Observer=Class.create();
Form.Element.Observer.prototype=Object.extend(new Abstract.TimedObserver(),{getValue:function(){return Form.Element.getValue(this.element)
}});
Form.Observer=Class.create();
Form.Observer.prototype=Object.extend(new Abstract.TimedObserver(),{getValue:function(){return Form.serialize(this.element)
}});
Abstract.EventObserver=function(){};
Abstract.EventObserver.prototype={initialize:function(A,B){this.element=$(A);
this.callback=B;
this.lastValue=this.getValue();
if(this.element.tagName.toLowerCase()=="form"){this.registerFormCallbacks()
}else{this.registerCallback(this.element)
}},onElementEvent:function(){var A=this.getValue();
if(this.lastValue!=A){this.callback(this.element,A);
this.lastValue=A
}},registerFormCallbacks:function(){Form.getElements(this.element).each(this.registerCallback.bind(this))
},registerCallback:function(A){if(A.type){switch(A.type.toLowerCase()){case"checkbox":case"radio":Event.observe(A,"click",this.onElementEvent.bind(this));
break;
default:Event.observe(A,"change",this.onElementEvent.bind(this));
break
}}}};
Form.Element.EventObserver=Class.create();
Form.Element.EventObserver.prototype=Object.extend(new Abstract.EventObserver(),{getValue:function(){return Form.Element.getValue(this.element)
}});
Form.EventObserver=Class.create();
Form.EventObserver.prototype=Object.extend(new Abstract.EventObserver(),{getValue:function(){return Form.serialize(this.element)
}});
if(!window.Event){var Event=new Object()
}Object.extend(Event,{KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,KEY_HOME:36,KEY_END:35,KEY_PAGEUP:33,KEY_PAGEDOWN:34,element:function(A){return $(A.target||A.srcElement)
},isLeftClick:function(A){return(((A.which)&&(A.which==1))||((A.button)&&(A.button==1)))
},pointerX:function(A){return A.pageX||(A.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft))
},pointerY:function(A){return A.pageY||(A.clientY+(document.documentElement.scrollTop||document.body.scrollTop))
},stop:function(A){if(A.preventDefault){A.preventDefault();
A.stopPropagation()
}else{A.returnValue=false;
A.cancelBubble=true
}},findElement:function(C,B){var A=Event.element(C);
while(A.parentNode&&(!A.tagName||(A.tagName.toUpperCase()!=B.toUpperCase()))){A=A.parentNode
}return A
},observers:false,_observeAndCache:function(D,C,B,A){if(!this.observers){this.observers=[]
}if(D.addEventListener){this.observers.push([D,C,B,A]);
D.addEventListener(C,B,A)
}else{if(D.attachEvent){this.observers.push([D,C,B,A]);
D.attachEvent("on"+C,B)
}}},unloadCache:function(){if(!Event.observers){return 
}for(var A=0,B=Event.observers.length;
A<B;
A++){Event.stopObserving.apply(this,Event.observers[A]);
Event.observers[A][0]=null
}Event.observers=false
},observe:function(D,C,B,A){D=$(D);
A=A||false;
if(C=="keypress"&&(Prototype.Browser.WebKit||D.attachEvent)){C="keydown"
}Event._observeAndCache(D,C,B,A)
},stopObserving:function(D,C,B,A){D=$(D);
A=A||false;
if(C=="keypress"&&(Prototype.Browser.WebKit||D.attachEvent)){C="keydown"
}if(D.removeEventListener){D.removeEventListener(C,B,A)
}else{if(D.detachEvent){try{D.detachEvent("on"+C,B)
}catch(E){}}}}});
if(Prototype.Browser.IE){Event.observe(window,"unload",Event.unloadCache,false)
}var Position={includeScrollOffsets:false,prepare:function(){this.deltaX=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;
this.deltaY=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0
},realOffset:function(B){var A=0,C=0;
do{A+=B.scrollTop||0;
C+=B.scrollLeft||0;
B=B.parentNode
}while(B);
return[C,A]
},cumulativeOffset:function(B){var A=0,C=0;
do{A+=B.offsetTop||0;
C+=B.offsetLeft||0;
B=B.offsetParent
}while(B);
return[C,A]
},positionedOffset:function(B){var A=0,D=0;
do{A+=B.offsetTop||0;
D+=B.offsetLeft||0;
B=B.offsetParent;
if(B){if(B.tagName=="BODY"){break
}var C=Element.getStyle(B,"position");
if(C=="relative"||C=="absolute"){break
}}}while(B);
return[D,A]
},offsetParent:function(A){if(A.offsetParent){return A.offsetParent
}if(A==document.body){return A
}while((A=A.parentNode)&&A!=document.body){if(Element.getStyle(A,"position")!="static"){return A
}}return document.body
},within:function(B,A,C){if(this.includeScrollOffsets){return this.withinIncludingScrolloffsets(B,A,C)
}this.xcomp=A;
this.ycomp=C;
this.offset=this.cumulativeOffset(B);
return(C>=this.offset[1]&&C<this.offset[1]+B.offsetHeight&&A>=this.offset[0]&&A<this.offset[0]+B.offsetWidth)
},withinIncludingScrolloffsets:function(B,A,D){var C=this.realOffset(B);
this.xcomp=A+C[0]-this.deltaX;
this.ycomp=D+C[1]-this.deltaY;
this.offset=this.cumulativeOffset(B);
return(this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+B.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+B.offsetWidth)
},overlap:function(B,A){if(!B){return 0
}if(B=="vertical"){return((this.offset[1]+A.offsetHeight)-this.ycomp)/A.offsetHeight
}if(B=="horizontal"){return((this.offset[0]+A.offsetWidth)-this.xcomp)/A.offsetWidth
}},page:function(D){var A=0,C=0;
var B=D;
do{A+=B.offsetTop||0;
C+=B.offsetLeft||0;
if(B.offsetParent==document.body){if(Element.getStyle(B,"position")=="absolute"){break
}}}while(B=B.offsetParent);
B=D;
do{if(!window.opera||B.tagName=="BODY"){A-=B.scrollTop||0;
C-=B.scrollLeft||0
}}while(B=B.parentNode);
return[C,A]
},clone:function(C,E){var A=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{});
C=$(C);
var D=Position.page(C);
E=$(E);
var F=[0,0];
var B=null;
if(Element.getStyle(E,"position")=="absolute"){B=Position.offsetParent(E);
F=Position.page(B)
}if(B==document.body){F[0]-=document.body.offsetLeft;
F[1]-=document.body.offsetTop
}if(A.setLeft){E.style.left=(D[0]-F[0]+A.offsetLeft)+"px"
}if(A.setTop){E.style.top=(D[1]-F[1]+A.offsetTop)+"px"
}if(A.setWidth){E.style.width=C.offsetWidth+"px"
}if(A.setHeight){E.style.height=C.offsetHeight+"px"
}},absolutize:function(B){B=$(B);
if(B.style.position=="absolute"){return 
}Position.prepare();
var D=Position.positionedOffset(B);
var F=D[1];
var E=D[0];
var C=B.clientWidth;
var A=B.clientHeight;
B._originalLeft=E-parseFloat(B.style.left||0);
B._originalTop=F-parseFloat(B.style.top||0);
B._originalWidth=B.style.width;
B._originalHeight=B.style.height;
B.style.position="absolute";
B.style.top=F+"px";
B.style.left=E+"px";
B.style.width=C+"px";
B.style.height=A+"px"
},relativize:function(A){A=$(A);
if(A.style.position=="relative"){return 
}Position.prepare();
A.style.position="relative";
var C=parseFloat(A.style.top||0)-(A._originalTop||0);
var B=parseFloat(A.style.left||0)-(A._originalLeft||0);
A.style.top=C+"px";
A.style.left=B+"px";
A.style.height=A._originalHeight;
A.style.width=A._originalWidth
}};
if(Prototype.Browser.WebKit){Position.cumulativeOffset=function(B){var A=0,C=0;
do{A+=B.offsetTop||0;
C+=B.offsetLeft||0;
if(B.offsetParent==document.body){if(Element.getStyle(B,"position")=="absolute"){break
}}B=B.offsetParent
}while(B);
return[C,A]
}
}Element.addMethods();var Rico={Version:"2.0 beta2",loadRequested:1,loadComplete:2,init:function(){try{document.execCommand("BackgroundImageCache",false,true)
}catch(E){}this.preloadMsgs="";
var F=document.getElementsByTagName("script");
this.baseHref=location.protocol+"//"+location.host;
this.loadedFiles={};
this.loadQueue=[];
this.windowIsLoaded=false;
this.onLoadCallbacks=[];
for(var C=0;
C<F.length;
C++){if(!F[C].src){continue
}var H=F[C].src;
var B=H.lastIndexOf("/");
var G=H.substring(0,B+1);
var A=H.substring(B+1);
this.loadedFiles[A]=this.loadComplete;
if(A=="rico.js"){this.jsDir=G;
this.cssDir=G+"css/";
this.imgDir=G+"images/";
this.htmDir=G;
this.xslDir=G
}}if(typeof Prototype=="undefined"){this.include("prototype.js")
}this.include("ricoCommon.js");
var D=function(){Rico.windowLoaded()
};
if(window.addEventListener){window.addEventListener("load",D,false)
}else{if(window.attachEvent){window.attachEvent("onload",D)
}}this.onLoad(function(){Rico.writeDebugMsg("Pre-load messages:\n"+Rico.preloadMsgs)
})
},moduleDependencies:{Accordion:["ricoBehaviors.js","ricoEffects.js","ricoComponents.js"],Color:["ricoColor.js"],Corner:["ricoStyles.js"],DragAndDrop:["ricoDragDrop.js"],Effect:["ricoEffects.js"],Calendar:["ricoCalendar.js","ricoCalendar.css"],Tree:["ricoTree.js","ricoTree.css"],ColorPicker:["ricoColorPicker.js","ricoStyles.js"],SimpleGrid:["ricoCommon.js","ricoGridCommon.js","ricoGrid.css","ricoSimpleGrid.js"],LiveGrid:["ricoCommon.js","ricoGridCommon.js","ricoGrid.css","ricoBehaviors.js","ricoLiveGrid.js"],CustomMenu:["ricoMenu.js","ricoMenu.css"],LiveGridMenu:["+CustomMenu","ricoLiveGridMenu.js"],LiveGridAjax:["+LiveGrid","ricoLiveGridAjax.js"],LiveGridForms:["+LiveGridAjax","+LiveGridMenu","+Accordion","+Corner","ricoLiveGridForms.js","ricoLiveGridForms.css"],SpreadSheet:["+SimpleGrid","ricoSheet.js"]},loadModule:function(A){var C=this.moduleDependencies[A];
if(!C){return 
}for(var B=0;
B<C.length;
B++){if(C[B].substring(0,1)=="+"){this.loadModule(C[B].slice(1))
}else{this.include(C[B])
}}},include:function(A){if(this.loadedFiles[A]){return 
}this.addPreloadMsg("include: "+A);
var C=A.substr(A.lastIndexOf(".")+1);
switch(C.toLowerCase()){case"js":this.loadQueue.push(A);
this.loadedFiles[A]=this.loadRequested;
this.checkLoadQueue();
return ;
case"css":var B=document.createElement("link");
B.type="text/css";
B.rel="stylesheet";
B.href=this.cssDir+A;
this.loadedFiles[A]=this.loadComplete;
document.getElementsByTagName("head")[0].appendChild(B);
return 
}},checkLoadQueue:function(){if(this.loadQueue.length==0){return 
}if(this.inProcess){return 
}this.addScriptToDOM(this.loadQueue.shift())
},addScriptToDOM:function(A){this.addPreloadMsg("addScriptToDOM: "+A);
var C=document.createElement("script");
C.type="text/javascript";
C.src=this.jsDir+A;
this.loadedFiles[A]=this.loadRequested;
this.inProcess=A;
var B=document.getElementsByTagName("head")[0];
if(A.substring(0,4)=="rico"){B.appendChild(C)
}else{if(/WebKit|Khtml/i.test(navigator.userAgent)){B.appendChild(C);
this.includeLoaded(A)
}else{C.onload=C.onreadystatechange=function(){if(C.readyState&&C.readyState!="loaded"&&C.readyState!="complete"){return 
}C.onreadystatechange=C.onload=null;
Rico.includeLoaded(A)
};
B.appendChild(C)
}}},includeLoaded:function(A){this.addPreloadMsg("loaded: "+A);
this.loadedFiles[A]=this.loadComplete;
if(A==this.inProcess){this.inProcess=null;
this.checkLoadQueue();
this.checkIfComplete()
}},windowLoaded:function(){this.windowIsLoaded=true;
this.checkIfComplete()
},checkIfComplete:function(){var C=this.windowIsLoaded?"":"window";
for(var A in this.loadedFiles){if(this.loadedFiles[A]==this.loadRequested){C+=" "+A
}}this.addPreloadMsg("waitingFor: "+C);
if(C.length==0){this.addPreloadMsg("Processing callbacks");
while(this.onLoadCallbacks.length>0){var B=this.onLoadCallbacks.pop();
if(B){B()
}}}},onLoad:function(A){this.onLoadCallbacks.push(A);
this.checkIfComplete()
},isKonqueror:navigator.userAgent.toLowerCase().indexOf("konqueror")>=0,startTime:new Date(),timeStamp:function(){var A=new Date();
return(A.getTime()-this.startTime.getTime())+": "
},setDebugArea:function(C,A){if(!this.debugArea||A){var B=document.getElementById(C);
if(!B){return 
}this.debugArea=B;
B.value=""
}},addPreloadMsg:function(A){this.preloadMsgs+=Rico.timeStamp()+A+"\n"
},writeDebugMsg:function(B,A){if(this.debugArea){if(A){this.debugArea.value=""
}this.debugArea.value+=this.timeStamp()+B+"\n"
}}};
Rico.init();if(typeof Rico=="undefined"){throw ("Cannot find the Rico object")
}if(typeof Prototype=="undefined"){throw ("Rico requires the Prototype JavaScript framework")
}Rico.prototypeVersion=parseFloat(Prototype.Version.split(".")[0]+"."+Prototype.Version.split(".")[1]);
if(Rico.prototypeVersion<1.3){throw ("Rico requires Prototype JavaScript framework version 1.3 or greater")
}var RicoUtil={getDirectChildrenByTag:function(E,D){var B=new Array();
var A=E.childNodes;
D=D.toLowerCase();
for(var C=0;
C<A.length;
C++){if(A[C]&&A[C].tagName&&A[C].tagName.toLowerCase()==D){B.push(A[C])
}}return B
},createXmlDocument:function(){if(document.implementation&&document.implementation.createDocument){var A=document.implementation.createDocument("","",null);
if(A.readyState==null){A.readyState=1;
A.addEventListener("load",function(){A.readyState=4;
if(typeof A.onreadystatechange=="function"){A.onreadystatechange()
}},false)
}return A
}if(window.ActiveXObject){return Try.these(function(){return new ActiveXObject("MSXML2.DomDocument")
},function(){return new ActiveXObject("Microsoft.DomDocument")
},function(){return new ActiveXObject("MSXML.DomDocument")
},function(){return new ActiveXObject("MSXML3.DomDocument")
})||false
}return null
},getInnerText:function(D){if(typeof D=="string"){return D
}if(typeof D=="undefined"){return D
}var C=D.childNodes;
var A=C.length;
var E="";
for(var B=0;
B<A;
B++){switch(C[B].nodeType){case 1:if(Element.getStyle(C[B],"display")=="none"){continue
}switch(C[B].tagName.toLowerCase()){case"img":E+=C[B].alt||C[B].title||C[B].src;
break;
case"input":if(C[B].type=="hidden"){continue
}case"select":case"textarea":E+=$F(C[B])||"";
break;
default:E+=this.getInnerText(C[B]);
break
}break;
case 3:E+=C[B].nodeValue;
break
}}return E
},getContentAsString:function(A,B){if(B){return this._getEncodedContent(A)
}if(typeof A.xml!="undefined"){return this._getContentAsStringIE(A)
}return this._getContentAsStringMozilla(A)
},_getEncodedContent:function(A){if(A.innerHTML){return A.innerHTML
}switch(A.childNodes.length){case 0:return"";
case 1:return A.firstChild.nodeValue;
default:return A.childNodes[1].nodeValue
}},_getContentAsStringIE:function(A){var C="";
for(var B=0;
B<A.childNodes.length;
B++){var D=A.childNodes[B];
if(D.nodeType==4){C+=D.nodeValue
}else{C+=D.xml
}}return C
},_getContentAsStringMozilla:function(B){var A=new XMLSerializer();
var D="";
for(var C=0;
C<B.childNodes.length;
C++){var E=B.childNodes[C];
if(E.nodeType==4){D+=E.nodeValue
}else{D+=A.serializeToString(E)
}}return D
},docElement:function(){return(document.compatMode&&document.compatMode.indexOf("CSS")!=-1)?document.documentElement:document.getElementsByTagName("body")[0]
},windowHeight:function(){return window.innerHeight?window.innerHeight:this.docElement().clientHeight
},windowWidth:function(){return this.docElement().clientWidth
},docScrollLeft:function(){if(window.pageXOffset){return window.pageXOffset
}else{if(document.documentElement&&document.documentElement.scrollLeft){return document.documentElement.scrollLeft
}else{if(document.body){return document.body.scrollLeft
}else{return 0
}}}},docScrollTop:function(){if(window.pageYOffset){return window.pageYOffset
}else{if(document.documentElement&&document.documentElement.scrollTop){return document.documentElement.scrollTop
}else{if(document.body){return document.body.scrollTop
}else{return 0
}}}},nan2zero:function(A){if(typeof (A)=="string"){A=parseInt(A)
}return isNaN(A)||typeof (A)=="undefined"?0:A
},eventKey:function(A){if(typeof (A.keyCode)=="number"){return A.keyCode
}else{if(typeof (A.which)=="number"){return A.which
}else{if(typeof (A.charCode)=="number"){return A.charCode
}}}return -1
},getPreviosSiblingByTagName:function(C,B){var A=C.previousSibling;
while(A){if((A.tagName==B)&&(A.style.display!="none")){return A
}A=A.previousSibling
}return null
},getParentByTagName:function(D,A,C){var B=D;
A=A.toLowerCase();
while(B){if(B.tagName&&B.tagName.toLowerCase()==A){if(!C||B.className.indexOf(C)>=0){return B
}}B=B.parentNode
}return null
},wrapChildren:function(C,B,F,D){var A=D||"div";
var E=document.createElement(A);
if(F){E.id=F
}if(B){E.className=B
}while(C.firstChild){E.appendChild(C.firstChild)
}C.appendChild(E);
return E
},formatPosNumber:function(E,F,B,D){var A=E.toFixed(F).split(/\./);
if(B){var C=/(\d+)(\d{3})/;
while(C.test(A[0])){A[0]=A[0].replace(C,"$1"+B+"$2")
}}return A.join(D)
},DOMNode_insertAfter:function(A,B){var C=B.parentNode;
if(C.lastChild==B){return C.appendChild(A)
}else{return C.insertBefore(A,B.nextSibling)
}},positionCtlOverIcon:function(E,I){if(E.style.display=="none"){E.style.display="block"
}var B=Position.page(I);
var F=Prototype.Browser.IE?1:2;
var A=this.nan2zero(Element.getStyle(I,"padding-left"));
E.style.left=(B[0]+A+F)+"px";
var H=this.docScrollTop();
var G=B[1]+F+H;
var D=E.offsetHeight;
var C=I.offsetHeight;
if(G+C+D<this.windowHeight()+H){G+=C
}else{G=Math.max(G-D,H)
}E.style.top=G+"px"
},createFormField:function(D,B,F,G,A){if(typeof A!="string"){A=G
}if(Prototype.Browser.IE){var C=B+' id="'+G+'"';
if(F){C+=' type="'+F+'"'
}if(B.match(/^(form|input|select|textarea|object|button|img)$/)){C+=' name="'+A+'"'
}var E=document.createElement("<"+C+" />")
}else{var E=document.createElement(B);
if(F){E.type=F
}E.id=G;
if(typeof E.name=="string"){E.name=A
}}D.appendChild(E);
return E
},getCookie:function(G){var B=G+"=";
var F=B.length;
var A=document.cookie.length;
var D=0;
while(D<A){var C=D+F;
if(document.cookie.substring(D,C)==B){var E=document.cookie.indexOf(";",C);
if(E==-1){E=document.cookie.length
}return unescape(document.cookie.substring(C,E))
}D=document.cookie.indexOf(" ",D)+1;
if(D==0){break
}}return null
},setCookie:function(D,F,E,C,A){var G=D+"="+escape(F);
if(typeof (E)=="number"){var B=new Date();
B.setTime(B.getTime()+(E*24*60*60*1000));
G+="; expires="+B.toGMTString()
}if(typeof (C)=="string"){G+="; path="+C
}if(typeof (A)=="string"){G+="; domain="+A
}document.cookie=G
}};
var RicoTranslate={phrases:{},thouSep:",",decPoint:".",langCode:"en",re:/^(\W*)\b(.*)\b(\W*)$/,dateFmt:"mm/dd/yyyy",timeFmt:"hh:nn:ss a/pm",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],addPhrase:function(B,A){this.phrases[B]=A
},getPhrase:function(C){var E=C.split(/\t/);
var A,D="";
for(var B=0;
B<E.length;
B++){if(this.re.exec(E[B])){A=this.phrases[RegExp.$2];
D+=(typeof A=="string")?RegExp.$1+A+RegExp.$3:E[B]
}else{D+=E[B]
}}return D
}};
if(!Date.prototype.formatDate){Date.prototype.formatDate=function(A){var C=this;
var B=(typeof A=="string")?B=A:"translateDate";
switch(B){case"locale":case"localeDateTime":return C.toLocaleString();
case"localeDate":return C.toLocaleDateString();
case"translate":case"translateDateTime":B=RicoTranslate.dateFmt+" "+RicoTranslate.timeFmt;
break;
case"translateDate":B=RicoTranslate.dateFmt;
break
}return B.replace(/(yyyy|mmmm|mmm|mm|dddd|ddd|dd|hh|nn|ss|a\/p)/gi,function(D){switch(D.toLowerCase()){case"yyyy":return C.getFullYear();
case"mmmm":return RicoTranslate.monthNames[C.getMonth()];
case"mmm":return RicoTranslate.monthNames[C.getMonth()].substr(0,3);
case"mm":return(C.getMonth()+1).toPaddedString(2);
case"m":return(C.getMonth()+1);
case"dddd":return RicoTranslate.dayNames[C.getDay()];
case"ddd":return RicoTranslate.dayNames[C.getDay()].substr(0,3);
case"dd":return C.getDate().toPaddedString(2);
case"d":return C.getDate();
case"hh":return((h=C.getHours()%12)?h:12).toPaddedString(2);
case"h":return((h=C.getHours()%12)?h:12);
case"HH":return C.getHours().toPaddedString(2);
case"H":return C.getHours();
case"nn":return C.getMinutes().toPaddedString(2);
case"ss":return C.getSeconds().toPaddedString(2);
case"a/p":return C.getHours()<12?"a":"p"
}})
}
}if(!Date.prototype.setISO8601){Date.prototype.setISO8601=function(B){if(!B){return false
}var E=B.match(/(\d\d\d\d)(?:-?(\d\d)(?:-?(\d\d)(?:[T ](\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|(?:([-+])(\d\d)(?::?(\d\d))?)?)?)?)?)?/);
if(!E){return false
}var D=0;
var A=new Date(E[1],0,1);
if(E[2]){A.setMonth(E[2]-1)
}if(E[3]){A.setDate(E[3])
}if(E[4]){A.setHours(E[4])
}if(E[5]){A.setMinutes(E[5])
}if(E[6]){A.setSeconds(E[6])
}if(E[7]){A.setMilliseconds(Number("0."+E[7])*1000)
}if(E[8]){if(E[10]&&E[11]){D=(Number(E[10])*60)+Number(E[11])
}D*=((E[9]=="-")?1:-1);
D-=A.getTimezoneOffset()
}var C=(Number(A)+(D*60*1000));
this.setTime(Number(C));
return true
}
}if(!Date.prototype.toISO8601String){Date.prototype.toISO8601String=function(D,G){if(!D){var D=6
}if(!G){var G="Z";
var A=this
}else{var F=G.match(/([-+])([0-9]{2}):([0-9]{2})/);
var C=(Number(F[2])*60)+Number(F[3]);
C*=((F[1]=="-")?-1:1);
var A=new Date(Number(Number(this)+(C*60000)))
}var H=function(I){return((I<10)?"0":"")+I
};
var E="";
E+=A.getUTCFullYear();
if(D>1){E+="-"+H(A.getUTCMonth()+1)
}if(D>2){E+="-"+H(A.getUTCDate())
}if(D>3){E+="T"+H(A.getUTCHours())+":"+H(A.getUTCMinutes())
}if(D>5){var B=Number(A.getUTCSeconds()+"."+((A.getUTCMilliseconds()<100)?"0":"")+H(A.getUTCMilliseconds()));
E+=":"+H(B)
}else{if(D>4){E+=":"+H(A.getUTCSeconds())
}}if(D>3){E+=G
}return E
}
}if(!String.prototype.formatDate){String.prototype.formatDate=function(A){var B=this.replace(/-/g,"/");
var C=new Date(B);
return isNaN(C)?this:C.formatDate(A)
}
}if(!Number.prototype.formatNumber){Number.prototype.formatNumber=function(C){if(isNaN(this)){return"NaN"
}var B=this;
if(typeof C.multiplier=="number"){B*=C.multiplier
}var I=typeof C.decPlaces=="number"?C.decPlaces:0;
var E=typeof C.thouSep=="string"?C.thouSep:RicoTranslate.thouSep;
var F=typeof C.decPoint=="string"?C.decPoint:RicoTranslate.decPoint;
var D=C.prefix||"";
var G=C.suffix||"";
var A=typeof C.negSign=="string"?C.negSign:"L";
A=A.toUpperCase();
var J,H;
if(B<0){J=RicoUtil.formatPosNumber(-B,I,E,F);
if(A=="P"){J="("+J+")"
}J=D+J;
if(A=="L"){J="-"+J
}if(A=="T"){J+="-"
}H="negNumber"
}else{H=B==0?"zeroNumber":"posNumber";
J=D+RicoUtil.formatPosNumber(B,I,E,F)
}return"<span class='"+H+"'>"+J+G+"</span>"
}
}if(!String.prototype.formatNumber){String.prototype.formatNumber=function(A){var B=parseFloat(this);
return isNaN(B)?this:B.formatNumber(A)
}
}Rico.Shim=Class.create();
if(Prototype.Browser.IE){Rico.Shim.prototype={initialize:function(A){this.ifr=document.createElement("iframe");
this.ifr.style.position="absolute";
this.ifr.style.display="none";
this.ifr.src="javascript:false;";
A.parentNode.appendChild(this.ifr);
this.DivRef=A
},hide:function(){this.ifr.style.display="none"
},show:function(){this.ifr.style.width=this.DivRef.offsetWidth;
this.ifr.style.height=this.DivRef.offsetHeight;
this.ifr.style.top=this.DivRef.style.top;
this.ifr.style.left=this.DivRef.style.left;
this.ifr.style.zIndex=this.DivRef.currentStyle.zIndex-1;
this.ifr.style.display="block"
}}
}else{Rico.Shim.prototype={initialize:function(){},hide:function(){},show:function(){}}
}Rico.Shadow=Class.create();
Rico.Shadow.prototype={initialize:function(A){this.div=document.createElement("div");
this.div.style.position="absolute";
if(typeof this.div.style.filter=="undefined"){new Image().src=Rico.imgDir+"shadow.png";
new Image().src=Rico.imgDir+"shadow_ur.png";
new Image().src=Rico.imgDir+"shadow_ll.png";
this.createShadow();
this.offset=5
}else{this.div.style.backgroundColor="#888";
this.div.style.filter="progid:DXImageTransform.Microsoft.Blur(makeShadow=1, shadowOpacity=0.3, pixelRadius=3)";
this.offset=0
}this.div.style.display="none";
A.parentNode.appendChild(this.div);
this.DivRef=A
},createShadow:function(){var E=document.createElement("table");
E.style.height="100%";
E.style.width="100%";
E.cellSpacing=0;
E.dir="ltr";
var A=E.insertRow(-1);
A.style.height="8px";
var C=A.insertCell(-1);
C.style.width="8px";
var B=A.insertCell(-1);
B.style.background="transparent url("+Rico.imgDir+"shadow_ur.png) no-repeat right bottom";
var G=E.insertRow(-1);
var F=G.insertCell(-1);
F.style.background="transparent url("+Rico.imgDir+"shadow_ll.png) no-repeat right bottom";
var D=G.insertCell(-1);
D.style.background="transparent url("+Rico.imgDir+"shadow.png) no-repeat right bottom";
this.div.appendChild(E)
},hide:function(){this.div.style.display="none"
},show:function(){this.div.style.width=this.DivRef.offsetWidth+"px";
this.div.style.height=this.DivRef.offsetHeight+"px";
this.div.style.top=(parseInt(this.DivRef.style.top)+this.offset)+"px";
this.div.style.left=(parseInt(this.DivRef.style.left)+this.offset)+"px";
this.div.style.zIndex=parseInt(Element.getStyle(this.DivRef,"z-index"))-1;
this.div.style.display="block"
}};
Rico.Popup=Class.create();
Rico.Popup.prototype={initialize:function(B,A){this.options={hideOnEscape:true,hideOnClick:true,ignoreClicks:false,position:"absolute",shadow:true};
Object.extend(this.options,B||{});
if(A){this.setDiv(A)
}},setDiv:function(B,C){this.divPopup=$(B);
var A=this.options.position=="auto"?Element.getStyle(this.divPopup,"position").toLowerCase():this.options.position;
if(!this.divPopup||A!="absolute"){return 
}this.closeFunc=C||this.closePopup.bindAsEventListener(this);
this.shim=new Rico.Shim(this.divPopup);
if(this.options.shadow){this.shadow=new Rico.Shadow(this.divPopup)
}if(this.options.hideOnClick){Event.observe(document,"click",this.closeFunc)
}if(this.options.hideOnEscape){Event.observe(document,"keyup",this._checkKey.bindAsEventListener(this))
}if(this.options.ignoreClicks){this.ignoreClicks()
}},ignoreClicks:function(){Event.observe(this.divPopup,"click",this._ignoreClick.bindAsEventListener(this))
},_ignoreClick:function(A){if(A.stopPropagation){A.stopPropagation()
}else{A.cancelBubble=true
}return true
},_checkKey:function(A){if(RicoUtil.eventKey(A)==27){this.closeFunc()
}return true
},openPopup:function(B,A){if(typeof B=="number"){this.divPopup.style.left=B+"px"
}if(typeof A=="number"){this.divPopup.style.top=A+"px"
}this.divPopup.style.display="block";
if(this.shim){this.shim.show()
}if(this.shadow){this.shadow.show()
}},closePopup:function(){if(this.shim){this.shim.hide()
}if(this.shadow){this.shadow.hide()
}this.divPopup.style.display="none"
}};
Rico.includeLoaded("ricoCommon.js");Rico.ContentTransitionBase=function(){};
Rico.ContentTransitionBase.prototype={initialize:function(C,B,A){if(typeof C=="string"){C=$$(C)
}if(typeof B=="string"){B=$$(B)
}this.titles=C;
this.contents=B;
this.options=Object.extend({duration:200,steps:8,rate:Rico.Effect.easeIn},A||{});
this.hoverSet=new Rico.HoverSet(C,A);
B.each(function(D){if(D){Element.hide(D)
}});
this.selectionSet=new Rico.SelectionSet(C,Object.extend(this.options,{onSelect:this.select.bind(this)}));
if(this.initContent){this.initContent()
}},reset:function(){this.selectionSet.reset()
},select:function(C){if(this.selected==this.contentOf(C)){return 
}var A=this.contentOf(C);
if(this.transition){if(this.selected){var B=this.transition(A);
if(B){Rico.animate(B,this.options)
}}else{Element.show(A)
}}else{if(this.selected){Element.hide(this.selected)
}Element.show(A)
}this.selected=A
},add:function(B,A){this.titles.push(B);
this.contents.push(A);
this.hoverSet.add(B);
this.selectionSet.add(B);
this.selectionSet.select(B)
},remove:function(A){},removeAll:function(){this.hoverSet.removeAll();
this.selectionSet.removeAll()
},openByIndex:function(A){this.selectionSet.selectIndex(A)
},contentOf:function(A){return this.contents[this.titles.indexOf(A)]
}};
Rico.ContentTransition=Class.create();
Rico.ContentTransition.prototype=Object.extend(new Rico.ContentTransitionBase(),{});
Rico.SlidingPanel=Class.create();
Rico.SlidingPanel.prototype={initialize:function(A){this.panel=A;
this.options=arguments[1]||{};
this.closed=true;
this.showing=false;
this.openEffect=this.options.openEffect;
this.closeEffect=this.options.closeEffect;
this.animator=new Rico.Effect.Animator();
Element.makeClipping(this.panel)
},toggle:function(){if(!this.showing){this.open()
}else{this.close()
}},open:function(){if(this.closed){this.showing=true;
Element.show(this.panel);
this.options.disabler.disableNative()
}this.animator.play(this.openEffect,{onFinish:function(){Element.undoClipping($(this.panel))
}.bind(this),rate:Rico.Effect.easeIn})
},close:function(){Element.makeClipping(this.panel);
this.animator.stop();
this.showing=false;
this.animator.play(this.closeEffect,{onFinish:function(){Element.hide(this.panel);
this.options.disabler.enableNative()
}.bind(this),rate:Rico.Effect.easeOut})
}};
Rico.Accordion=Class.create();
Rico.Accordion.prototype=Object.extend(new Rico.ContentTransitionBase(),{initContent:function(){this.selected.style.height=this.options.panelHeight+"px"
},transition:function(A){if(!this.options.noAnimate){return new Rico.AccordionEffect(this.selected,A,this.options.panelHeight)
}else{A.style.height=this.options.panelHeight+"px";
if(this.selected){Element.hide(this.selected)
}Element.show(A)
}}});
Rico.TabbedPanel=Class.create();
Rico.TabbedPanel.prototype=Object.extend(new Rico.ContentTransitionBase(),{initContent:function(){if(false&&(this.options.panelHeight=="auto"||this.options.panelWidth=="auto")){var B=0,C=0;
for(var A=0;
A<this.contents.length;
A++){var D=Element.getDimensions(this.contents[A]);
B=Math.max(B,D.width);
C=Math.max(C,D.height)
}if(this.options.panelWidth=="auto"){this.options.panelWidth=B
}if(this.options.panelHeight=="auto"){this.options.panelHeight=C
}}if(typeof this.options.panelWidth=="number"){this.options.panelWidth+="px"
}if(typeof this.options.panelHeight=="number"){this.options.panelHeight+="px"
}if(Rico.Corner){this.options.color="transparent";
this.options.corners="top";
for(var A=0;
A<this.titles.length;
A++){if(this.titles[A]){if(this.options.panelHdrWidth){this.titles[A].style.width=this.options.panelHdrWidth
}Rico.Corner.round(this.titles[A],this.options)
}}}this.transition(this.selected)
},transition:function(A){if(this.selected){Element.hide(this.selected)
}Element.show(A);
if(this.options.panelHeight){A.style.height=this.options.panelHeight
}if(this.options.panelWidth){A.style.width=this.options.panelWidth
}}});
Rico.SlidingPanel.top=function(B,D){var C=Object.extend({disabler:Rico.Controls.defaultDisabler},arguments[2]||{});
var A=C.height||Element.getDimensions(D)[1]||D.offsetHeight;
var E=C.top||Position.positionedOffset(B)[1];
C.openEffect=new Rico.Effect.SizeFromTop(B,D,E,A,{baseHeight:A});
C.closeEffect=new Rico.Effect.SizeFromTop(B,D,E,1,{baseHeight:A});
B.style.height="0px";
D.style.top=-A+"px";
return new Rico.SlidingPanel(B,C)
};
Rico.SlidingPanel.bottom=function(B){var C=Object.extend({disabler:Rico.Controls.blankDisabler},arguments[1]||{});
var A=C.height||Element.getDimensions(B).height;
var D=Position.positionedOffset(B)[1];
C.openEffect=new Rico.Effect.SizeFromBottom(B,D-A,A);
C.closeEffect=new Rico.Effect.SizeFromBottom(B,D,1);
return new Rico.SlidingPanel(B,C)
};
Rico.includeLoaded("ricoComponents.js");Rico.DragAndDrop=Class.create();
Rico.DragAndDrop.prototype={initialize:function(A){this.dropZones=new Array();
this.draggables=new Array();
this.currentDragObjects=new Array();
this.dragElement=null;
this.lastSelectedDraggable=null;
this.currentDragObjectVisible=false;
this.interestedInMotionEvents=false;
this._mouseDown=this._mouseDownHandler.bindAsEventListener(this);
this._mouseMove=this._mouseMoveHandler.bindAsEventListener(this);
this._mouseUp=this._mouseUpHandler.bindAsEventListener(this);
this.mapDiv=A
},registerDropZone:function(A){this.dropZones[this.dropZones.length]=A
},deregisterDropZone:function(A){var D=new Array();
var B=0;
for(var C=0;
C<this.dropZones.length;
C++){if(this.dropZones[C]!=A){D[B++]=this.dropZones[C]
}}this.dropZones=D
},clearDropZones:function(){this.dropZones=new Array()
},registerDraggable:function(A){this.draggables[this.draggables.length]=A;
this._addMouseDownHandler(A)
},clearSelection:function(){for(var A=0;
A<this.currentDragObjects.length;
A++){this.currentDragObjects[A].deselect()
}this.currentDragObjects=new Array();
this.lastSelectedDraggable=null
},hasSelection:function(){return this.currentDragObjects.length>0
},setStartDragFromElement:function(C,D){this.origPos=RicoUtil.toDocumentPosition(D);
this.startx=C.screenX-this.origPos.x;
this.starty=C.screenY-this.origPos.y;
var A=MW.Util.findPosX(this.mapDiv);
var B=MW.Util.findPosY(this.mapDiv);
this.startx+=A;
this.starty+=B;
this.interestedInMotionEvents=this.hasSelection();
this._terminateEvent(C)
},updateSelection:function(A,B){if(!B){this.clearSelection()
}if(A.isSelected()){this.currentDragObjects.removeItem(A);
A.deselect();
if(A==this.lastSelectedDraggable){this.lastSelectedDraggable=null
}}else{this.currentDragObjects[this.currentDragObjects.length]=A;
A.select();
this.lastSelectedDraggable=A
}},_mouseDownHandler:function(F){if(arguments.length==0){F=event
}var B=F.which!=undefined;
if((B&&F.which!=1)||(!B&&F.button!=1)){return 
}var E=F.target?F.target:F.srcElement;
var A=E.draggable;
var D=E;
while(A==null&&D.parentNode){D=D.parentNode;
A=D.draggable
}if(A==null){return 
}this.updateSelection(A,F.ctrlKey);
if(this.hasSelection()){for(var C=0;
C<this.dropZones.length;
C++){this.dropZones[C].clearPositionCache()
}}this.setStartDragFromElement(F,A.getMouseDownHTMLElement())
},_mouseMoveHandler:function(B){var A=B.which!=undefined;
if(!this.interestedInMotionEvents){return 
}if(!this.hasSelection()){return 
}if(!this.currentDragObjectVisible){this._startDrag(B)
}if(!this.activatedDropZones){this._activateRegisteredDropZones()
}this._updateDraggableLocation(B);
this._updateDropZonesHover(B);
this._terminateEvent(B)
},_makeDraggableObjectVisible:function(B){if(!this.hasSelection()){return 
}var A;
if(this.currentDragObjects.length>1){A=this.currentDragObjects[0].getMultiObjectDragGUI(this.currentDragObjects)
}else{A=this.currentDragObjects[0].getSingleObjectDragGUI()
}if(RicoUtil.getElementsComputedStyle(A,"position")!="absolute"){A.style.position="absolute"
}if(A.parentNode==null||A.parentNode.nodeType==11){document.body.appendChild(A)
}this.dragElement=A;
this._updateDraggableLocation(B);
this.currentDragObjectVisible=true
},_leftOffset:function(A){return A.offsetX?document.body.scrollLeft:0
},_topOffset:function(A){return A.offsetY?document.body.scrollTop:0
},_updateDraggableLocation:function(B){var A=this.dragElement.style;
A.left=(B.screenX+this._leftOffset(B)-this.startx)+"px";
A.top=(B.screenY+this._topOffset(B)-this.starty)+"px"
},_updateDropZonesHover:function(B){var C=this.dropZones.length;
for(var A=0;
A<C;
A++){if(!this._mousePointInDropZone(B,this.dropZones[A])){this.dropZones[A].hideHover()
}}for(var A=0;
A<C;
A++){if(this._mousePointInDropZone(B,this.dropZones[A])){if(this.dropZones[A].canAccept(this.currentDragObjects)){this.dropZones[A].showHover()
}}}},_startDrag:function(B){for(var A=0;
A<this.currentDragObjects.length;
A++){this.currentDragObjects[A].startDrag()
}this._makeDraggableObjectVisible(B)
},_mouseUpHandler:function(B){if(!this.hasSelection()){return 
}var A=B.which!=undefined;
if((A&&B.which!=1)||(!A&&B.button!=1)){return 
}this.interestedInMotionEvents=false;
if(this.dragElement==null){this._terminateEvent(B);
return 
}if(this._placeDraggableInDropZone(B)){this._completeDropOperation(B)
}else{this._terminateEvent(B)
}Event.stopObserving(document.body,"mousemove",this._mouseMove);
Event.stopObserving(document.body,"mouseup",this._mouseUp)
},_retTrue:function(){return true
},_completeDropOperation:function(A){if(this.dragElement!=this.currentDragObjects[0].getMouseDownHTMLElement()){if(this.dragElement.parentNode!=null){this.dragElement.parentNode.removeChild(this.dragElement)
}}this._deactivateRegisteredDropZones();
this._endDrag();
this.clearSelection();
this.dragElement=null;
this.currentDragObjectVisible=false;
this._terminateEvent(A)
},_doCancelDragProcessing:function(){this._cancelDrag();
if(this.dragElement!=this.currentDragObjects[0].getMouseDownHTMLElement()&&this.dragElement){if(this.dragElement.parentNode!=null){this.dragElement.parentNode.removeChild(this.dragElement)
}}this._deactivateRegisteredDropZones();
this.dragElement=null;
this.currentDragObjectVisible=false
},_placeDraggableInDropZone:function(C){var A=false;
var D=this.dropZones.length;
for(var B=0;
B<D;
B++){if(this._mousePointInDropZone(C,this.dropZones[B])){if(this.dropZones[B].canAccept(this.currentDragObjects)){this.dropZones[B].hideHover();
this.dropZones[B].accept(this.currentDragObjects);
A=true;
break
}}}return A
},_cancelDrag:function(){for(var A=0;
A<this.currentDragObjects.length;
A++){this.currentDragObjects[A].cancelDrag()
}},_endDrag:function(){for(var A=0;
A<this.currentDragObjects.length;
A++){this.currentDragObjects[A].endDrag()
}},_mousePointInDropZone:function(B,C){var A=C.getAbsoluteRect();
return B.clientX>A.left+this._leftOffset(B)&&B.clientX<A.right+this._leftOffset(B)&&B.clientY>A.top+this._topOffset(B)&&B.clientY<A.bottom+this._topOffset(B)
},_addMouseDownHandler:function(A){htmlElement=A.getMouseDownHTMLElement();
if(htmlElement!=null){htmlElement.draggable=A;
Event.observe(htmlElement,"mousedown",this._onmousedown.bindAsEventListener(this));
Event.observe(htmlElement,"mousedown",this._mouseDown)
}},_activateRegisteredDropZones:function(){var C=this.dropZones.length;
for(var A=0;
A<C;
A++){var B=this.dropZones[A];
if(B.canAccept(this.currentDragObjects)){B.activate()
}}this.activatedDropZones=true
},_deactivateRegisteredDropZones:function(){var B=this.dropZones.length;
for(var A=0;
A<B;
A++){this.dropZones[A].deactivate()
}this.activatedDropZones=false
},_onmousedown:function(){Event.observe(document.body,"mousemove",this._mouseMove);
Event.observe(document.body,"mouseup",this._mouseUp)
},_terminateEvent:function(A){if(A.stopPropagation!=undefined){A.stopPropagation()
}else{if(A.cancelBubble!=undefined){A.cancelBubble=true
}}if(A.preventDefault!=undefined){A.preventDefault()
}else{A.returnValue=false
}},initializeEventHandlers:function(){if(typeof document.implementation!="undefined"&&document.implementation.hasFeature("HTML","1.0")&&document.implementation.hasFeature("Events","2.0")&&document.implementation.hasFeature("CSS","2.0")){document.addEventListener("mouseup",this._mouseUpHandler.bindAsEventListener(this),false);
document.addEventListener("mousemove",this._mouseMoveHandler.bindAsEventListener(this),false)
}else{document.attachEvent("onmouseup",this._mouseUpHandler.bindAsEventListener(this));
document.attachEvent("onmousemove",this._mouseMoveHandler.bindAsEventListener(this))
}}};
var dndMgr=new Rico.DragAndDrop();
dndMgr.initializeEventHandlers();
Rico.Draggable=Class.create();
Rico.Draggable.prototype={initialize:function(A,B){this.type=A;
this.htmlElement=$(B);
this.selected=false
},getMouseDownHTMLElement:function(){return this.htmlElement
},select:function(){this.selected=true;
if(this.showingSelected){return 
}var B=this.getMouseDownHTMLElement();
var A=Rico.Color.createColorFromBackground(B);
A.isBright()?A.darken(0.033):A.brighten(0.033);
this.saveBackground=RicoUtil.getElementsComputedStyle(B,"backgroundColor","background-color");
B.style.backgroundColor=A.asHex();
this.showingSelected=true
},deselect:function(){this.selected=false;
if(!this.showingSelected){return 
}var A=this.getMouseDownHTMLElement();
A.style.backgroundColor=this.saveBackground;
this.showingSelected=false
},isSelected:function(){return this.selected
},startDrag:function(){},cancelDrag:function(){},endDrag:function(){},getSingleObjectDragGUI:function(){return this.htmlElement
},getMultiObjectDragGUI:function(A){return this.htmlElement
},getDroppedGUI:function(){return this.htmlElement
},toString:function(){return this.type+":"+this.htmlElement+":"
}};
Rico.Dropzone=Class.create();
Rico.Dropzone.prototype={initialize:function(A){this.htmlElement=$(A);
this.absoluteRect=null
},getHTMLElement:function(){return this.htmlElement
},clearPositionCache:function(){this.absoluteRect=null
},getAbsoluteRect:function(){if(this.absoluteRect==null){var A=this.getHTMLElement();
var B=RicoUtil.toViewportPosition(A);
this.absoluteRect={top:B.y,left:B.x,bottom:B.y+A.offsetHeight,right:B.x+A.offsetWidth}
}return this.absoluteRect
},activate:function(){var C=this.getHTMLElement();
if(C==null||this.showingActive){return 
}this.showingActive=true;
this.saveBackgroundColor=C.style.backgroundColor;
var B="#ffea84";
var A=Rico.Color.createColorFromBackground(C);
if(A==null){C.style.backgroundColor=B
}else{A.isBright()?A.darken(0.2):A.brighten(0.2);
C.style.backgroundColor=A.asHex()
}},deactivate:function(){var A=this.getHTMLElement();
if(A==null||!this.showingActive){return 
}A.style.backgroundColor=this.saveBackgroundColor;
this.showingActive=false;
this.saveBackgroundColor=null
},showHover:function(){var A=this.getHTMLElement();
if(A==null||this.showingHover){return 
}this.saveBorderWidth=A.style.borderWidth;
this.saveBorderStyle=A.style.borderStyle;
this.saveBorderColor=A.style.borderColor;
this.showingHover=true;
A.style.borderWidth="1px";
A.style.borderStyle="solid";
A.style.borderColor="#ffff00"
},hideHover:function(){var A=this.getHTMLElement();
if(A==null||!this.showingHover){return 
}A.style.borderWidth=this.saveBorderWidth;
A.style.borderStyle=this.saveBorderStyle;
A.style.borderColor=this.saveBorderColor;
this.showingHover=false
},canAccept:function(A){return true
},accept:function(B){var D=this.getHTMLElement();
if(D==null){return 
}n=B.length;
for(var A=0;
A<n;
A++){var C=B[A].getDroppedGUI();
if(RicoUtil.getElementsComputedStyle(C,"position")=="absolute"){C.style.position="static";
C.style.top="";
C.style.top=""
}D.appendChild(C)
}}};
RicoUtil=Object.extend(RicoUtil,{getElementsComputedStyle:function(D,A,B){if(arguments.length==2){B=A
}var C=$(D);
if(C.currentStyle){return C.currentStyle[A]
}else{return document.defaultView.getComputedStyle(C,null).getPropertyValue(B)
}},createXmlDocument:function(){if(document.implementation&&document.implementation.createDocument){var A=document.implementation.createDocument("","",null);
if(A.readyState==null){A.readyState=1;
A.addEventListener("load",function(){A.readyState=4;
if(typeof A.onreadystatechange=="function"){A.onreadystatechange()
}},false)
}return A
}if(window.ActiveXObject){return Try.these(function(){return new ActiveXObject("MSXML2.DomDocument")
},function(){return new ActiveXObject("Microsoft.DomDocument")
},function(){return new ActiveXObject("MSXML.DomDocument")
},function(){return new ActiveXObject("MSXML3.DomDocument")
})||false
}return null
},getContentAsString:function(A){return A.xml!=undefined?this._getContentAsStringIE(A):this._getContentAsStringMozilla(A)
},_getContentAsStringIE:function(A){var C="";
for(var B=0;
B<A.childNodes.length;
B++){var D=A.childNodes[B];
if(D.nodeType==4){C+=D.nodeValue
}else{C+=D.xml
}}return C
},_getContentAsStringMozilla:function(B){var A=new XMLSerializer();
var D="";
for(var C=0;
C<B.childNodes.length;
C++){var E=B.childNodes[C];
if(E.nodeType==4){D+=E.nodeValue
}else{D+=A.serializeToString(E)
}}return D
},toViewportPosition:function(A){return this._toAbsolute(A,true)
},toDocumentPosition:function(A){return this._toAbsolute(A,false)
},_toAbsolute:function(B,E){if(navigator.userAgent.toLowerCase().indexOf("msie")==-1){return this._toAbsoluteMozilla(B,E)
}var A=0;
var G=0;
var D=B;
while(D){var C=0;
var F=0;
if(D!=B){var C=parseInt(this.getElementsComputedStyle(D,"borderLeftWidth"));
var F=parseInt(this.getElementsComputedStyle(D,"borderTopWidth"));
C=isNaN(C)?0:C;
F=isNaN(F)?0:F
}A+=D.offsetLeft-D.scrollLeft+C;
G+=D.offsetTop-D.scrollTop+F;
D=D.offsetParent
}if(E){A-=this.docScrollLeft();
G-=this.docScrollTop()
}return{x:A,y:G}
},_toAbsoluteMozilla:function(B,D){var A=0;
var E=0;
var C=B;
while(C){A+=C.offsetLeft;
E+=C.offsetTop;
C=C.offsetParent
}C=B;
while(C&&C!=document.body&&C!=document.documentElement){if(C.scrollLeft){A-=C.scrollLeft
}if(C.scrollTop){E-=C.scrollTop
}C=C.parentNode
}if(D){A-=this.docScrollLeft();
E-=this.docScrollTop()
}return{x:A,y:E}
},docScrollLeft:function(){if(window.pageXOffset){return window.pageXOffset
}else{if(document.documentElement&&document.documentElement.scrollLeft){return document.documentElement.scrollLeft
}else{if(document.body){return document.body.scrollLeft
}else{return 0
}}}},docScrollTop:function(){if(window.pageYOffset){return window.pageYOffset
}else{if(document.documentElement&&document.documentElement.scrollTop){return document.documentElement.scrollTop
}else{if(document.body){return document.body.scrollTop
}else{return 0
}}}}});
Rico.includeLoaded("ricoDragDrop.js");Rico.Color=Class.create();
Rico.Color.prototype={initialize:function(C,B,A){this.rgb={r:C,g:B,b:A}
},setRed:function(A){this.rgb.r=A
},setGreen:function(A){this.rgb.g=A
},setBlue:function(A){this.rgb.b=A
},setHue:function(B){var A=this.asHSB();
A.h=B;
this.rgb=Rico.Color.HSBtoRGB(A.h,A.s,A.b)
},setSaturation:function(B){var A=this.asHSB();
A.s=B;
this.rgb=Rico.Color.HSBtoRGB(A.h,A.s,A.b)
},setBrightness:function(A){var B=this.asHSB();
B.b=A;
this.rgb=Rico.Color.HSBtoRGB(B.h,B.s,B.b)
},darken:function(B){var A=this.asHSB();
this.rgb=Rico.Color.HSBtoRGB(A.h,A.s,Math.max(A.b-B,0))
},brighten:function(B){var A=this.asHSB();
this.rgb=Rico.Color.HSBtoRGB(A.h,A.s,Math.min(A.b+B,1))
},blend:function(A){this.rgb.r=Math.floor((this.rgb.r+A.rgb.r)/2);
this.rgb.g=Math.floor((this.rgb.g+A.rgb.g)/2);
this.rgb.b=Math.floor((this.rgb.b+A.rgb.b)/2)
},isBright:function(){var A=this.asHSB();
return this.asHSB().b>0.5
},isDark:function(){return !this.isBright()
},asRGB:function(){return"rgb("+this.rgb.r+","+this.rgb.g+","+this.rgb.b+")"
},asHex:function(){return"#"+this.rgb.r.toColorPart()+this.rgb.g.toColorPart()+this.rgb.b.toColorPart()
},asHSB:function(){return Rico.Color.RGBtoHSB(this.rgb.r,this.rgb.g,this.rgb.b)
},toString:function(){return this.asHex()
}};
Rico.Color.createFromHex=function(D){if(D.length==4){var B=D;
var D="#";
for(var C=1;
C<4;
C++){D+=(B.charAt(C)+B.charAt(C))
}}if(D.indexOf("#")==0){D=D.substring(1)
}var F=D.substring(0,2);
var E=D.substring(2,4);
var A=D.substring(4,6);
return new Rico.Color(parseInt(F,16),parseInt(E,16),parseInt(A,16))
};
Rico.Color.createColorFromBackground=function(D){var B=Element.getStyle(D,"background-color");
if(B.match(/^(transparent|rgba\(0,\s*0,\s*0,\s*0\))$/i)&&D.parentNode){return Rico.Color.createColorFromBackground(D.parentNode)
}if(B==null){return new Rico.Color(255,255,255)
}if(B.indexOf("rgb(")==0){var A=B.substring(4,B.length-1);
var C=A.split(",");
return new Rico.Color(parseInt(C[0]),parseInt(C[1]),parseInt(C[2]))
}else{if(B.indexOf("#")==0){return Rico.Color.createFromHex(B)
}else{return new Rico.Color(255,255,255)
}}};
Rico.Color.HSBtoRGB=function(G,E,I){var C=0;
var D=0;
var J=0;
if(E==0){C=parseInt(I*255+0.5);
D=C;
J=C
}else{var F=(G-Math.floor(G))*6;
var H=F-Math.floor(F);
var B=I*(1-E);
var A=I*(1-E*H);
var K=I*(1-(E*(1-H)));
switch(parseInt(F)){case 0:C=(I*255+0.5);
D=(K*255+0.5);
J=(B*255+0.5);
break;
case 1:C=(A*255+0.5);
D=(I*255+0.5);
J=(B*255+0.5);
break;
case 2:C=(B*255+0.5);
D=(I*255+0.5);
J=(K*255+0.5);
break;
case 3:C=(B*255+0.5);
D=(A*255+0.5);
J=(I*255+0.5);
break;
case 4:C=(K*255+0.5);
D=(B*255+0.5);
J=(I*255+0.5);
break;
case 5:C=(I*255+0.5);
D=(B*255+0.5);
J=(A*255+0.5);
break
}}return{r:parseInt(C),g:parseInt(D),b:parseInt(J)}
};
Rico.Color.RGBtoHSB=function(A,E,J){var F;
var D;
var I;
var K=(A>E)?A:E;
if(J>K){K=J
}var G=(A<E)?A:E;
if(J<G){G=J
}I=K/255;
if(K!=0){D=(K-G)/K
}else{D=0
}if(D==0){F=0
}else{var B=(K-A)/(K-G);
var H=(K-E)/(K-G);
var C=(K-J)/(K-G);
if(A==K){F=C-H
}else{if(E==K){F=2+B-C
}else{F=4+H-B
}}F=F/6;
if(F<0){F=F+1
}}return{h:F,s:D,b:I}
};
Rico.Corner={round:function(D,B){var D=$(D);
this._setOptions(B);
var A=this.options.color=="fromElement"?this._background(D):this.options.color;
var C=this.options.bgColor=="fromParent"?this._background(D.parentNode):this.options.bgColor;
this._roundCornersImpl(D,A,C)
},_roundCornersImpl:function(C,A,B){if(this.options.border){this._renderBorder(C,B)
}if(this._isTopRounded()){this._roundTopCorners(C,A,B)
}if(this._isBottomRounded()){this._roundBottomCorners(C,A,B)
}},_renderBorder:function(D,E){var B="1px solid "+this._borderColor(E);
var A="border-left: "+B;
var F="border-right: "+B;
var C="style='"+A+";"+F+"'";
D.innerHTML="<div "+C+">"+D.innerHTML+"</div>"
},_roundTopCorners:function(C,A,E){var D=this._createCorner(E);
for(var B=0;
B<this.options.numSlices;
B++){D.appendChild(this._createCornerSlice(A,E,B,"top"))
}C.style.paddingTop="0px";
C.insertBefore(D,C.firstChild)
},_roundBottomCorners:function(C,A,E){var D=this._createCorner(E);
for(var B=(this.options.numSlices-1);
B>=0;
B--){D.appendChild(this._createCornerSlice(A,E,B,"bottom"))
}C.style.paddingBottom=0;
C.appendChild(D)
},_createCorner:function(B){var A=document.createElement("div");
A.style.backgroundColor=(this._isTransparent()?"transparent":B);
return A
},_createCornerSlice:function(C,D,G,A){var E=document.createElement("span");
var B=E.style;
B.backgroundColor=C;
B.display="block";
B.height="1px";
B.overflow="hidden";
B.fontSize="1px";
var F=this._borderColor(C,D);
if(this.options.border&&G==0){B.borderTopStyle="solid";
B.borderTopWidth="1px";
B.borderLeftWidth="0px";
B.borderRightWidth="0px";
B.borderBottomWidth="0px";
B.height="0px";
B.borderColor=F
}else{if(F){B.borderColor=F;
B.borderStyle="solid";
B.borderWidth="0px 1px"
}}if(!this.options.compact&&(G==(this.options.numSlices-1))){B.height="2px"
}this._setMargin(E,G,A);
this._setBorder(E,G,A);
return E
},_setOptions:function(A){this.options={corners:"all",color:"fromElement",bgColor:"fromParent",blend:true,border:false,compact:false};
Object.extend(this.options,A||{});
this.options.numSlices=this.options.compact?2:4;
if(this._isTransparent()){this.options.blend=false
}},_whichSideTop:function(){if(this._hasString(this.options.corners,"all","top")){return""
}if(this.options.corners.indexOf("tl")>=0&&this.options.corners.indexOf("tr")>=0){return""
}if(this.options.corners.indexOf("tl")>=0){return"left"
}else{if(this.options.corners.indexOf("tr")>=0){return"right"
}}return""
},_whichSideBottom:function(){if(this._hasString(this.options.corners,"all","bottom")){return""
}if(this.options.corners.indexOf("bl")>=0&&this.options.corners.indexOf("br")>=0){return""
}if(this.options.corners.indexOf("bl")>=0){return"left"
}else{if(this.options.corners.indexOf("br")>=0){return"right"
}}return""
},_borderColor:function(A,B){if(A=="transparent"){return B
}else{if(this.options.border){return this.options.border
}else{if(this.options.blend){return this._blend(B,A)
}else{return""
}}}},_setMargin:function(D,E,B){var C=this._marginSize(E);
var A=B=="top"?this._whichSideTop():this._whichSideBottom();
if(A=="left"){D.style.marginLeft=C+"px";
D.style.marginRight="0px"
}else{if(A=="right"){D.style.marginRight=C+"px";
D.style.marginLeft="0px"
}else{D.style.marginLeft=C+"px";
D.style.marginRight=C+"px"
}}},_setBorder:function(D,E,B){var C=this._borderSize(E);
var A=B=="top"?this._whichSideTop():this._whichSideBottom();
if(A=="left"){D.style.borderLeftWidth=C+"px";
D.style.borderRightWidth="0px"
}else{if(A=="right"){D.style.borderRightWidth=C+"px";
D.style.borderLeftWidth="0px"
}else{D.style.borderLeftWidth=C+"px";
D.style.borderRightWidth=C+"px"
}}if(this.options.border!=false){D.style.borderLeftWidth=C+"px"
}D.style.borderRightWidth=C+"px"
},_marginSize:function(E){if(this._isTransparent()){return 0
}var D=[5,3,2,1];
var A=[3,2,1,0];
var C=[2,1];
var B=[1,0];
if(this.options.compact&&this.options.blend){return B[E]
}else{if(this.options.compact){return C[E]
}else{if(this.options.blend){return A[E]
}else{return D[E]
}}}},_borderSize:function(E){var D=[5,3,2,1];
var B=[2,1,1,1];
var A=[1,0];
var C=[0,2,0,0];
if(this.options.compact&&(this.options.blend||this._isTransparent())){return 1
}else{if(this.options.compact){return A[E]
}else{if(this.options.blend){return B[E]
}else{if(this.options.border){return C[E]
}else{if(this._isTransparent()){return D[E]
}}}}}return 0
},_hasString:function(B){for(var A=1;
A<arguments.length;
A++){if(B.indexOf(arguments[A])>=0){return true
}}return false
},_blend:function(C,A){var B=Rico.Color.createFromHex(C);
B.blend(Rico.Color.createFromHex(A));
return B
},_background:function(A){try{return Rico.Color.createColorFromBackground(A).asHex()
}catch(B){return"#ffffff"
}},_isTransparent:function(){return this.options.color=="transparent"
},_isTopRounded:function(){return this._hasString(this.options.corners,"all","top","tl","tr")
},_isBottomRounded:function(){return this._hasString(this.options.corners,"all","bottom","bl","br")
},_hasSingleTextChild:function(A){return A.childNodes.length==1&&A.childNodes[0].nodeType==3
}};
Rico.includeLoaded("ricoStyles.js");MW={};
MW.VERSION_NUMBER="$Revision: 1.0 $";MW.transformXml=function(A,C){var B;
if(navigator.appVersion.indexOf("MSIE")!=-1){B=this.transformIE(A,C)
}else{B=this.transformMOZ(A,C)
}return B
};
MW.transformIE=function(A,C){var D=A;
if(!(D.firstChild)){D=new ActiveXObject("Microsoft.XMLDOM");
D.async=false;
D.loadXML(A)
}var B=D.transformNode(C);
return B
};
MW.transformMOZ=function(C,D){var B=new XSLTProcessor();
B.importStylesheet(D);
var H=document.implementation.createDocument("","",null);
var F=C;
if(!(F instanceof Document)){F=H.loadXML(C)
}var E=B.transformToDocument(F);
var A=new XMLSerializer();
var G=A.serializeToString(E);
return G
};
if(navigator.userAgent.indexOf("Gecko")!=-1){Document.prototype.loadXML=function(A){var C=new DOMParser();
var B=C.parseFromString(A,"text/xml");
return B
}
};MW.Control=OpenLayers.Class(OpenLayers.Control,{});MW.Format=OpenLayers.Class(OpenLayers.Format,{});MW.GeometryUtil=new Object();
MW.GeometryUtil.getCoordinatesFromComponent=function(F){var C=[];
var B=0;
var H=F.getComponentsString();
B=0;
var G=H.indexOf(",");
while(G!=-1){var E=H.substring(0,G);
var D=null;
H=H.substring(G+1);
G=H.indexOf(",");
if(G!=-1){D=H.substring(0,G);
H=H.substring(G+1);
G=H.indexOf(",")
}else{D=H
}E=(new Number(E)).valueOf();
D=(new Number(D)).valueOf();
var A=[];
A[0]=E;
A[1]=D;
C[B]=A;
B++
}return C
};
MW.GeometryUtil.containsGeometry=function(D,B){var G=MW.GeometryUtil.getCoordinatesFromComponent(D);
var E=MW.GeometryUtil.getCoordinatesFromComponent(B);
for(i=0;
i<E.length;
i++){var F=0;
var A=E[i][0];
var C=E[i][1];
for(j=0;
j<G.length-1;
j++){if(G[j][1]<=C){if(G[j+1][1]>C){if(MW.GeometryUtil.isLeft(G[j],G[j+1],E[i])>0){F++
}}}else{if(G[j+1][1]<=C){if(MW.GeometryUtil.isLeft(G[j],G[j+1],E[i])<0){F=F-1
}}}}if(F==0){return false
}}return true
};
MW.GeometryUtil.isLeft=function(B,A,C){return((A[0]-B[0])*(C[1]-B[1])-(C[0]-B[0])*(A[1]-B[1]))
};MW.Layer=OpenLayers.Class({loading:null,setLoading:function(){this.events.register("loadstart",this,this.startLoading);
this.events.register("loadend",this,this.stopLoading);
this.events.register("loadcancel",this,this.stopLoading)
},startLoading:function(A){if(this.loading==null){this.loading=new MW.Control.LoadingMessage();
if((this.map!=null)&&(this.loading!=null)){this.map.addControl(this.loading)
}}this.loading.startLoad()
},stopLoading:function(A){if(this.map!=null&&this.loading!=null){this.loading.stopLoad()
}},CLASS_NAME:"MW.Layer"});MW.Map=OpenLayers.Class(OpenLayers.Map,{layerMinZoomLevel:null,initialCenter:null,latShift:null,layerMinZoomLevelImgPath:null,minZoomLevel:0,layerMinZoomLevelBounds:null,copyrightControl:null,floatingDivList:null,widthImageFixed:null,heightImageFixed:null,initialize:function(B,A){OpenLayers.Map.prototype.initialize.apply(this,[B,A]);
this.div.style.overflowY="auto";
this.floatingDivList=new Array();
if(this.initialCenter==null){this.initialCenter=this.maxExtent.getCenterLonLat()
}if(this.latShift!=null){this.initialCenter.lat+=this.latShift
}},setCenter:function(H,N,L,D){if(!this.center&&!this.isValidLonLat(H)){H=this.maxExtent.getCenterLonLat()
}if(this.restrictedExtent!=null){if(H==null){H=this.getCenter()
}if(N==null){N=this.getZoom()
}var E=this.getResolutionForZoom(N);
var O=this.calculateBounds(H,E);
if(!this.restrictedExtent.containsBounds(O)){var Q=this.restrictedExtent.getCenterLonLat();
if(O.getWidth()>this.restrictedExtent.getWidth()){H=new OpenLayers.LonLat(Q.lon,H.lat)
}else{if(O.left<this.restrictedExtent.left){H=H.add(this.restrictedExtent.left-O.left,0)
}else{if(O.right>this.restrictedExtent.right){H=H.add(this.restrictedExtent.right-O.right,0)
}}}if(O.getHeight()>this.restrictedExtent.getHeight()){H=new OpenLayers.LonLat(H.lon,Q.lat)
}else{if(O.bottom<this.restrictedExtent.bottom){H=H.add(0,this.restrictedExtent.bottom-O.bottom)
}else{if(O.top>this.restrictedExtent.top){H=H.add(0,this.restrictedExtent.top-O.top)
}}}}}var B=D||((this.isValidZoomLevel(N))&&(N!=this.getZoom()));
if(this.layerMinZoomLevelImgPath!=null&&this.layerMinZoomLevelBounds==null){if(this.widthImageFixed!=null&&this.heightImageFixed!=null){var C=this.widthImageFixed;
var M=this.heightImageFixed;
this.layerMinZoomLevelBounds=this.calculateBoundsMinZoomLevel(this.initialCenter,this.getMaxResolution(),new OpenLayers.Size(C-2,M));
this.layerMinZoomLevelGraphicLayer=new OpenLayers.Layer.Image(this.layerMinZoomLevel,this.layerMinZoomLevelImgPath,this.layerMinZoomLevelBounds,new OpenLayers.Size(C,M));
this.layerMinZoomLevelGraphicLayer.imageSize=new OpenLayers.Size(C,M);
this.layerMinZoomLevelGraphicLayer.imageOffset=new OpenLayers.Pixel(-1,0)
}else{this.layerMinZoomLevelBounds=this.calculateBounds(this.initialCenter,this.getMaxResolution());
this.layerMinZoomLevelGraphicLayer=new OpenLayers.Layer.Image(this.layerMinZoomLevel,this.layerMinZoomLevelImgPath,this.layerMinZoomLevelBounds,this.size)
}this.layerMinZoomLevelGraphicLayer.setIsBaseLayer(false);
this.layerMinZoomLevelGraphicLayer.setVisibility(true);
this.layerMinZoomLevelGraphicLayer.displayInLayerSwitcher=false;
this.addLayer(this.layerMinZoomLevelGraphicLayer);
this.layerMinZoomLevelGraphicLayer.setZIndex(this.Z_INDEX_BASE.Overlay-5)
}var P=this.getLayerByName(this.layerMinZoomLevel);
if(this.layerMinZoomLevel!=null){if(this.getZoom()>0&&N==0){H=this.initialCenter
}}var F=(this.isValidLonLat(H))&&(!H.equals(this.center));
if(B||F||!L){if(!L){this.events.triggerEvent("movestart")
}if(F){if((!B)&&(this.center)){this.centerLayerContainer(H)
}this.center=H.clone()
}if((B)||(this.layerContainerOrigin==null)){if(this.center==null){this.center=H.clone()
}this.layerContainerOrigin=this.center.clone();
this.layerContainerDiv.style.left="0px";
this.layerContainerDiv.style.top="0px"
}if(B){this.zoom=N;
this.viewRequestID++
}var A=this.getExtent();
this.baseLayer.moveTo(A,B,L);
for(var G=0;
G<this.layers.length;
G++){var J=this.layers[G];
if(!J.isBaseLayer){var I;
var K=J.calculateInRange();
I=(J.visibility&&K);
if(J.inRange!=K){J.inRange=K;
this.events.triggerEvent("changelayer")
}if(I){J.moveTo(A,B,L)
}else{J.display(false)
}}}if(B){for(var G=0;
G<this.popups.length;
G++){this.popups[G].updatePosition()
}}this.events.triggerEvent("move");
if(B){this.events.triggerEvent("zoomend");
if(P!=null){if(this.getZoom()>0){P.setVisibility(false)
}else{P.setVisibility(true);
P.tile.imgDiv.style.display="block"
}}}}if(!L){this.events.triggerEvent("moveend")
}},isValidZoomLevel:function(A){return((A!=null)&&(A>=this.minZoomLevel)&&(A<this.getNumZoomLevels()))
},getLayerByName:function(B){var A=null;
for(var D=0;
D<this.layers.length;
D++){var C=this.layers[D];
if((C.name!=null)&&(C.name==B)){A=C
}}return A
},zoomToExtent:function(A){if(!this.isValidLonLat(A.getCenterLonLat())&&this.zoom==0){return false
}this.setCenter(A.getCenterLonLat(),this.getZoomForExtent(A))
},getInitialCenter:function(){return this.initialCenter
},addLayer:function(A){A.div.className="olLayerDiv";
OpenLayers.Map.prototype.addLayer.apply(this,arguments)
},calculateBoundsMinZoomLevel:function(A,B,D){var E=null;
if(A==null){A=this.getCenter()
}if(B==null){B=this.getResolution()
}if((A!=null)&&(B!=null)){var F=D.w*B;
var C=D.h*B;
E=new OpenLayers.Bounds(A.lon-F/2,A.lat-C/2,A.lon+F/2,A.lat+C/2)
}return E
},CLASS_NAME:"MW.Map"});MW.Marker=OpenLayers.Class(OpenLayers.Marker,{id:null,iconUrl:null,iconSize:null,popup:null,popupsize:null,serializable:{props:["lonlat","icon","id","iconUrl","iconSize","popup","popupsize","position","visible"],args:[]},position:null,visible:true,initialize:function(A){OpenLayers.Util.extend(this,A);
if(this.iconSize==null){this.iconSize=new OpenLayers.Size(35,35)
}var C;
if(this.position=="center"){C=-this.iconSize.h/2
}else{C=-this.iconSize.h
}if(this.iconUrl!=null){var B=new OpenLayers.Pixel(-(this.iconSize.w/2),C);
this.icon=new OpenLayers.Icon(this.iconUrl,this.iconSize,B)
}else{if(this.icon==null){var B=new OpenLayers.Pixel(-(this.iconSize.w/2),C);
this.icon=new OpenLayers.Icon(OpenLayers.ImgPath+"marker.png",this.iconSize,B)
}}this.icon.imageDiv.style.cursor="pointer";
this.events=new OpenLayers.Events(this,this.icon.imageDiv,null);
this.events.register("dblclick",this,this.stopevent);
this.events.register("mousedown",this,this.stopevent);
this.events.register("click",this,this.markerClick.bind(this))
},hideMarker:function(){this.icon.display(false);
this.visible=false
},createPopup:function(E,D){if(D==null){D=false
}this.icon.position=this.position;
var B={lonlat:this.lonlat,text:E,anchor:this.icon};
var A=new MW.Popup(B);
A.setBackgroundColor("transparent");
this.map.addPopup(A);
if(D){A.show()
}else{A.hide()
}this.popupcloser=document.getElementById(A.id+"_popupcloser");
var C=A.hide.bindAsEventListener(A);
OpenLayers.Event.observe(this.popupcloser,"click",C);
this.popup=A;
return A
},setPopup:function(A,C){if(C==null){C=false
}A.setBackgroundColor("transparent");
if(C){A.show()
}else{A.hide()
}this.map.addPopup(A);
this.popupcloser=document.getElementById(A.id+"_popupcloser");
if(this.popupcloser!=null){var B=A.hide.bindAsEventListener(A);
OpenLayers.Event.observe(this.popupcloser,"click",B)
}this.popup=A;
this.popup.updateTopPosition();
return A
},stopevent:function(A){OpenLayers.Event.stop(A,true)
},markerClick:function(B){if(this.popup!=null){if(this.popup.visible()==true){this.popup.hide()
}else{this.popup.show();
if(this.map.layerMinZoomLevel!=null&&this.map.getZoom()>0){var C=this.map.getExtent();
var D=this.map.getCenter();
var A=D.lon;
var E=D.lat;
if((this.lonlat.lon+this.popup.size.w/2*this.map.getResolution())>C.right){A=A+((this.lonlat.lon+this.popup.size.w/2*this.map.getResolution())-C.right)
}if((C.left>this.lonlat.lon-this.popup.size.w/2*this.map.getResolution())){A=A-((C.left-this.lonlat.lon+this.popup.size.w/2*this.map.getResolution()))
}if((this.lonlat.lat+this.popup.size.h*this.map.getResolution()+this.icon.size.h*this.map.getResolution())>C.top){E=E+((this.lonlat.lat+this.popup.size.h*this.map.getResolution()+this.icon.size.h*this.map.getResolution())-C.top)
}this.map.setCenter(new OpenLayers.LonLat(A,E),this.map.getZoom())
}}}OpenLayers.Event.stop(B,true)
},display:function(A){this.icon.display(A);
this.icon.imageDiv.style.visibility=(A)?"visible":"hidden";
this.visible=A
},destroy:function(){this.map=null;
this.events.destroy();
this.events=null;
if(this.icon!=null){this.icon.destroy();
this.icon=null
}if(this.popup!=null){this.popup.destroy();
this.popup=null
}},CLASS_NAME:"MW.Marker"});MW.Popup=OpenLayers.Class(OpenLayers.Popup,{text:null,anchor:null,firstTimeShow:false,serializable:{props:["id","lonlat","size","contentHTML","text","anchor","firstTimeShow"],args:[]},initialize:function(A){OpenLayers.Util.extend(this,A);
if(this.id==null||this.id==""){this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")
}if(this.contentSize==null){this.contentSize=new OpenLayers.Size(OpenLayers.Popup.WIDTH,OpenLayers.Popup.HEIGHT)
}this.backgroundColor=OpenLayers.Popup.COLOR;
this.opacity=OpenLayers.Popup.OPACITY;
this.border=OpenLayers.Popup.BORDER;
this.div=OpenLayers.Util.createDiv(this.id,null,null,null,null,null,"hidden");
this.groupDiv=OpenLayers.Util.createDiv(null,null,null,null,"relative",null,"hidden");
var B=this.div.id+"_contentDiv";
this.contentDiv=OpenLayers.Util.createDiv(B,null,this.contentSize.clone(),null,"relative",null,"hidden");
this.contentDiv.className="MWControlPopup";
this.groupDiv.appendChild(this.contentDiv);
this.div.appendChild(this.groupDiv);
this.setSize(this.contentSize);
this.registerEvents()
},destroy:function(){if(this.map!=null){this.map.removePopup(this);
this.map=null
}if(this.events!=null){this.events.destroy();
this.events=null
}this.div=null
},draw:function(B){var E=true;
if(navigator.appVersion.indexOf("MSIE")!=-1){E=false
}if(B==null){if((this.lonlat!=null)&&(this.map!=null)){B=this.map.getLayerPxFromLonLat(this.lonlat)
}}this.setSize(this.contentSize);
this.setBackgroundColor();
this.setBorder();
if(this.contentHTML==null||this.contentHTML==""){var C='<div id="popupelement" style="padding-left:90px; width: 310px; text-align: left;">';
if(E==false){var D=navigator.appVersion.split("MSIE");
var A=parseFloat(D[1]);
if(A<6.5){C=C+'<div style="background: url('+OpenLayers.ImgPath+'/balloon_up.gif) no-repeat top left; width: 150px; height: 30px;" ><div style="background: #ffffff url('+OpenLayers.ImgPath+'/chiusura.gif) no-repeat top right; float: right; width: 15px; height: 15px; margin-top: 10px;margin-right: 8px;cursor: pointer;" id="'+this.id+'_popupcloser"></div></div>'
}else{C=C+'<div style="background: url('+OpenLayers.ImgPath+'/balloon_up.png) no-repeat top left; width: 150px; height: 30px;" ><div style="background: #ffffff url('+OpenLayers.ImgPath+'/chiusura.gif) no-repeat top right; float: right; width: 15px; height: 15px; margin-top: 10px;margin-right: 8px;cursor: pointer;" id="'+this.id+'_popupcloser"></div></div>'
}}else{C=C+'<div style="background: url('+OpenLayers.ImgPath+'/balloon_up.png) no-repeat top left; width: 150px; height: 30px;" ><div style="background: #ffffff url('+OpenLayers.ImgPath+'/chiusura.gif) no-repeat top right; float: right; width: 15px; height: 15px; margin-top: 10px;margin-right: 8px;cursor: pointer;" id="'+this.id+'_popupcloser"></div></div>'
}if(this.text!=null){C=C+'<div style="background: #ffffff; border: 2px solid #F39E00; border-top: 0px;border-bottom: 0px;width: 146px!important;width: 150px; float: left;font-family:Verdana;font-size:9px;color:black;padding-top:0px;padding-bottom:0px;"><p style="margin:0px;padding:0px;padding-left:10px;padding-right:10px;">'+this.text+"</p></div>"
}if(E==false){C=C+"<div style=\"filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+OpenLayers.ImgPath+"/balloon_down.png');width:310px; height: 71px; float: left;\"></div></div>"
}else{C=C+'<div style="background: url('+OpenLayers.ImgPath+'/balloon_down.png) no-repeat bottom left; width:310px; height: 71px; float: left;"></div></div>'
}this.setContentHTML(C)
}else{this.setContentHTML(this.contentHTML)
}this.moveTo(B);
return this.div
},moveTo:function(A){if(this.anchor!=null){var B=this.map.getLonLatFromPixel(A);
B.lon=B.lon-this.size.w*this.map.getResolution()/2;
if(this.anchor.position=="center"){B.lat=B.lat+this.size.h*this.map.getResolution()+this.anchor.size.h/2*this.map.getResolution()
}else{B.lat=B.lat+this.size.h*this.map.getResolution()+this.anchor.size.h*this.map.getResolution()
}A=this.map.getPixelFromLonLat(B)
}if((A!=null)&&(this.div!=null)){this.div.style.left=A.x+"px";
this.div.style.top=A.y+"px"
}},show:function(){OpenLayers.Element.show(this.div);
if(this.firstTimeShow==false){this.updateTopPosition();
this.firstTimeShow=true
}},updateTopPosition:function(){this.contentDiv.style.height="";
if(this.contentDiv.firstChild!=null){var B=Math.abs(parseInt(this.contentDiv.offsetHeight)-this.size.h);
this.div.style.top=(parseInt(this.div.style.top)-B)+"px";
this.div.style.height=(parseInt(this.div.style.height)+B)+"px";
var A=new OpenLayers.Size(this.size.w,this.div.style.height);
this.setSize(A)
}},CLASS_NAME:"MW.Popup"});
OpenLayers.Popup.WIDTH=310;
OpenLayers.Popup.HEIGHT=77;
OpenLayers.Popup.COLOR="white";
OpenLayers.Popup.OPACITY=1;
OpenLayers.Popup.BORDER="0px";MW.Util=new Object();
MW.createUrl=function(A,D){var C=document.createElement("a");
C.href="#";
C.innerHTML=D;
C.events=new OpenLayers.Events(this,C,null);
var B={link:A};
C.events.register("click",C,OpenLayers.Function.bindAsEventListener(MW.openUrl,B));
return C
};
MW.openUrl=function(){var B=(this.link).toLowerCase();
B=B.replace(/ /g,"");
B=B.replace(/ /g,"");
B=B.replace(/'/g,"");
var A=new Object();
A=window.open(B,"","");
A.focus()
};
MW.Util.findPosX=function(A){var B=0;
if(A.offsetParent){while(1){B+=A.offsetLeft;
if(!A.offsetParent){break
}A=A.offsetParent
}}else{if(A.x){B+=A.x
}}return B
};
MW.Util.findPosY=function(B){var A=0;
if(B.offsetParent){while(1){A+=B.offsetTop;
if(!B.offsetParent){break
}B=B.offsetParent
}}else{if(B.y){A+=B.y
}}return A
};
OpenLayers.Proxy="";
MW.Util.escapeUri=function(A){return(A.substring(A.indexOf("http://")+7))
};
MW.Util.transformXMLJStoXMLString=function(B){var A=B;
A=A.replace(/&lt;/g,"<");
A=A.replace(/&gt;/g,">");
return A
};
OpenLayers.IMAGE_RELOAD_ATTEMPTS=1;
OpenLayers.Util.onImageLoadError=function(){this._attempts=(this._attempts)?(this._attempts+1):1;
if(this._attempts<=OpenLayers.IMAGE_RELOAD_ATTEMPTS){this.src=this.src
}else{this.style.visibility="hidden"
}this.style.display=""
};
OpenLayers.Util.onImageLoad=function(){if(!this.viewRequestID||(this.map&&this.viewRequestID==this.map.viewRequestID)){this.style.backgroundColor=null;
this.style.display="";
this.style.visibility="visible"
}};MW.Classify=OpenLayers.Class({layer:null,stroke:{color:"",size:"",opacity:""},fill:{color:"",opacity:""},markerSymbol:{name:"",size:""},label:{field:"",font:"",size:"8",x_pos:"",y_pos:"",rotation:"",color:"",opacity:""},scale:{min:"",max:""},filter:{field_name:"",paletteName:"",num_classes:"",division:""},initialize:function(A){OpenLayers.Util.extend(this,A)
},getLayer:function(){return this.layer
},setLayer:function(A){this.layer=A
},getStroke:function(){return this.stroke
},setStroke:function(A){this.stroke=A
},getFill:function(){return this.fill
},setFill:function(A){this.fill=A
},getMarkerSymbol:function(){return this.markerSymbol
},setMarkerSymbol:function(A){this.markerSymbol=A
},getLabel:function(){return this.label
},setLabel:function(A){this.label=A
},getScale:function(){return this.scale
},setScale:function(A){this.scale=A
},getFilter:function(){return this.filter
},setFilter:function(A){this.filter=A
},reset:function(){this.layer=null;
this.stroke={color:"",size:"",opacity:""};
this.fill={color:"",opacity:""};
this.markerSymbol={name:"",size:""};
this.label={field:"",font:"",size:"",x_pos:"",y_pos:"",rotation:"",color:"",opacity:""};
this.scale={min:"",max:""};
this.filter={field_name:"",paletteName:"",num_classes:"",division:""}
},CLASS_NAME:"MW.Classify"});MW.WMSLayer=OpenLayers.Class({physicalName:null,logicalName:null,group:null,visibility:false,minZoomLevel:null,maxZoomLevel:null,inRange:true,displayInLayerSwitcher:true,legendUrl:null,serializable:{props:["physicalName","logicalName","group","minZoomLevel","maxZoomLevel","visibility","legendUrl","displayInLayerSwitcher","legendName"],args:[]},legendName:true,initialize:function(A){OpenLayers.Util.extend(this,A);
if(!this.logicalName){this.logicalName=this.physicalName
}},calculateInRange:function(A){var B=true;
if(this.minZoomLevel!=null&&this.maxZoomLevel!=null){B=((A>=this.minZoomLevel)&&(A<=this.maxZoomLevel))
}return B
},getVisibility:function(){return this.visibility
},setVisibility:function(A){this.visibility=A
},CLASS_NAME:"MW.WMSLayer"});MW.Control.Aci=OpenLayers.Class(OpenLayers.Control,{id:null,div:null,divPanel:null,divDetail:null,htmlDetail:null,urlDetail:null,findUrl:null,findResult:null,sezione:null,foglio:null,mappale:null,sub:null,ente:null,tipovia:null,via:null,numero:null,interno:{numero:"",esponente:"",scala:"",piano:""},esponente:null,address:null,namespace_uri_gml:"http://www.opengis.net/gml",namespace_prefix_gml:"gml",markersLayer:null,geocoding:true,civico:true,events:null,loading:null,EVENT_TYPES:["loadComplete","loadFailure"],fallThrough:false,iconUrl:"marker.png",iconSize:new OpenLayers.Size(21,25),xslPath:null,xsl:null,layerSel:null,initialize:function(A){OpenLayers.Control.prototype.initialize.apply(this,[A]);
this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");
this.markersLayer=new MW.Layer.Markers("markersAci");
this.markersLayer.displayInLayerSwitcher=false;
this.events.register("loadComplete",this,this.stopLoading);
this.events.register("loadFailure",this,this.stopLoading)
},reset:function(){this.markersLayer.clearMarkers();
this.findResult=null
},showMarker:function(F,H){AutoSizeFramedCloud=OpenLayers.Class(OpenLayers.Popup.FramedCloud,{autoSize:true});
popupClass=AutoSizeFramedCloud;
popupContentHTML=H;
var C=new OpenLayers.Feature(this.markersLayer,F);
C.closeBox=true;
C.popupClass=popupClass;
C.data.popupContentHTML=popupContentHTML;
C.data.overflow="hidden";
var G=new OpenLayers.Pixel(-(this.iconSize.w/2),-this.iconSize.h);
var D=new OpenLayers.Icon(OpenLayers.ImgPath+this.iconUrl,this.iconSize,G);
C.data.icon=D;
var A=C.createMarker();
this.markersLayer.addMarker(A);
if(A.popup==null){A.popup=C.createPopup(C.closeBox);
this.map.addPopup(A.popup)
}A.popup.show();
var B=function(I){this.popup.toggle();
OpenLayers.Event.stop(I)
};
A.events.register("click",C,B);
A.events.register("dblclick",C,this.stopevent);
A.events.register("mousedown",C,this.stopevent);
var E=new OpenLayers.Bounds(F.lon,F.lat,F.lon,F.lat);
this.map.zoomToExtent(E)
},showMarkerNoZoom:function(E,G){AutoSizeFramedCloud=OpenLayers.Class(OpenLayers.Popup.FramedCloud,{autoSize:true,minSize:new OpenLayers.Size(450,300)});
popupClass=AutoSizeFramedCloud;
popupContentHTML=G;
var C=new OpenLayers.Feature(this.markersLayer,E);
C.closeBox=true;
C.popupClass=popupClass;
C.data.popupContentHTML=popupContentHTML;
C.data.overflow="auto";
var F=new OpenLayers.Pixel(-(this.iconSize.w/2),-this.iconSize.h);
var D=new OpenLayers.Icon(OpenLayers.ImgPath+this.iconUrl,this.iconSize,F);
C.data.icon=D;
var A=C.createMarker();
this.markersLayer.addMarker(A);
if(A.popup==null){A.popup=C.createPopup(C.closeBox);
this.map.addPopup(A.popup)
}A.popup.show();
var B=function(H){this.popup.toggle();
OpenLayers.Event.stop(H)
};
A.events.register("click",C,B);
A.events.register("dblclick",C,this.stopevent);
A.events.register("mousedown",C,this.stopevent)
},stopevent:function(A){OpenLayers.Event.stop(A,true)
},stopLoading:function(){if(this.map!=null&&this.loading!=null){this.loading.stopLoad()
}},CLASS_NAME:"MW.Control.Aci"});NONE=0;
RESPONSE_LOADED=1;
UNKNOWN_RESPONSE=11;
SERVER_ERROR=13;
MW.Control.Classify=OpenLayers.Class(MW.Control,{div:null,urlMapWork:null,servletNameMapWork:"/mapworkservlet?",getCapabilitiesPars:"serviceName=GetCapabilities&actionName=GetCapabilities",classifyPars:"serviceName=Classify&actionName=Classify&xmlRequest=",statusClassify:null,capabilitiesResponse:null,namespace_uri_capabilities:"http://schemas.corenet.it/mapwork/servizi/capabilities",namespace_prefix_capabilities:"cap",namespace_uri_sld:"http://www.opengis.net/sld",namespace_prefix_sld:"sld",events:null,EVENT_TYPES:["loadComplete","loadFailure"],fallThrough:false,colours:["#FFFFFF","#FFCCCC","#FFCC99","#FFFF99","#FFFFCC","#99FF99","#99FFFF","#CCFFFF","#CCCCFF","#FFCCFF","#CCCCCC","#FF6666","#FF9966","#FFFF66","#FFFF33","#66FF99","#33FFFF","#66FFFF","#9999FF","#FF99FF","#C0C0C0","#FF0000","#FF9900","#FFCC66","#FFFF00","#33FF33","#66CCCC","#33CCFF","#6666CC","#CC66CC","#999999","#CC0000","#FF6600","#FFCC33","#FFCC00","#33CC00","#00CCCC","#3366FF","#6633FF","#CC33CC","#666666","#990000","#CC6600","#CC9933","#999900","#009900","#339999","#3333FF","#6600CC","#993399","#333333","#660000","#993300","#996633","#666600","#006600","#336666","#000099","#333399","#663366","#000000","#330000","#663300","#663333","#333300","#003300","#003333","#000066","#330099","#330033"],minClasses:99999,maxClasses:-99999,status_code:null,progressiveSldNumber:0,defaultFonts:["Andale Mono","Arial","Arial Black","Book Antiqua","Comic Sans MS","Courier New","Georgia","Helvetica","Impact","Symbol","Tahoma","Terminal","Times New Roman","Trebuchet MS","Verdana","Webdings","Wingdings"],defaultFontSize:[8,12,16,20,24,28,32,36,40],initialize:function(A){OpenLayers.Control.prototype.initialize.apply(this,[A]);
this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");
this.events=new OpenLayers.Events(this,this,this.EVENT_TYPES,this.fallThrough);
if(this.statusClassify==null){this.statusClassify=new MW.Classify()
}},draw:function(){if(this.div!=null){this.div.className="MWControlClassify";
this.classifysimple=document.createElement("input");
this.classifysimple.name="classify";
this.classifysimple.type="checkbox";
this.classifysimple.checked=true;
this.classifysimple.defaultChecked=true;
this.classifysimple.value="1";
this.div.appendChild(this.classifysimple);
this.span=document.createElement("span");
this.div.appendChild(this.span);
this.span.innerHTML="Simple";
this.br=document.createElement("br");
this.div.appendChild(this.br);
this.classifyfilter=document.createElement("input");
this.classifyfilter.name="classify";
this.classifyfilter.type="checkbox";
this.classifyfilter.value="2";
this.div.appendChild(this.classifyfilter);
var B={input:this.classifyfilter,classify:this};
OpenLayers.Event.observe(this.classifyfilter,"click",this.toggleFilter.bind(B));
var B={input:this.classifysimple,classify:this};
OpenLayers.Event.observe(this.classifysimple,"click",this.toggleFilter.bind(B));
this.span=document.createElement("span");
this.div.appendChild(this.span);
this.span.innerHTML="Filter";
this.br=document.createElement("br");
this.div.appendChild(this.br);
this.divSimple=document.createElement("div");
this.divSimple.id="simple";
this.divSimple.style.display="block";
this.divSimple.style.visibility="visible";
this.divSimple.className="MWControlClassifySimple";
this.div.appendChild(this.divSimple);
this.span=document.createElement("span");
this.divSimple.appendChild(this.span);
this.span.innerHTML="Layer:";
this.layer=document.createElement("select");
this.layer.id="layer";
this.divSimple.appendChild(this.layer);
var B={input:this.layer,statusClassify:this.statusClassify,classify:this};
OpenLayers.Event.observe(this.layer,"change",this.onChangeInput.bind(B));
this.br=document.createElement("br");
this.divSimple.appendChild(this.br);
this.span=document.createElement("div");
this.divSimple.appendChild(this.span);
this.span.className="Title";
this.span.innerHTML="Stroke";
this.span=document.createElement("span");
this.divSimple.appendChild(this.span);
this.span.innerHTML="Color:";
this.color=document.createElement("input");
this.color.id="strokecolor";
this.color.type="text";
this.color.style.width="120px";
this.color.style.marginRight="2px";
this.divSimple.appendChild(this.color);
var B={input:this.color,statusClassifyField:this.statusClassify.stroke,nameField:"color"};
OpenLayers.Event.observe(this.color,"keyup",this.onKeyUpInput.bind(B));
this.pick=document.createElement("input");
this.pick.className="insertcolor";
this.pick.type="button";
this.pick.value="pick";
this.divSimple.appendChild(this.pick);
this.span=document.createElement("span");
this.divSimple.appendChild(this.span);
this.span.innerHTML="Size:";
this.input=document.createElement("input");
this.input.id="strokesize";
this.input.type="text";
this.input.style.width="50px";
this.divSimple.appendChild(this.input);
var B={input:this.input,statusClassifyField:this.statusClassify.stroke,nameField:"size"};
OpenLayers.Event.observe(this.input,"keyup",this.onKeyUpInput.bind(B));
this.span=document.createElement("span");
this.divSimple.appendChild(this.span);
this.span.innerHTML="Opacity:";
this.input=document.createElement("input");
this.input.id="strokeopacity";
this.input.type="text";
this.input.style.width="40px";
this.divSimple.appendChild(this.input);
var B={input:this.input,statusClassifyField:this.statusClassify.stroke,nameField:"opacity"};
OpenLayers.Event.observe(this.input,"keyup",this.onKeyUpInput.bind(B));
this.containerTable=document.createElement("div");
this.containerTable.className="containerTblPalette";
this.containerTable.style.display="none";
this.containerTable.style.visibility="hidden";
this.divSimple.appendChild(this.containerTable);
this.table=document.createElement("table");
this.table.className="tblPalette";
this.table.cellpadding="0";
this.table.cellspacing="1";
this.table.border="0";
this.containerTable.appendChild(this.table);
this.tbody=document.createElement("tbody");
this.table.appendChild(this.tbody);
for(A=0;
A<70;
A++){if((A)%10==0){this.row=document.createElement("tr")
}this.cell=document.createElement("td");
this.cell.style.backgroundColor=this.colours[A];
this.cell.innerHTML="&nbsp;";
var B={cell:this.cell,table:this.containerTable,inputColor:this.color,color:this.colours[A],statusClassifyField:this.statusClassify.stroke,nameField:"color"};
OpenLayers.Event.observe(this.cell,"click",this.pickColor.bind(B));
this.row.appendChild(this.cell);
if((A)%10==0){this.tbody.appendChild(this.row)
}}OpenLayers.Event.observe(this.pick,"click",this.togglePalette.bind(this.containerTable));
this.br=document.createElement("br");
this.divSimple.appendChild(this.br);
this.span=document.createElement("div");
this.divSimple.appendChild(this.span);
this.span.className="Title";
this.span.innerHTML="Fill";
this.span=document.createElement("span");
this.divSimple.appendChild(this.span);
this.span.innerHTML="Color:";
this.color=document.createElement("input");
this.color.id="fillcolor";
this.color.type="text";
this.color.style.width="120px";
this.color.style.marginRight="2px";
this.divSimple.appendChild(this.color);
var B={input:this.color,statusClassifyField:this.statusClassify.fill,nameField:"color"};
OpenLayers.Event.observe(this.color,"keyup",this.onKeyUpInput.bind(B));
this.pick=document.createElement("input");
this.pick.className="insertcolor";
this.pick.type="button";
this.pick.value="pick";
this.divSimple.appendChild(this.pick);
this.span=document.createElement("span");
this.divSimple.appendChild(this.span);
this.span.innerHTML="Opacity:";
this.input=document.createElement("input");
this.input.id="fillopacity";
this.input.type="text";
this.input.style.width="40px";
this.divSimple.appendChild(this.input);
var B={input:this.input,statusClassifyField:this.statusClassify.fill,nameField:"opacity"};
OpenLayers.Event.observe(this.input,"keyup",this.onKeyUpInput.bind(B));
this.containerTable=document.createElement("div");
this.containerTable.className="containerTblPalette";
this.containerTable.style.display="none";
this.containerTable.style.visibility="hidden";
this.divSimple.appendChild(this.containerTable);
this.table=document.createElement("table");
this.table.className="tblPalette";
this.table.cellpadding="0";
this.table.cellspacing="1";
this.table.border="0";
this.containerTable.appendChild(this.table);
this.tbody=document.createElement("tbody");
this.table.appendChild(this.tbody);
for(A=0;
A<70;
A++){if((A)%10==0){this.row=document.createElement("tr")
}this.cell=document.createElement("td");
this.cell.style.backgroundColor=this.colours[A];
this.cell.innerHTML="&nbsp;";
var B={cell:this.cell,table:this.containerTable,inputColor:this.color,color:this.colours[A],statusClassifyField:this.statusClassify.fill,nameField:"color"};
OpenLayers.Event.observe(this.cell,"click",this.pickColor.bind(B));
this.row.appendChild(this.cell);
if((A)%10==0){this.tbody.appendChild(this.row)
}}OpenLayers.Event.observe(this.pick,"click",this.togglePalette.bind(this.containerTable));
this.br=document.createElement("br");
this.divSimple.appendChild(this.br);
this.span=document.createElement("div");
this.divSimple.appendChild(this.span);
this.span.className="Title";
this.span.innerHTML="Marker Symbol";
this.span=document.createElement("span");
this.divSimple.appendChild(this.span);
this.span.innerHTML="Name:";
this.input=document.createElement("select");
this.input.id="markersymbolname";
this.divSimple.appendChild(this.input);
var B={input:this.input,statusClassifyField:this.statusClassify.markerSymbol,nameField:"name"};
this.option=document.createElement("option");
this.option.value="";
this.option.innerHTML="";
this.input.appendChild(this.option);
this.option=document.createElement("option");
this.option.value="circle";
this.option.innerHTML="circle";
this.input.appendChild(this.option);
this.option=document.createElement("option");
this.option.value="square";
this.option.innerHTML="square";
this.input.appendChild(this.option);
this.option=document.createElement("option");
this.option.value="triangle";
this.option.innerHTML="triangle";
this.input.appendChild(this.option);
this.option=document.createElement("option");
this.option.value="star";
this.option.innerHTML="star";
this.input.appendChild(this.option);
this.option=document.createElement("option");
this.option.value="cross";
this.option.innerHTML="cross";
this.input.appendChild(this.option);
this.option=document.createElement("option");
this.option.value="arrow";
this.option.innerHTML="arrow";
this.input.appendChild(this.option);
this.option=document.createElement("option");
this.option.value="x";
this.option.innerHTML="x";
this.input.appendChild(this.option);
OpenLayers.Event.observe(this.input,"change",this.onKeyUpInput.bind(B));
this.span=document.createElement("span");
this.divSimple.appendChild(this.span);
this.span.innerHTML="Size:";
this.input=document.createElement("input");
this.input.id="markersymbolsize";
this.input.type="text";
this.input.style.width="50px";
this.divSimple.appendChild(this.input);
var B={input:this.input,statusClassifyField:this.statusClassify.markerSymbol,nameField:"size"};
OpenLayers.Event.observe(this.input,"keyup",this.onKeyUpInput.bind(B));
this.br=document.createElement("br");
this.divSimple.appendChild(this.br);
this.span=document.createElement("div");
this.divSimple.appendChild(this.span);
this.span.className="Title";
this.span.innerHTML="Label";
this.span=document.createElement("span");
this.divSimple.appendChild(this.span);
this.span.innerHTML="Field:";
this.labelfield=document.createElement("select");
this.labelfield.id="labelfield";
this.divSimple.appendChild(this.labelfield);
var B={input:this.labelfield,statusClassify:this.statusClassify,classify:this};
OpenLayers.Event.observe(this.labelfield,"change",this.onChangeInput.bind(B));
this.option=document.createElement("option");
this.option.value="";
this.option.innerHTML="";
this.labelfield.appendChild(this.option);
this.br=document.createElement("br");
this.divSimple.appendChild(this.br);
this.span=document.createElement("span");
this.divSimple.appendChild(this.span);
this.span.innerHTML="Font:";
this.input=document.createElement("select");
this.input.id="labelfont";
this.input.style.width="200px";
for(var A=0;
A<this.defaultFonts.length;
A++){this.option=document.createElement("option");
this.option.value=this.defaultFonts[A];
this.option.innerHTML=this.defaultFonts[A];
this.option.style.fontFamily=this.defaultFonts[A];
this.input.appendChild(this.option)
}this.divSimple.appendChild(this.input);
var B={input:this.input,statusClassifyField:this.statusClassify.label,nameField:"font"};
OpenLayers.Event.observe(this.input,"change",this.onKeyUpInput.bind(B));
this.br=document.createElement("br");
this.divSimple.appendChild(this.br);
this.span=document.createElement("span");
this.divSimple.appendChild(this.span);
this.span.innerHTML="Pos_x:";
this.input=document.createElement("input");
this.input.id="labelxpos";
this.input.type="text";
this.input.style.width="60px";
this.divSimple.appendChild(this.input);
var B={input:this.input,statusClassifyField:this.statusClassify.label,nameField:"x_pos"};
OpenLayers.Event.observe(this.input,"keyup",this.onKeyUpInput.bind(B));
this.span=document.createElement("span");
this.divSimple.appendChild(this.span);
this.span.innerHTML="Pos_y:";
this.input=document.createElement("input");
this.input.id="labelypos";
this.input.type="text";
this.input.style.width="60px";
this.divSimple.appendChild(this.input);
var B={input:this.input,statusClassifyField:this.statusClassify.label,nameField:"y_pos"};
OpenLayers.Event.observe(this.input,"keyup",this.onKeyUpInput.bind(B));
this.br=document.createElement("br");
this.divSimple.appendChild(this.br);
this.span=document.createElement("span");
this.divSimple.appendChild(this.span);
this.span.innerHTML="Size:";
this.input=document.createElement("select");
this.input.id="labelsize";
this.input.style.width="50px";
for(var A=0;
A<this.defaultFontSize.length;
A++){this.option=document.createElement("option");
this.option.value=this.defaultFontSize[A];
this.option.innerHTML=this.defaultFontSize[A];
this.option.style.fontSize=this.defaultFontSize[A]+"px";
this.input.appendChild(this.option)
}this.divSimple.appendChild(this.input);
var B={input:this.input,statusClassifyField:this.statusClassify.label,nameField:"size"};
OpenLayers.Event.observe(this.input,"change",this.onKeyUpInput.bind(B));
this.span=document.createElement("span");
this.divSimple.appendChild(this.span);
this.span.innerHTML="Rotation:";
this.input=document.createElement("input");
this.input.id="labelrotation";
this.input.type="text";
this.input.style.width="60px";
this.divSimple.appendChild(this.input);
var B={input:this.input,statusClassifyField:this.statusClassify.label,nameField:"rotation"};
OpenLayers.Event.observe(this.input,"keyup",this.onKeyUpInput.bind(B));
this.br=document.createElement("br");
this.divSimple.appendChild(this.br);
this.span=document.createElement("span");
this.divSimple.appendChild(this.span);
this.span.innerHTML="Color:";
this.color=document.createElement("input");
this.color.id="labelcolor";
this.color.type="text";
this.color.style.width="120px";
this.color.style.marginRight="2px";
this.divSimple.appendChild(this.color);
var B={input:this.color,statusClassifyField:this.statusClassify.label,nameField:"color"};
OpenLayers.Event.observe(this.color,"keyup",this.onKeyUpInput.bind(B));
this.pick=document.createElement("input");
this.pick.className="insertcolor";
this.pick.type="button";
this.pick.value="pick";
this.divSimple.appendChild(this.pick);
this.span=document.createElement("span");
this.divSimple.appendChild(this.span);
this.span.innerHTML="Opacity:";
this.input=document.createElement("input");
this.input.id="labelopacity";
this.input.type="text";
this.input.style.width="40px";
this.divSimple.appendChild(this.input);
var B={input:this.input,statusClassifyField:this.statusClassify.label,nameField:"opacity"};
OpenLayers.Event.observe(this.input,"keyup",this.onKeyUpInput.bind(B));
this.containerTable=document.createElement("div");
this.containerTable.className="containerTblPalette";
this.containerTable.style.display="none";
this.containerTable.style.visibility="hidden";
this.divSimple.appendChild(this.containerTable);
this.table=document.createElement("table");
this.table.className="tblPalette";
this.table.cellpadding="0";
this.table.cellspacing="1";
this.table.border="0";
this.containerTable.appendChild(this.table);
this.tbody=document.createElement("tbody");
this.table.appendChild(this.tbody);
for(A=0;
A<70;
A++){if((A)%10==0){this.row=document.createElement("tr")
}this.cell=document.createElement("td");
this.cell.style.backgroundColor=this.colours[A];
this.cell.innerHTML="&nbsp;";
var B={cell:this.cell,table:this.containerTable,inputColor:this.color,color:this.colours[A],statusClassifyField:this.statusClassify.label,nameField:"color"};
OpenLayers.Event.observe(this.cell,"click",this.pickColor.bind(B));
this.row.appendChild(this.cell);
if((A)%10==0){this.tbody.appendChild(this.row)
}}OpenLayers.Event.observe(this.pick,"click",this.togglePalette.bind(this.containerTable));
this.br=document.createElement("br");
this.divSimple.appendChild(this.br);
this.span=document.createElement("div");
this.divSimple.appendChild(this.span);
this.span.className="Title";
this.span.innerHTML="Scale";
this.span=document.createElement("span");
this.divSimple.appendChild(this.span);
this.span.innerHTML="Min:";
this.input=document.createElement("input");
this.input.id="scalemin";
this.input.type="text";
this.input.style.width="100px";
this.divSimple.appendChild(this.input);
var B={input:this.input,statusClassifyField:this.statusClassify.scale,nameField:"min"};
OpenLayers.Event.observe(this.input,"keyup",this.onKeyUpInput.bind(B));
this.span=document.createElement("span");
this.divSimple.appendChild(this.span);
this.span.innerHTML="Max:";
this.input=document.createElement("input");
this.input.id="scalemax";
this.input.type="text";
this.input.style.width="100px";
this.divSimple.appendChild(this.input);
var B={input:this.input,statusClassifyField:this.statusClassify.scale,nameField:"max"};
OpenLayers.Event.observe(this.input,"keyup",this.onKeyUpInput.bind(B));
this.br=document.createElement("br");
this.divSimple.appendChild(this.br);
this.br=document.createElement("br");
this.divSimple.appendChild(this.br);
this.divFilter=document.createElement("div");
this.divFilter.id="filter";
this.divFilter.style.display="none";
this.divFilter.style.visibility="hidden";
this.divFilter.className="MWControlClassifyFilter";
this.div.appendChild(this.divFilter);
this.span=document.createElement("span");
this.divFilter.appendChild(this.span);
this.span.innerHTML="Field:";
this.filterfield=document.createElement("select");
this.filterfield.id="filterfield";
this.divFilter.appendChild(this.filterfield);
var B={input:this.filterfield,statusClassify:this.statusClassify,classify:this};
OpenLayers.Event.observe(this.filterfield,"change",this.onChangeInput.bind(B));
this.option=document.createElement("option");
this.option.value="";
this.option.innerHTML="";
this.filterfield.appendChild(this.option);
this.br=document.createElement("br");
this.divFilter.appendChild(this.br);
this.span=document.createElement("span");
this.divFilter.appendChild(this.span);
this.span.innerHTML="Classes:";
this.classes=document.createElement("select");
this.classes.id="filterclasses";
this.divFilter.appendChild(this.classes);
var B={input:this.classes,statusClassify:this.statusClassify,classify:this};
OpenLayers.Event.observe(this.classes,"change",this.onChangeInput.bind(B));
this.span=document.createElement("span");
this.divFilter.appendChild(this.span);
this.span.innerHTML="Palette Name:";
this.filterpalettename=document.createElement("select");
this.filterpalettename.id="filterpalettename";
this.divFilter.appendChild(this.filterpalettename);
var B={input:this.filterpalettename,statusClassify:this.statusClassify,classify:this};
OpenLayers.Event.observe(this.filterpalettename,"change",this.onChangeInput.bind(B));
this.option=document.createElement("option");
this.option.value="";
this.option.innerHTML="";
this.filterpalettename.appendChild(this.option);
this.br=document.createElement("br");
this.divFilter.appendChild(this.br);
this.span=document.createElement("span");
this.divFilter.appendChild(this.span);
this.span.innerHTML="Division:";
this.input=document.createElement("select");
this.input.id="division";
this.divFilter.appendChild(this.input);
this.option=document.createElement("option");
this.option.value="";
this.option.innerHTML="";
this.input.appendChild(this.option);
this.option=document.createElement("option");
this.option.value="quantile";
this.option.innerHTML="quantile";
this.input.appendChild(this.option);
this.option=document.createElement("option");
this.option.value="unique values";
this.option.innerHTML="unique values";
this.input.appendChild(this.option);
this.option=document.createElement("option");
this.option.value="equal intervals";
this.option.innerHTML="equal intervals";
this.input.appendChild(this.option);
var B={input:this.input,statusClassifyField:this.statusClassify.filter,nameField:"division"};
OpenLayers.Event.observe(this.input,"change",this.onKeyUpInput.bind(B));
this.br=document.createElement("br");
this.divFilter.appendChild(this.br);
this.br=document.createElement("br");
this.divFilter.appendChild(this.br);
this.br=document.createElement("br");
this.div.appendChild(this.br);
this.divCommands=document.createElement("div");
this.divCommands.className="commands";
this.div.appendChild(this.divCommands);
this.divApplica=document.createElement("input");
this.divApplica.className="inputButton";
this.divApplica.value="Applica";
this.divApplica.type="button";
this.divApplica.scr=OpenLayers.ImgPath+"submit.gif";
this.divApplica.title="Applica";
this.divCommands.appendChild(this.divApplica);
OpenLayers.Event.observe(this.divApplica,"click",this.loadClassify.bind(this));
this.divReset=document.createElement("input");
this.divReset.className="inputButton";
this.divReset.value="Annulla";
this.divReset.type="button";
this.divReset.scr=OpenLayers.ImgPath+"submit.gif";
this.divReset.title="Annulla";
this.divCommands.appendChild(this.divReset);
OpenLayers.Event.observe(this.divReset,"click",this.resetClassify.bind(this));
this.br=document.createElement("br");
this.divCommands.appendChild(this.br);
this.divDownload=document.createElement("input");
this.divDownload.className="inputButton";
this.divDownload.value="Download";
this.divDownload.type="button";
this.divDownload.scr=OpenLayers.ImgPath+"submit.gif";
this.divDownload.title="Download";
this.divCommands.appendChild(this.divDownload);
OpenLayers.Event.observe(this.divDownload,"click",this.downloadClassify.bind(this));
this.br=document.createElement("br");
this.div.appendChild(this.br);
this.divpanel=document.createElement("div");
this.divpanel.id="panel";
this.divpanel.className="panel";
this.div.appendChild(this.divpanel)
}if(this.capabilitiesResponse==null){this.loadGetCapabilities()
}else{this.fillFieldsClassify()
}return this.div
},destroy:function(){this.map=null;
this.div=null;
this.statusClassify=null;
this.urlMapWork=null;
this.classifyPars=null;
this.getCapabilitiesPars=null;
this.capabilitiesResponse=null;
if(this.events&&this.events!=null){this.events.destroy()
}this.events=null;
OpenLayers.Control.prototype.destroy.apply(this,arguments)
},togglePalette:function(A){if(this.style.display=="none"){this.style.display="block";
this.style.visibility="visible"
}else{this.style.display="none";
this.style.visibility="hidden"
}},toggleFilter:function(A){if(this.input.value=="1"){this.classify.divSimple.style.display="block";
this.classify.divFilter.style.display="none";
this.classify.divSimple.style.visibility="visible";
this.classify.divFilter.style.visibility="hidden";
this.classify.classifysimple.checked=true;
this.classify.classifyfilter.checked=false
}else{this.classify.divSimple.style.display="none";
this.classify.divFilter.style.display="block";
this.classify.divSimple.style.visibility="hidden";
this.classify.divFilter.style.visibility="visible";
this.classify.classifysimple.checked=false;
this.classify.classifyfilter.checked=true
}},pickColor:function(A){this.cell.style.border="1px solid #FF0000";
this.inputColor.value=this.color;
this.table.style.display="none";
this.table.style.visibility="hidden";
this.cell.style.border="1px solid #666666";
this.statusClassifyField[this.nameField]=this.inputColor.value
},onChangeInput:function(M){if(this.input.id=="layer"){this.statusClassify.setLayer(this.input.value);
this.classify.labelfield.innerHTML="";
this.classify.filterfield.innerHTML="";
this.option=document.createElement("option");
this.option.value="";
this.option.innerHTML="";
this.classify.labelfield.appendChild(this.option);
this.option=document.createElement("option");
this.option.value="";
this.option.innerHTML="";
this.classify.filterfield.appendChild(this.option);
var A=OpenLayers.Ajax.getElementsByTagNameNS(this.classify.capabilitiesResponse,this.classify.namespace_uri_capabilities,this.classify.namespace_prefix_capabilities,"layer");
if(A!=null&&A.length>0){for(i=0;
i<A.length;
i++){var K=A[i];
var J=K.getAttribute("logicalName");
var F=this.statusClassify.getLayer();
if(J!=null&&F!=null&&J.toUpperCase()==F.toUpperCase()){var E=OpenLayers.Ajax.getElementsByTagNameNS(K,this.classify.namespace_uri_capabilities,this.classify.namespace_prefix_capabilities,"field");
for(j=0;
j<E.length;
j++){var B=E[j];
var N=B.getAttribute("name");
this.option=document.createElement("option");
this.option.value=N;
this.option.innerHTML=N;
this.classify.labelfield.appendChild(this.option);
this.option=document.createElement("option");
this.option.value=N;
this.option.innerHTML=N;
this.classify.filterfield.appendChild(this.option)
}var B=OpenLayers.Ajax.getElementsByTagNameNS(K,this.classify.namespace_uri_capabilities,this.classify.namespace_prefix_capabilities,"fid")[0];
if(B!=null){var N=B.getAttribute("name");
this.option=document.createElement("option");
this.option.value=N.toUpperCase();
this.option.innerHTML=N.toUpperCase();
this.classify.labelfield.appendChild(this.option);
this.option=document.createElement("option");
this.option.value=N.toUpperCase();
this.option.innerHTML=N.toUpperCase();
this.classify.filterfield.appendChild(this.option)
}break
}}}this.statusClassify.label.field="";
this.statusClassify.filter.field_name=""
}if(this.input.id=="labelfield"){this.statusClassify.label.field=this.input.value
}if(this.input.id=="filterfield"){this.statusClassify.filter.field_name=this.input.value
}if(this.input.id=="filterpalettename"){this.statusClassify.filter.paletteName=this.input.value
}if(this.input.id=="filterclasses"){this.statusClassify.filter.num_classes=this.input.value;
var I=OpenLayers.Ajax.getElementsByTagNameNS(this.classify.capabilitiesResponse,this.classify.namespace_uri_capabilities,this.classify.namespace_prefix_capabilities,"palette");
this.classify.filterpalettename.innerHTML="";
this.option=document.createElement("option");
this.option.value="";
this.option.innerHTML="";
this.classify.filterpalettename.appendChild(this.option);
if(I!=null&&I.length>0){for(i=0;
i<I.length;
i++){var H=I[i];
var D=H.getAttribute("name");
var O=OpenLayers.Ajax.getElementsByTagNameNS(H,this.classify.namespace_uri_capabilities,this.classify.namespace_prefix_capabilities,"range")[0];
if(O!=null){var C=(new Number(O.getAttribute("min"))).valueOf();
var L=(new Number(O.getAttribute("max"))).valueOf();
var G=(new Number(this.input.value)).valueOf();
if(G>=C&&G<=L){this.option=document.createElement("option");
this.option.value=D;
this.option.innerHTML=D;
this.classify.filterpalettename.appendChild(this.option)
}}}}this.statusClassify.filter.paletteName=""
}},onKeyUpInput:function(A){this.statusClassifyField[this.nameField]=this.input.value
},loadGetCapabilities:function(){var D=this.successGetCapabilities.bind(this);
var A=this.failureGetCapabilities.bind(this);
var B=this.getCapabilitiesPars;
var C=this.urlMapWork+this.servletNameMapWork;
if(MW.Proxy&&this.urlMapWork.startsWith("http")){C=MW.Proxy+MW.Util.escapeUri(C)
}OpenLayers.Console.debug("Ajax request url: "+C+B);
new OpenLayers.Ajax.Request(C+B,{method:"get",parameters:null,asynchronous:false,onComplete:D,onFailure:A})
},successGetCapabilities:function(B){if(B.responseXML==null&&B.responseText==null){return 
}var A=B.responseXML;
if(!A||B.fileType!="XML"){A=OpenLayers.parseXMLString(B.responseText)
}this.capabilitiesResponse=A;
if(this.statusClassify!=null){var G=OpenLayers.Ajax.getElementsByTagNameNS(A,this.namespace_uri_capabilities,this.namespace_prefix_capabilities,"layer")[0];
var D=this.statusClassify.getLayer();
if(G!=null&&D==null){this.statusClassify.setLayer(G.getAttribute("logicalName"))
}}var F=OpenLayers.Ajax.getElementsByTagNameNS(A,this.namespace_uri_capabilities,this.namespace_prefix_capabilities,"palette");
if(F!=null&&F.length>0){for(i=0;
i<F.length;
i++){var E=F[i];
var I=OpenLayers.Ajax.getElementsByTagNameNS(E,this.namespace_uri_capabilities,this.namespace_prefix_capabilities,"range")[0];
if(I!=null){var C=(new Number(I.getAttribute("min"))).valueOf();
var H=(new Number(I.getAttribute("max"))).valueOf();
if(this.minClasses>C){this.minClasses=C
}if(this.maxClasses<H){this.maxClasses=H
}}}}this.fillFieldsClassify()
},fillFieldsClassify:function(){if(this.div!=null){var A=OpenLayers.Ajax.getElementsByTagNameNS(this.capabilitiesResponse,this.namespace_uri_capabilities,this.namespace_prefix_capabilities,"layer");
if(A!=null&&A.length>0){for(i=0;
i<A.length;
i++){var L=A[i];
var F=L.getAttribute("logicalName");
this.option=document.createElement("option");
this.option.value=F;
this.option.innerHTML=F;
this.layer.appendChild(this.option)
}}this.layer.value=this.statusClassify.getLayer();
if(A!=null&&A.length>0){for(i=0;
i<A.length;
i++){var L=A[i];
var K=L.getAttribute("logicalName");
var G=this.statusClassify.getLayer();
if(K!=null&&G!=null&&K.toUpperCase()==G.toUpperCase()){var E=OpenLayers.Ajax.getElementsByTagNameNS(L,this.namespace_uri_capabilities,this.namespace_prefix_capabilities,"field");
for(j=0;
j<E.length;
j++){var B=E[j];
var N=B.getAttribute("name");
this.option=document.createElement("option");
this.option.value=N;
this.option.innerHTML=N;
this.labelfield.appendChild(this.option);
this.option=document.createElement("option");
this.option.value=N;
this.option.innerHTML=N;
this.filterfield.appendChild(this.option)
}var B=OpenLayers.Ajax.getElementsByTagNameNS(L,this.namespace_uri_capabilities,this.namespace_prefix_capabilities,"fid")[0];
if(B!=null){var N=B.getAttribute("name");
this.option=document.createElement("option");
this.option.value=N.toUpperCase();
this.option.innerHTML=N.toUpperCase();
this.labelfield.appendChild(this.option);
this.option=document.createElement("option");
this.option.value=N.toUpperCase();
this.option.innerHTML=N.toUpperCase();
this.filterfield.appendChild(this.option)
}break
}}}for(i=this.minClasses;
i<=this.maxClasses;
i++){this.option=document.createElement("option");
this.option.value=i+"";
this.option.innerHTML=i+"";
this.classes.appendChild(this.option)
}this.classes.value=this.minClasses;
this.statusClassify.filter.num_classes=this.minClasses;
var J=OpenLayers.Ajax.getElementsByTagNameNS(this.capabilitiesResponse,this.namespace_uri_capabilities,this.namespace_prefix_capabilities,"palette");
if(J!=null&&J.length>0){for(i=0;
i<J.length;
i++){var I=J[i];
var D=I.getAttribute("name");
var O=OpenLayers.Ajax.getElementsByTagNameNS(I,this.namespace_uri_capabilities,this.namespace_prefix_capabilities,"range")[0];
if(O!=null){var C=(new Number(O.getAttribute("min"))).valueOf();
var M=(new Number(O.getAttribute("max"))).valueOf();
var H=(new Number(this.classes.value)).valueOf();
if(H>=C&&H<=M){this.option=document.createElement("option");
this.option.value=D;
this.option.innerHTML=D;
this.filterpalettename.appendChild(this.option)
}}}}}},failureGetCapabilities:function(A){alert("Si Ã¨ verificato un errore nel servizio di GetCapabilities");
return 
},setClassifyPanel:function(A){this.div=A
},stopevent:function(A){OpenLayers.Event.stop(A,true)
},loadClassify:function(){var K=this.statusClassify.getLayer();
if(K==null||K==""){alert("Occorre specificare il nome del layer su cui applicare la renderizzazione.");
return 
}if(this.div!=null){this.divpanel.style.display="none";
this.divpanel.style.visibility="hidden";
this.divpanel.innerHTML=""
}var B="";
var A=OpenLayers.Ajax.getElementsByTagNameNS(this.capabilitiesResponse,this.namespace_uri_capabilities,this.namespace_prefix_capabilities,"layer");
if(A!=null&&A.length>0){for(I=0;
I<A.length;
I++){var N=A[I];
var L=N.getAttribute("logicalName");
var K=this.statusClassify.getLayer();
if(L!=null&&K!=null&&L.toUpperCase()==K.toUpperCase()){B=N.getAttribute("id");
break
}}}for(var I=0;
I<this.map.layers.length;
I++){var K=this.map.layers[I];
if(K.CLASS_NAME=="MW.Layer.WMS"){if(K.params.LAYERS.indexOf(B)!=-1){this.deleteSldAxl(K);
var F=this.createClassifyRequest("url",false);
var M=this.classifyPars+encodeURIComponent(F);
var G=this.urlMapWork+this.servletNameMapWork;
if(MW.Proxy&&this.urlMapWork.startsWith("http")){G=MW.Proxy+MW.Util.escapeUri(G)
}var D={layerWMS:K,classify:this};
var O=this.successSLDClassify.bind(D);
var E=this.failureClassify.bind(D);
OpenLayers.Console.debug("Ajax request url: "+G+M);
new OpenLayers.Ajax.Request(G+M,{method:"get",parameters:null,onComplete:O,onFailure:E});
break
}}else{if(K.CLASS_NAME=="MW.Layer.ArcXML"){this.status_code=NONE;
for(var H=0;
H<K.options.layers.length;
H++){var C=K.options.layers[H].id;
if(C==B){this.deleteSldAxl(K);
var F=this.createClassifyRequest(null,true);
var M=this.classifyPars+encodeURIComponent(F);
var G=this.urlMapWork+this.servletNameMapWork;
if(MW.Proxy&&this.urlMapWork.startsWith("http")){G=MW.Proxy+MW.Util.escapeUri(G)
}var D={layerArcXML:K,classify:this};
var J=this.successAXLClassify.bind(D);
var E=this.failureClassify.bind(D);
OpenLayers.Console.debug("Ajax request url: "+G+M);
new OpenLayers.Ajax.Request(G+M,{method:"get",parameters:null,onComplete:J,onFailure:E});
break
}}}}}},successSLDClassify:function(D){this.classify.status_code=UNKNOWN_RESPONSE;
if(D.responseXML==null&&D.responseText==null){return 
}var A=D.responseXML;
if(!A||D.fileType!="XML"){A=OpenLayers.parseXMLString(D.responseText)
}this.classify.status_code=RESPONSE_LOADED;
var B=A.getElementsByTagName("exception");
if(B.length>0){var E=B[0].getAttribute("message");
this.classify.divpanel.style.display="block";
this.classify.divpanel.style.visibility="visible";
this.classify.divpanel.innerHTML=E;
this.classify.events.triggerEvent("loadFailure");
return 
}var C=(A.getElementsByTagName("urlSld"))[0].getAttribute("value");
this.layerWMS.setSld(this.classify.urlMapWork+C);
this.layerWMS.redraw(true);
if(this.classify.status_code>10){this.classify.events.triggerEvent("loadFailure")
}else{this.classify.events.triggerEvent("loadComplete")
}},successAXLClassify:function(E){this.classify.status_code=UNKNOWN_RESPONSE;
if(E.responseXML==null&&E.responseText==null){return 
}var D=E.responseXML;
if(!D||E.fileType!="XML"){D=OpenLayers.parseXMLString(E.responseText)
}this.classify.status_code=RESPONSE_LOADED;
var H=D.getElementsByTagName("exception");
if(H.length>0){var I=H[0].getAttribute("message");
this.classify.divpanel.style.display="block";
this.classify.divpanel.style.visibility="visible";
this.classify.divpanel.innerHTML=I;
this.classify.events.triggerEvent("loadFailure");
return 
}var B=[];
var C=D.getElementsByTagName("LAYERDEF");
var G=new OpenLayers.Format.XML();
for(i=0;
i<C.length;
i++){var A=C[i];
var F=G.write(A);
B.push(F)
}this.layerArcXML.options.layerDefList=B;
this.layerArcXML.redraw(true);
if(this.classify.status_code>10){this.classify.events.triggerEvent("loadFailure")
}else{this.classify.events.triggerEvent("loadComplete")
}},failureClassify:function(A){if(this.classify.div!=null){this.classify.divpanel.style.display="block";
this.classify.divpanel.innerHTML="Si &#232; verificato un errore nel servizio."
}this.classify.status_code=SERVER_ERROR;
this.classify.events.triggerEvent("loadFailure");
return 
},resetClassify:function(){this.statusClassify.reset();
for(var C=0;
C<this.map.layers.length;
C++){var B=this.map.layers[C];
if(B.CLASS_NAME=="MW.Layer.WMS"){var E=OpenLayers.Ajax.getElementsByTagNameNS(this.capabilitiesResponse,this.namespace_uri_capabilities,this.namespace_prefix_capabilities,"layer");
if(E!=null&&E.length>0){for(j=0;
j<E.length;
j++){var D=E[j];
physicalName=D.getAttribute("id");
if(B.params.LAYERS.indexOf(physicalName)!=-1){B.deleteSld();
B.params.buffer=0;
B.redraw(true);
break
}}}}if(B.CLASS_NAME=="MW.Layer.ArcXML"){var E=OpenLayers.Ajax.getElementsByTagNameNS(this.capabilitiesResponse,this.namespace_uri_capabilities,this.namespace_prefix_capabilities,"layer");
if(E!=null&&E.length>0){for(j=0;
j<E.length;
j++){var D=E[j];
physicalName=D.getAttribute("id");
for(var A=0;
A<B.options.layers.length;
A++){var F=B.options.layers[A].id;
if(F.indexOf(physicalName)!=-1){B.options.layerDefList=[];
B.params.buffer=0;
B.redraw(true);
break
}}}}}}if(this.div!=null){var D=OpenLayers.Ajax.getElementsByTagNameNS(this.capabilitiesResponse,this.namespace_uri_capabilities,this.namespace_prefix_capabilities,"layer")[0];
if(D!=null){this.statusClassify.setLayer(D.getAttribute("logicalName"))
}this.div.innerHTML="";
this.draw()
}},deleteSldAxl:function(A){for(var D=0;
D<this.map.layers.length;
D++){var C=this.map.layers[D];
if(C.CLASS_NAME=="MW.Layer.WMS"&&C.id!=A.id){var F=OpenLayers.Ajax.getElementsByTagNameNS(this.capabilitiesResponse,this.namespace_uri_capabilities,this.namespace_prefix_capabilities,"layer");
if(F!=null&&F.length>0){for(j=0;
j<F.length;
j++){var E=F[j];
physicalName=E.getAttribute("id");
if(C.params.LAYERS.indexOf(physicalName)!=-1){C.deleteSld();
C.params.buffer=0;
C.redraw(true);
break
}}}}if(C.CLASS_NAME=="MW.Layer.ArcXML"&&C.id!=A.id){var F=OpenLayers.Ajax.getElementsByTagNameNS(this.capabilitiesResponse,this.namespace_uri_capabilities,this.namespace_prefix_capabilities,"layer");
if(F!=null&&F.length>0){for(j=0;
j<F.length;
j++){var E=F[j];
physicalName=E.getAttribute("id");
for(var B=0;
B<C.options.layers.length;
B++){var G=C.options.layers[B].id;
if(G.indexOf(physicalName)!=-1){C.options.layerDefList=[];
C.params.buffer=0;
C.redraw(true);
break
}}}}}}},downloadClassify:function(){var I=this.statusClassify.getLayer();
if(I==null||I==""){alert("Occorre specificare il nome del layer su cui applicare la renderizzazione.");
return 
}if(this.div!=null){this.divpanel.style.display="none";
this.divpanel.style.visibility="hidden";
this.divpanel.innerHTML=""
}var B="";
var A=OpenLayers.Ajax.getElementsByTagNameNS(this.capabilitiesResponse,this.namespace_uri_capabilities,this.namespace_prefix_capabilities,"layer");
if(A!=null&&A.length>0){for(G=0;
G<A.length;
G++){var L=A[G];
var J=L.getAttribute("logicalName");
var I=this.statusClassify.getLayer();
if(J!=null&&I!=null&&J.toUpperCase()==I.toUpperCase()){B=L.getAttribute("id");
break
}}}var D="";
for(var G=0;
G<this.map.layers.length;
G++){var I=this.map.layers[G];
if(I.CLASS_NAME=="MW.Layer.WMS"){if(I.params.LAYERS.indexOf(B)!=-1){D=this.createClassifyRequest("file");
break
}}else{if(I.CLASS_NAME=="MW.Layer.ArcXML"){for(var F=0;
F<I.options.layers.length;
F++){var C=I.options.layers[F].id;
if(C==B){D=this.createClassifyRequest("file",true);
break
}}}}}var K=this.classifyPars+encodeURIComponent(D);
var E=this.urlMapWork+this.servletNameMapWork;
if(MW.Proxy&&this.urlMapWork.startsWith("http")){E=MW.Proxy+MW.Util.escapeUri(this.urlMapWork)
}var H=window.open(E+K);
H.focus()
},createClassifyRequest:function(D,C){var B='<?xml version="1.0" encoding="UTF-8"?><ClassifyServiceRequest xmlns="http://schemas.corenet.it/mapwork/servizi/classify" xmlns:ogc="http://www.opengis.net/ogc" xmlns:sld="http://www.opengis.net/sld" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.corenet.it/mapwork/servizi/classify"><layer name="'+this.statusClassify.getLayer()+'">';
var A=false;
if(this.statusClassify.stroke.color!=""){if(A==false){B+="<style>";
A=true
}B+="<stroke";
if(this.statusClassify.stroke.color!=""){B=B+' color="'+this.statusClassify.stroke.color+'"'
}if(this.statusClassify.stroke.size!=""){B=B+' size="'+this.statusClassify.stroke.size+'"'
}if(this.statusClassify.stroke.opacity!=""){B=B+' opacity="'+this.statusClassify.stroke.opacity+'"'
}B+="></stroke>"
}if(this.statusClassify.fill.color!=""){if(A==false){B+="<style>";
A=true
}B+="<fill";
if(this.statusClassify.fill.color!=""){B=B+' color="'+this.statusClassify.fill.color+'"'
}if(this.statusClassify.fill.opacity!=""){B=B+' opacity="'+this.statusClassify.fill.opacity+'"'
}B+="></fill>"
}if(this.statusClassify.markerSymbol.name!=""){if(A==false){B+="<style>";
A=true
}B+="<markerSymbol";
if(this.statusClassify.markerSymbol.name!=""){B=B+' name="'+this.statusClassify.markerSymbol.name+'"'
}if(this.statusClassify.markerSymbol.size!=""){B=B+' size="'+this.statusClassify.markerSymbol.size+'"'
}B+="></markerSymbol>"
}if(this.statusClassify.label.field!=""){if(A==false){B+="<style>";
A=true
}B+="<label";
if(this.statusClassify.label.field!=""){B=B+' field="'+this.statusClassify.label.field+'"'
}if(this.statusClassify.label.font!=""){B=B+' font="'+this.statusClassify.label.font+'"'
}if(this.statusClassify.label.size!=""){B=B+' size="'+this.statusClassify.label.size+'"'
}if(this.statusClassify.label.x_pos!=""){B=B+' x_pos="'+this.statusClassify.label.x_pos+'"'
}if(this.statusClassify.label.y_pos!=""){B=B+' y_pos="'+this.statusClassify.label.y_pos+'"'
}if(this.statusClassify.label.rotation!=""){B=B+' rotation="'+this.statusClassify.label.rotation+'"'
}if(this.statusClassify.label.color!=""){B=B+' color="'+this.statusClassify.label.color+'"'
}if(this.statusClassify.label.opacity!=""){B=B+' opacity="'+this.statusClassify.label.opacity+'"'
}B+="></label>"
}if(this.statusClassify.scale.min!=""||this.statusClassify.scale.max!=""){if(A==false){B+="<style>";
A=true
}B+="<scale";
if(this.statusClassify.scale.min!=""){B=B+' min="'+this.statusClassify.scale.min+'"'
}if(this.statusClassify.scale.max!=""){B=B+' max="'+this.statusClassify.scale.max+'"'
}B+="></scale>"
}if(this.statusClassify.filter.field_name!=""){if(A==false){B+="<style>";
A=true
}B+="<filter";
if(this.statusClassify.filter.field_name!=""){B=B+' field_name="'+this.statusClassify.filter.field_name+'"'
}if(this.statusClassify.filter.paletteName!=""){B=B+' paletteName="'+this.statusClassify.filter.paletteName+'"'
}if(this.statusClassify.filter.num_classes!=""){B=B+' num_classes="'+this.statusClassify.filter.num_classes+'"'
}B+=">";
if(this.statusClassify.filter.division!=""){B=B+'<division name="'+this.statusClassify.filter.division+'"/>'
}B+="</filter>"
}if(A==true){B+="</style>"
}B+="</layer>";
if(D!=null||C==true){B+="<options"
}if(D!=null){B+=' responseFormat="'+D+'"'
}if(C==true){B+=' responseAXL="true"'
}if(D!=null||C==true){B+="/>"
}B+="</ClassifyServiceRequest>";
return B
},CLASS_NAME:"MW.Control.Classify"});MW.Control.DragPan=OpenLayers.Class(OpenLayers.Control.DragPan,{panMap:function(F){this.panned=true;
var D=this.handler.last.x-F.x;
var B=this.handler.last.y-F.y;
var E=this.map.getSize();
var A=new OpenLayers.Pixel(E.w/2+D,E.h/2+B);
var C=this.map.getLonLatFromViewPortPx(A);
if(this.map.getLayerByName(this.map.layerMinZoomLevel)==null||this.map.getZoom()>0){this.map.setCenter(C,null,this.handler.dragging)
}},panMapDone:function(A){if(this.panned){this.panMap(A);
this.panned=false
}},CLASS_NAME:"MW.Control.DragPan"});MW.Control.DrawFeature=OpenLayers.Class(OpenLayers.Control.DrawFeature,{drawFeature:function(F){var E=new OpenLayers.Feature.Vector(F);
var A=true;
if(F.CLASS_NAME=="OpenLayers.Geometry.Polygon"){var C=MW.GeometryUtil.getCoordinatesFromComponent(F.components[0]);
if(C.length==2||C.length==3){A=false
}if(C.length==4){if(C[1][0]==C[2][0]||C[1][1]==C[2][1]){A=false
}}}if(F.CLASS_NAME=="OpenLayers.Geometry.LineString"){var C=MW.GeometryUtil.getCoordinatesFromComponent(F);
if(C.length==1){A=false
}if(C.length==2){if(C[0][0]==C[1][0]||C[0][1]==C[1][1]){A=false
}}}if(A==true){if(this.layer.features!=null){var B=this.layer.features.length;
for(ii=0;
ii<B;
ii++){var D=this.layer.features[ii].geometry;
if(D.CLASS_NAME=="OpenLayers.Geometry.Polygon"){if(D.components!=null&&D.components.length>0){if(MW.GeometryUtil.containsGeometry(D.components[0],F.components[0])){for(nn=1;
nn<D.components.length;
nn++){if(D.components[nn].intersects(F.components[0])){A=false;
break
}if(MW.GeometryUtil.containsGeometry(D.components[nn],F.components[0])||MW.GeometryUtil.containsGeometry(F.components[0],D.components[nn])){A=false;
break
}}if(A==true){D.addComponents(F.components[0]);
A=false;
this.layer.redraw(true);
break
}}}}}}}if(A==true){this.layer.addFeatures([E]);
this.featureAdded(E);
this.events.triggerEvent("featureadded",{feature:E})
}},CLASS_NAME:"MW.Control.DrawFeature"});MW.Control.DrawPoint=OpenLayers.Class(MW.Control,{type:OpenLayers.Control.TYPE_BUTTON,id:null,div:null,pointControl:null,pointLayer:null,map:null,defaultHandlerOptions:{single:true,"double":false,pixelTolerance:0,stopSingle:false,stopDouble:false},initialize:function(A){OpenLayers.Control.prototype.initialize.apply(this,[A]);
this.pointLayer=new OpenLayers.Layer.Vector("Point Layer");
this.map.addLayer(this.pointLayer);
this.pointControl=new OpenLayers.Control.DrawFeature(this.pointLayer,OpenLayers.Handler.Point);
this.pointControl.featureAdded=this.onFeatureAdded.bind(this);
this.map.addControl(this.pointControl);
this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")
},onFeatureAdded:function(){if(this.pointLayer.features.length>1){var A=this.pointLayer.features[0];
this.pointLayer.removeFeatures(A)
}},draw:function(){if(this.div!=null){OpenLayers.Control.prototype.draw.apply(this,arguments);
this.div.className="MWControlDrawPoint";
this.divpanel=document.createElement("div");
this.divpanel.id="panel";
this.divpanel.className="panel";
this.div.appendChild(this.divpanel)
}return this.div
},trigger:function(A){if(this.active){this.deactivate();
this.pointControl.deactivate()
}else{this.activate();
this.pointControl.activate()
}},getCoords:function(){if(this.pointLayer.features[0]!=null){var A=this.pointLayer.features[0].geometry;
var B=A.getCentroid();
return B
}},CLASS_NAME:"MW.Control.OpenLS.DrawPoint"});MW.Control.FloatingPanel=OpenLayers.Class(MW.Control,{size:null,position:null,title:null,idname:null,zIndex:"9999",childElement:null,external:false,initialize:function(A){MW.Control.prototype.initialize.apply(this,[A]);
this.idname=OpenLayers.Util.createUniqueID("FloatingPanel")
},destroy:function(){OpenLayers.Event.stopObservingElement(this.div);
OpenLayers.Event.stopObservingElement(this.div);
OpenLayers.stopObservingElement(document);
OpenLayers.stopObservingElement(document.body);
if(this.floatingEvents){this.floatingEvents.destroy()
}this.floatingEvents=null;
this.childElement=null;
this.size=null;
this.position=null;
this.title=null;
this.idname=null;
this.div=null;
MW.Control.prototype.destroy.apply(this,arguments)
},draw:function(){if(this.div!=null){this.external=true;
var D=null;
var A=null;
if(this.div.style.width){D=this.div.style.width
}else{if(this.size!=null){D=this.size.w
}else{D="250px"
}}if(this.div.style.height){A=this.div.style.height;
this.div.style.height=""
}else{if(this.size!=null){A=this.size.h
}else{A="400px"
}}this.size=new OpenLayers.Size(D,A)
}MW.Control.prototype.draw.apply(this,arguments);
this.div.className="MWControlFloatingPanel";
if(!this.external){this.div.id=this.idname+"Container";
this.div.style.left=this.position.x+"px";
this.div.style.top=this.position.y+"px"
}this.titlePanel=document.createElement("div");
this.titlePanel.className="titlePanel";
this.titlePanel.style.width=this.size.w+"px";
this.titlePanel.style.cursor="default";
this.spanTitle=document.createElement("span");
this.spanTitle.className="titleSpan";
this.divtext=document.createElement("div");
this.divtext.className="titleText";
this.divtext.innerHTML=this.title;
this.spanTitle.appendChild(this.divtext);
this.statusbarimg=document.createElement("div");
this.statusbarimg.className="statusBarImg";
this.spanTitle.appendChild(this.statusbarimg);
if(!this.external){this.imgReset=document.createElement("img");
this.imgReset.id="sbImgReset"+this.idname;
this.imgReset.src=OpenLayers.ImgPath+"floating/reset.gif";
this.imgReset.style.cursor="pointer";
this.statusbarimg.appendChild(this.imgReset)
}this.imgNascondi=document.createElement("img");
this.imgNascondi.id="sbImgNascondi"+this.idname;
this.imgNascondi.src=OpenLayers.ImgPath+"floating/nascondi.gif";
this.imgNascondi.style.cursor="pointer";
this.statusbarimg.appendChild(this.imgNascondi);
OpenLayers.Event.observe(this.statusbarimg,"mousedown",OpenLayers.Event.stop);
if(!this.external){this.imgChiusura=document.createElement("img");
this.imgChiusura.id="sbImgChiusura"+this.idname;
this.imgChiusura.src=OpenLayers.ImgPath+"floating/chiusura.gif";
this.imgChiusura.style.cursor="pointer";
this.statusbarimg.appendChild(this.imgChiusura)
}if(!this.external){this.floatingEvents=new OpenLayers.Events(this,this.div,null,true);
this.floatingEvents.register("mousemove",this,this.controlposition);
this.floatingEvents=new OpenLayers.Events(this,this.imgReset,null,true);
this.floatingEvents.register("click",this,this.resetPosition)
}this.floatingEvents=new OpenLayers.Events(this,this.imgNascondi,null,true);
this.floatingEvents.register("click",this,this.toggleChild);
if(!this.external){this.floatingEvents=new OpenLayers.Events(this,this.imgChiusura,null,true);
this.floatingEvents.register("click",this,this.showHideFloating)
}this.titlePanel.appendChild(this.spanTitle);
if(!this.external){this.titlePanel.style.cursor="move"
}this.div.appendChild(this.titlePanel);
this.childElement=document.createElement("div");
this.childElement.id=this.idname+"Child";
this.childElement.style.top="0px";
this.childElement.style.left="0px";
this.childElement.style.width=this.size.w+"px";
this.childElement.style.height=this.size.h+"px";
this.childElement.className="child";
this.div.appendChild(this.childElement);
OpenLayers.Event.observe(this.div,"DOMMouseScroll",this.stopLocalEvent);
OpenLayers.Event.observe(this.div,"mousewheel",this.stopLocalEvent);
if(!this.external){var C=this.controlposition.bindAsEventListener(this);
OpenLayers.Event.observe(document,"mousemove",C);
OpenLayers.Event.observe(document.body,"mousemove",C)
}this.overflowEvents=new OpenLayers.Events(this,this.div,null,true);
this.overflowEvents.register("mousedown",this,this.mouseDownEvent);
this.overflowEvents.register("mouseup",this,this.mouseUpEvent);
this.events=new OpenLayers.Events(this,this.childElement,null);
this.events.register("click",this.childElement,this.stopevent);
var B={div:this.div,zIndex:this.zIndex};
this.events.register("mousedown",this.childElement,OpenLayers.Function.bindAsEventListener(this.mouseDownEventOnChild,B));
this.events.register("dblclick",this.childElement,this.stopevent);
this.events=new OpenLayers.Events(this,this.titlePanel,null);
this.events.register("click",this.titlePanel,this.stopevent);
this.events.register("dblclick",this.titlePanel,this.stopevent);
this.map.events.unregister("moveend",this,this.update);
this.map.floatingDivList.push(this);
if(!this.external){this.setRicoDragDrop()
}return this.div
},stopLocalEvent:function(A){if(A.stopPropagation){OpenLayers.Event.stop(A,true)
}else{A.cancelBubble=true
}},addDummyContent:function(A){var B=document.createElement("span");
B.innerHTML=A;
this.childElement.appendChild(B)
},setRicoDragDrop:function(){var A=this.map.viewPortDiv;
this.dndMgr=new Rico.DragAndDrop(A);
this.dndMgr.initializeEventHandlers();
this.dndMgr.registerDraggable(new Rico.Draggable("",this.div));
this.map.events.register("mousedown",this.div,this.dndMgr._mouseDown);
this.map.events.register("mousemove",this.div,this.dndMgr._mouseMove);
this.map.events.register("mouseup",this.div,this.dndMgr._mouseUp)
},orderBrotherFloatingElement:function(){this.map.floatingDivList.sort(function(C,B){return B.div.style.zIndex-C.div.style.zIndex
});
var A;
for(A=0;
A<this.map.floatingDivList.length;
A++){this.map.floatingDivList[A].div.style.zIndex=this.zIndex-A
}},mouseDownEvent:function(A){document.onselectstart=function(){return false
};
this.div.style.zIndex=this.zIndex+1
},mouseDownEventOnChild:function(A){this.div.style.zIndex=this.zIndex+1;
OpenLayers.Event.stop(A,true)
},mouseUpEvent:function(A){this.orderBrotherFloatingElement()
},baseLayerDraw:function(){this.draw();
this.map.events.unregister("changebaselayer",this,this.baseLayerDraw)
},stopevent:function(A){OpenLayers.Event.stop(A,true)
},setdndMgrFloating:function(){this.dndMgr.registerDraggable(new Rico.Draggable("test-rico-dnd",this.idname+"Container"))
},controlposition:function(G){var F=(this.div.style.left.substring(0,this.div.style.left.indexOf("px")))*1+this.div.offsetWidth*0.5;
var E=(this.div.style.top.substring(0,this.div.style.top.indexOf("px")))*1+this.div.offsetHeight*0.5;
var C=(this.map.div.style.left.substring(0,this.map.div.style.left.indexOf("px")))*1+this.map.div.offsetWidth*1;
var B=(this.map.div.style.top.substring(0,this.map.div.style.top.indexOf("px")))*1+this.map.div.offsetHeight*1;
var I=(this.map.div.style.left.substring(0,this.map.div.style.left.indexOf("px")))*1;
var D=(this.div.style.top.substring(0,this.div.style.top.indexOf("px")))*1;
var H=(this.map.div.style.top.substring(0,this.map.div.style.top.indexOf("px")))*1;
if((F>C)||(E>B)||(F<I)||(D<H)){this.dndMgr.clearSelection();
this.resetPosition(null)
}var A=document.getElementById("sbImgReset"+this.idname);
if(A!=null){if(((this.div.style.left!=this.position.x+"px")||(this.div.style.top!=this.position.y+"px"))&&!(A.src.match(OpenLayers.ImgPath+"floating/resetUnpinned.gif"))){A.src=OpenLayers.ImgPath+"floating/resetUnpinned.gif"
}}},resetPosition:function(A){var B=document.getElementById("sbImgReset"+this.idname);
if(B!=null){B.src=OpenLayers.ImgPath+"floating/reset.gif"
}this.div.style.left=this.position.x+"px";
this.div.style.top=this.position.y+"px";
this.orderBrotherFloatingElement()
},toggleChild:function(){if(document.getElementById(this.childElement.id)==null){this.div.appendChild(this.childElement);
var A=document.getElementById("sbImgNascondi"+this.idname);
if(A!=null){A.src=OpenLayers.ImgPath+"floating/nascondi.gif"
}}else{this.div.removeChild(this.childElement);
var A=document.getElementById("sbImgNascondi"+this.idname);
if(A!=null){A.src=OpenLayers.ImgPath+"floating/ripristina.gif"
}}},showHideFloating:function(){if(this.div.style.display=="none"){this.div.style.display="block"
}else{this.div.style.display="none"
}},getContentContainer:function(){return this.childElement.id
},CLASS_NAME:"MW.Control.FloatingPanel"});MW.Control.Info=OpenLayers.Class(OpenLayers.Control,{info:null,initialize:function(A){OpenLayers.Control.prototype.initialize.apply(this,[A])
},draw:function(){this.handler=new OpenLayers.Handler.Drag(this,{down:this.defaultMouseDown})
},defaultMouseDown:function(A){if(this.info.CLASS_NAME=="MW.Control.FloatingPanel.Info.GetFeatureInfo"){if(this.info.layers.length==0){alert("Nessun tema visibile sulla mappa.");
return 
}}var D=this.map.getLonLatFromPixel(new OpenLayers.Pixel(A.x,A.y));
var B=this.map.getLonLatFromPixel(new OpenLayers.Pixel(A.x,A.y));
t=this.info.getTolerance();
t/=2;
D.lon-=t;
D.lat-=t;
B.lon+=t;
B.lat+=t;
var C=new OpenLayers.Bounds(D.lon,D.lat,B.lon,B.lat);
this.info.setBounds(C);
if(this.info.CLASS_NAME=="MW.Control.FloatingPanel.Info.GetFeatureInfo"){this.info.setMousePosition({x:A.x,y:A.y})
}this.map.addControl(this.info)
},CLASS_NAME:"MW.Control.Info"});MW.Control.InfoLayerArcXML=OpenLayers.Class(MW.Control,{type:OpenLayers.Control.TYPE_BUTTON,arcXML:null,optionsLayer:null,optionsInfo:null,defaultHandlerOptions:{single:true,"double":false,pixelTolerance:0,stopSingle:false,stopDouble:false},initialize:function(A){this.handlerOptions=OpenLayers.Util.extend({},this.defaultHandlerOptions);
OpenLayers.Control.prototype.initialize.apply(this,[A]);
this.handler=new OpenLayers.Handler.Click(this,{click:this.onClick},this.handlerOptions);
this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")
},onClick:function(B){var A=this.map.getLonLatFromPixel(B.xy);
this.arcXML.getFeatureInfo(A,this.optionsLayer,this.optionsInfo)
},trigger:function(A){if(this.active){this.deactivate()
}else{this.activate()
}},CLASS_NAME:"MW.Control.InfoLayerArcXML"});MW.Control.LoadingMessage=OpenLayers.Class(MW.Control,{element:null,div:null,imgFileName:"loading.gif",initialize:function(A){OpenLayers.Control.prototype.initialize.apply(this,[A])
},destroy:function(){if(!this.element){return 
}this.element.removeChild(this.img);
this.div.removeChild(this.element);
this.img=null;
this.element=null;
this.imgFileName=null;
OpenLayers.Control.prototype.destroy.apply(this,arguments)
},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);
this.img=document.createElement("img");
this.img.className=this.displayClass;
this.img.src=OpenLayers.Util.getImagesLocation()+this.imgFileName;
this.element=document.createElement("div");
this.element.className=this.displayClass+"Background";
this.element.appendChild(this.img);
this.div.appendChild(this.element);
this.div.style.display="none";
return this.div
},startLoad:function(){this.div.style.display="block"
},stopLoad:function(){this.div.style.display="none"
},setImgFileName:function(A){this.imgFileName=A
},CLASS_NAME:"MW.Control.LoadingMessage"});MW.Control.MapGE=OpenLayers.Class(MW.Control,{type:OpenLayers.Control.TYPE_BUTTON,url:null,params:"&actionName=GOOGLEEARTH",inputSrs:"utm*",initialize:function(A){OpenLayers.Control.prototype.initialize.apply(this,arguments)
},trigger:function(){this.callGoogleEarth()
},callGoogleEarth:function(){var B=this.map.getExtent();
var A=this.url;
window.open(A+this.params+"&minx="+B.left+"&maxx="+B.right+"&miny="+B.bottom+"&maxy="+B.top+"&inputSrs="+this.inputSrs)
},CLASS_NAME:"MW.Control.MapGE"});MW.Control.MapPrint=OpenLayers.Class(MW.Control,{type:OpenLayers.Control.TYPE_BUTTON,printWin:null,olonSaveStrMap:null,title:null,footer:null,overview:null,initialize:function(A){OpenLayers.Control.prototype.initialize.apply(this,arguments)
},trigger:function(){this.print()
},clone:function(A){this.olonSaveStrMap=A.olonSaveStrMap;
this.title=A.title;
this.footer=A.footer;
this.overview=A.overview
},print:function(){var C=new MW.Format.OLON();
this.olonSaveStrMap=C.write(this.map,true);
var A=this.map.controls;
var D="";
for(var B=0;
B<A.length;
B++){if(A[B].displayClass=="olControlOverviewMap"){if(A[B].element.style.display=="none"){A[B].maximizeControl();
D=A[B].div.innerHTML;
A[B].minimizeControl()
}else{D=A[B].div.innerHTML
}}}if(D!=""){this.overview=D
}if(this.printWin!=null){this.printWin.close()
}this.printWin=window.open("print.html","Anteprima_di_stampa");
this.printWin.focus()
},createMap:function(G,H,C,F){var B=new MW.Format.OLON();
var D=B.read(this.olonSaveStrMap);
var I={maxResolution:D.maxResolution,maxExtent:D.maxExtent,numZoomLevels:D.numZoomLevels,units:D.units,projection:D.projection,center:D.center,controls:[]};
var A=new OpenLayers.Map(G,I);
if(this.title!=null&&this.title!=""&&H){H.innerHTML="<h1>"+this.title+"</h1>"
}if(this.footer!=null&&this.footer!=""&&C){C.innerHTML="<h4>"+this.footer+"</h4>"
}if(this.overview!=null&&this.overview!=""&&F){F.innerHTML=this.overview
}for(i=0;
i<D.layers.length;
i++){var E=D.layers[i];
if(E.visibility){A.addLayer(E)
}}A.setCenter(D.center,D.zoom);
return A
},CLASS_NAME:"MW.Control.MapPrint"});MW.Control.OpenLS=OpenLayers.Class(MW.Control,{});MW.Control.Overview=OpenLayers.Class(MW.Control,{ovmap:null,layers:null,minRatio:8,maxRatio:32,mapOptions:null,layerBounds:null,imageUrl:null,zoomboxHideLevel:0,initialize:function(A){this.imageUrl=OpenLayers.ImgPath+"overviewMW.gif";
this.layers=new Array();
MW.Control.prototype.initialize.apply(this,[A])
},destroy:function(){MW.Control.prototype.destroy.apply(this,arguments)
},draw:function(){if(this.div!=null){this.external=true;
var D=null;
var A=null;
if(this.div.style.width){D=this.div.style.width
}else{if(this.size!=null){D=this.size.w
}else{D="250px"
}}if(this.div.style.height){A=this.div.style.height;
this.div.style.height=""
}else{if(this.size!=null){A=this.size.h
}else{A="400px"
}}this.size=new OpenLayers.Size(D,A)
}MW.Control.prototype.draw.apply(this,arguments);
this.div.className="MWControlOverview";
this.div.style.left="";
this.div.style.top="";
this.titlePanel=document.createElement("div");
this.titlePanel.className="titlePanel";
this.titlePanel.style.width=this.size.w+"px";
this.titlePanel.style.cursor="default";
this.spanTitle=document.createElement("span");
this.spanTitle.className="titleSpan";
this.divtext=document.createElement("div");
this.divtext.className="titleText";
this.divtext.innerHTML=this.title;
this.spanTitle.appendChild(this.divtext);
this.statusbarimg=document.createElement("div");
this.statusbarimg.className="statusBarImg";
this.spanTitle.appendChild(this.statusbarimg);
this.imgNascondi=document.createElement("img");
this.imgNascondi.id="sbImgNascondi"+this.idname;
this.imgNascondi.src=OpenLayers.ImgPath+"nascondi.gif";
this.imgNascondi.style.cursor="pointer";
this.statusbarimg.appendChild(this.imgNascondi);
this.floatingEvents=new OpenLayers.Events(this,this.imgNascondi,null,true);
this.floatingEvents.register("click",this,this.toggleChild);
this.titlePanel.appendChild(this.spanTitle);
this.div.appendChild(this.titlePanel);
this.childElement=document.createElement("div");
this.childElement.id=this.idname+"Child";
this.childElement.style.top="0px";
this.childElement.style.left="0px";
this.childElement.style.width=this.size.w+"px";
this.childElement.style.height=this.size.h+"px";
this.childElement.className="child";
this.div.appendChild(this.childElement);
OpenLayers.Event.observe(this.div,"DOMMouseScroll",this.stopLocalEvent);
OpenLayers.Event.observe(this.div,"mousewheel",this.stopLocalEvent);
this.overflowEvents=new OpenLayers.Events(this,this.div,null,true);
this.overflowEvents.register("mousedown",this,this.mouseDownEvent);
this.overflowEvents.register("mouseup",this,this.mouseUpEvent);
this.events=new OpenLayers.Events(this,this.childElement,null);
this.events.register("click",this.childElement,this.stopevent);
var C={div:this.div,zIndex:this.zIndex};
this.events.register("mousedown",this.childElement,OpenLayers.Function.bindAsEventListener(this.mouseDownEventOnChild,C));
this.events.register("dblclick",this.childElement,this.stopevent);
this.events=new OpenLayers.Events(this,this.titlePanel,null);
this.events.register("mousedown",this.titlePanel,this.stopevent);
this.events.register("click",this.titlePanel,this.stopevent);
this.events.register("dblclick",this.titlePanel,this.stopevent);
this.map.events.unregister("moveend",this,this.update);
this.div.style.height="";
if(this.layers.length==0){this.graphicLayer=new OpenLayers.Layer.Image("Overview",this.imageUrl,this.layerBounds,this.size);
this.graphicLayer.setIsBaseLayer(false);
this.graphicLayer.setVisibility(false);
this.graphicLayer.displayInLayerSwitcher=false;
this.map.addLayer(this.graphicLayer);
var B=this.graphicLayer.clone();
B.setIsBaseLayer(true);
this.layers=[B]
}this.mapDiv=document.createElement("div");
this.mapDiv.id=OpenLayers.Util.createUniqueID(this.idname);
this.mapDiv.className="mapDiv";
this.mapDiv.style.height="100%";
this.mapDiv.style.width="100%";
this.childElement.appendChild(this.mapDiv);
this.map.events.register("moveend",this,this.update);
if(!this.external){this.map.events.register("mouseup",this,this.moveStartOverview);
this.map.events.register("mousemove",this,this.moveStartOverview)
}this.rectEvents=new OpenLayers.Events(this,this.mapDiv,null,true,{includeXY:true});
this.rectEvents.register("mouseout",this,this.rectMouseOut);
this.rectEvents.register("mousedown",this,this.rectMouseDown);
this.rectEvents.register("mousemove",this,this.rectMouseMove);
this.rectEvents.register("mouseup",this,this.rectMouseUp);
this.rectEvents.register("click",this,function(E){OpenLayers.Event.stop(E)
});
if(this.map.getExtent()){this.update()
}return this.div
},baseLayerDraw:function(){this.draw();
this.map.events.unregister("changebaselayer",this,this.baseLayerDraw)
},rectMouseOut:function(A){if(this.mouseDragStart!=null&&OpenLayers.Util.mouseLeft(A,this.ovmap.div)){if(this.zoomBox){this.removeZoomBox()
}this.mouseDragStart=null
}},rectMouseDown:function(A){if(this.zoomBox!=null){this.removeZoomBox()
}if(!OpenLayers.Event.isLeftClick(A)){return 
}A.xy.x=A.xy.x-2;
A.xy.y=A.xy.y-2;
this.mouseDragStart=A.xy.clone();
this.performedDrag=false;
this.startViaKeyboard=true;
this.ovmap.div.style.cursor="crosshair";
this.zoomBox=OpenLayers.Util.createDiv("zoomBoxOverview",this.mouseDragStart,null,null,"absolute");
this.zoomBox.style.fontSize="1px";
this.zoomBox.style.zIndex=this.ovmap.Z_INDEX_BASE.Popup-1;
this.ovmap.viewPortDiv.appendChild(this.zoomBox);
this.performedDrag=true;
OpenLayers.Event.stop(A)
},rectMouseMove:function(C){if(this.mouseDragStart!=null){C.xy.x=C.xy.x-2;
C.xy.y=C.xy.y-2;
var B=Math.abs(this.mouseDragStart.x-C.xy.x);
var A=Math.abs(this.mouseDragStart.y-C.xy.y);
this.zoomBox.style.width=Math.max(1,B)+"px";
this.zoomBox.style.height=Math.max(1,A)+"px";
if(C.xy.x<this.mouseDragStart.x){this.zoomBox.style.left=C.xy.x+"px"
}if(C.xy.y<this.mouseDragStart.y){this.zoomBox.style.top=C.xy.y+"px"
}this.performedDrag=true
}},rectMouseUp:function(A){if(!OpenLayers.Event.isLeftClick(A)){return 
}this.zoomBoxEnd(A);
document.onselectstart=null;
this.mouseDragStart=null
},zoomBoxEnd:function(B){if(this.mouseDragStart!=null){B.xy.x=B.xy.x-2;
B.xy.y=B.xy.y-2;
if(Math.abs(this.mouseDragStart.x-B.xy.x)>5||Math.abs(this.mouseDragStart.y-B.xy.y)>5){var H=this.ovmap.getLonLatFromViewPortPx(this.mouseDragStart);
var A=this.ovmap.getLonLatFromViewPortPx(B.xy);
var G=Math.max(H.lat,A.lat);
var C=Math.min(H.lat,A.lat);
var F=Math.min(H.lon,A.lon);
var D=Math.max(H.lon,A.lon);
var E=new OpenLayers.Bounds(F,C,D,G);
if(this.map.getZoomForExtent(E)>0){if(!this.map.isValidLonLat(E.getCenterLonLat())){if(this.zoomBox!=null){this.removeZoomBox()
}this.map.zoomTo(0);
return false
}this.map.zoomToExtent(E)
}else{if(this.zoomBox!=null){this.removeZoomBox()
}this.map.zoomTo(this.map.getZoomForExtent(E))
}}else{var A=this.ovmap.getLonLatFromViewPortPx(B.xy);
if(!this.map.isValidLonLat(new OpenLayers.LonLat((A.lon),(A.lat)))){if(this.zoomBox!=null){this.removeZoomBox()
}this.map.zoomTo(0);
return false
}this.map.setCenter(new OpenLayers.LonLat((A.lon),(A.lat)),this.map.getZoom()+1)
}}},update:function(){if(document.getElementById(this.childElement.id)==null){return 
}if(this.ovmap==null){this.createMap();
if(!this.isSuitableOverview()){this.updateOverview()
}}this.updateRectToMap()
},moveStartOverview:function(){var A=document.getElementById(this.mapDiv.id);
if(this.ovmap&&this.ovmap!=null&&A&&A!=null){this.ovmap.events.triggerEvent("movestart")
}},updateOverview:function(){var B=this.map.getResolution();
var A=this.ovmap.getResolution();
var C=A/B;
if(C>this.maxRatio){A=this.minRatio*B
}else{if(C<=this.minRatio){A=this.maxRatio*B
}}this.ovmap.setCenter(this.map.center,this.ovmap.getZoomForResolution(A));
this.updateRectToMap()
},createMap:function(){var A=OpenLayers.Util.extend({controls:[],maxResolution:"auto"},this.mapOptions);
this.ovmap=new MW.Map(this.mapDiv.id,A);
this.ovmap.addLayers(this.layers);
this.ovmap.zoomTo(0)
},updateRectToMap:function(){if(this.zoomBox!=null){this.removeZoomBox()
}if(this.map.units!="degrees"){if(this.ovmap.getProjection()&&(this.map.getProjection()!=this.ovmap.getProjection())){alert("The overview map only works when it is in the same projection as the main map")
}}var A=this.getRectBoundsFromMapBounds(this.map.getExtent());
if(this.map.getZoom()>this.zoomboxHideLevel){if(A){this.setRectPxBounds(A)
}}},setRectPxBounds:function(C){var D;
var F=Math.max(C.top,0);
var E=Math.max(C.left,0);
var A=C.top+Math.abs(C.getHeight());
var B=C.left+C.getWidth();
this.zoomBox=OpenLayers.Util.createDiv("zoomBoxOverview",null,null,null,"absolute");
this.zoomBox.style.fontSize="1px";
this.zoomBox.style.top=parseInt(F)+"px";
this.zoomBox.style.left=parseInt(E)+"px";
this.zoomBox.style.height=parseInt(Math.max(A-F,0))+"px";
this.zoomBox.style.width=parseInt(Math.max(B-E,0))+"px";
this.zoomBox.style.zIndex=this.ovmap.Z_INDEX_BASE.Popup-1;
this.ovmap.viewPortDiv.appendChild(this.zoomBox)
},updateMapToRect:function(){var B=this.getRectPxBounds();
var A=this.getMapBoundsFromRectBounds(B);
this.map.setCenter(A.getCenterLonLat(),this.map.zoom)
},stopevent:function(A){OpenLayers.Event.stop(A,true)
},removeZoomBox:function(){this.ovmap.viewPortDiv.removeChild(this.zoomBox);
this.zoomBox=null
},isSuitableOverview:function(){var B=this.map.getExtent();
var A=this.map.maxExtent;
var C=new OpenLayers.Bounds(Math.max(B.left,A.left),Math.max(B.bottom,A.bottom),Math.min(B.right,A.right),Math.min(B.top,A.top));
var D=this.ovmap.getResolution()/this.map.getResolution();
return((D>this.minRatio)&&(D<=this.maxRatio)&&(this.ovmap.getExtent().containsBounds(C)))
},getRectBoundsFromMapBounds:function(D){var A=new OpenLayers.LonLat(D.left,D.bottom);
var F=new OpenLayers.LonLat(D.right,D.top);
var C=this.getOverviewPxFromLonLat(A);
var B=this.getOverviewPxFromLonLat(F);
var E=null;
if(C&&B){E=new OpenLayers.Bounds(C.x,C.y,B.x,B.y)
}return E
},getOverviewPxFromLonLat:function(D){var B=this.ovmap.getResolution();
var C=this.ovmap.getExtent();
var A=null;
if(C){A=new OpenLayers.Pixel(Math.round(1/B*(D.lon-C.left)),Math.round(1/B*(C.top-D.lat)))
}return A
},getMapBoundsFromRectBounds:function(D){var C=new OpenLayers.Pixel(D.left,D.bottom);
var B=new OpenLayers.Pixel(D.right,D.top);
var A=this.getLonLatFromOverviewPx(C);
var E=this.getLonLatFromOverviewPx(B);
return new OpenLayers.Bounds(A.lon,A.lat,E.lon,E.lat)
},toggleChild:function(){if(document.getElementById(this.childElement.id)==null){this.div.appendChild(this.childElement);
var A=document.getElementById("sbImgNascondi"+this.idname);
if(A!=null){A.src=OpenLayers.ImgPath+"nascondi.gif"
}}else{this.div.removeChild(this.childElement);
var A=document.getElementById("sbImgNascondi"+this.idname);
if(A!=null){A.src=OpenLayers.ImgPath+"ripristina.gif"
}}this.update()
},stopLocalEvent:function(A){if(A.stopPropagation){OpenLayers.Event.stop(A,true)
}else{A.cancelBubble=true
}},CLASS_NAME:"MW.Control.Overview"});MW.Control.PolygonsUnion=OpenLayers.Class(MW.Control,{type:OpenLayers.Control.TYPE_BUTTON,id:null,div:null,polygonUnionUrl:null,polygonLayer:null,namespace_uri_openls:"http://www.opengis.net/xls",EVENT_TYPES:["loadComplete","loadFailure"],namespace_uri_gml:"http://www.opengis.net/gml",namespace_prefix_gml:"gml",defaultHandlerOptions:{single:true,"double":false,pixelTolerance:0,stopSingle:false,stopDouble:false},unionPars:"serviceName=PolygonUnion&methodType=ejb&actionName=polygonunion&xmlRequest=",initialize:function(A){OpenLayers.Control.prototype.initialize.apply(this,[A]);
this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_")
},getPolygons:function(){var C='<PolygonUnionRequest xmlns="http://schemas.corenet.it/mapwork/servizi/polygonunion" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc">';
for(i=0;
i<this.polygonLayer.selectedFeatures.length;
i++){var E=this.polygonLayer.selectedFeatures[i];
if(E!=null&&E.geometry!=null){var B=E.geometry;
if(B.CLASS_NAME=="OpenLayers.Geometry.Polygon"){C+="<Polygon>";
for(j=0;
j<B.components.length;
j++){var D=B.components[j];
var F=MW.GeometryUtil.getCoordinatesFromComponent(D);
if(j==0){C+="<gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>"
}else{C+="<gml:innerBoundaryIs><gml:LinearRing><gml:coordinates>"
}for(p=0;
p<F.length;
p++){var A=F[p];
C+=A[0]+","+A[1]+" "
}if(j==0){C+="</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs>"
}else{C+="</gml:coordinates></gml:LinearRing></gml:innerBoundaryIs>"
}}C+="</Polygon>"
}}}C+="</PolygonUnionRequest>";
return C
},draw:function(){if(this.div!=null){OpenLayers.Control.prototype.draw.apply(this,arguments);
this.div.className="MWControlPolygonsUnion";
this.divpanel=document.createElement("div");
this.divpanel.id="panel";
this.divpanel.className="panel";
this.div.appendChild(this.divpanel)
}return this.div
},trigger:function(A){this.loadPolygonUnion()
},loadPolygonUnion:function(){if(this.div!=null){this.divpanel.style.display="none";
this.divpanel.innerHTML=""
}var A=this.successUnion.bind(this);
var C=this.failureGeocode.bind(this);
if(this.polygonLayer.selectedFeatures!=null&&this.polygonLayer.selectedFeatures.length>0){var E=this.getPolygons();
var B=this.unionPars+E;
this.status_code=NONE;
var D=this.polygonUnionUrl;
if(MW.Proxy&&this.geocodeUrl.startsWith("http")){D=MW.Proxy+MW.Util.escapeUri(this.polygonUnionUrl)
}OpenLayers.Console.debug("Ajax request url: "+D+B);
new OpenLayers.Ajax.Request(D+B,{method:"get",parameters:null,onComplete:A,onFailure:C})
}},successUnion:function(E){if(E.responseXML==null&&E.responseText==null){return 
}var B=E.responseXML;
if(!B||E.fileType!="XML"){B=OpenLayers.parseXMLString(E.responseText)
}var P=OpenLayers.Ajax.getElementsByTagNameNS(B,this.namespace_uri_gml,"gml","coordinates");
if(P[0]!=null){if(P[0].firstChild!=null){var Q=P[0].firstChild.nodeValue;
var K=Q.trim();
var L=new Array();
var F=0;
var G=-1;
for(j=0;
j<K.length;
j++){if(K[j]==" "&&K[j+1]!=" "){var J=K.substring(G+1,j);
var I=J.indexOf(",");
pointx=(new Number(J.substring(0,I))).valueOf();
pointy=(new Number(J.substring(I+1))).valueOf();
if(pointx!=0&&pointy!=0){var O=new OpenLayers.Geometry.Point(pointx,pointy);
L[F]=O;
F=F+1
}G=j
}}var D=new OpenLayers.Geometry.LinearRing(L);
var N=new OpenLayers.Geometry.Polygon(D);
var H=new OpenLayers.Feature.Vector(N);
var A=this.polygonLayer.features;
var C=A.length;
this.polygonLayer.removeFeatures(this.polygonLayer.selectedFeatures);
this.polygonLayer.addFeatures(new OpenLayers.Feature.Vector(N))
}}else{var M=OpenLayers.Ajax.getElementsByTagNameNS(B,this.namespace_uri_gml,"ns6","exception message");
if(M!=null){alert("Errore nella selezione dei poligoni:i poligoni selezionati sono disgiunti")
}}},failureGeocode:function(A){if(this.div!=null){this.divpanel.style.display="block";
this.divpanel.innerHTML="Si è verificato un errore nel servizio."
}this.status_code=SERVER_ERROR;
this.events.triggerEvent("loadFailure");
return 
},CLASS_NAME:"MW.Control.OpenLS.PolygonsUnion"});NONE=0;
SELECT_LOADED=1;
UNKNOWN_SELECT=11;
SERVER_ERROR=13;
MW.Control.Select=OpenLayers.Class(MW.Control,{div:null,urlMapWork:null,urlWms:null,getCapabilitiesPars:"actionName=GetCapabilities",geometricSearchPars:"serviceName=GeometricSearch&actionName=GeometricSearch&xmlRequest=",layer:null,columnGeometry:null,id:null,namespace_uri_mapwork:"http://schemas.corenet.it/mapwork/servizi",namespace_prefix_mapwork:"mpw",namespace_uri_capabilities:"http://schemas.corenet.it/mapwork/servizi/capabilities",namespace_prefix_capabilities:"cap",namespace_uri_gml:"http://www.opengis.net/gm",namespace_prefix_gml:"mpw",events:null,loading:null,EVENT_TYPES:["loadComplete","loadFailure"],fallThrough:false,status_code:null,sessionId:null,geometry:null,type:null,operation:null,logicOps:null,pointControl:null,lineControl:null,polygonControl:null,layerSelPhysicalName:null,fieldNameSTD:null,layerSelect:null,numFeatures:0,layersSelection:[],extractFeatures:false,isVectorLayer:false,styleMap:null,lastGeometrySelection:"",reducedOptions:false,internalEditingToolbarDisabled:false,maxFeatures:null,geometries:null,featureList:null,initialize:function(A){MW.Control.prototype.initialize.apply(this,[A]);
this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");
this.events.register("loadComplete",this,this.stopLoading);
this.events.register("loadFailure",this,this.stopLoading)
},draw:function(){this.loading=new MW.Control.LoadingMessage();
if((this.map!=null)&&(this.loading!=null)){this.map.addControl(this.loading)
}if(this.div!=null){MW.Control.prototype.draw.apply(this,arguments);
var F=null;
var G=null;
var B=null;
F=this.getLayerByName("Point Layer");
if(F==null){F=new OpenLayers.Layer.Vector("Point Layer",{displayInLayerSwitcher:false});
this.map.addLayer(F);
this.pointControl=new MW.Control.DrawFeature(F,OpenLayers.Handler.Point);
this.map.addControl(this.pointControl)
}G=this.getLayerByName("Line Layer");
if(G==null){G=new OpenLayers.Layer.Vector("Line Layer",{displayInLayerSwitcher:false});
this.map.addLayer(G);
this.lineControl=new MW.Control.DrawFeature(G,OpenLayers.Handler.Path);
this.map.addControl(this.lineControl)
}B=this.getLayerByName("Polygon Layer");
if(B==null){B=new OpenLayers.Layer.Vector("Polygon Layer",{displayInLayerSwitcher:false});
this.map.addLayer(B);
this.polygonControl=new MW.Control.DrawFeature(B,OpenLayers.Handler.Polygon);
this.map.addControl(this.polygonControl)
}this.pointControl.deactivate();
this.lineControl.deactivate();
this.polygonControl.deactivate();
this.div.className="MWControlGeometricSearch";
if(!this.internalEditingToolbarDisabled){var A=document.createElement("span");
A.className="pos marginspangeometry";
A.innerHTML="Utilizza gli strumenti qui sotto per selezionare un punto, una spezzata o un poligono sulla mappa e avviare cos&#236; la ricerca sul layer d'interesse.";
this.div.appendChild(A);
var D=document.createElement("br");
this.div.appendChild(D);
D=document.createElement("br");
this.div.appendChild(D);
var E=document.createElement("div");
E.className="imgdraw marginleftgeometry";
this.div.appendChild(E);
this.imgPunto=document.createElement("img");
this.imgPunto.id="punto";
this.imgPunto.src=OpenLayers.ImgPath+"toolbar/external/punto.png";
E.appendChild(this.imgPunto);
E=document.createElement("div");
E.className="imgdraw";
E.style.marginLeft="10px";
this.div.appendChild(E);
this.imgLinea=document.createElement("img");
this.imgLinea.id="linea";
this.imgLinea.src=OpenLayers.ImgPath+"toolbar/external/linea.png";
E.appendChild(this.imgLinea);
E=document.createElement("div");
E.className="imgdraw";
E.style.marginLeft="10px";
this.div.appendChild(E);
this.imgPoligono=document.createElement("img");
this.imgPoligono.id="poligono";
this.imgPoligono.src=OpenLayers.ImgPath+"toolbar/external/poligono.png";
E.appendChild(this.imgPoligono);
D=document.createElement("br");
this.div.appendChild(D);
D=document.createElement("br");
this.div.appendChild(D);
var C={select:this,controlActive:this.pointControl};
OpenLayers.Event.observe(this.imgPunto,"click",this.onChangeGeometry.bind(C));
var C={select:this,controlActive:this.lineControl};
OpenLayers.Event.observe(this.imgLinea,"click",this.onChangeGeometry.bind(C));
var C={select:this,controlActive:this.polygonControl};
OpenLayers.Event.observe(this.imgPoligono,"click",this.onChangeGeometry.bind(C))
}spanDiv=document.createElement("div");
spanDiv.className="spanDiv";
this.div.appendChild(spanDiv);
this.span=document.createElement("span");
spanDiv.appendChild(this.span);
this.span.innerHTML="Layer di selezione: ";
inputDiv=document.createElement("div");
inputDiv.className="inputDiv";
this.div.appendChild(inputDiv);
this.inputlayer=document.createElement("select");
this.inputlayer.id="layerSelection";
this.inputlayer.className="inputText";
inputDiv.appendChild(this.inputlayer);
OpenLayers.Event.observe(this.inputlayer,"change",this.onChangeLayer.bind(this));
this.br=document.createElement("br");
this.div.appendChild(this.br);
if(!this.reducedOptions){spanDiv=document.createElement("div");
spanDiv.className="spanDiv";
this.div.appendChild(spanDiv);
this.span=document.createElement("span");
spanDiv.appendChild(this.span);
this.span.innerHTML="Tipo di selezione: ";
inputDiv=document.createElement("div");
inputDiv.className="inputDiv";
this.div.appendChild(inputDiv);
this.inputtype=document.createElement("select");
this.inputtype.id="type";
this.inputtype.className="inputText";
inputDiv.appendChild(this.inputtype);
this.option=document.createElement("option");
this.option.value="select";
this.option.innerHTML="Select";
this.inputtype.appendChild(this.option);
this.option=document.createElement("option");
this.option.value="add";
this.option.innerHTML="Add";
this.inputtype.appendChild(this.option);
this.option=document.createElement("option");
this.option.value="delete";
this.option.innerHTML="Delete";
this.inputtype.appendChild(this.option);
this.br=document.createElement("br");
this.div.appendChild(this.br);
spanDiv=document.createElement("div");
spanDiv.className="spanDiv";
this.div.appendChild(spanDiv);
this.span=document.createElement("span");
spanDiv.appendChild(this.span);
this.span.innerHTML="Filtro di ricerca: ";
inputDiv=document.createElement("div");
inputDiv.className="inputDiv";
this.div.appendChild(inputDiv);
this.inputoperation=document.createElement("select");
this.inputoperation.id="operation";
this.inputoperation.className="inputText";
inputDiv.appendChild(this.inputoperation);
this.option=document.createElement("option");
this.option.value="Intersects";
this.option.innerHTML="Intersects";
this.inputoperation.appendChild(this.option);
this.option=document.createElement("option");
this.option.value="Contains";
this.option.innerHTML="Contains";
this.inputoperation.appendChild(this.option);
this.br=document.createElement("br");
this.div.appendChild(this.br);
spanDiv=document.createElement("div");
spanDiv.className="spanDiv";
this.div.appendChild(spanDiv);
this.span=document.createElement("span");
spanDiv.appendChild(this.span);
this.span.innerHTML="Operazione di ricerca: ";
inputDiv=document.createElement("div");
inputDiv.className="inputDiv";
this.div.appendChild(inputDiv);
this.inputlogicops=document.createElement("select");
this.inputlogicops.id="logicops";
this.inputlogicops.className="inputText";
inputDiv.appendChild(this.inputlogicops);
this.option=document.createElement("option");
this.option.value="And";
this.option.innerHTML="And";
this.inputlogicops.appendChild(this.option);
this.option=document.createElement("option");
this.option.value="Or";
this.option.innerHTML="Or";
this.option.selected="selected";
this.inputlogicops.appendChild(this.option);
this.br=document.createElement("br");
this.div.appendChild(this.br)
}this.resDiv=document.createElement("div");
this.resDiv.className="resDiv";
this.resDiv.id="resDiv";
this.div.appendChild(this.resDiv);
this.span=document.createElement("span");
this.resDiv.appendChild(this.span);
this.span.innerHTML="";
this.resDiv.style.display="none";
this.spanNumFeatures=document.createElement("span");
this.spanNumFeatures.id="numFeatures";
this.spanNumFeatures.innerHTML=""+this.numFeatures;
this.resDiv.appendChild(this.spanNumFeatures);
this.br=document.createElement("br");
this.div.appendChild(this.br);
this.divVai=document.createElement("input");
this.divVai.className="inputButton";
this.divVai.value="Avvia";
this.divVai.type="button";
this.divVai.scr=OpenLayers.ImgPath+"submit.gif";
this.divVai.title="Avvia la selezione";
this.div.appendChild(this.divVai);
OpenLayers.Event.observe(this.divVai,"click",this.invokeGeometricSearch.bind(this));
this.divReset=document.createElement("input");
this.divReset.className="inputButton";
this.divReset.value="Pulisci";
this.divReset.type="button";
this.divReset.style.marginLeft="5px";
this.divReset.scr=OpenLayers.ImgPath+"submit.gif";
this.divReset.title="Pulisci la selezione";
this.div.appendChild(this.divReset);
OpenLayers.Event.observe(this.divReset,"click",this.reset.bind(this));
this.br=document.createElement("br");
this.div.appendChild(this.br);
this.divpanel=document.createElement("div");
this.divpanel.id="panel";
this.divpanel.className="panel";
this.div.appendChild(this.divpanel)
}this.loadGetCapabilities();
return this.div
},onChangeGeometry:function(B){if(this.select.div!=null){this.select.pointControl.deactivate();
this.select.lineControl.deactivate();
this.select.polygonControl.deactivate();
if(this.controlActive.handler.CLASS_NAME=="OpenLayers.Handler.Point"){this.select.inputgeometria="Point";
var D=this.select.imgPunto;
D.src=OpenLayers.ImgPath+"toolbar/external/punto_over.png";
var D=this.select.imgPoligono;
D.src=OpenLayers.ImgPath+"toolbar/external/poligono.png";
var D=this.select.imgLinea;
D.src=OpenLayers.ImgPath+"toolbar/external/linea.png"
}else{if(this.controlActive.handler.CLASS_NAME=="OpenLayers.Handler.Polygon"){this.select.inputgeometria="Polygon";
var D=this.select.imgPunto;
D.src=OpenLayers.ImgPath+"toolbar/external/punto.png";
var D=this.select.imgPoligono;
D.src=OpenLayers.ImgPath+"toolbar/external/poligono_over.png";
var D=this.select.imgLinea;
D.src=OpenLayers.ImgPath+"toolbar/external/linea.png"
}else{if(this.controlActive.handler.CLASS_NAME=="OpenLayers.Handler.Path"){this.select.inputgeometria="LineString";
var D=this.select.imgPunto;
D.src=OpenLayers.ImgPath+"toolbar/external/punto.png";
var D=this.select.imgPoligono;
D.src=OpenLayers.ImgPath+"toolbar/external/poligono.png";
var D=this.select.imgLinea;
D.src=OpenLayers.ImgPath+"toolbar/external/linea_over.png"
}}}var A=this.select.inputgeometria;
if(this.select.lastGeometrySelection!=A){var E=this.select.getLayerByName("Point Layer");
if(E!=null){if(E.features!=null&&E.features.length>0){E.destroyFeatures(E.features)
}}var F=this.select.getLayerByName("Line Layer");
if(F!=null){if(F.features!=null&&F.features.length>0){F.destroyFeatures(F.features)
}}var C=this.select.getLayerByName("Polygon Layer");
if(C!=null){if(C.features!=null&&C.features.length>0){C.destroyFeatures(C.features)
}}}this.select.lastGeometrySelection=A;
this.controlActive.activate()
}},onChangeLayer:function(A){if(this.div!=null){if(this.inputlayer!=null){for(i=0;
i<this.layersSelection.length;
i++){var B=this.layersSelection[i];
if(this.inputlayer.value==B.namelogical){this.layer=B.namelogical;
this.layerSelPhysicalName=B.layerSelPhysicalName;
this.columnGeometry=B.columnGeometry;
this.fieldNameSTD=B.fieldNameSTD
}}}}},invokeGeometricSearch:function(B){if(this.div!=null){var A=null;
var E=null;
var F="Select";
var C="Intersects";
var D="Or";
E=this.getLayerByName("Polygon Layer");
if(E!=null&&E.features.length<=0){E=this.getLayerByName("Line Layer");
if(E!=null&&E.features.length<=0){E=this.getLayerByName("Point Layer")
}}if(this.inputtype!=null){F=this.inputtype.value
}if(this.inputoperation!=null){C=this.inputoperation.value
}if(this.inputlogicops!=null){D=this.inputlogicops.value
}this.loadGeometricSearch(E,F,C,D)
}},stopLoading:function(){if(this.map!=null&&this.loading!=null){this.loading.stopLoad()
}},destroy:function(){this.map=null;
this.div=null;
this.layer=null;
this.columnGeometry=null;
this.layersSelection=[];
this.layerSelect=null;
this.geometry=null;
this.operation=null;
this.logicOps=null;
this.sessionId=null;
this.type=null;
this.urlMapWork=null;
this.urlWms=null;
this.geometricSearchPars=null;
this.getCapabilitiesPars=null;
if(this.pointControl!=null){this.pointControl=null;
this.lineControl=null;
this.polygonControl=null
}this.layerSelPhysicalName=null;
this.fieldNameSTD=null;
this.numFeatures=0;
if(this.events&&this.events!=null){this.events.destroy()
}this.events=null;
MW.Control.prototype.destroy.apply(this,arguments)
},loadGetCapabilities:function(){var D=this.successGetCapabilities.bind(this);
var A=this.failureGetCapabilities.bind(this);
var B=this.getCapabilitiesPars;
var C=this.urlMapWork;
if(MW.Proxy&&this.urlMapWork.startsWith("http")){C=MW.Proxy+MW.Util.escapeUri(this.urlMapWork)
}OpenLayers.Console.debug("Ajax request url: "+C+B);
new OpenLayers.Ajax.Request(C+B,{method:"get",parameters:null,asynchronous:false,onComplete:D,onFailure:A})
},successGetCapabilities:function(E){if(E.responseXML==null&&E.responseText==null){return 
}var D=E.responseXML;
if(!D||E.fileType!="XML"){D=OpenLayers.parseXMLString(E.responseText)
}var A=OpenLayers.Ajax.getElementsByTagNameNS(D,this.namespace_uri_capabilities,this.namespace_prefix_capabilities,"layer");
if(A!=null&&A.length>0){for(i=0;
i<A.length;
i++){var I=A[i];
var H=I.getAttribute("logicalName");
var F=OpenLayers.Ajax.getElementsByTagNameNS(I,this.namespace_uri_capabilities,this.namespace_prefix_capabilities,"geometry")[0];
if(H!=null&&H!=""){var B={namelogical:H,layerSelPhysicalName:I.getAttribute("selectionLayer"),columnGeometry:F.getAttribute("column"),fieldNameSTD:I.getAttribute("fieldNameSTD")};
this.layersSelection.push(B);
if(this.div!=null){var C=this.inputlayer;
var G=document.createElement("option");
G.value=H;
G.innerHTML=H;
C.appendChild(G);
if(i==0){this.layer=H;
this.layerSelPhysicalName=I.getAttribute("selectionLayer");
this.fieldNameSTD=I.getAttribute("fieldNameSTD");
this.columnGeometry=F.getAttribute("column")
}}else{if(this.layer!=null&&H.toUpperCase()==this.layer.toUpperCase()){this.layerSelPhysicalName=I.getAttribute("selectionLayer");
this.fieldNameSTD=I.getAttribute("fieldNameSTD");
this.columnGeometry=F.getAttribute("column")
}}}}}},failureGetCapabilities:function(A){alert("Si Ã¨ verificato un errore nel servizio di GetCapabilities");
return 
},loadGeometricSearch:function(J,I,D,E){this.status_code=NONE;
if(J!=null&&J.features!=null&&J.features.length>0){this.geometry=J
}if(I!=null&&I!=""){this.type=I
}if(D!=null&&D!=""){this.operation=D
}if(E!=null&&E!=""){this.logicOps=E;
if((this.logicOps=="And"||this.logicOps=="Or")&&(this.geometry.features!=null&&this.geometry.features.length<=1)){this.logicOps==null
}if(this.logicOps=="Not"&&(this.geometry.features!=null&&this.geometry.features.length>1)){alert("L'operatore \"Not\" e' applicabile ad un solo poligono o ad una sola liena.");
return 
}}if(this.div!=null){this.divpanel.style.display="none";
this.divpanel.innerHTML=""
}if(J==null||J.length<=0){alert("Disegnare l'area di selezione.");
return 
}if(this.layer==null){alert("Specificare il layer di selezione.");
return 
}if(this.sessionId==null&&this.type=="add"){this.type="select"
}if(this.sessionId==null&&this.type=="delete"){alert("Specificare come tipo di selezione la select.");
return 
}if(this.layerSelPhysicalName==null){alert("Non e' stato recuperato il nome fisico del layer di selezione dal servizio di GetCapabilities.");
return 
}if(this.columnGeometry==null){alert("Non e' stato recuperato il nome della colonna che contiene la geometria del layer di selezione dal servizio di GetCapabilities.");
return 
}var G=this.successGeometricSearch.bind(this);
var C=this.failureGeometricSearch.bind(this);
var A=this.createGeometricSearchRequest();
var K=this.getLayerByName("Point Layer");
if(K!=null){if(K.features!=null&&K.features.length>0){K.destroyFeatures(K.features)
}}var L=this.getLayerByName("Line Layer");
if(L!=null){if(L.features!=null&&L.features.length>0){L.destroyFeatures(L.features)
}}var H=this.getLayerByName("Polygon Layer");
if(H!=null){if(H.features!=null&&H.features.length>0){H.destroyFeatures(H.features)
}}var F=this.geometricSearchPars+A;
this.status_code=NONE;
var B=this.urlMapWork;
if(MW.Proxy&&this.urlMapWork.startsWith("http")){B=MW.Proxy+MW.Util.escapeUri(this.urlMapWork)
}if(this.map!=null){this.loading.startLoad()
}OpenLayers.Console.debug("Ajax request url: "+B+F);
new OpenLayers.Ajax.Request(B+F,{method:"get",parameters:null,onComplete:G,onFailure:C})
},setGeometricSearchPanel:function(A){this.div=A
},successGeometricSearch:function(E){this.status_code=UNKNOWN_SELECT;
if(E.responseXML==null&&E.responseText==null){return 
}var A=E.responseXML;
if(!A||E.fileType!="XML"){A=OpenLayers.parseXMLString(E.responseText)
}var H=OpenLayers.Ajax.getElementsByTagNameNS(A,this.namespace_uri_mapwork,this.namespace_prefix_mapwork,"exception");
if(H!=null&&H.length>0){var O=H[0];
if(O!=null){var B=O.getAttribute("code");
var K=O.getAttribute("message");
if(B!=null&&B=="0"&&K!=null){if(this.div!=null){this.divpanel.style.display="block";
this.divpanel.innerHTML="Si &#232; verificato un errore nel servizio.</br>"+K
}this.status_code=SERVER_ERROR
}if(B!=null&&B=="1"&&K!=null){if(this.layerSelect!=null){this.map.removeLayer(this.layerSelect);
this.layerSelect=null
}if(this.div!=null){var L=this.spanNumFeatures;
if(L!=null){this.resDiv.style.display="block";
L.innerHTML=""+this.numFeatures
}}this.status_code=UNKNOWN_SELECT
}}}var D=OpenLayers.Ajax.getElementsByTagNameNS(A,this.namespace_uri_mapwork,this.namespace_prefix_mapwork,"numFeatures");
if(D!=null&&D.length>0){var I=D[0];
if(I!=null){var M=I.getAttribute("value");
if(M!=null&&M!=""){this.numFeatures=(new Number(M.trim())).valueOf()
}}}var P=OpenLayers.Ajax.getElementsByTagNameNS(A,this.namespace_uri_mapwork,this.namespace_prefix_mapwork,"sessionId");
if(P!=null&&P.length>0){var C=P[0];
if(C!=null){var N=C.getAttribute("Value");
if(N!=null&&N!=""){this.sessionId=N.trim();
if(this.layerSelect!=null){this.map.removeLayer(this.layerSelect);
this.layerSelect=null
}if(this.extractFeatures==true){this.geometries=OpenLayers.Ajax.getElementsByTagNameNS(A,this.namespace_uri_mapwork,this.namespace_prefix_mapwork,"geometry");
this.featureList=OpenLayers.Ajax.getElementsByTagNameNS(A,this.namespace_uri_mapwork,this.namespace_prefix_mapwork,"feature")
}if(this.isVectorLayer){this.layerSelect=new OpenLayers.Layer.Vector("Selezione",{styleMap:this.styleMap});
var R=new OpenLayers.Format.GML();
for(i=0;
i<this.geometries.length;
i++){var F=this.geometries[i];
if(F.firstChild!=null){var G=R.parseFeature(F);
this.layerSelect.addFeatures([G])
}}}else{var Q={srs:"EPSG:23032",layers:this.layerSelPhysicalName,format:"image/png",transparent:true,BBOX:this.map.getExtent().toBBOX(),CQL_FILTER:"ID_SESSIONE='"+this.sessionId+"'"};
this.layerSelect=new OpenLayers.Layer.WMS("Selezione",this.urlWms,Q)
}this.layerSelect.setIsBaseLayer(false);
this.layerSelect.displayInLayerSwitcher=false;
this.map.addLayer(this.layerSelect);
this.layerSelect.redraw(true);
if(this.div!=null){this.resDiv.style.display="block";
var L=this.spanNumFeatures;
if(L!=null){if(this.maxFeatures!=null&&this.maxFeatures!=""&&this.numFeatures>this.maxFeatures){L.innerHTML="";
var J="Restituiti "+this.maxFeatures+" elementi di "+this.numFeatures+" trovati";
L.innerHTML=J
}else{L.innerHTML="Trovati "+this.numFeatures+" elementi"
}}}this.status_code=SELECT_LOADED
}}}if(this.status_code>10){this.events.triggerEvent("loadFailure")
}else{this.events.triggerEvent("loadComplete")
}},failureGeometricSearch:function(A){if(this.div!=null){this.divpanel.style.display="block";
this.divpanel.innerHTML="Si &#232; verificato un errore nel servizio."
}this.status_code=SERVER_ERROR;
this.events.triggerEvent("loadFailure");
return 
},stopevent:function(A){OpenLayers.Event.stop(A,true)
},createGeometricSearchRequest:function(){var F='<?xml version="1.0" encoding="UTF-8"?><geometricSearchRequest xmlns="http://schemas.corenet.it/mapwork/servizi" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" xmlns:sld="http://www.opengis.net/sld"><layer logicalName="'+this.layer+'"><Filter>';
if(this.logicOps!=null&&this.logicOps!=""){F+="<ogc:"+this.logicOps+">"
}if(this.geometry.features!=null){for(i=0;
i<this.geometry.features.length;
i++){var D=this.geometry.features[i];
if(D!=null&&D.geometry!=null){var B=D.geometry;
F+="<ogc:"+this.operation+"><ogc:PropertyName>"+this.columnGeometry+"</ogc:PropertyName>";
if(B.CLASS_NAME=="OpenLayers.Geometry.Polygon"){F+="<gml:Polygon>";
for(j=0;
j<B.components.length;
j++){var C=B.components[j];
var E=MW.GeometryUtil.getCoordinatesFromComponent(C);
if(j==0){F+="<gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>"
}else{F+="<gml:innerBoundaryIs><gml:LinearRing><gml:coordinates>"
}for(p=0;
p<E.length;
p++){var A=E[p];
F+=A[0]+","+A[1]+" "
}if(j==0){F+="</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs>"
}else{F+="</gml:coordinates></gml:LinearRing></gml:innerBoundaryIs>"
}}F+="</gml:Polygon>"
}if(B.CLASS_NAME=="OpenLayers.Geometry.LineString"){F+="<gml:LineString><gml:coordinates>";
var E=MW.GeometryUtil.getCoordinatesFromComponent(B);
for(p=0;
p<E.length;
p++){var A=E[p];
F+=A[0]+","+A[1]+" "
}F+="</gml:coordinates></gml:LineString>"
}if(B.CLASS_NAME=="OpenLayers.Geometry.Point"){F+="<gml:Point ><gml:coordinates>";
F+=B.x+","+B.y+" ";
F+="</gml:coordinates></gml:Point >"
}F+="</ogc:"+this.operation+">"
}}}if(this.logicOps!=null&&this.logicOps!=""){F+="</ogc:"+this.logicOps+">"
}F+="</Filter></layer>";
F+='<searchOptions retrieveFeatures="'+this.extractFeatures+'" retrieveFeatureGeometry="'+this.extractFeatures+'"';
if(this.type!=null&&this.type!=""){F+=' type="'+this.type+'"'
}if(this.maxFeatures!=null&&this.maxFeatures!=""){F+=' maxFeatures="'+this.maxFeatures+'"'
}F+="></searchOptions>";
F+="</geometricSearchRequest>";
return F
},reset:function(A){if(this.div!=null){var D=this.getLayerByName("Point Layer");
if(D!=null){if(D.features!=null&&D.features.length>0){D.destroyFeatures(D.features)
}}var F=this.getLayerByName("Line Layer");
if(F!=null){if(F.features!=null&&F.features.length>0){F.destroyFeatures(F.features)
}}var C=this.getLayerByName("Polygon Layer");
if(C!=null){if(C.features!=null&&C.features.length>0){C.destroyFeatures(C.features)
}}if(this.pointControl!=null){this.polygonControl.deactivate();
this.lineControl.deactivate();
this.pointControl.deactivate()
}this.inputgeometria=null;
if(this.imgPunto!=null&&this.imgPoligono!=null&&this.imgLinea!=null){var B=this.imgPunto;
B.src=OpenLayers.ImgPath+"toolbar/external/punto.png";
var B=this.imgPoligono;
B.src=OpenLayers.ImgPath+"toolbar/external/poligono.png";
var B=this.imgLinea;
B.src=OpenLayers.ImgPath+"toolbar/external/linea.png"
}if(this.inputtype!=null){this.inputtype.value="select"
}if(this.inputoperation!=null){this.inputoperation.value="Intersects"
}if(this.inputlogicops!=null){this.inputlogicops.value=""
}var E=this.resDiv;
if(E!=null){E.style.display="none"
}this.divpanel.innerHTML=""
}if(this.layerSelect!=null){this.map.removeLayer(this.layerSelect);
this.layerSelect=null
}this.geometry=null;
this.type=null;
this.operation=null;
this.logicOps=null;
this.status_code=NONE;
this.numFeatures=0
},getStatusCode:function(){return this.status_code
},getLayerByName:function(B){var A=null;
for(var D=0;
D<this.map.layers.length;
D++){var C=this.map.layers[D];
if((C.name!=null)&&(C.name==B)){A=C
}}return A
},CLASS_NAME:"MW.Control.Select"});MW.Control.SelectFeature=OpenLayers.Class(OpenLayers.Control.SelectFeature,{clickFeature:function(A){var B=(OpenLayers.Util.indexOf(A.layer.selectedFeatures,A)>-1);
if(B){if(this.toggleSelect()){this.unselect(A)
}else{if(!this.multipleSelect()){this.unselectAll({except:A})
}}}else{if(!this.multipleSelect()){this.unselectAll({except:A})
}this.select(A)
}},clickoutFeature:function(A){if(this.clickout){this.unselectAll()
}},overFeature:function(B){var A=B.layer;
if(this.highlightOnly){this.highlight(B)
}else{if(OpenLayers.Util.indexOf(A.selectedFeatures,B)==-1){this.select(B)
}}},outFeature:function(D){if(this.highlightOnly){if(D._lastHighlighter==this.id){if(D._prevHighlighter&&D._prevHighlighter!=this.id){delete D._lastHighlighter;
var E=this.map.getControl(D._prevHighlighter);
if(E){E.highlight(D)
}}else{var C=false;
for(var B=0;
B<this.layer.selectedFeatures.length;
B++){var A=this.layer.selectedFeatures[B];
if(A==D){C=true
}}if(C==false){this.unhighlight(D)
}}}}else{this.unselect(D)
}},CLASS_NAME:"MW.Control.SelectFeature"});MW.Control.SelectPolygons=OpenLayers.Class(MW.Control,{type:null,id:null,div:null,selectControl:null,polygonLayer:null,map:null,defaultHandlerOptions:{single:true,"double":false,pixelTolerance:0,stopSingle:false,stopDouble:false},initialize:function(A){this.handlerOptions=OpenLayers.Util.extend({},this.defaultHandlerOptions);
OpenLayers.Control.prototype.initialize.apply(this,[A]);
this.selectControl=new OpenLayers.Control.SelectFeature(this.polygonLayer,{multiple:true,toggle:true,clickout:false});
this.map.addControl(this.selectControl);
this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");
this.handler=new OpenLayers.Handler.Click(this,{click:this.onClick},this.handlerOptions)
},getPolygons:function(){var C='<PolygonUnionRequest xmlns="http://schemas.corenet.it/mapwork/servizi/polygonunion" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc">';
for(i=0;
i<this.polygonLayer.selectedFeatures.length;
i++){var E=this.polygonLayer.selectedFeatures[i];
if(E!=null&&E.geometry!=null){var B=E.geometry;
if(B.CLASS_NAME=="OpenLayers.Geometry.Polygon"){C+="<Polygon>";
for(j=0;
j<B.components.length;
j++){var D=B.components[j];
var F=MW.GeometryUtil.getCoordinatesFromComponent(D);
if(j==0){C+="<gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>"
}else{C+="<gml:innerBoundaryIs><gml:LinearRing><gml:coordinates>"
}for(p=0;
p<F.length;
p++){var A=F[p];
C+=A[0]+","+A[1]+" "
}if(j==0){C+="</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs>"
}else{C+="</gml:coordinates></gml:LinearRing></gml:innerBoundaryIs>"
}}C+="</Polygon>"
}}}C+="</PolygonUnionRequest>";
return C
},getLayerByName:function(B){var A=null;
for(var D=0;
D<this.map.layers.length;
D++){var C=this.map.layers[D];
if((C.name!=null)&&(C.name==B)){A=C
}}return A
},draw:function(){if(this.div!=null){OpenLayers.Control.prototype.draw.apply(this,arguments);
this.div.className="MWControlSelectPolygons";
this.divpanel=document.createElement("div");
this.divpanel.id="panel";
this.divpanel.className="panel";
this.div.appendChild(this.divpanel)
}return this.div
},trigger:function(A){},activate:function(A){this.selectControl.activate()
},activate:function(){this.selectControl.activate();
return OpenLayers.Control.prototype.activate.apply(this,arguments)
},deactivate:function(){this.selectControl.deactivate();
return OpenLayers.Control.prototype.deactivate.apply(this,arguments)
},CLASS_NAME:"MW.Control.OpenLS.SelectPolygons"});MW.Control.SimpleLayerSwitcher=OpenLayers.Class(OpenLayers.Control.LayerSwitcher,{layerStates:null,baseLayers:null,ascending:true,rightPosition:false,layerMoreDiv:null,overlayDiv:null,overlayDivOpened:false,titleMore:null,initialize:function(A){OpenLayers.Control.prototype.initialize.apply(this,arguments);
this.layerStates=[]
},destroy:function(){OpenLayers.Event.stopObservingElement(this.div);
this.clearLayersArray();
this.map.events.unregister("addlayer",this,this.redraw);
this.map.events.unregister("changelayer",this,this.redraw);
this.map.events.unregister("removelayer",this,this.redraw);
this.map.events.unregister("changebaselayer",this,this.redraw);
OpenLayers.Control.prototype.destroy.apply(this,arguments)
},setMap:function(A){OpenLayers.Control.prototype.setMap.apply(this,arguments);
this.map.events.register("addlayer",this,this.redraw);
this.map.events.register("changelayer",this,this.redraw);
this.map.events.register("removelayer",this,this.redraw);
this.map.events.register("changebaselayer",this,this.redraw)
},draw:function(){OpenLayers.Control.prototype.draw.apply(this);
if(this.rightPosition){this.div.style.right=this.position.x;
this.div.style.left=""
}this.loadContents();
this.redraw();
return this.div
},clearLayersArray:function(){var C=this["baseLayers"];
if(C){for(var B=0;
B<C.length;
B++){var A=C[B];
OpenLayers.Event.stopObservingElement(A.inputElem);
OpenLayers.Event.stopObservingElement(A.labelSpan)
}}if(this.layerMoreDiv!=null){this.layerMoreDiv.innerHTML="";
this.layerMoreDiv=null;
this.overlayDiv.innerHTML="";
this.overlayDiv=null
}this.div.innerHTML=""
},checkRedraw:function(){var D=false;
if(!this.layerStates.length||(this.map.layers.length!=this.layerStates.length)){D=true
}else{for(var B=0;
B<this.layerStates.length;
B++){var C=this.layerStates[B];
var A=this.map.layers[B];
if((C.name!=A.name)||(C.inRange!=A.inRange)||(C.id!=A.id)||(C.visibility!=A.visibility)){D=true;
break
}}}return D
},redraw:function(){if(!this.checkRedraw()){return this.div
}this.clearLayersArray();
var L=false;
this.layerStates=new Array(this.map.layers.length);
for(var F=0;
F<this.map.layers.length;
F++){var G=this.map.layers[F];
this.layerStates[F]={name:G.name,visibility:G.visibility,inRange:G.inRange,id:G.id}
}var E=this.map.layers.slice();
if(!this.ascending){E.reverse()
}var D=0;
for(var F=0;
F<E.length;
F++){var G=E[F];
var I=G.isBaseLayer;
if(G.displayInLayerSwitcher&&I){D++;
var K=(I)?(G==this.map.baseLayer):G.getVisibility();
var M=document.createElement("div");
M.id=this.id+"_layerdiv_"+D;
if(K){M.className="buttonClassSelected"
}else{M.className="buttonClassUnselected"
}var A={inputElem:M,layer:G,layerSwitcher:this};
OpenLayers.Event.observe(M,"mouseup",OpenLayers.Function.bindAsEventListener(this.onInputClick,A));
var B=document.createElement("span");
B.innerHTML=G.name;
OpenLayers.Event.observe(B,"click",OpenLayers.Function.bindAsEventListener(this.onInputClick,A));
M.appendChild(B);
this.div.appendChild(M)
}else{if(G.displayInLayerSwitcher&&!I){if(this.layerMoreDiv==null){this.layerMoreDiv=document.createElement("div");
this.layerMoreDiv.id=this.id+"_layermorediv";
this.layerMoreDiv.className="buttonClassUnselected moreDivUnselected";
var B=document.createElement("span");
B.innerHTML=this.titleMore;
this.layerMoreDiv.appendChild(B);
this.overlayDiv=document.createElement("div");
this.overlayDiv.id=this.id+"_overlaydiv";
this.overlayDiv.className="overlayDiv hidden";
var A={layerMoreDiv:this.layerMoreDiv,overlayDiv:this.overlayDiv,layerSwitcher:this};
OpenLayers.Event.observe(this.layerMoreDiv,"mouseover",OpenLayers.Function.bindAsEventListener(this.showOverlayDivEvent,A));
OpenLayers.Event.observe(this.layerMoreDiv,"mouseout",OpenLayers.Function.bindAsEventListener(this.hideOverlayDiv,A));
OpenLayers.Event.observe(this.overlayDiv,"mouseover",OpenLayers.Function.bindAsEventListener(this.showOverlayDivEvent,A));
OpenLayers.Event.observe(this.overlayDiv,"mouseout",OpenLayers.Function.bindAsEventListener(this.hideOverlayDiv,A))
}this.div.appendChild(this.layerMoreDiv);
this.div.appendChild(this.overlayDiv);
var C=document.createElement("div");
this.overlayDiv.appendChild(C);
var J=document.createElement("input");
J.id="input_"+G.name+"_"+F;
J.name=G.name;
J.type="checkbox";
J.value=G.name;
var K=G.calculateInRange()&&G.getVisibility();
var H=G.calculateInRange();
if(!H){J.disabled="disabled"
}else{J.disabled=""
}J.checked=K;
J.defaultChecked=K;
var A={overlay:G,inputElem:J,layerSwitcher:this};
OpenLayers.Event.observe(J,"mouseup",OpenLayers.Function.bindAsEventListener(this.onInputOverlayClick,A));
OpenLayers.Event.observe(J,"keyup",OpenLayers.Function.bindAsEventListener(this.onInputOverlayKeyPress,A));
C.appendChild(J);
var B=document.createElement("span");
B.innerHTML=G.name;
C.appendChild(B);
OpenLayers.Event.observe(B,"mouseup",OpenLayers.Function.bindAsEventListener(this.onInputOverlayClick,A));
if(this.overlayDivOpened){this.showOverlayDiv()
}}}}return this.div
},showOverlayDivEvent:function(B){this.overlayDiv.className=this.overlayDiv.className.replace("hidden","show");
this.layerMoreDiv.className=this.layerMoreDiv.className.replace("moreDivUnselected","moreDivSelected");
this.layerSwitcher.overlayDivOpened=true;
var C=navigator.appVersion.split("MSIE");
var A=parseFloat(C[1]);
if(A<6.5){hackCSSLayerSwitcherOverlayDivSize=layerSwitcher.overlayDiv.offsetWidth
}},showOverlayDiv:function(){this.overlayDiv.className=this.overlayDiv.className.replace("hidden","show");
this.layerMoreDiv.className=this.layerMoreDiv.className.replace("moreDivUnselected","moreDivSelected");
this.overlayDivOpened=true;
var A=this.overlayDiv.getElementsByTagName("input")[0];
A.focus()
},hideOverlayDiv:function(A){this.overlayDiv.className=this.overlayDiv.className.replace("show","hidden");
this.layerMoreDiv.className=this.layerMoreDiv.className.replace("moreDivSelected","moreDivUnselected");
this.layerSwitcher.overlayDivOpened=false
},onInputClick:function(B){if(this.layer.minZoomVisibleLevel!=null){if(this.layer.minZoomVisibleLevel>this.layer.map.zoom){OpenLayers.Event.stop(B);
return 
}}this.layer.map.setBaseLayer(this.layer);
if(this.layer.backgroundColor!=null){this.layer.map.viewPortDiv.style.backgroundColor=this.layer.backgroundColor
}else{this.layer.map.viewPortDiv.style.backgroundColor=null
}if(this.layerSwitcher.overlay&&this.layerSwitcher.overlay.length>0){for(var A=0;
A<this.layerSwitcher.overlay.length;
A++){this.layerSwitcher.overlay[A].setVisibility(false)
}}if(this.layer.overlay&&this.layer.overlay.length>0){for(var A=0;
A<this.layerSwitcher.overlay.length;
A++){this.layerSwitcher.overlay[A]=this.layer.map.getLayerByName(this.layer.overlay[A]);
this.layerSwitcher.overlay[A].setVisibility(true)
}}OpenLayers.Event.stop(B)
},onInputOverlayClick:function(A){if(!this.inputElem.disabled){this.inputElem.checked=!this.inputElem.checked;
this.overlay.setVisibility(this.inputElem.checked)
}else{}OpenLayers.Event.stop(A)
},onInputOverlayKeyPress:function(A){if(A.keyCode==32){if(!this.inputElem.disabled){this.inputElem.checked=!this.inputElem.checked;
this.overlay.setVisibility(this.inputElem.checked)
}else{}}OpenLayers.Event.stop(A)
},onLayerClick:function(A){this.updateMap()
},updateMap:function(){for(var A=0;
A<this.baseLayers.length;
A++){var B=this.baseLayers[A];
if(B.inputElem.checked){this.map.setBaseLayer(B.layer,false)
}}for(var A=0;
A<this.dataLayers.length;
A++){var B=this.dataLayers[A];
B.layer.setVisibility(B.inputElem.checked)
}},loadContents:function(){this.div.style.backgroundColor="transparent";
OpenLayers.Event.observe(this.div,"mouseup",OpenLayers.Function.bindAsEventListener(this.mouseUp,this));
OpenLayers.Event.observe(this.div,"click",this.ignoreEvent);
OpenLayers.Event.observe(this.div,"mousedown",OpenLayers.Function.bindAsEventListener(this.mouseDown,this));
OpenLayers.Event.observe(this.div,"dblclick",this.ignoreEvent)
},ignoreEvent:function(A){OpenLayers.Event.stop(A)
},mouseDown:function(A){this.isMouseDown=true;
this.ignoreEvent(A)
},mouseUp:function(A){if(this.isMouseDown){this.isMouseDown=false;
this.ignoreEvent(A)
}},CLASS_NAME:"MW.Control.SimpleLayerSwitcher"});MW.Control.SplitPolygon=OpenLayers.Class(MW.Control,{EVENT_TYPES:["aftersplit"],vectorLayer:null,line:null,polygons:[],handler:null,onlySelected:false,initialize:function(A){MW.Control.prototype.initialize.apply(this,[A])
},activate:function(){MW.Control.prototype.activate.apply(this,[]);
this.handler=new OpenLayers.Handler.Path(this,{done:function(A){this.line=new OpenLayers.Feature.Vector(A);
this.split()
}},{style:{fillColor:"#ff0000",fillOpacity:1,strokeColor:"#ff0000",strokeOpacity:1,strokeWidth:1}});
this.handler.activate()
},deactivate:function(){MW.Control.prototype.deactivate.apply(this,[]);
if(this.handler){this.handler.deactivate()
}},split:function(){this.polygons=[];
for(var V=0;
V<this.vectorLayer.features.length;
V++){var O=this.vectorLayer.features[V];
if(O.geometry instanceof OpenLayers.Geometry.Polygon){if(this.line.geometry.intersects(O.geometry)){if(this.onlySelected){var Q=(OpenLayers.Util.indexOf(this.vectorLayer.selectedFeatures,O)>-1);
if(Q){this.polygons.push(O)
}}else{this.polygons.push(O)
}}}}for(var S=0;
S<this.polygons.length;
S++){var K=this.polygons[S];
this.validatePolygon(K.geometry.components[0]);
var Y=[];
var U=[];
var Z=[];
var F=K.geometry.components[0];
var B=-1;
B=this.getFirstSegmentIntersect(F);
for(var T=0;
T<this.line.geometry.components.length-1;
T++){var A=this.line.geometry.components[T];
var b=this.line.geometry.components[T+1];
var R={x1:A.x,y1:A.y,x2:b.x,y2:b.y};
for(var V=0;
V<F.components.length-1;
V++){var X=(V+B)%(F.components.length-1);
var D=F.components[X];
var C=F.components[(V+1+B)%(F.components.length-1)];
var W={x1:D.x,y1:D.y,x2:C.x,y2:C.y};
var N=OpenLayers.Geometry.segmentsIntersect(R,W,{point:true});
if(N){Y.push(N);
U.push(W);
Z.push(X)
}}}if(Y.length<2){continue
}else{this.insertionSortPoints(Y,U,Z)
}var M=[];
M.push(new OpenLayers.Geometry.Point(Y[0].x,Y[0].y));
for(var V=0;
V<this.line.geometry.components.length;
V++){if(K.geometry.containsPoint(this.line.geometry.components[V])){M.push(new OpenLayers.Geometry.Point(this.line.geometry.components[V].x,this.line.geometry.components[V].y))
}}M.push(new OpenLayers.Geometry.Point(Y[1].x,Y[1].y));
if(Z[0]!=Z[1]){for(var V=Z[1]+1;
(F.components[V%F.components.length].x!=U[0].x1)&&(F.components[V%F.components.length].y!=U[0].y1);
V++){M.push(new OpenLayers.Geometry.Point(F.components[V%F.components.length].x,F.components[V%F.components.length].y))
}M.push(new OpenLayers.Geometry.Point(U[0].x1,U[0].y1))
}M.push(new OpenLayers.Geometry.Point(Y[0].x,Y[0].y));
var I=new OpenLayers.Geometry.LinearRing(M);
var L=new OpenLayers.Geometry.Polygon([I]);
var H=new OpenLayers.Feature.Vector(L);
var P=[];
var a=[];
this.vectorLayer.removeFeatures(this.line);
this.vectorLayer.removeFeatures(K);
P.push(K);
this.vectorLayer.addFeatures(H);
this.vectorLayer.drawFeature(H);
a.push(H);
M=[];
M.push(new OpenLayers.Geometry.Point(Y[1].x,Y[1].y));
for(var V=this.line.geometry.components.length-1;
V>=0;
V--){if(K.geometry.containsPoint(this.line.geometry.components[V])){M.push(new OpenLayers.Geometry.Point(this.line.geometry.components[V].x,this.line.geometry.components[V].y))
}}M.push(new OpenLayers.Geometry.Point(Y[0].x,Y[0].y));
for(var V=Z[0]+1;
(F.components[V%F.components.length].x!=U[1].x1)&&(F.components[V%F.components.length].y!=U[1].y1);
V++){M.push(new OpenLayers.Geometry.Point(F.components[V%F.components.length].x,F.components[V%F.components.length].y))
}M.push(new OpenLayers.Geometry.Point(U[1].x1,U[1].y1));
M.push(new OpenLayers.Geometry.Point(Y[1].x,Y[1].y));
var G=new OpenLayers.Geometry.LinearRing(M);
var J=new OpenLayers.Geometry.Polygon([G]);
var E=new OpenLayers.Feature.Vector(J);
this.vectorLayer.addFeatures(E);
this.vectorLayer.drawFeature(E);
a.push(E);
this.events.triggerEvent("aftersplit",{source:P,features:a})
}},insertionSortPoints:function(B,D,F){for(var C=B.length-1;
C>0;
C--){var E=C-1;
while(E<B.length&&(B[E].distanceTo(this.line.geometry.components[0])>B[C].distanceTo(this.line.geometry.components[0]))){var A=B[E];
B[E]=B[C];
B[C]=A;
A=D[E];
D[E]=D[C];
D[C]=A;
A=F[E];
F[E]=F[C];
F[C]=A;
E++
}}},getFirstSegmentIntersect:function(M){var E=-1;
var L=null;
for(var F=0;
F<this.line.geometry.components.length-1;
F++){var B=this.line.geometry.components[F];
var A=this.line.geometry.components[F+1];
var J={x1:B.x,y1:B.y,x2:A.x,y2:A.y};
for(var G=0;
G<M.components.length-1;
G++){var I=M.components[G];
var H=M.components[G+1];
var D={x1:I.x,y1:I.y,x2:H.x,y2:H.y};
var C=OpenLayers.Geometry.segmentsIntersect(J,D,{point:true});
if(C){var K=C.distanceTo(this.line.geometry.components[0]);
if(L==null||K<L){E=G;
L=K
}}}}return E
},validatePolygon:function(B,A){if(A&&!this.isClockWise(B)){return this.reversePoint(B)
}else{if(!A&&this.isClockWise(B)){return this.reversePoint(B)
}else{return B
}}},reversePoint:function(E){var A;
var D=E;
for(var C=D.components.length-1,B=0;
C>=Math.floor(D.components.length/2);
C--,B++){A=D.components[B];
D.components[B]=D.components[C];
D.components[C]=A
}return D
},isClockWise:function(A){if(A.getArea()>0){return true
}else{return false
}},CLASS_NAME:"MW.Control.SplitPolygon"});MW.Control.Toolbar=OpenLayers.Class(OpenLayers.Control.Panel,{verticalGroups:{controlId:{},div:{},className:{}},initialize:function(A){OpenLayers.Control.Panel.prototype.initialize.apply(this,[A])
},redraw:function(){if(this.active){for(var E=0;
E<this.controls.length;
E++){var J=this.verticalGroups.controlId[this.controls[E].id];
var F=this.controls[E].panel_div;
var C=this.div.childNodes;
if(J==null||J==""){var N=false;
var B=null;
for(var D=0;
D<C.length&&!N;
D++){B=C[D];
if(B==F){N=true
}}if(!N){this.div.appendChild(F)
}else{F=B
}}else{var K=false;
var B=null;
var M=null;
for(var D=0;
D<C.length&&!K;
D++){B=C[D];
if(B.childNodes.length>0){for(var I=0;
I<B.childNodes.length&&!K;
I++){M=B.childNodes[I];
if(M==F){K=true
}}}}if(!K){F.style.marginLeft="0px";
if(this.verticalGroups.div[J]==null||this.verticalGroups.div[J]==""){var G=document.createElement("div");
G.id=J;
G.className="verticalGroup";
if(this.verticalGroups.className[J]){G.className+=" "+this.verticalGroups.className[J]
}var H=document.createElement("div");
H.className="toolBarGroupOpen";
var L=document.createElement("img");
L.src=OpenLayers.ImgPath+"toolbar/external/pin_off.gif";
L.className="toolBarGroupOpenImg";
H.appendChild(L);
var A={openArrowImg:L};
OpenLayers.Event.observe(L,"mouseover",function(){L.src=OpenLayers.ImgPath+"toolbar/external/pin_on.gif"
});
OpenLayers.Event.observe(L,"mouseout",function(){L.src=OpenLayers.ImgPath+"toolbar/external/pin_off.gif"
});
A={verticalGroup:G};
OpenLayers.Event.observe(L,"click",this.openVerticalMenu.bindAsEventListener(A));
OpenLayers.Event.observe(H,"mousedown",OpenLayers.Function.bindAsEventListener(OpenLayers.Event.stop));
OpenLayers.Event.observe(H,"dblclick",OpenLayers.Function.bindAsEventListener(OpenLayers.Event.stop));
A={verticalGroup:G,element:F,panel:this};
OpenLayers.Event.observe(F,"click",this.moveToTopMenu.bindAsEventListener(A));
G.appendChild(H);
G.appendChild(F);
this.div.appendChild(G);
this.verticalGroups.div[G.id]=G
}else{F.style.display="none";
this.verticalGroups.div[J].appendChild(F);
var A={verticalGroup:this.verticalGroups.div[J],element:F,panel:this};
OpenLayers.Event.observe(F,"click",this.moveToTopMenu.bindAsEventListener(A))
}}else{F=M
}}if(this.controls[E].active){F.className=this.controls[E].displayClass+"ItemActive"
}else{F.className=this.controls[E].displayClass+"ItemInactive"
}if(this.controls[E].over){F.className=this.controls[E].displayClass+"ItemOver"
}}}},openVerticalMenu:function(A){OpenLayers.Event.stop(A?A:window.event);
var D=this.verticalGroup;
var E=D.childNodes;
for(var C=2;
C<E.length;
C++){var B=E[C];
if(B.style.display=="none"){B.style.display="block"
}else{B.style.display="none"
}}},moveToTopMenu:function(A){var D=this.element;
var E=this.verticalGroup;
var B=E.childNodes;
E.removeChild(D);
E.insertBefore(D,B[1]);
B=E.childNodes;
for(var C=2;
C<B.length;
C++){var D=B[C];
D.style.display="none"
}},addControls:function(B,G,C){if(!(B instanceof Array)){B=[B]
}this.controls=this.controls.concat(B);
var F=null;
if(G){F=OpenLayers.Util.createUniqueID("verticalGroup")
}for(var E=0;
E<B.length;
E++){var D=document.createElement("div");
var A=B[E].title;
if(A!=null){D.title=B[E].title
}var H=document.createTextNode(" ");
B[E].panel_div=D;
OpenLayers.Event.observe(B[E].panel_div,"click",OpenLayers.Function.bind(this.onClick,this,B[E]));
OpenLayers.Event.observe(B[E].panel_div,"mouseover",OpenLayers.Function.bind(this.onMouseOver,this,B[E]));
OpenLayers.Event.observe(B[E].panel_div,"mouseout",OpenLayers.Function.bind(this.onMouseOut,this,B[E]));
OpenLayers.Event.observe(B[E].panel_div,"mousedown",OpenLayers.Function.bindAsEventListener(OpenLayers.Event.stop));
OpenLayers.Event.observe(B[E].panel_div,"dblclick",OpenLayers.Function.bindAsEventListener(OpenLayers.Event.stop));
if(G){this.verticalGroups.controlId[B[E].id]=F;
this.verticalGroups.className[F]=C
}}if(this.map){for(var E=0;
E<B.length;
E++){this.map.addControl(B[E]);
B[E].deactivate()
}this.redraw()
}},onClick:function(B,A){OpenLayers.Event.stop(A?A:window.event);
this.activateControl(B);
B.over=false;
this.redraw()
},onMouseOver:function(B,A){OpenLayers.Event.stop(A?A:window.event);
B.over=true;
this.redraw()
},onMouseOut:function(B,A){B.over=false;
this.redraw()
},CLASS_NAME:"MW.Control.Toolbar"});MW.Control.ZoomBar=OpenLayers.Class(OpenLayers.Control.PanZoom,{small:false,imageLocation:"/",zoomStopWidth:13,zoomStopHeight:8,slider:null,sliderIcon:"slider.gif",zoombarIcon:"zoombar.gif",sliderSize:new OpenLayers.Size(13,15),sliderEvents:null,zoomBarDiv:null,divEvents:null,moveCursoStyle:"move",events:null,mapCenter:null,mapZoomLevel:1,EVENT_TYPES:["drawComplete"],initialize:function(){OpenLayers.Control.PanZoom.prototype.initialize.apply(this,arguments)
},destroy:function(){if(this.slider!=null){this.div.removeChild(this.slider);
this.slider=null
}if(this.sliderEvents!=null){this.sliderEvents.destroy();
this.sliderEvents=null
}if(this.zoomBarDiv!=null){this.div.removeChild(this.zoombarDiv);
this.zoomBarDiv=null
}if(this.divEvents!=null){this.divEvents.destroy();
this.divEvents=null
}this.events.destroy();
this.events=null;
this.map.events.unregister("zoomend",this,this.moveZoomBar);
this.map.events.unregister("changebaselayer",this,this.redraw);
OpenLayers.Control.PanZoom.prototype.destroy.apply(this,arguments)
},setMap:function(A){OpenLayers.Control.PanZoom.prototype.setMap.apply(this,arguments);
this.map.events.register("changebaselayer",this,this.redraw)
},redraw:function(){if(this.div!=null){this.div.innerHTML=""
}this.draw()
},draw:function(C){MW.Control.prototype.draw.apply(this,arguments);
C=this.position.clone();
this.buttons=[];
var E=new OpenLayers.Size(16,16);
var D=new OpenLayers.Size(14,14);
var B=new OpenLayers.Pixel(C.x+20+E.w/2,C.y+10+E.w/2);
if(this.small){B=new OpenLayers.Pixel(C.x+5+E.w/2,C.y-11+E.w/2)
}this._addButton("ombratop","ombratop.gif",B.add(-14,3),0);
this._addButton("ombraplus","ombrasquare.gif",B.add(4,E.h*3+13),D);
if(!this.small){var A=new OpenLayers.Size(14,this.zoomStopHeight*(this.map.getNumZoomLevels()+1));
this._addButton("ombrabar","ombrasquare.gif",B.add(+2,E.h*4+9),A)
}else{this._addButton("ombratop","ombratop.gif",B.add(-14,3),0);
this._addButton("ombraplus","ombrasquare.gif",B.add(4,E.h*3+13),D)
}this._addButton("panup","north-mini.gif",B.add(0,-1),E);
C.y=B.y+E.h;
this._addButton("panleft","west-mini.gif",B.add(-E.w-1,E.h),E);
this._addButton("zoomworld","zoom-world-mini.gif",B.add(0,E.h),E);
this._addButton("panright","east-mini.gif",B.add(E.w+1,E.h),E);
this._addButton("pandown","south-mini.gif",B.add(0,E.h*2+1),E);
this._addButton("zoomin","zoom-plus-mini.gif",B.add(0,E.h*3+9),E);
if(!this.small){B=this._addZoomBar(B.add(+1,E.h*4+9))
}if(!this.small){this._addButton("ombraminus","ombrasquare.gif",B.add(3,E.h/2+4),D);
this._addButton("zoomout","zoom-minus-mini.gif",B.add(-1,E.h/2),E)
}else{this._addButton("ombraminus","ombrasquare.gif",B.add(2,E.h*3+29),E);
this._addButton("zoomout","zoom-minus-mini.gif",B.add(0,E.h*3+27),E)
}return this.div
},_addButton:function(A,D,I,G){var F=OpenLayers.Util.getImagesLocation()+D;
var B=OpenLayers.Util.createAlphaImageDiv(this.id+"_"+A,I,G,F,"absolute");
this.div.appendChild(B);
OpenLayers.Util.extend(B,{zoombar:this});
OpenLayers.Event.observe(B,"mousedown",OpenLayers.Function.bindAsEventListener(this.buttonDown,B));
OpenLayers.Event.observe(B,"dblclick",OpenLayers.Function.bindAsEventListener(this.doubleClick,B));
OpenLayers.Event.observe(B,"click",OpenLayers.Function.bindAsEventListener(this.doubleClick,B));
B.action=A;
B.map=this.map;
if(!this.slideRatio){var C=this.slideFactor;
var E=function(){return C
}
}else{var H=this.slideRatio;
var E=function(J){return this.map.getSize()[J]*H
}
}B.getSlideFactor=E;
this.buttons.push(B);
return B
},_addZoomBar:function(A){var D=OpenLayers.Util.getImagesLocation();
var G="OpenLayers_Control_PanZoomBar_Slider"+this.map.id;
var B=this.map.getNumZoomLevels()-1-this.map.getZoom();
var C=OpenLayers.Util.createAlphaImageDiv(G,A.add(-1,B*this.zoomStopHeight),this.sliderSize,D+this.imageLocation+this.sliderIcon,"absolute");
this.slider=C;
this.sliderEvents=new OpenLayers.Events(this,C,null,true,{includeXY:true});
this.sliderEvents.register("mousedown",this,this.zoomBarDown);
this.sliderEvents.register("mousemove",this,this.zoomBarDrag);
this.sliderEvents.register("mouseup",this,this.zoomBarUp);
this.sliderEvents.register("dblclick",this,this.doubleClick);
this.sliderEvents.register("click",this,this.doubleClick);
sz=new OpenLayers.Size();
sz.h=this.zoomStopHeight*(this.map.getNumZoomLevels()+1);
sz.w=this.zoomStopWidth;
var F=null;
if(OpenLayers.Util.alphaHack()){var G="OpenLayers_Control_PanZoomBar"+this.map.id;
F=OpenLayers.Util.createAlphaImageDiv(G,A,new OpenLayers.Size(sz.w,this.zoomStopHeight),D+this.zoombarIcon,"absolute",null,"crop");
F.style.height=sz.h
}else{F=OpenLayers.Util.createDiv("OpenLayers_Control_PanZoomBar_Zoombar"+this.map.id,A,sz,D+this.zoombarIcon)
}this.zoombarDiv=F;
this.divEvents=new OpenLayers.Events(this,F,null,true,{includeXY:true});
this.divEvents.register("mousedown",this,this.divClick);
this.divEvents.register("mousemove",this,this.passEventToSlider);
this.divEvents.register("dblclick",this,this.doubleClick);
this.divEvents.register("click",this,this.doubleClick);
var E=navigator.appVersion.indexOf("MSIE");
if(E!=-1){this.divEvents.register("mouseover",this,this.removeOffset)
}this.div.appendChild(F);
this.startTop=parseInt(F.style.top);
this.div.appendChild(C);
this.map.events.register("zoomend",this,this.moveZoomBar);
A=A.add(0,this.zoomStopHeight*this.map.getNumZoomLevels());
return A
},buttonDown:function(A){if(!OpenLayers.Event.isLeftClick(A)){return 
}switch(this.action){case"panup":this.map.pan(0,-50);
break;
case"pandown":this.map.pan(0,50);
break;
case"panleft":this.map.pan(-50,0);
break;
case"panright":this.map.pan(50,0);
break;
case"zoomin":this.map.zoomIn();
break;
case"zoomout":this.map.zoomOut();
break;
case"zoomworld":if(this.zoombar.mapCenter==null){this.map.zoomToExtent(this.map.getMaxExtent())
}else{this.map.setCenter(this.zoombar.mapCenter,this.zoombar.mapZoomLevel)
}break
}OpenLayers.Event.stop(A)
},decodeParameters:function(A){A=A.replace(/&lt;/g,"<");
A=A.replace(/&gt;/g,">");
return A
},passEventToSlider:function(A){this.sliderEvents.handleBrowserEvent(A)
},removeOffset:function(A){this.zoombarDiv.offsets=null
},divClick:function(A){if(!OpenLayers.Event.isLeftClick(A)){return 
}var D=A.xy.y;
var C=OpenLayers.Util.pagePosition(A.object)[1];
var B=Math.floor((D-C)/this.zoomStopHeight);
this.map.zoomTo((this.map.getNumZoomLevels()-1)-B);
OpenLayers.Event.stop(A)
},zoomBarDown:function(A){if(!OpenLayers.Event.isLeftClick(A)){return 
}this.map.events.register("mousemove",this,this.passEventToSlider);
this.map.events.register("mouseup",this,this.passEventToSlider);
this.mouseDragStart=A.xy.clone();
this.zoomStart=A.xy.clone();
this.div.style.cursor=this.moveCursoStyle;
this.zoombarDiv.offsets=null;
OpenLayers.Event.stop(A)
},zoomBarDrag:function(B){if(this.mouseDragStart!=null){var A=this.mouseDragStart.y-B.xy.y;
var D=OpenLayers.Util.pagePosition(this.zoombarDiv);
if((B.clientY-D[1])>0&&(B.clientY-D[1])<parseInt(this.zoombarDiv.style.height)-2){var C=parseInt(this.slider.style.top)-A;
this.slider.style.top=C+"px"
}this.mouseDragStart=B.xy.clone();
OpenLayers.Event.stop(B)
}},zoomBarUp:function(B){if(!OpenLayers.Event.isLeftClick(B)){return 
}if(this.zoomStart){this.div.style.cursor="";
this.map.events.unregister("mouseup",this,this.passEventToSlider);
this.map.events.unregister("mousemove",this,this.passEventToSlider);
var A=this.zoomStart.y-B.xy.y;
this.map.zoomTo(this.map.zoom+Math.round(A/this.zoomStopHeight));
this.moveZoomBar();
this.mouseDragStart=null;
OpenLayers.Event.stop(B)
}},moveZoomBar:function(){var A=((this.map.getNumZoomLevels()-1)-this.map.getZoom())*this.zoomStopHeight+this.startTop+1;
this.slider.style.top=A+"px"
},CLASS_NAME:"MW.Control.ZoomBar"});MW.Format.ArcXML=OpenLayers.Class(OpenLayers.Format.ArcXML,{layerdeflist:[],initialize:function(A){this.request=new OpenLayers.Format.ArcXML.Request();
this.response=new OpenLayers.Format.ArcXML.Response();
this.layerdeflist=[];
if(A){if(A.requesttype=="feature"){this.request.get_image=null;
var C=this.request.get_feature.query;
this.addCoordSys(C.featurecoordsys,A.featureCoordSys);
this.addCoordSys(C.filtercoordsys,A.filterCoordSys);
if(A.polygon){C.isspatial=true;
C.spatialfilter.polygon=A.polygon
}else{if(A.envelope){C.isspatial=true;
C.spatialfilter.envelope={minx:0,miny:0,maxx:0,maxy:0};
this.parseEnvelope(C.spatialfilter.envelope,A.envelope)
}}}else{if(A.requesttype=="image"){this.request.get_feature=null;
var B=this.request.get_image.properties;
this.parseEnvelope(B.envelope,A.envelope);
this.addOutput(B.output,A.output);
B.background={};
this.addBackground(B.background,A.background);
this.addLayers(B.layerlist,A.layers);
this.addLayers(this.layerdeflist,A.layerDefList);
this.addImageSize(B.imagesize,A.tileSize);
this.addCoordSys(B.featurecoordsys,A.featureCoordSys);
this.addCoordSys(B.filtercoordsys,A.filterCoordSys)
}else{this.request=null
}}}OpenLayers.Format.XML.prototype.initialize.apply(this,[A])
},addLayers:function(C,B){if(typeof B!="undefined"){for(var A=0;
A<B.length;
A++){C.push(B[A])
}}},addBackground:function(B,A){if(typeof A!="undefined"&&A!=null){B.color=A.color;
if(typeof A.transcolor!="undefined"&&A.transcolor!=null){B.transcolor=A.transcolor
}}},addOutput:function(A,B){if(typeof B!="undefined"&&B!=null){A.type=B.type
}},write:function(){var U=this.createElementNS("","ARCXML");
this.setAttributeNS(U,null,"version","1.1");
this.setAttributeNS(U,null,"encoding","ISO-8859-1");
var H=this.createElementNS("","REQUEST");
if(this.request.get_image!=null){var M=this.createElementNS("","GET_IMAGE");
H.appendChild(M);
var L=this.createElementNS("","PROPERTIES");
M.appendChild(L);
var C=this.request.get_image.properties;
if(C.envelope!=null){var Y=this.createElementNS("","ENVELOPE");
L.appendChild(Y);
this.setAttributeNS(Y,null,"minx",C.envelope.minx);
this.setAttributeNS(Y,null,"miny",C.envelope.miny);
this.setAttributeNS(Y,null,"maxx",C.envelope.maxx);
this.setAttributeNS(Y,null,"maxy",C.envelope.maxy)
}var W=this.createElementNS("","IMAGESIZE");
L.appendChild(W);
this.setAttributeNS(W,null,"height",C.imagesize.height);
this.setAttributeNS(W,null,"width",C.imagesize.width);
if(C.imagesize.height!=C.imagesize.printheight||C.imagesize.width!=C.imagesize.printwidth){this.setAttributeNS(W,null,"printheight",C.imagesize.printheight);
this.setArrtibuteNS(W,null,"printwidth",C.imagesize.printwidth)
}var I=this.createElementNS("","OUTPUT");
L.appendChild(I);
this.setAttributeNS(I,null,"type",C.output.type);
if(C.background!=null&&typeof C.background.color!="undefined"){var A=this.createElementNS("","BACKGROUND");
L.appendChild(A);
this.setAttributeNS(A,null,"color",C.background.color.r+","+C.background.color.g+","+C.background.color.b);
if(C.background.transcolor!==null){this.setAttributeNS(A,null,"transcolor",C.background.transcolor.r+","+C.background.transcolor.g+","+C.background.transcolor.b)
}}if(C.layerlist!=null&&C.layerlist.length>0){var G=this.createElementNS("","LAYERLIST");
this.setAttributeNS(G,null,"order","true");
L.appendChild(G);
var b=[];
if(this.layerdeflist!=null&&this.layerdeflist.length>0){for(var B=0;
B<this.layerdeflist.length;
B++){var N=this.layerdeflist[B];
N=N.replace(/\n/g,"");
var R=OpenLayers.Format.XML.prototype.read.apply(this,[N]);
var Q=R.documentElement.getAttribute("id");
G.appendChild(R.documentElement);
b.push(Q)
}}for(var T=0;
T<C.layerlist.length;
T++){var c=C.layerlist[T].id;
var K=false;
if(b!=null&&b.length>0){for(var B=0;
B<b.length;
B++){var O=b[B];
if(c==O){K=true;
break
}}}if(K==false){var S=this.createElementNS("","LAYERDEF");
G.appendChild(S);
this.setAttributeNS(S,null,"id",C.layerlist[T].id);
this.setAttributeNS(S,null,"visible",C.layerlist[T].visible);
if(typeof C.layerlist[T].query=="object"){var F=C.layerlist[T].query;
if(F.where.length<0){continue
}var d=null;
if(typeof F.spatialfilter=="boolean"&&F.spatialfilter){d=this.createElementNS("","SPATIALQUERY")
}else{d=this.createElementNS("","QUERY")
}this.setAttributeNS(d,null,"where",F.where);
if(typeof F.accuracy=="number"&&F.accuracy>0){this.setAttributeNS(d,null,"accuracy",F.accuracy)
}if(typeof F.featurelimit=="number"&&F.featurelimit<2000){this.setAttributeNS(d,null,"featurelimit",F.featurelimit)
}if(typeof F.subfields=="string"&&F.subfields!="#ALL#"){this.setAttributeNS(d,null,"subfields",F.subfields)
}if(typeof F.joinexpression=="string"&&F.joinexpression.length>0){this.setAttributeNS(d,null,"joinexpression",F.joinexpression)
}if(typeof F.jointables=="string"&&F.jointables.length>0){this.setAttributeNS(d,null,"jointables",F.jointables)
}S.appendChild(d)
}if(typeof C.layerlist[T].renderer=="object"){this.addRenderer(S,C.layerlist[T].renderer)
}}}}}else{if(this.request.get_feature!=null){var M=this.createElementNS("","GET_FEATURES");
this.setAttributeNS(M,null,"outputmode","newxml");
this.setAttributeNS(M,null,"checkesc","true");
if(typeof this.request.get_feature.geometry=="string"){this.setAttributeNS(M,null,"geometry",this.request.get_feature.geometry)
}else{this.setAttributeNS(M,null,"geometry","false")
}if(typeof this.request.get_feature.compact=="string"){this.setAttributeNS(M,null,"compact",this.request.get_feature.compact)
}if(typeof this.request.get_feature.featurelimit=="number"){this.setAttributeNS(M,null,"featurelimit",this.request.get_feature.featurelimit)
}this.setAttributeNS(M,null,"globalenvelope","true");
H.appendChild(M);
if(this.request.get_feature.layer!=null&&this.request.get_feature.layer.length>0){var Z=this.createElementNS("","LAYER");
this.setAttributeNS(Z,null,"id",this.request.get_feature.layer);
M.appendChild(Z)
}var V=this.request.get_feature.query;
if(V!=null){var X=null;
if(V.isspatial){X=this.createElementNS("","SPATIALQUERY")
}else{X=this.createElementNS("","QUERY")
}M.appendChild(X);
if(typeof V.accuracy=="number"){this.setAttributeNS(X,null,"accuracy",V.accuracy)
}if(V.featurecoordsys!=null){var E=this.createElementNS("","FEATURECOORDSYS");
if(V.featurecoordsys.id==0){this.setAttributeNS(E,null,"string",V.featurecoordsys.string)
}else{this.setAttributeNS(E,null,"id",V.featurecoordsys.id)
}X.appendChild(E)
}if(V.filtercoordsys!=null){var D=this.createElementNS("","FILTERCOORDSYS");
if(V.filtercoordsys.id==0){this.setAttributeNS(D,null,"string",V.filtercoordsys.string)
}else{this.setAttributeNS(D,null,"id",V.filtercoordsys.id)
}X.appendChild(D)
}if(V.buffer>0){var P=this.createElementNS("","BUFFER");
this.setAttributeNS(P,null,"distance",V.buffer);
X.appendChild(P)
}if(V.isspatial){var J=this.createElementNS("","SPATIALFILTER");
this.setAttributeNS(J,null,"relation",V.spatialfilter.relation);
X.appendChild(J);
if(V.spatialfilter.envelope){var a=this.createElementNS("","ENVELOPE");
this.setAttributeNS(a,null,"minx",V.spatialfilter.envelope.minx);
this.setAttributeNS(a,null,"miny",V.spatialfilter.envelope.miny);
this.setAttributeNS(a,null,"maxx",V.spatialfilter.envelope.maxx);
this.setAttributeNS(a,null,"maxy",V.spatialfilter.envelope.maxy);
J.appendChild(a)
}else{if(typeof V.spatialfilter.polygon=="object"){J.appendChild(this.writePolygonGeometry(V.spatialfilter.polygon))
}}}if(V.where!=null&&V.where.length>0){this.setAttributeNS(X,null,"where",V.where)
}}}}U.appendChild(H);
return OpenLayers.Format.XML.prototype.write.apply(this,[U])
},parseResponse:function(Z){if(typeof Z=="string"){var N=new OpenLayers.Format.XML();
Z=N.read(Z)
}var A=new OpenLayers.Format.ArcXML.Response();
var a=Z.getElementsByTagName("ERROR");
if(a!=null&&a.length>0){A.error=this.getChildValue(a,"Unknown error.")
}else{var R=Z.getElementsByTagName("RESPONSE");
if(R==null||R.length==0){A.error="No RESPONSE tag found in ArcXML response.";
return A
}var Q=R[0].firstChild.nodeName;
if(Q=="#text"){Q=R[0].firstChild.nextSibling.nodeName
}if(Q=="IMAGE"){var C=Z.getElementsByTagName("ENVELOPE");
var W=Z.getElementsByTagName("OUTPUT");
if(C==null||C.length==0){A.error="No ENVELOPE tag found in ArcXML response."
}else{if(W==null||W.length==0){A.error="No OUTPUT tag found in ArcXML response."
}else{var U=this.parseAttributes(C[0]);
var V=this.parseAttributes(W[0]);
if(typeof V.type=="string"){A.image={envelope:U,output:{type:V.type,data:this.getChildValue(W[0])}}
}else{A.image={envelope:U,output:V}
}}}}else{if(Q=="FEATURES"){var I=R[0].getElementsByTagName("FEATURES");
A.features.namesAttributes=[];
var P=I[0].getElementsByTagName("FEATURECOUNT");
A.features.featurecount=P[0].getAttribute("count");
if(A.features.featurecount>0){var D=I[0].getElementsByTagName("ENVELOPE");
A.features.envelope=this.parseAttributes(D[0],typeof (0));
var X=I[0].getElementsByTagName("FEATURE");
for(var M=0;
M<X.length;
M++){var H=new OpenLayers.Feature.Vector();
var S=X[M].getElementsByTagName("FIELD");
for(var F=0;
F<S.length;
F++){var G=S[F].getAttribute("name");
var K=S[F].getAttribute("value");
H.attributes[G]=K;
if(M==0){A.features.namesAttributes.push(G)
}}var T=X[M].getElementsByTagName("POLYGON");
if(T.length>0){var J=T[0].getElementsByTagName("RING");
var E=[];
for(var O=0;
O<J.length;
O++){var Y=[];
Y.push(this.parsePointGeometry(J[O]));
var L=J[O].getElementsByTagName("HOLE");
for(var B=0;
B<L.length;
B++){Y.push(this.parsePointGeometry(L[B]))
}L=null;
E.push(new OpenLayers.Geometry.Polygon(Y));
Y=null
}J=null;
if(E.length==1){H.geometry=E[0]
}else{H.geometry=new OpenLayers.Geometry.MultiPolygon(E)
}}A.features.feature.push(H)
}}}else{A.error="Unidentified response type."
}}}return A
},CLASS_NAME:"MW.Format.ArcXML"});MW.Format.OLON=OpenLayers.Class(OpenLayers.Format.JSON,{read:function(D,B){var C=OpenLayers.Format.JSON.prototype.read(D,B);
var A=OpenLayers.Class.deserialize(C);
return A
},write:function(C,A){var B=OpenLayers.Class.serialize(C);
var D=OpenLayers.Format.JSON.prototype.write(B,A);
return D
},CLASS_NAME:"MW.Format.OLON"});MW.Layer.ArcXML=OpenLayers.Class(OpenLayers.Layer.ArcIMS,MW.Layer,{layerDefList:[],initialize:function(D,C,B){OpenLayers.Layer.ArcIMS.prototype.initialize.apply(this,[D,C,B]);
if(this.transparent){if(!this.isBaseLayer){this.isBaseLayer=false
}this.format=OpenLayers.Util.alphaHack()?"image/gif":"image/png";
var A={type:""};
A.type=OpenLayers.Util.alphaHack()?"gif":"png";
this.options.output=A
}MW.Layer.prototype.setLoading.apply(this,arguments)
},getURL:function(D){var A="";
D=this.adjustBounds(D);
var C=new MW.Format.ArcXML(OpenLayers.Util.extend(this.options,{requesttype:"image",envelope:D.toArray(),tileSize:this.tileSize}));
OpenLayers.Console.debug("Ajax request url: "+this.getFullRequestString());
OpenLayers.Console.debug("Ajax request data: "+C.write());
var B=new OpenLayers.Request.POST({url:this.getFullRequestString(),data:C.write(),async:false});
if(B!=null){var F=B.responseXML;
if(!F||!F.documentElement){F=B.responseText
}var E=new MW.Format.ArcXML();
var G=E.read(F);
A=this.getUrlOrImage(G.image.output)
}return A
},getURLasync:function(C,A,E,D){C=this.adjustBounds(C);
var B=new MW.Format.ArcXML(OpenLayers.Util.extend(this.options,{requesttype:"image",envelope:C.toArray(),tileSize:this.tileSize}));
OpenLayers.Console.debug("Ajax request url: "+this.getFullRequestString());
OpenLayers.Console.debug("Ajax request data: "+B.write());
OpenLayers.Request.POST({url:this.getFullRequestString(),async:true,data:B.write(),callback:function(F){var H=F.responseXML;
if(!H||!H.documentElement){H=F.responseText
}var G=new MW.Format.ArcXML();
var I=G.read(H);
A[E]=this.getUrlOrImage(I.image.output);
D.apply(A)
},scope:this})
},getFeatureInfo:function(H,F,L){var B=L.buffer||1;
var I=L.callback||this.getFeatureInfoDone;
var J=L.scope||"done";
if(L.divInfo&&L.divInfo!=null){L.divInfo.style.display="none";
L.divInfo.innerHTML=""
}var A={};
OpenLayers.Util.extend(A,this.options);
A.requesttype="feature";
if(H instanceof OpenLayers.LonLat){A.polygon=null;
A.envelope=[H.lon-B,H.lat-B,H.lon+B,H.lat+B]
}else{if(H instanceof OpenLayers.Geometry.Polygon){A.envelope=null;
A.polygon=H
}}var E=new MW.Format.ArcXML(A);
OpenLayers.Util.extend(E.request.get_feature,L);
E.request.get_feature.layer=F.id;
if(typeof F.query.accuracy=="number"){E.request.get_feature.query.accuracy=F.query.accuracy
}else{var G=this.map.getCenter();
var D=this.map.getViewPortPxFromLonLat(G);
D.x++;
var C=this.map.getLonLatFromPixel(D);
E.request.get_feature.query.accuracy=C.lon-G.lon
}E.request.get_feature.query.where=F.query.where;
E.request.get_feature.query.spatialfilter.relation="area_intersection";
var K=OpenLayers.Layer.Grid.prototype.getFullRequestString.apply(this,[{CustomService:"Query"},""]);
OpenLayers.Console.debug("Ajax request url: "+K);
OpenLayers.Console.debug("Ajax request data: "+E.write());
new OpenLayers.Ajax.Request(K,{asynchronous:true,method:"POST",postBody:E.write(),onComplete:function(N){var M=E.parseResponse(N.responseText);
if(!E.iserror()){I.call(J,M.features,L.divInfo)
}else{I.call(J,null,L.divInfo)
}}})
},getFeatureInfoDone:function(A,E){if(E!=null){E.className="MWInfoLayerArcIMS";
if(A!=null&&A.feature!=null&&A.feature.length==0){E.innerHTML="Non &#232; stato trovato nessun elemento.";
E.style.display="block";
return 
}if(A==null){E.innerHTML="Si &#232; verificato un errore nel servizio.";
E.style.display="block";
return 
}if(A!=null&&A.feature!=null&&A.feature.length>0){var H=document.createElement("table");
H.className="featureInfo";
var D=document.createElement("tbody");
H.appendChild(D);
E.appendChild(H);
var J=document.createElement("tr");
for(var C=0;
C<A.namesAttributes.length;
C++){var G=A.namesAttributes[C];
if(G.indexOf("#")==-1){var F=document.createElement("td");
F.style.background="#eee";
F.style.fontWeight="bold";
F.appendChild(document.createTextNode(G));
J.appendChild(F)
}}D.appendChild(J);
for(var C=0;
C<A.feature.length;
C++){var I=A.feature[C];
var J=document.createElement("tr");
for(var B=0;
B<A.namesAttributes.length;
B++){var G=A.namesAttributes[B];
if(G.indexOf("#")==-1){var F=document.createElement("td");
F.appendChild(document.createTextNode(I.attributes[G]));
J.appendChild(F)
}}D.appendChild(J)
}E.style.display="block"
}}},CLASS_NAME:"MW.Layer.ArcXML"});MW.Layer.Markers=OpenLayers.Class(OpenLayers.Layer.Markers,MW.Layer,{initialize:function(C,B,A){OpenLayers.Layer.Markers.prototype.initialize.apply(this,[C,B,A]);
MW.Layer.prototype.setLoading.apply(this,arguments)
},removeMarker:function(A){if(this.markers&&this.markers.length){OpenLayers.Util.removeItem(this.markers,A);
if((A.icon!=null)&&(A.icon.imageDiv!=null)&&(A.icon.imageDiv.parentNode==this.div)){this.div.removeChild(A.icon.imageDiv);
A.drawn=false
}}if(A.popup!=null){this.map.removePopup(A.popup);
A.popup.destroy()
}},display:function(C){OpenLayers.Layer.Markers.prototype.display.apply(this,arguments);
var B;
for(B=0;
B<this.markers.length;
B++){var A=this.markers[B];
if(A.popup!=null&&!C){A.popup.hide()
}}},CLASS_NAME:"MW.Layer.Markers"});MW.Layer.RSS=OpenLayers.Class(MW.Layer.Markers,MW.Layer,{location:null,features:null,type:null,iconUrl:"marker.png",iconSize:new OpenLayers.Size(21,25),popupSize:new OpenLayers.Size(200,100),namespace_uri_openls:"http://www.opengis.net/xls",namespace_prefix_openls:"xls",namespace_uri_georss:"http://www.georss.org/georss",namespace_prefix_georss:"ns3",initialize:function(C,A,D,B){OpenLayers.Layer.Markers.prototype.initialize.apply(this,[C,B]);
this.features=[];
this.loadRSS(A,D);
MW.Layer.prototype.setLoading.apply(this,arguments)
},destroy:function(){this.clearFeatures();
this.features=null;
OpenLayers.Layer.Markers.prototype.destroy.apply(this,arguments)
},loadRSS:function(A,B){this.clearMarkers();
this.clearFeatures();
this.location=A;
this.type=B;
if(this.location!=null&&this.type!=null){if(this.type=="url"){var C=this.location;
if(MW.Proxy&&this.location.startsWith("http")){C=MW.Proxy+MW.Util.escapeUri(this.location)
}OpenLayers.loadURL(C,null,this,this.parseData)
}else{this.parseData(OpenLayers.parseXMLString(this.location))
}}},parseData:function(Y){this.clearMarkers();
this.clearFeatures();
var Z=null;
if(this.type=="url"){Z=Y.responseXML;
if(!Z||Y.fileType!="XML"){Z=OpenLayers.parseXMLString(Y.responseText)
}}else{Z=Y
}this.name=Z.getElementsByTagName("title")[0].firstChild.nodeValue;
var L=Z.getElementsByTagName("item");
for(var U=0;
U<L.length;
U++){var Y={};
var W=L[U];
var K=null;
var H=null;
var D=null;
var B=null;
var X=null;
var a="Indirizzo:";
var J=null;
var S=OpenLayers.Ajax.getElementsByTagNameNS(W,this.namespace_uri_georss,this.namespace_prefix_georss,"point");
if(S!=null&&S.length>0&&S[0].firstChild!=null){var O=S[0].firstChild.nodeValue.split(" ");
if(O!=null&&O.length==2){K=new OpenLayers.LonLat((new Number(O[0])).valueOf(),(new Number(O[1])).valueOf())
}}var P=OpenLayers.Ajax.getElementsByTagNameNS(W,this.namespace_uri_openls,this.namespace_prefix_openls,"Address");
if(P!=null){var E=P[0];
if(E!=null){var T=OpenLayers.Ajax.getElementsByTagNameNS(E,this.namespace_uri_openls,this.namespace_prefix_openls,"StreetAddress")[0];
if(T!=null){var M=OpenLayers.Ajax.getElementsByTagNameNS(T,this.namespace_uri_openls,this.namespace_prefix_openls,"Street")[0];
var C=OpenLayers.Ajax.getElementsByTagNameNS(T,this.namespace_uri_openls,this.namespace_prefix_openls,"_StreetLocation")[0];
if(M!=null){H=M.getAttribute("officialName");
B="";
if(C!=null){B=C.getAttribute("number");
X=C.getAttribute("subdivision")
}}}var R=OpenLayers.Ajax.getElementsByTagNameNS(E,this.namespace_uri_openls,this.namespace_prefix_openls,"freeFormAddress")[0];
if(R!=null&&R.firstChild!=null){D=R.firstChild.nodeValue
}}}var Q=W.getElementsByTagName("title");
if(Q!=null&&Q[0]!=null&&Q[0].firstChild!=null&&Q[0].firstChild.nodeValue!=null&&Q[0].firstChild.nodeValue!=""){a=Q[0].firstChild.nodeValue
}var A=W.getElementsByTagName("link");
if(A!=null&&A[0]!=null&&A[0].firstChild!=null&&A[0].firstChild.nodeValue!=null&&A[0].firstChild.nodeValue!=""){J=A[0].firstChild.nodeValue
}if(((H!=null&&H!="")||(D!=null&&D!=""))&&K!=null&&K.lon!=0&&K.lat!=0&&K.lon!=0&&K.lat!=0){var N='<font class="textRSS"></br>'+a+"</br></font>";
if(H!=null&&H!=""){if(J!=null&&J!=""){N=N+'<a href="#" onclick = "var newWin=window.open(\''+J+'\');newWin.focus();" class="linkRSS">'
}else{N=N+'<font class="textRSS">'
}N=N+H;
if(B!=null&&B!=""){N+=", "+B;
if(X!=null&&X!=""){N+="/"+X
}}if(J!=null&&J!=""){N=N+"</a>"
}else{N=N+"</font>"
}}else{if(D!=null&&D!=""){if(J!=null&&J!=""){N=N+'<a href="#" onclick = "var newWin=window.open(\''+J+'\');newWin.focus();" class="linkRSS">'
}else{N=N+'<font class="textRSS">'
}N=N+D;
if(J!=null&&J!=""){N=N+"</a>"
}else{N=N+"</font>"
}}}AutoSizeFramedCloud=OpenLayers.Class(OpenLayers.Popup.FramedCloud,{autoSize:true,minSize:this.popupSize});
popupClass=AutoSizeFramedCloud;
popupContentHTML=N;
var G=new OpenLayers.Feature(this,K);
G.closeBox=true;
G.popupClass=popupClass;
G.data.popupContentHTML=popupContentHTML;
G.data.overflow="hidden";
var F=new OpenLayers.Pixel(-(this.iconSize.w/2),-this.iconSize.h);
var V=new OpenLayers.Icon(OpenLayers.ImgPath+this.iconUrl,this.iconSize,F);
G.data.icon=V;
var I=G.createMarker();
this.features.push(G);
this.addMarker(I);
I.events.register("click",G,this.markerClick.bind(G));
I.events.register("dblclick",G,this.stopevent);
I.events.register("mousedown",G,this.stopevent)
}}},markerClick:function(B){if(this.layer!=null&&this.layer.features!=null){var A=this.layer.features;
for(var C=0;
C<A.length;
C++){if(A[C]!=null&&A[C].popup!=null&&A[C].marker!=this.marker){A[C].popup.hide()
}}}if(this.popup==null&&this.layer!=null){this.popup=this.createPopup(this.closeBox);
this.layer.map.addPopup(this.popup);
this.popup.show();
this.marker.popup=this.popup
}else{this.popup.toggle()
}OpenLayers.Event.stop(B)
},stopevent:function(A){OpenLayers.Event.stop(A,true)
},clearFeatures:function(){if(this.features!=null){while(this.features.length>0){var A=this.features[0];
OpenLayers.Util.removeItem(this.features,A);
A.destroy()
}}},loadLink:function(B){var A=window.open(B);
A.focus()
},CLASS_NAME:"MW.Layer.RSS"});MW.Layer.WMS=OpenLayers.Class(OpenLayers.Layer.WMS,MW.Layer,{ratio:2,tile:null,doneLoading:false,boundsInitial:null,legendId:null,legendImage:null,layers:null,sldType:null,serializable:{args:["name","url","params","options","layers"],props:["reproject","encodeBBOX","layername","type","numZoomLevels","maxResolution","minResolution","maxExtent","wrapDateLine","displayOutsideMaxExtent","isBaseLayer","displayInLayerSwitcher","visibility","opacity","layers"]},initialize:function(D,C,F,B,E){var A=[];
F=OpenLayers.Util.upperCaseObject(F);
this.layers=E;
if(B&&B.legendId&&F&&!F.SLD){B.legendId=null
}A.push(D,C,F,B);
OpenLayers.Layer.WMS.prototype.initialize.apply(this,A);
MW.Layer.prototype.setLoading.apply(this,arguments)
},controlLayer:function(A){var B=false;
return B
},setSld:function(A,B){this.params.SLD=A;
this.sldType=B
},setLegend:function(B){if(B!=null&&B!=""){this.legendId=B;
var A=null;
if(this.sldType=="string"){A=this.getFullRequestString({REQUEST:"getlegendgraphic",LAYER:this.params.LAYERS,format:"image/png",sldBody:this.params.SLD,sld:null,HEIGHT:null,WIDTH:null})
}else{A=this.getFullRequestString({REQUEST:"getlegendgraphic",LAYER:this.params.LAYERS,format:"image/png",sld:this.params.SLD,sldBody:null,HEIGHT:null,WIDTH:null})
}if(this.legendImage!=null){OpenLayers.Util.getElement(this.legendId).removeChild(this.legendImage);
this.legendImage=null
}this.legendImage=OpenLayers.Util.createImage(null,0,0,A);
this.imgId=this.legendImage.id;
OpenLayers.Util.getElement(this.legendId).appendChild(this.legendImage)
}},deleteSld:function(){this.params.SLD=null
},deleteLegend:function(){if(this.legendId!=null&&this.legendId!=""){if(this.legendImage!=null){OpenLayers.Util.getElement(this.legendId).removeChild(this.legendImage);
this.legendImage=null
}}},addTile:function(B,A){return new MW.Tile.Image(this,A,B,null,this.tileSize)
},getURL:function(C){C=this.adjustBounds(C);
var E=this.getImageSize();
var D=[];
if(this.layers){for(var B=0;
B<this.layers.length;
B++){this.layers[B].inRange=this.layers[B].calculateInRange(this.map.getZoom());
if(this.layers[B].visibility&&this.layers[B].inRange){D.push(this.layers[B].physicalName)
}}}if(D.length>0||this.params.LAYERS){var A=null;
if(this.sldType=="string"){A=this.getFullRequestString({BBOX:this.encodeBBOX?C.toBBOX():C.toArray(),WIDTH:E.w,HEIGHT:E.h,LAYERS:this.params.LAYERS?this.params.LAYERS:D,SLD:null,SLDBODY:this.params.SLD,TRANSPARENT:this.params.TRANSPARENT?this.params.TRANSPARENT:"TRUE"})
}else{A=this.getFullRequestString({BBOX:this.encodeBBOX?C.toBBOX():C.toArray(),WIDTH:E.w,HEIGHT:E.h,LAYERS:this.params.LAYERS?this.params.LAYERS:D,SLD:this.params.SLD,SLDBODY:null,TRANSPARENT:this.params.TRANSPARENT?this.params.TRANSPARENT:"TRUE"})
}return A
}return null
},setMap:function(B){if(this.map==null){this.map=B;
this.maxExtent=this.maxExtent||this.map.maxExtent;
this.projection=this.projection||this.map.projection;
if(this.projection&&typeof this.projection=="string"){this.projection=new OpenLayers.Projection(this.projection)
}this.units=this.projection.getUnits()||this.units||this.map.units;
this.initResolutions();
if(!this.isBaseLayer){this.inRange=this.calculateInRange();
var A=((this.visibility)&&(this.inRange));
this.div.style.display=A?"":"none"
}this.setTileSize()
}if(this.legendId){this.setLegend(this.legendId)
}},CLASS_NAME:"MW.Layer.WMS"});MW.Control.FloatingPanel.Info=OpenLayers.Class(MW.Control.FloatingPanel,{url:null,featureCount:50,tolerance:50,loading:null,statusCode:null,divInfo:null,initialize:function(A){MW.Control.FloatingPanel.prototype.initialize.apply(this,[A])
},destroy:function(){MW.Control.FloatingPanel.prototype.destroy.apply(this,arguments)
},draw:function(){if(this.statusCode=="loading"){return 
}if(this.div==null){MW.Control.FloatingPanel.prototype.draw.apply(this,arguments)
}else{if(this.childElement==null){MW.Control.FloatingPanel.prototype.draw.apply(this,arguments)
}this.childElement.innerHTML=""
}this.div.style.width=this.size.w;
this.childElement.style.height="";
this.childElement.style.maxHeight=this.size.h+"px";
this.childElement.style.overflow="auto";
var B=navigator.appVersion.split("MSIE");
var A=parseFloat(B[1]);
this.divInfo=document.createElement("div");
this.divInfo.className="Info";
this.divInfo.id="Info";
this.childElement.appendChild(this.divInfo);
this.loadFeature();
this.statusCode="loading";
this.div.style.display="none";
if(this.loading==null){this.loading=new MW.Control.LoadingMessage();
if(this.loading!=null){this.map.addControl(this.loading)
}}this.loading.startLoad();
return this.div
},loadFeature:function(){},setBounds:function(A){this.extent=A
},getTolerance:function(){return this.tolerance
},CLASS_NAME:"MW.Control.FloatingPanel.Info"});MW.Control.FloatingPanel.LayerSwitcher=OpenLayers.Class(MW.Control.FloatingPanel,OpenLayers.Control.LayerSwitcher,{wmsRedraw:false,layerStates:null,groups:{groupDivs:{},checked:{},layers:{},display:{}},initialize:function(A){MW.Control.FloatingPanel.prototype.initialize.apply(this,[A]);
OpenLayers.Control.LayerSwitcher.prototype.initialize.apply(this,[A])
},destroy:function(){OpenLayers.Event.stopObservingElement(this.div);
this.clearLayersArray("base");
this.clearLayersArray("data");
this.map.events.unregister("addlayer",this,this.redraw);
this.map.events.unregister("changelayer",this,this.redraw);
this.map.events.unregister("removelayer",this,this.redraw);
this.map.events.unregister("changebaselayer",this,this.redraw);
MW.Control.FloatingPanel.prototype.destroy.apply(this,arguments);
OpenLayers.Control.LayerSwitcher.prototype.destroy.apply(this,arguments)
},setMap:function(A){OpenLayers.Control.prototype.setMap.apply(this,arguments);
this.map.events.register("addlayer",this,this.redraw);
this.map.events.register("changelayer",this,this.redraw);
this.map.events.register("removelayer",this,this.redraw);
this.map.events.register("changebaselayer",this,this.redraw)
},draw:function(){MW.Control.FloatingPanel.prototype.draw.apply(this,arguments);
this.div.style.width=this.size.w+"px";
this.childElement.className=this.displayClass;
this.childElement.style.height="";
var B=navigator.appVersion.split("MSIE");
var A=parseFloat(B[1]);
if(A<6.5){this.iframe=document.createElement("iframe");
this.iframe.className=this.displayClass+"iframe";
this.div.appendChild(this.iframe)
}this.loadContents();
this.redraw();
this.updateMap();
return this.div
},loadContents:function(){this.layersDiv=document.createElement("div");
this.layersDiv.id="layersDiv";
this.layersDiv.style.maxHeight=this.size.h+"px";
this.layersDiv.style.overflowY="auto";
this.layersDiv.style.overflowX="hidden";
this.baseLbl=document.createElement("div");
this.baseLbl.className="layersLabel";
this.baseLbl.id="baseLayerLabel";
this.baseLbl.innerHTML="Base Layer";
this.baseLayersDiv=document.createElement("div");
this.baseLayersDiv.id="baseLayersDiv";
this.baseLayersDiv.className="dataOrBaseLayersDiv";
this.dataLbl=document.createElement("div");
this.dataLbl.className="layersLabel";
this.dataLbl.id="dataLayerLabel";
this.dataLbl.innerHTML="Overlays";
this.dataLayersDiv=document.createElement("div");
this.dataLayersDiv.id="baseLayersDiv";
this.dataLayersDiv.className="dataOrBaseLayersDiv";
if(this.ascending){this.layersDiv.appendChild(this.baseLbl);
this.layersDiv.appendChild(this.baseLayersDiv);
this.layersDiv.appendChild(this.dataLbl);
this.layersDiv.appendChild(this.dataLayersDiv)
}else{this.layersDiv.appendChild(this.dataLbl);
this.layersDiv.appendChild(this.dataLayersDiv);
this.layersDiv.appendChild(this.baseLbl);
this.layersDiv.appendChild(this.baseLayersDiv)
}this.childElement.appendChild(this.layersDiv);
var B=OpenLayers.Util.getImagesLocation();
var A=new OpenLayers.Size(18,18)
},clearLayersArray:function(D){var E=this[D+"Layers"];
if(E){for(var C=0,A=E.length;
C<A;
C++){var B=E[C];
if(B.inputElem!=null){OpenLayers.Event.stopObservingElement(B.inputElem)
}if(B.labelSpan!=null){OpenLayers.Event.stopObservingElement(B.labelSpan)
}}}this[D+"LayersDiv"].innerHTML="";
this[D+"Layers"]=[];
this.groups.groupDivs={}
},redraw:function(){if(!this.checkRedraw()&&!this.wmsRedraw){return this.div
}this.wmsRedraw=false;
this.clearLayersArray("base");
this.clearLayersArray("data");
var F=false;
var K=false;
var R;
var S;
this.layerStates=[];
for(R=0;
R<this.map.layers.length;
R++){S=this.map.layers[R];
this.layerStates[R]={name:S.name,visibility:S.visibility,inRange:S.inRange,id:S.id};
if(S.group&&!S.isBaseLayer){S.group=S.group.replace(/\/$/,"");
S.group=S.group.replace(/^\//,"");
this.createGroupDiv(S.group)
}if(S.CLASS_NAME=="MW.Layer.WMS"&&S.layers!=null){var A=S.layers;
for(var Q=0;
Q<A.length;
Q++){var S=A[Q];
if(S.group){S.group=S.group.replace(/\/$/,"");
S.group=S.group.replace(/^\//,"");
this.createGroupDiv(S.group)
}}}}var J=this.map.layers.slice();
var N=this.getWMSLayers();
for(var Q=0;
Q<N.length;
Q++){J.push(N[Q])
}if(!this.ascending){J.reverse()
}for(R=0;
R<J.length;
R++){S=J[R];
var E=S.isBaseLayer;
var P=null;
if(S.displayInLayerSwitcher){if(E){K=true
}else{F=true
}var I=(E)?(S==this.map.baseLayer):S.getVisibility();
var O=document.createElement("div");
var B="layerDiv"+(I?"Active":"Inactive");
var G=document.createElement("input");
if(S.logicalName!=null){S.name=S.logicalName
}G.id="input_"+S.name;
G.name=(E)?"baseLayers":S.name;
G.type=(E)?"radio":"checkbox";
G.value=S.name;
G.checked=I;
G.defaultChecked=I;
if(!E&&!S.inRange){G.disabled=true
}var C={inputElem:G,layer:S,layerSwitcher:this};
OpenLayers.Event.observe(G,"mouseup",OpenLayers.Function.bindAsEventListener(this.onInputClick,C));
var M=document.createElement("span");
if(!E&&!S.inRange){M.style.color="gray";
B="layerDivOutOfRange"
}M.innerHTML=S.name;
M.style.verticalAlign=(E)?"bottom":"baseline";
M.className="labelSpan";
OpenLayers.Event.observe(M,"click",OpenLayers.Function.bindAsEventListener(this.onInputClick,C));
O.className=B;
var D=(E)?this.baseLayers:this.dataLayers;
D.push({layer:S,inputElem:G,labelSpan:M});
if(!E){if(!S.group){P=this.dataLayersDiv
}else{var H=S.group;
var L=this.groups.groupDivs[H];
this.appendLayerToGroups(S);
P=L
}}else{P=this.baseLayersDiv
}O.appendChild(G);
O.appendChild(M);
if(S.buttonDropLayer===true){this.addDropLayerButton(S,O)
}if(S.buttonMoveLayer===true){this.addMoveLayerButton(S,O)
}if(S.buttonOpacity===true){this.addOpacityLayerButton(S,O)
}if(S.buttonZoomToExtent===true){this.addZoomToLayerExtentButton(S,O)
}P.appendChild(O)
}}this.dataLbl.style.display=(F)?"":"none";
this.baseLbl.style.display=(K)?"":"none";
this.layersDiv.style.height="";
if(this.layersDiv.offsetHeight>this.size.h){this.layersDiv.style.height=this.layersDiv.style.maxHeight
}return this.div
},getWMSLayers:function(){var B=[];
for(var A=0;
A<this.map.layers.length;
A++){if(this.map.layers[A].CLASS_NAME=="MW.Layer.WMS"&&this.map.layers[A].layers!=null&&(!this.map.layers[A].isBaseLayer)){for(var C=0;
C<this.map.layers[A].layers.length;
C++){this.map.layers[A].layers[C].WMSLayer=this.map.layers[A]
}this.map.layers[A].WMSSwitcher=this;
B=B.concat(this.map.layers[A].layers)
}}return B
},onInputClick:function(A){if(!this.inputElem.disabled){if(this.inputElem.type=="radio"){this.inputElem.checked=true;
if(this.layer.layerMinZoomLevelGraphicLayerUrl){this.layer.map.layerMinZoomLevelGraphicLayer.url=OpenLayers.ImgPath+this.layer.layerMinZoomLevelGraphicLayerUrl
}this.layer.map.setBaseLayer(this.layer);
if(this.layer.map.copyrightControl!=null){this.layer.map.copyrightControl.setUrl(this.layer.copyrightUrl,this.layer.copyrightTitle)
}if(this.layer.backgroundColor!=null){this.layer.map.viewPortDiv.style.backgroundColor=this.layer.backgroundColor
}else{this.layer.map.viewPortDiv.style.backgroundColor=null
}}else{this.inputElem.checked=!this.inputElem.checked;
this.layerSwitcher.updateMap()
}}this.layerSwitcher.map.events.triggerEvent("changelayer");
OpenLayers.Event.stop(A)
},onInputGroupClick:function(G){var C=!this.inputElem.checked;
var B=this.groupDiv.getElementsByTagName("input");
this.inputElem.checked=C;
this.layerSwitcher.groups.checked[this.inputElem.value]=C;
for(var E=0;
E<B.length;
E++){B[E].checked=C;
this.layerSwitcher.groups.checked[B[E].value]=C
}var A=null;
var H=this.layerSwitcher.dataLayers;
for(var D=0;
D<H.length;
D++){var F=H[D];
if(this.layerSwitcher.isInGroup(this.inputElem.value,F.layer)){F.inputElem.checked=C;
F.layer.setVisibility(C);
A=F.layer.WMSLayer;
if(!F.layer.calculateInRange()){F.layer.setVisibility(false)
}}}if(A!=null){A.redraw()
}this.layerSwitcher.updateMap();
this.layerSwitcher.map.events.triggerEvent("changelayer");
OpenLayers.Event.stop(G)
},onGroupClick:function(B){var A=this.layergroup;
var D=this.groups.groupDivs[A];
if(D){var C=(D.style.display!="block"?true:false);
this.layerswitcher.colapseGroup(A,C)
}this.layerswitcher.layersDiv.style.height="";
if(this.layerswitcher.layersDiv.offsetHeight>this.layerswitcher.size.h){this.layerswitcher.layersDiv.style.height=this.layerswitcher.layersDiv.style.maxHeight
}},colapseGroup:function(A,C){var B=this.groups.groupDivs[A];
if(B){B.style.display=(C===true?"block":"none");
this.groups.display[A]=B.style.display
}},updateMap:function(){var A;
var B;
for(A=0;
A<this.baseLayers.length;
A++){B=this.baseLayers[A];
if(B.inputElem.checked){this.map.setBaseLayer(B.layer,false)
}}for(A=0;
A<this.dataLayers.length;
A++){B=this.dataLayers[A];
B.layer.setVisibility(B.inputElem.checked);
if(B.layer.WMSLayer!=null){B.layer.WMSLayer.redraw();
this.wmsRedraw=true
}}this.redraw()
},createGroupDiv:function(D){var J=D.split("/");
var I=J[J.length-1];
var E=this.groups.groupDivs[D];
var G=document.createElement("div");
G.className="groupName";
if(!E){var A=this.groups.groupDivs[J.slice(0,J.length-2).join("/")];
if(!A){if(J.length==1){A=this.dataLayersDiv
}else{A=this.createGroupDiv(J.slice(0,J.length-1).join("/"))
}}E=document.createElement("div");
E.className="layerGroup";
if(!this.groups.display[D]){this.groups.display[D]="none"
}E.style.display=this.groups.display[D];
this.groups.groupDivs[D]=E;
var H=document.createElement("span");
H.className="groupLabel";
H.innerHTML=I;
OpenLayers.Event.observe(H,"mouseup",OpenLayers.Function.bindAsEventListener(this.onGroupClick,{layergroup:D,groups:this.groups,layerswitcher:this}));
var B=document.createElement("input");
B.id="input_"+J.join("_");
B.name=J.join("_");
B.type="checkbox";
B.value=D;
B.checked=false;
B.defaultChecked=false;
if(!this.groups.checked[D]){this.groups.checked[D]=false
}if(this.groups.layers[D]){this.groups.checked[D]=false;
for(var F=0;
F<this.groups.layers[D].length;
F++){if(this.groups.layers[D][F].getVisibility()==true){this.groups.checked[D]=true;
break
}}}B.checked=this.groups.checked[D];
B.defaultChecked=this.groups.checked[D];
if(!this.groups.layers[D]){this.groups.layers[D]=[]
}var C={groupDiv:E,layerSwitcher:this,inputElem:B};
OpenLayers.Event.observe(B,"mouseup",OpenLayers.Function.bindAsEventListener(this.onInputGroupClick,C));
G.appendChild(B);
G.appendChild(H);
A.appendChild(G);
A.appendChild(E)
}return this.groups.groupDivs[D]
},appendLayerToGroups:function(C){var A=C.group.split("/");
var D=null;
for(var B=1;
B<=A.length;
B++){D=A.slice(0,B).join("/");
if(!this.isInGroup(D,C)){this.groups.layers[D].push(C);
if(C.getVisibility()==true){this.groups.checked[D]=true
}}}},isInGroup:function(C,B){for(var A=0;
A<this.groups.layers[C].length;
A++){if(this.groups.layers[C][A].id==B.id&&this.groups.layers[C][A].logicalName==B.logicalName){return true
}}return false
},CLASS_NAME:"MW.Control.FloatingPanel.LayerSwitcher"});MW.Control.FloatingPanel.Legend=OpenLayers.Class(MW.Control.FloatingPanel,{imgWidth:50,initialize:function(A){MW.Control.FloatingPanel.prototype.initialize.apply(this,[A])
},destroy:function(){MW.Control.FloatingPanel.prototype.destroy.apply(this,arguments)
},setMap:function(A){OpenLayers.Control.prototype.setMap.apply(this,arguments);
this.map.events.register("addlayer",this,this.redraw);
this.map.events.register("changelayer",this,this.redraw);
this.map.events.register("removelayer",this,this.redraw)
},draw:function(){MW.Control.FloatingPanel.prototype.draw.apply(this,arguments);
this.childElement.className=this.displayClass;
var B=navigator.appVersion.split("MSIE");
var A=parseFloat(B[1]);
if(A<6.5){this.iframe=document.createElement("iframe");
this.iframe.className=this.displayClass+"iframe";
this.div.appendChild(this.iframe)
}this.legendDiv=document.createElement("div");
this.legendDiv.className="LegendDiv";
this.childElement.appendChild(this.legendDiv);
this.childElement.style.height="";
this.childElement.style.maxHeight=this.size.h+"px";
this.legendDiv.style.overflow="auto";
this.legendDiv.style.maxHeight=this.size.h+"px";
this.redraw();
return this.div
},redraw:function(){this.legendDiv.innerHTML="";
this.legendDiv.style.height="";
if(this.map==null){return 
}var D;
for(D=0;
D<this.map.layers.length;
D++){layer=this.map.layers[D];
if(layer.layers!=null){for(var H=0;
H<layer.layers.length;
H++){var F=layer.layers[H];
if(F.CLASS_NAME=="MW.WMSLayer"&&F.legendUrl!=null&&F.legendUrl!=""&&F.visibility&&F.displayInLayerSwitcher){var G=document.createElement("div");
G.className="line";
this.legendDiv.appendChild(G);
var B=document.createElement("div");
B.className="left";
G.appendChild(B);
var C=document.createElement("img");
C.src=F.legendUrl;
if(C.src.match("getlegendgraphic")&&B.offsetWidth!=0){C.src+="&WIDTH="+B.offsetWidth
}else{if(C.src.match("getlegendgraphic")){C.src+="&WIDTH="+this.imgWidth
}}B.appendChild(C);
if(F.legendName==true){var A=document.createElement("div");
A.className="right";
G.appendChild(A);
var E=document.createElement("span");
E.innerHTML=F.logicalName;
A.appendChild(E)
}else{B.style.width="100%"
}}}}if(!layer.isBaseLayer&&layer.displayInLayerSwitcher&&layer.visibility){var G=document.createElement("div");
G.className="line";
this.legendDiv.appendChild(G);
var B=document.createElement("div");
B.className="left";
G.appendChild(B);
var C=document.createElement("img");
C.src=layer.legendUrl;
if(C.src.match("getlegendgraphic")){C.src+="&WIDTH="+B.offsetWidth
}C.style.width="100%";
B.appendChild(C);
var A=document.createElement("div");
A.className="right";
G.appendChild(A);
var E=document.createElement("span");
E.innerHTML=layer.name;
A.appendChild(E)
}}if(this.size!=null&&this.size.h!=null){if(this.legendDiv.offsetHeight>this.size.h){this.legendDiv.style.height=this.legendDiv.style.maxHeight
}}},toggleChild:function(){MW.Control.FloatingPanel.prototype.toggleChild.apply(this,arguments);
if(document.getElementById(this.childElement.id)!=null){this.redraw()
}},CLASS_NAME:"MW.Control.FloatingPanel.Legend"});NONE=0;
LOCATION_LOADED=1;
UNKNOWN_LOCATION=11;
SERVER_ERROR=13;
MW.Control.OpenLS.Geocoding=OpenLayers.Class(MW.Control.OpenLS,{id:null,div:null,geocodeUrl:null,geocodePars:"serviceName=geocode&methodType=ejb&actionName=geocode&xmlRequest=",namespace_uri_openls:"http://www.opengis.net/xls",namespace_prefix_openls:"xls",namespace_uri_gml:"http://www.opengis.net/gml",namespace_prefix_gml:"gml",markersLayer:null,events:null,loading:null,EVENT_TYPES:["loadComplete","loadFailure"],fallThrough:false,status_code:null,iconUrl:"marker.png",iconSize:new OpenLayers.Size(21,25),popupSize:new OpenLayers.Size(200,130),initialize:function(A){OpenLayers.Control.prototype.initialize.apply(this,[A]);
this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");
this.markersLayer=new MW.Layer.Markers("GeocodedObject");
this.markersLayer.displayInLayerSwitcher=false;
this.events.register("loadComplete",this,this.stopLoading);
this.events.register("loadFailure",this,this.stopLoading)
},draw:function(){this.loading=new MW.Control.LoadingMessage();
if((this.map!=null)&&(this.loading!=null)){this.map.addControl(this.loading)
}if(this.div!=null){OpenLayers.Control.prototype.draw.apply(this,arguments);
this.div.className="MWControlGeocode";
this.divinput=document.createElement("div");
this.divinput.id="input";
this.divinput.className="input";
this.div.appendChild(this.divinput);
this.span=document.createElement("span");
this.divinput.appendChild(this.span);
this.span.innerHTML="Indirizzo";
this.input=document.createElement("input");
this.input.id="address";
this.input.style.marginLeft="5px";
this.divinput.appendChild(this.input);
this.divVai=document.createElement("input");
this.divVai.className="inputButton";
this.divVai.value="Cerca";
this.divVai.type="button";
this.divVai.scr=OpenLayers.ImgPath+"submit.gif";
this.divVai.title="Avvia la ricerca";
this.divinput.appendChild(this.divVai);
OpenLayers.Event.observe(this.divVai,"click",this.invokeGeocode.bind(this));
this.divbr=document.createElement("br");
this.div.appendChild(this.divbr);
this.divpanel=document.createElement("div");
this.divpanel.id="panel";
this.divpanel.className="panel";
this.div.appendChild(this.divpanel)
}return this.div
},stopLoading:function(){if(this.map!=null&&this.loading!=null){this.loading.stopLoad()
}},destroy:function(){if(this.map!=null){if(this.markersLayer!=null){this.map.removeLayer(this.markersLayer,true);
this.markersLayer=null
}}this.map=null;
this.div=null;
if(this.events){this.events.destroy()
}this.events=null;
OpenLayers.Control.prototype.destroy.apply(this,arguments)
},invokeGeocode:function(B){if(this.div!=null){if(this.input!=null){var A=this.input.value;
this.loadGeocode(A)
}}},loadGeocode:function(A){this.reset();
if(this.div!=null){this.divpanel.style.display="none";
this.divpanel.innerHTML=""
}if(A==null||A==""){alert("Inserire l'indirizzo.");
return 
}var F=this.successGeocode.bind(this);
var C=this.failureGeocode.bind(this);
var E=this.createGeocodeRequest(A);
var B=this.geocodePars+E;
this.status_code=NONE;
var D=this.geocodeUrl;
if(MW.Proxy&&this.geocodeUrl.startsWith("http")){D=MW.Proxy+MW.Util.escapeUri(this.geocodeUrl)
}if(this.map!=null){this.loading.startLoad();
if(this.map.getLayer(this.markersLayer.id)==null){this.markersLayer.displayInLayerSwitcher=false;
this.map.addLayer(this.markersLayer)
}}OpenLayers.Console.debug("Ajax request url: "+D+B);
new OpenLayers.Ajax.Request(D+B,{method:"get",parameters:null,onComplete:F,onFailure:C})
},setGeocodePanel:function(A){this.div=A
},successGeocode:function(F){this.status_code=UNKNOWN_LOCATION;
if(F.responseXML==null&&F.responseText==null){return 
}var A=F.responseXML;
if(!A||F.fileType!="XML"){A=OpenLayers.parseXMLString(F.responseText)
}var U=OpenLayers.Ajax.getElementsByTagNameNS(A,this.namespace_uri_openls,this.namespace_prefix_openls,"GeocodedAddress");
if(U!=null){if(U.length>0){for(i=0;
i<U.length;
i++){var R=null;
var P=null;
var J=null;
var G=null;
var B=null;
var V=null;
var N=U[i];
var E=OpenLayers.Ajax.getElementsByTagNameNS(N,this.namespace_uri_gml,this.namespace_prefix_gml,"Point");
if(E!=null&&E.length>0){var L=E[0];
var I=OpenLayers.Ajax.getElementsByTagNameNS(L,this.namespace_uri_gml,this.namespace_prefix_gml,"pos")[0];
if(I!=null){if(I.firstChild!=null){var K=I.firstChild.nodeValue;
if(K!=""){var M=K.indexOf(" ");
R=(new Number(K.substring(0,M))).valueOf();
P=(new Number(K.substring(M+1))).valueOf()
}}}}var Q=OpenLayers.Ajax.getElementsByTagNameNS(N,this.namespace_uri_openls,this.namespace_prefix_openls,"Address");
if(Q!=null){var H=Q[0];
if(H!=null){var T=OpenLayers.Ajax.getElementsByTagNameNS(H,this.namespace_uri_openls,this.namespace_prefix_openls,"StreetAddress")[0];
if(T!=null){var O=OpenLayers.Ajax.getElementsByTagNameNS(T,this.namespace_uri_openls,this.namespace_prefix_openls,"Street")[0];
var C=OpenLayers.Ajax.getElementsByTagNameNS(T,this.namespace_uri_openls,this.namespace_prefix_openls,"_StreetLocation")[0];
if(O!=null){J=O.getAttribute("officialName");
B="";
if(C!=null){B=C.getAttribute("number");
V=C.getAttribute("subdivision")
}}}var S=OpenLayers.Ajax.getElementsByTagNameNS(H,this.namespace_uri_openls,this.namespace_prefix_openls,"freeFormAddress")[0];
if(S!=null&&S.firstChild!=null){G=S.firstChild.nodeValue
}}}if(((J!=null&&J!="")||(G!=null&&G!=""))&&R!=null&&P!=null&&R!=""&&P!=""){this.status_code=LOCATION_LOADED;
if(U.length==1){if(J!=null&&J!=""){this.setLocalita(new OpenLayers.LonLat(R,P),J,B,V)
}else{if(G!=null&&G!=""){this.setLocalita(new OpenLayers.LonLat(R,P),G,B,V)
}}}else{if(this.div!=null){this.divHref=document.createElement("a");
this.divHref.href="#";
this.divHref.innerHTML=J;
if(B!=null&&B!=""){this.divHref.innerHTML=this.divHref.innerHTML+" "+B;
if(V!=null&&V!=""){this.divHref.innerHTML=this.divHref.innerHTML+"/"+V
}}this.divpanel.style.display="block";
this.divpanel.appendChild(this.divHref);
this.br=document.createElement("br");
this.divpanel.appendChild(this.br);
if(J!=null&&J!=""){var D={lonlat:new OpenLayers.LonLat(R,P),officialName:J,number:B,subciv:V,geocodeObject:this};
OpenLayers.Event.observe(this.divHref,"click",this.submitLocalita.bindAsEventListener(D))
}else{if(G!=null&&G!=""){var D={lonlat:new OpenLayers.LonLat(R,P),officialName:G,number:B,subciv:V,geocodeObject:this};
OpenLayers.Event.observe(this.divHref,"click",this.submitLocalita.bindAsEventListener(D))
}}}}}}}}if(this.status_code>10){if(this.div!=null){this.divpanel.style.display="block";
this.divpanel.innerHTML="Indirizzo non trovato."
}this.events.triggerEvent("loadFailure")
}else{this.events.triggerEvent("loadComplete")
}},failureGeocode:function(A){if(this.div!=null){this.divpanel.style.display="block";
this.divpanel.innerHTML="Si ï¿½ verificato un errore nel servizio."
}this.status_code=SERVER_ERROR;
this.events.triggerEvent("loadFailure");
return 
},submitLocalita:function(B){var E=this.lonlat;
var C=this.officialName;
var D=this.number;
var A=this.subciv;
var F="</br>Indirizzo:</br>"+C;
if(D!=null&&D!=""){F+=", "+D;
if(A!=null&&A!=""){F+="/"+A
}}this.geocodeObject.loadGeocodes(E,F)
},setLocalita:function(D,B,C,A){var E="</br>Indirizzo:</br>"+B;
if(C!=null&&C!=""){E+=", "+C;
if(A!=null&&A!=""){E+="/"+A
}}this.loadGeocodes(D,E)
},loadGeocodes:function(F,H){AutoSizeFramedCloud=OpenLayers.Class(OpenLayers.Popup.FramedCloud,{autoSize:true,minSize:this.popupSize});
popupClass=AutoSizeFramedCloud;
popupContentHTML=H;
var D=new OpenLayers.Feature(this.markersLayer,F);
D.closeBox=true;
D.popupClass=popupClass;
D.data.popupContentHTML=popupContentHTML;
D.data.overflow="hidden";
var G=new OpenLayers.Pixel(-(this.iconSize.w/2),-this.iconSize.h);
var B={lonlat:F,iconUrl:OpenLayers.ImgPath+this.iconUrl,iconSize:this.iconSize,title:"Indirizzo"};
var A=new MW.Marker(B);
this.markersLayer.addMarker(A);
if(A.popup==null){A.createPopup(H,true)
}A.popup.show();
var C=function(I){this.popup.toggle();
OpenLayers.Event.stop(I)
};
A.events.register("click",D,C);
A.events.register("dblclick",D,this.stopevent);
A.events.register("mousedown",D,this.stopevent);
var E=new OpenLayers.Bounds(F.lon,F.lat,F.lon,F.lat);
this.map.zoomToExtent(E)
},stopevent:function(A){OpenLayers.Event.stop(A,true)
},createGeocodeRequest:function(A){var B='<?xml version="1.0" encoding="UTF-8"?><GeocodeRequest xmlns="http://www.opengis.net/xls" xmlns:gml="http://www.opengis.net/gml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><Address countryCode="IT"><freeFormAddress>'+A+"</freeFormAddress></Address></GeocodeRequest>";
return B
},reset:function(){this.markersLayer.clearMarkers();
this.status_code=NONE
},getStatusCode:function(){return this.status_code
},CLASS_NAME:"MW.Control.OpenLS.Geocoding"});NONE=0;
LOCATION_LOADED=1;
UNKNOWN_LOCATION=11;
SERVER_ERROR=13;
MW.Control.OpenLS.ReverseGeocoding=OpenLayers.Class(MW.Control.OpenLS,{type:OpenLayers.Control.TYPE_TOGGLE,id:null,div:null,reverseGeocodeUrl:null,reverseGeocodePars:"actionName=ReverseGeocode&serviceName=reversegeocode&xmlRequest=",namespace_uri_openls:"http://www.opengis.net/xls",namespace_prefix_openls:"xls",namespace_uri_gml:"http://www.opengis.net/gml",namespace_prefix_gml:"gml",markersLayer:null,events:null,loading:null,EVENT_TYPES:["loadComplete","loadFailure"],fallThrough:false,status_code:null,iconUrl:"marker.png",iconSize:new OpenLayers.Size(21,25),popupSize:new OpenLayers.Size(200,130),defaultHandlerOptions:{single:true,"double":false,pixelTolerance:0,stopSingle:false,stopDouble:false},lonlat:null,srs:"EPSG:3003",initialize:function(A){this.handlerOptions=OpenLayers.Util.extend({},this.defaultHandlerOptions);
OpenLayers.Control.prototype.initialize.apply(this,[A]);
this.handler=new OpenLayers.Handler.Click(this,{click:this.onClick},this.handlerOptions);
this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");
this.markersLayer=new MW.Layer.Markers("GeocodedObject");
this.markersLayer.displayInLayerSwitcher=false;
this.events=new OpenLayers.Events(this,this,this.EVENT_TYPES,this.fallThrough);
this.events.register("loadComplete",this,this.stopLoading);
this.events.register("loadFailure",this,this.stopLoading)
},onClick:function(B){var A=this.map.getLonLatFromPixel(B.xy);
this.lonlat=A;
this.loadReverseGeocode(A)
},draw:function(){this.loading=new MW.Control.LoadingMessage();
if((this.map!=null)&&(this.loading!=null)){this.map.addControl(this.loading)
}if(this.div!=null){OpenLayers.Control.prototype.draw.apply(this,arguments);
this.div.className="MWControlReverseGeocode";
this.divpanel=document.createElement("div");
this.divpanel.id="panel";
this.divpanel.className="panel";
this.div.appendChild(this.divpanel)
}return this.div
},stopLoading:function(){if(this.map!=null&&this.loading!=null){this.loading.stopLoad()
}},destroy:function(){if(this.map!=null){if(this.markersLayer!=null){this.map.removeLayer(this.markersLayer,true);
this.markersLayer=null
}}this.map=null;
this.div=null;
if(this.events){this.events.destroy()
}this.events=null;
OpenLayers.Control.prototype.destroy.apply(this,arguments)
},loadReverseGeocode:function(E){this.reset();
if(this.div!=null){this.divpanel.style.display="none";
this.divpanel.innerHTML=""
}if(E==null||E.lon==null||E.lat==null){alert("Cliccare  un punto sulla mappa.");
return 
}var A=this.successReverseGeocode.bind(this);
var B=this.failureReverseGeocode.bind(this);
var F=this.createReverseGeocodeRequest(E);
var C=this.reverseGeocodePars+F;
var D=this.reverseGeocodeUrl;
if(MW.Proxy&&this.reverseGeocodeUrl.startsWith("http")){D=MW.Proxy+MW.Util.escapeUri(this.reverseGeocodeUrl)
}if(this.map!=null){this.loading.startLoad();
if(this.map.getLayer(this.markersLayer.id)==null){this.markersLayer.displayInLayerSwitcher=false;
this.map.addLayer(this.markersLayer)
}}OpenLayers.Console.debug("Ajax request url: "+D+C);
new OpenLayers.Ajax.Request(D+C,{method:"get",parameters:null,onComplete:A,onFailure:B})
},setReverseGeocodePanel:function(A){this.div=A
},successReverseGeocode:function(F){this.status_code=UNKNOWN_LOCATION;
if(F.responseXML==null&&F.responseText==null){return 
}var A=F.responseXML;
if(!A||F.fileType!="XML"){A=OpenLayers.parseXMLString(F.responseText)
}var U=OpenLayers.Ajax.getElementsByTagNameNS(A,this.namespace_uri_openls,this.namespace_prefix_openls,"ReverseGeocodedLocation");
if(U!=null){if(U.length>0){for(i=0;
i<U.length;
i++){var Q=null;
var P=null;
var J=null;
var G=null;
var B=null;
var V=null;
var T=U[i];
var E=OpenLayers.Ajax.getElementsByTagNameNS(T,this.namespace_uri_gml,this.namespace_prefix_gml,"Point");
if(E!=null&&E.length>0){var L=E[0];
var I=OpenLayers.Ajax.getElementsByTagNameNS(L,this.namespace_uri_gml,this.namespace_prefix_gml,"pos")[0];
if(I!=null){if(I.firstChild!=null){var K=I.firstChild.nodeValue;
if(K!=""){var M=K.indexOf(" ");
Q=(new Number(K.substring(0,M))).valueOf();
P=(new Number(K.substring(M+1))).valueOf()
}}}}var N=OpenLayers.Ajax.getElementsByTagNameNS(T,this.namespace_uri_openls,this.namespace_prefix_openls,"Address");
if(N!=null){var H=N[0];
if(H!=null){var S=OpenLayers.Ajax.getElementsByTagNameNS(H,this.namespace_uri_openls,this.namespace_prefix_openls,"StreetAddress")[0];
if(S!=null){var O=OpenLayers.Ajax.getElementsByTagNameNS(S,this.namespace_uri_openls,this.namespace_prefix_openls,"Street")[0];
var C=OpenLayers.Ajax.getElementsByTagNameNS(S,this.namespace_uri_openls,this.namespace_prefix_openls,"_StreetLocation")[0];
if(O!=null){J=O.getAttribute("officialName");
B="";
if(C!=null){B=C.getAttribute("number");
V=C.getAttribute("subdivision")
}}}var R=OpenLayers.Ajax.getElementsByTagNameNS(H,this.namespace_uri_openls,this.namespace_prefix_openls,"freeFormAddress")[0];
if(R!=null&&R.firstChild!=null){G=R.firstChild.nodeValue
}}}if(((J!=null&&J!="")||(G!=null&&G!=""))&&Q!=null&&P!=null&&Q!=""&&P!=""){this.status_code=LOCATION_LOADED;
if(U.length==1){if(J!=null&&J!=""){this.setLocalita(new OpenLayers.LonLat(Q,P),J,B,V)
}else{if(G!=null&&G!=""){this.setLocalita(this.lonlat,G,B,V)
}}}else{if(this.div!=null){this.divHref=document.createElement("a");
this.divHref.href="#";
this.divHref.innerHTML=J;
if(B!=null&&B!=""){this.divHref.innerHTML=this.divHref.innerHTML+" "+B;
if(V!=null&&V!=""){this.divHref.innerHTML=this.divHref.innerHTML+"/"+V
}}this.divpanel.style.display="block";
this.divpanel.appendChild(this.divHref);
this.br=document.createElement("br");
this.divpanel.appendChild(this.br);
if(J!=null&&J!=""){var D={lonlat:new OpenLayers.LonLat(Q,P),officialName:J,number:B,subciv:V,reverseGeocodeObject:this};
OpenLayers.Event.observe(this.divHref,"click",this.submitLocalita.bindAsEventListener(D))
}else{if(G!=null&&G!=""){var D={lonlat:this.lonlat,officialName:G,number:B,subciv:V,reverseGeocodeObject:this};
OpenLayers.Event.observe(this.divHref,"click",this.submitLocalita.bindAsEventListener(D))
}}}}}}}}if(this.status_code>10){if(this.div!=null){this.divpanel.style.display="block";
this.divpanel.innerHTML="Indirizzo non trovato."
}this.events.triggerEvent("loadFailure")
}else{this.events.triggerEvent("loadComplete")
}},failureReverseGeocode:function(A){if(this.div!=null){this.divpanel.style.display="block";
this.divpanel.innerHTML="Si ï¿½ verificato un errore nel servizio."
}this.status_code=SERVER_ERROR;
this.events.triggerEvent("loadFailure");
return 
},submitLocalita:function(B){var E=this.lonlat;
var C=this.officialName;
var D=this.number;
var A=this.subciv;
var F="</br>Indirizzo:</br>"+C;
if(D!=null&&D!=""){F+=", "+D;
if(A!=null&&A!=""){F+="/"+A
}}this.reverseGeocodeObject.loadGeocodes(E,F)
},setLocalita:function(D,B,C,A){var E="</br>Indirizzo:</br>"+B;
if(C!=null&&C!=""){E+=", "+C;
if(A!=null&&A!=""){E+="/"+A
}}this.loadGeocodes(D,E)
},loadGeocodes:function(E,G){AutoSizeFramedCloud=OpenLayers.Class(OpenLayers.Popup.FramedCloud,{autoSize:true,minSize:this.popupSize});
popupClass=AutoSizeFramedCloud;
popupContentHTML=G;
var C=new OpenLayers.Feature(this.markersLayer,E);
C.closeBox=true;
C.popupClass=popupClass;
C.data.popupContentHTML=popupContentHTML;
C.data.overflow="hidden";
var F=new OpenLayers.Pixel(-(this.iconSize.w/2),-this.iconSize.h);
var D=new OpenLayers.Icon(OpenLayers.ImgPath+this.iconUrl,this.iconSize,F);
C.data.icon=D;
var A=C.createMarker();
this.markersLayer.addMarker(A);
if(A.popup==null){A.popup=C.createPopup(C.closeBox);
this.map.addPopup(A.popup)
}A.popup.show();
var B=function(H){this.popup.toggle();
OpenLayers.Event.stop(H)
};
A.events.register("click",C,B);
A.events.register("dblclick",C,this.stopevent);
A.events.register("mousedown",C,this.stopevent)
},calculateBounds:function(C){var B=null;
if(B==null){B=this.map.getExtent()
}if(!B.containsLonLat(C)){}if(C.lat+(this.iconSize.h*this.map.getResolution())>=B.top){var A=(this.iconSize.h*this.map.getResolution());
B=B.add(0,A)
}if(C.lat-(this.iconSize.h*this.map.getResolution())<=B.bottom){var A=(this.iconSize.h*this.map.getResolution());
B=B.add(0,-A)
}return B
},stopevent:function(A){OpenLayers.Event.stop(A,true)
},createReverseGeocodeRequest:function(B){var A='<?xml version="1.0" encoding="UTF-8"?><xls:ReverseGeocodeRequest xsi:schemaLocation="http://www.opengis.net/xls LocationUtilityService.xsd" xmlns:gml="http://www.opengis.net/gml" xmlns:xls="http://www.opengis.net/xls" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><xls:Position><gml:Point srsName="'+this.srs+'"><gml:pos>'+B.lon+" "+B.lat+"</gml:pos></gml:Point></xls:Position></xls:ReverseGeocodeRequest>";
return A
},reset:function(){if(this.markersLayer!=null){this.markersLayer.clearMarkers()
}this.status_code=NONE
},getStatusCode:function(){return this.status_code
},CLASS_NAME:"MW.Control.OpenLS.ReverseGeocoding"});MW.Control.Aci.FindVisura=OpenLayers.Class(MW.Control.Aci,{visure:[{nomeLogico:"Civici",findVisuraPars:"servizio=VisuraCivicoService&richiesta="},{nomeLogico:"Vie",findVisuraPars:"servizio=VisuraViaService&richiesta="},{nomeLogico:"Edifici",findVisuraPars:"servizio=VisuraEdificioService&richiesta="},{nomeLogico:"EdificiARCXML",findVisuraPars:"servizio=VisuraEdificioService&richiesta="},{nomeLogico:"Lotti",findVisuraPars:"servizio=VisuraLottoService&richiesta="}],findVisuraPars:null,geometry:null,initialize:function(A){MW.Control.Aci.prototype.initialize.apply(this,[A]);
if(this.xslPath!=null&&this.xslPath!=""){var B=this.successXsl.bind(this);
var C=this.failureXsl.bind(this);
new OpenLayers.Ajax.Request(this.xslPath,{method:"get",parameters:null,onComplete:B,onFailure:C})
}},successXsl:function(A){this.xsl=A.responseXML
},failureXsl:function(A){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Impossibile caricare l'xsl"
}this.findResult="Impossibile caricare l'xsl";
this.events.triggerEvent("loadFailure");
return 
},draw:function(){this.loading=new MW.Control.LoadingMessage();
if((this.map!=null)&&(this.loading!=null)){this.map.addControl(this.loading)
}},destroy:function(){if(this.map!=null){if(this.markersLayer!=null){this.map.removeLayer(this.markersLayer,true);
this.markersLayer=null
}}this.map=null;
this.div=null;
if(this.events){this.events.destroy()
}this.events=null;
OpenLayers.Control.prototype.destroy.apply(this,arguments)
},submitVisura:function(A){if(this.visura!=null){this.visura.loadVisura(this.ente,this.idStadioImmobile,this.layer)
}},loadVisura:function(H,I,D){this.reset();
this.ente=H;
this.idStadioImmobile=I;
if(this.diverrore!=null){this.diverrore.style.display="none";
this.spanerrore.innerHTML=""
}if(H==""||H==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca informazione sull'ente"
}this.findResult="Manca informazione sull'ente";
this.events.triggerEvent("loadFailure");
return 
}if(I==""||I==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca informazione sull'id dell'oggetto"
}this.findResult="Manca informazione sull'id dell'oggetto";
this.events.triggerEvent("loadFailure");
return 
}if(D!=""&&D!=null){this.findVisuraPars=null;
for(i=0;
i<this.visure.length;
i++){var E=this.visure[i];
if(E.nomeLogico==D){this.findVisuraPars=E.findVisuraPars;
break
}}}if(this.findVisuraPars==""||this.findVisuraPars==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca informazione sul servizio visura da invocare"
}this.findResult="Manca informazione sul servizio visura da invocare";
this.events.triggerEvent("loadFailure");
return 
}var G=this.successVisura.bind(this);
var C=this.failureVisura.bind(this);
var A=this.createFindVisuraRequest(H,I);
var F=this.findVisuraPars+A;
var B=this.findUrl;
if(MW.Proxy&&this.findUrl.startsWith("http")){B=MW.Proxy+MW.Util.escapeUri(this.findUrl)
}if(this.map!=null){this.loading.startLoad();
if(this.map.getLayer(this.markersLayer.id)==null){this.markersLayer.displayInLayerSwitcher=false;
this.map.addLayer(this.markersLayer)
}}OpenLayers.Console.debug("Ajax request url: "+B+F);
new OpenLayers.Ajax.Request(B+F,{method:"post",parameters:null,onComplete:G,onFailure:C})
},successVisura:function(C){if(C.responseXML==null&&C.responseText==null){return 
}var B=C.responseXML;
if(!B||C.fileType!="XML"){B=OpenLayers.parseXMLString(C.responseText)
}var D=B.getElementsByTagName("ErroreVisuraImmobili");
if(D!=null&&D[0]!=null&&D.length>0){var A=D[0];
var I=A.getElementsByTagName("FormatoRichiestaErrato")[0];
var F=A.getElementsByTagName("RicercaFallita")[0];
var J=A.getElementsByTagName("ErroreSistema")[0];
if(I!=null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Formato richiesta errato"
}this.findResult="Formato richiesta errato";
this.events.triggerEvent("loadFailure");
return 
}if(F!=null){if(this.diverrore!=null){this.diverrore.style.display="block";
if(F.firstChild!=null&&F.firstChild.nodeValue!=""){this.spanerrore.innerHTML=F.firstChild.nodeValue
}else{this.spanerrore.innerHTML="Nessun dato trovato con i criteri impostati"
}}if(F.firstChild!=null&&F.firstChild.nodeValue!=""){this.findResult=F.firstChild.nodeValue
}else{this.findResult="Nessun dato trovato con i criteri impostati"
}this.events.triggerEvent("loadFailure");
return 
}if(J!=null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML=J.getElementsByTagName("Descrizione")[0].firstChild.nodeValue
}this.findResult=J.getElementsByTagName("Descrizione")[0].firstChild.nodeValue;
this.events.triggerEvent("loadFailure");
return 
}}if(B.getElementsByTagName("GeometriaWKT")!=null&&B.getElementsByTagName("GeometriaWKT")[0]!=null&&B.getElementsByTagName("GeometriaWKT")[0].firstChild!=null){this.geometry=B.getElementsByTagName("GeometriaWKT")[0].firstChild.nodeValue
}if(this.xsl!=null){var G=C.responseText;
var E=MW.transformXml(G,this.xsl);
E=E.replace(/&lt;/g,"<");
E=E.replace(/&gt;/g,">");
this.htmlDetail=E;
if(this.divDetail!=null){this.divDetail.style.display="block";
this.divDetail.innerHTML=E
}else{if(this.urlDetail!=null){var H=window.open(this.urlDetail);
H.focus();
var K=document.createElement("div");
K.innerHTML=E;
H.document.body.appendChild(K)
}}}this.findResult="VISURA LOADED";
this.events.triggerEvent("loadComplete")
},failureVisura:function(A){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Errore di sistema"
}this.findResult="Errore di sistema";
this.events.triggerEvent("loadFailure");
return 
},createFindVisuraRequest:function(A,B){var C='<?xml version="1.0" encoding="UTF-8"?><RichiestaVisuraImmobili xmlns="http://elisa.it/aci" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><IdEnte>'+A+"</IdEnte><IdAssolutoStadioImmobile>"+B+"</IdAssolutoStadioImmobile></RichiestaVisuraImmobili>";
return C
},reset:function(){this.ente=null;
this.idStadioImmobile=null;
this.findResult=null;
if(this.divDetail!=null){this.divDetail.style.display="none";
this.divDetail.innerHTML=""
}this.htmlDetail=null
},CLASS_NAME:"MW.Control.Aci.FindVisura"});MW.Control.Aci.FindGeocoding=OpenLayers.Class(MW.Control.Aci,{geocodeUrl:null,geocodePars:"serviceName=geocode&methodType=ejb&actionName=geocode&xmlRequest=",findAddressPars:"servizio=RicercaViaService&richiesta=",findCivicoPars:"servizio=RicercaCivicoService&richiesta=",findVisuraStreetPars:"servizio=VisuraViaService&richiesta=",idStadioImmobileVia:null,idStadioImmobileCivico:null,lonlatCivico:null,lonlatVia:null,namespace_uri_openls:"http://www.opengis.net/xls",namespace_prefix_openls:"xls",detailStreet:false,initialize:function(A){MW.Control.Aci.prototype.initialize.apply(this,[A])
},loadObjectFromVia:function(I,F,J,G,D){this.reset();
this.sezione=null;
this.foglio=null;
this.mappale=null;
this.sub=null;
this.address=null;
this.ente=I;
this.via=J;
this.tipovia=F;
this.numero=G;
this.esponente=D;
if(this.diverrore!=null){this.diverrore.style.display="none";
this.spanerrore.innerHTML=""
}if(this.divPanel!=null){this.divPanel.style.display="none";
this.divPanel.innerHTML=""
}if(I==""||I==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca informazione sull'ente"
}this.findResult="Manca informazione sull'ente";
this.events.triggerEvent("loadFailure");
return 
}if(J==""||J==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca informazione sulla via"
}this.findResult="Manca informazione sulla via";
this.events.triggerEvent("loadFailure");
return 
}if(G==""||G==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca informazione sul numero civico"
}this.findResult="Manca informazione sul numero civico";
this.events.triggerEvent("loadFailure");
return 
}var A=this.successVia.bind(this);
var E=this.failureVia.bind(this);
var B=this.createFindViaRequest(I,F,J);
var H=this.findAddressPars+B;
var C=this.findUrl;
if(MW.Proxy&&this.findUrl.startsWith("http")){C=MW.Proxy+MW.Util.escapeUri(this.findUrl)
}if(this.map!=null){this.loading.startLoad();
if(this.map.getLayer(this.markersLayer.id)==null){this.markersLayer.displayInLayerSwitcher=false;
this.map.addLayer(this.markersLayer)
}}OpenLayers.Console.debug("Ajax request url: "+C);
new OpenLayers.Ajax.Request(C+H,{method:"post",parameters:null,onComplete:A,onFailure:E})
},successVia:function(F){if(F.responseXML==null&&F.responseText==null){return 
}var B=F.responseXML;
if(!B||F.fileType!="XML"){B=OpenLayers.parseXMLString(F.responseText)
}var J=B.getElementsByTagName("ErroreRicercaImmobili");
if(J!=null&&J[0]!=null&&J.length>0){var L=J[0];
var H=L.getElementsByTagName("FormatoRichiestaErrato")[0];
var I=L.getElementsByTagName("RicercaFallita")[0];
var P=L.getElementsByTagName("ParametriNonSelettivi")[0];
var C=L.getElementsByTagName("ErroreSistema")[0];
if(H!=null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Formato richiesta errato nella ricerca della via"
}this.findResult="Formato richiesta errato nella ricerca della via";
this.events.triggerEvent("loadFailure");
return 
}if(I!=null){if(this.diverrore!=null){this.diverrore.style.display="block";
if(I.firstChild!=null&&I.firstChild.nodeValue!=""){this.spanerrore.innerHTML=I.firstChild.nodeValue
}else{this.spanerrore.innerHTML="Nessun dato trovato con i criteri impostati"
}}if(I.firstChild!=null&&I.firstChild.nodeValue!=""){this.findResult=I.firstChild.nodeValue
}else{this.findResult="Nessun dato trovato con i criteri impostati"
}this.events.triggerEvent("loadFailure");
return 
}if(P!=null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML=P.firstChild.nodeValue
}this.findResult=P.firstChild.nodeValue;
this.events.triggerEvent("loadFailure");
return 
}if(C!=null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML=C.getElementsByTagName("Descrizione")[0].firstChild.nodeValue
}this.findResult=C.getElementsByTagName("Descrizione")[0].firstChild.nodeValue;
this.events.triggerEvent("loadFailure");
return 
}}var K=B.getElementsByTagName("Identificativi");
if(K==null||K.length==0){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Via non trovata"
}this.findResult="Via non trovata";
this.events.triggerEvent("loadFailure");
return 
}if(K!=null){if(K.length>0){for(i=0;
i<K.length;
i++){var O=K[i];
var N=null;
var G=null;
var S=null;
var Q=B.getElementsByTagName("InfoSinteticheStadioVia")[i];
if(Q!=null){var R=Q.getElementsByTagName("NomeToponimo")[0];
if(R!=null&&R.firstChild!=null&&R.firstChild.nodeValue!=""){G=R.firstChild.nodeValue
}var D=Q.getElementsByTagName("TipoToponimo")[0];
var M=null;
if(D!=null){M=D.getAttribute("Descrizione");
if(M!=null&&M!=""){S=M
}}}var A=O.getElementsByTagName("IdAssolutoStadioImmobile");
if(A!=null&&A[0]!=null&&A[0].firstChild.nodeValue!=""&&A[0].firstChild.nodeValue!=null){N=A[0].firstChild.nodeValue
}if(K.length==1){if(N==null||N==""){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Via non trovata"
}this.findResult="Via non trovata";
this.events.triggerEvent("loadFailure");
return 
}this.idStadioImmobileVia=N;
if(G!=null&&G!=""){this.via=G
}if(S!=null&&S!=""){this.tipovia=S
}this.loadObjectFromCivico(this.ente,this.idStadioImmobileVia,this.numero,this.esponente);
return 
}else{if(this.divPanel!=null){this.divHref=document.createElement("a");
this.divHref.href="#";
if(G==null||G==""){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Via non trovata"
}this.findResult="Via non trovata";
this.events.triggerEvent("loadFailure");
return 
}this.divHref.innerHTML=G;
if(this.numero!=null&&this.numero!=""){this.divHref.innerHTML=this.divHref.innerHTML+" "+this.numero;
if(this.esponente!=null&&this.esponente!=""){this.divHref.innerHTML=this.divHref.innerHTML+"/"+this.esponente
}}this.divPanel.style.display="block";
this.divPanel.appendChild(this.divHref);
this.br=document.createElement("br");
this.divPanel.appendChild(this.br);
var E={idStadioImmobileVia:N,nomevia:G,tipovia:S,geocodeObject:this};
OpenLayers.Event.observe(this.divHref,"click",this.submitVia.bindAsEventListener(E))
}}}}}this.findResult="ADDRESS LOADED";
this.events.triggerEvent("loadComplete")
},failureVia:function(A){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Errore di sistema"
}this.findResult="Errore di sistema";
this.events.triggerEvent("loadFailure");
return 
},submitVia:function(A){if(this.idStadioImmobileVia==null||thisidStadioImmobileVia==""){if(this.geocodeObject.diverrore!=null){this.geocodeObject.diverrore.style.display="block";
this.geocodeObject.spanerrore.innerHTML="Manca l'informazione sull'id della via"
}this.geocodeObject.findResult="Manca l'informazione sull'id della via";
this.geocodeObject.events.triggerEvent("loadFailure");
return 
}this.geocodeObject.idStadioImmobileVia=this.idStadioImmobileVia;
if(this.nomevia!=null&&this.nomevia!=""){this.geocodeObject.via=this.nomevia
}if(this.tipovia!=null&&this.tipovia!=""){this.geocodeObject.tipovia=this.tipovia
}this.geocodeObject.loadObjectFromCivico(this.geocodeObject.ente,this.geocodeObject.idStadioImmobileVia,this.geocodeObject.numero,this.geocodeObject.esponente)
},loadObjectFromCivico:function(I,B,G,E){this.reset();
this.sezione=null;
this.foglio=null;
this.mappale=null;
this.sub=null;
this.address=null;
this.ente=I;
this.idStadioImmobileVia=B;
this.numero=G;
this.esponente=E;
if(this.diverrore!=null){this.diverrore.style.display="none";
this.spanerrore.innerHTML=""
}if(this.divPanel!=null){this.divPanel.style.display="none";
this.divPanel.innerHTML=""
}if(I==""||I==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca informazione sull'ente"
}this.findResult="Manca informazione sull'ente";
this.events.triggerEvent("loadFailure");
return 
}if(B==""||B==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca informazione sulla via"
}this.findResult="Manca informazione sulla via";
this.events.triggerEvent("loadFailure");
return 
}if(G==""||G==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca informazione sul numero civico"
}this.findResult="Manca informazione sul numero civico";
this.events.triggerEvent("loadFailure");
return 
}var A=this.successCivico.bind(this);
var F=this.failureCivico.bind(this);
var C=this.createFindCivicoRequest(I,B,G,E);
var H=this.findCivicoPars+C;
var D=this.findUrl;
if(MW.Proxy&&this.findUrl.startsWith("http")){D=MW.Proxy+MW.Util.escapeUri(this.findUrl)
}if(this.map!=null){this.loading.startLoad();
if(this.map.getLayer(this.markersLayer.id)==null){this.markersLayer.displayInLayerSwitcher=false;
this.map.addLayer(this.markersLayer)
}}OpenLayers.Console.debug("Ajax request url: "+D+H);
new OpenLayers.Ajax.Request(D+H,{method:"post",parameters:null,onComplete:A,onFailure:F})
},successCivico:function(D){if(D.responseXML==null&&D.responseText==null){return 
}var C=D.responseXML;
if(!C||D.fileType!="XML"){C=OpenLayers.parseXMLString(D.responseText)
}var E=C.getElementsByTagName("ErroreRicercaImmobili");
if(E!=null&&E[0]!=null&&E.length>0){var A=E[0];
var I=A.getElementsByTagName("FormatoRichiestaErrato")[0];
var G=A.getElementsByTagName("RicercaFallita")[0];
var F=A.getElementsByTagName("ParametriNonSelettivi")[0];
var J=A.getElementsByTagName("ErroreSistema")[0];
if(I!=null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Formato richiesta errato nella ricerca del civico"
}this.findResult="Formato richiesta errato nella ricerca del civico";
this.events.triggerEvent("loadFailure");
return 
}if(G!=null){if(this.diverrore!=null){this.diverrore.style.display="block";
if(G.firstChild!=null&&G.firstChild.nodeValue!=""){this.spanerrore.innerHTML=G.firstChild.nodeValue
}else{this.spanerrore.innerHTML="Nessun dato trovato con i criteri impostati"
}}if(G.firstChild!=null&&G.firstChild.nodeValue!=""){this.findResult=G.firstChild.nodeValue
}else{this.findResult="Nessun dato trovato con i criteri impostati"
}this.events.triggerEvent("loadFailure");
return 
}if(F!=null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML=F.firstChild.nodeValue
}this.findResult=F.firstChild.nodeValue;
this.events.triggerEvent("loadFailure");
return 
}if(J!=null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML=J.getElementsByTagName("Descrizione")[0].firstChild.nodeValue
}this.findResult=J.getElementsByTagName("Descrizione")[0].firstChild.nodeValue;
this.events.triggerEvent("loadFailure");
return 
}}var H=C.getElementsByTagName("Identificativi");
if(H==null||H.length==0){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Errore di sistema"
}this.findResult="Errore di sistema";
this.events.triggerEvent("loadFailure");
return 
}if(H!=null&&H.length>1){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Civico non univoco"
}this.findResult="Civico non univoco";
this.events.triggerEvent("loadFailure");
return 
}var B=null;
if(H!=null||H.length==1){B=H[0].getElementsByTagName("IdAssolutoStadioImmobile")
}if(B!=null&&B[0]!=null&&B[0].firstChild.nodeValue!=""&&B[0].firstChild.nodeValue!=null){this.idStadioImmobileCivico=B[0].firstChild.nodeValue
}if(this.idStadioImmobileCivico!=""&&this.idStadioImmobileCivico!=null){this.loadObjectFromIdCivico(this.ente,this.idStadioImmobileCivico)
}else{if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca l'informazione sull'id del civico"
}this.findResult="Manca l'informazione sull'id del civico";
this.events.triggerEvent("loadFailure")
}},failureCivico:function(A){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Errore di sistema"
}this.findResult="Errore di sistema";
this.events.triggerEvent("loadFailure");
return 
},loadObjectFromGeocode:function(B,A){this.reset();
this.civico=true;
this.belfiore=null;
this.sezione=null;
this.foglio=null;
this.mappale=null;
this.sub=null;
this.via=null;
this.tipovia=null;
this.numero=null;
this.esponente=null;
this.interno=null;
this.idStadioImmobileVia=null;
this.ente=B;
this.address=A;
if(this.diverrore!=null){this.diverrore.style.display="none";
this.spanerrore.innerHTML=""
}if(this.divPanel!=null){this.divPanel.style.display="none";
this.divPanel.innerHTML=""
}if(B==""||B==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca informazione sull'ente"
}this.findResult="Manca informazione sull'ente";
this.events.triggerEvent("loadFailure");
return 
}if(A==""||A==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca informazione sull'indirizzo"
}this.findResult="Manca informazione sull'indirizzo";
this.events.triggerEvent("loadFailure");
return 
}var G=this.successGeocode.bind(this);
var D=this.failureGeocode.bind(this);
var F=this.createGeocodeRequest(A);
var C=this.geocodePars+F;
this.status_code=NONE;
var E=this.geocodeUrl;
if(MW.Proxy&&this.geocodeUrl.startsWith("http")){E=MW.Proxy+MW.Util.escapeUri(this.geocodeUrl)
}if(this.map!=null){this.loading.startLoad();
if(this.map.getLayer(this.markersLayer.id)==null){this.markersLayer.displayInLayerSwitcher=false;
this.map.addLayer(this.markersLayer)
}}OpenLayers.Console.debug("Ajax request url: "+E+C);
new OpenLayers.Ajax.Request(E+C,{method:"post",parameters:null,onComplete:G,onFailure:D})
},successGeocode:function(F){if(F.responseXML==null&&F.responseText==null){return 
}var A=F.responseXML;
if(!A||F.fileType!="XML"){A=OpenLayers.parseXMLString(F.responseText)
}var O=A.getElementsByTagName("IdAssolutoStadioImmobile");
if(O==null||O.length==0){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Indirizzo non trovato"
}this.findResult="Indirizzo non trovato";
this.events.triggerEvent("loadFailure");
return 
}var Y=OpenLayers.Ajax.getElementsByTagNameNS(A,this.namespace_uri_openls,this.namespace_prefix_openls,"GeocodedAddress");
if(Y==null||Y.length==0){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Indirizzo non trovato"
}this.findResult="Indirizzo non trovato";
this.events.triggerEvent("loadFailure");
return 
}if(Y!=null){if(Y.length>0){for(i=0;
i<Y.length;
i++){var U=null;
var S=null;
var I=null;
var B=null;
var Z=null;
var M=Y[i];
var E=OpenLayers.Ajax.getElementsByTagNameNS(M,this.namespace_uri_gml,this.namespace_prefix_gml,"Point");
if(E!=null&&E.length>0){var K=E[0];
var H=OpenLayers.Ajax.getElementsByTagNameNS(K,this.namespace_uri_gml,this.namespace_prefix_gml,"pos")[0];
if(H!=null){if(H.firstChild!=null){var J=H.firstChild.nodeValue;
if(J!=""){var L=J.indexOf(" ");
U=(new Number(J.substring(0,L))).valueOf();
S=(new Number(J.substring(L+1))).valueOf()
}}}}var T=OpenLayers.Ajax.getElementsByTagNameNS(M,this.namespace_uri_openls,this.namespace_prefix_openls,"Address");
if(T!=null){var G=T[0];
if(G!=null){var V=OpenLayers.Ajax.getElementsByTagNameNS(G,this.namespace_uri_openls,this.namespace_prefix_openls,"StreetAddress")[0];
if(V!=null){var N=OpenLayers.Ajax.getElementsByTagNameNS(V,this.namespace_uri_openls,this.namespace_prefix_openls,"Street")[0];
var C=OpenLayers.Ajax.getElementsByTagNameNS(V,this.namespace_uri_openls,this.namespace_prefix_openls,"_StreetLocation")[0];
if(N!=null){I=N.getAttribute("officialName");
B="";
if(C!=null){B=C.getAttribute("number");
Z=C.getAttribute("subdivision")
}}}}}if(I==null||I==""){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Indirizzo non trovato"
}this.findResult="Indirizzo non trovato";
this.events.triggerEvent("loadFailure");
return 
}if(I!=null&&I!=""){if(Y.length==1){if(O!=null&&O.length!=1){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Indirizzo non univoco"
}this.findResult="Indirizzo non univoco";
this.events.triggerEvent("loadFailure");
return 
}if(B!=null&&B!=""){this.idStadioImmobileCivico=O[0].getAttribute("value");
if(this.idStadioImmobileCivico==null||this.idStadioImmobileCivico==""){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca l'informazione sull'id del civico"
}this.findResult="Manca l'informazione sull'id del civico";
this.events.triggerEvent("loadFailure");
return 
}this.lonlatCivico=new OpenLayers.LonLat(U,S)
}else{this.idStadioImmobileVia=O[0].getAttribute("value");
this.lonlatVia=new OpenLayers.LonLat(U,S)
}this.address=I;
if(B!=null&&B!=""){this.numero=B;
if(Z!=null&&Z!=""){this.esponente=Z
}this.loadObjectFromIdCivico(this.ente,this.idStadioImmobileCivico);
return 
}else{if(this.lonlatVia==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca informazione sulla geometria della via"
}this.findResult="Manca informazione sulla geometria della via";
this.events.triggerEvent("loadFailure");
return 
}var P="Indirizzo:<br/>"+this.address;
this.showMarker(this.lonlatVia,P);
if(this.detailStreet==true&&this.xsl!=null&&this.idStadioImmobileVia!=null&&this.idStadioImmobileVia!=""){var X={findUrl:this.findUrl,xsl:this.xsl,findVisuraPars:this.findVisuraStreetPars,divDetail:this.divDetail,urlDetail:this.urlDetail};
this.findVisura=new MW.Control.Aci.FindVisura(X);
this.map.addControl(this.findVisura);
this.findVisura.events.register("loadComplete",this.findVisura,this.loadCompleteVisura.bind(this));
this.findVisura.events.register("loadFailure",this.findVisura,this.loadFailureVisura.bind(this));
this.findVisura.loadVisura(this.ente,this.idStadioImmobileVia);
return 
}}}else{if(this.divPanel!=null){if(i==0){this.divImg=document.createElement("div");
this.divImg.className="listResultsImg";
var W=function(){this.divPanel.style.display="none";
this.divPanel.innerHTML=""
};
OpenLayers.Event.observe(this.divImg,"click",W.bind(this));
this.divPanel.appendChild(this.divImg);
this.img=document.createElement("img");
this.img.src=OpenLayers.ImgPath+"chiusura.gif";
this.divImg.appendChild(this.img);
this.br=document.createElement("br");
this.divPanel.appendChild(this.br);
this.divlistResultsAddress=document.createElement("div");
this.divlistResultsAddress.className="listResultsAddress";
this.divPanel.appendChild(this.divlistResultsAddress)
}this.divHref=document.createElement("a");
this.divHref.href="#";
var P=I;
var R=null;
if(B!=null&&B!=""){P=P+" "+B;
if(Z!=null&&Z!=""){P=P+"/"+Z
}}this.divHref.innerHTML=P;
this.divPanel.style.display="block";
this.divlistResultsAddress.appendChild(this.divHref);
if(i!=Y.length-1){this.hr=document.createElement("hr");
this.divlistResultsAddress.appendChild(this.hr)
}for(j=0;
j<O.length;
j++){var Q=O[j];
var G=Q.getAttribute("address");
if(G!=null&&G==P){R=Q.getAttribute("value");
break
}}var D={lonlat:new OpenLayers.LonLat(U,S),idStadioImmobile:R,officialName:I,number:B,subciv:Z,geocodeObject:this};
OpenLayers.Event.observe(this.divHref,"click",this.submitAddress.bindAsEventListener(D))
}}}}}}this.findResult="ADDRESS LOADED";
this.events.triggerEvent("loadComplete")
},submitAddress:function(B){if(this.geocodeObject.diverrore!=null){this.geocodeObject.diverrore.style.display="none";
this.geocodeObject.spanerrore.innerHTML=""
}if(this.geocodeObject.divPanel!=null){this.geocodeObject.divPanel.style.display="none";
this.geocodeObject.divPanel.innerHTML=""
}if(this.lonlat==null){if(this.geocodeObject.diverrore!=null){this.geocodeObject.diverrore.style.display="block";
this.geocodeObject.spanerrore.innerHTML="Manca l'informazione sulla geometria dell'indirizzo"
}this.geocodeObject.findResult="Manca l'informazione sulla geometria dell'indirizzo";
this.geocodeObject.events.triggerEvent("loadFailure");
return 
}this.geocodeObject.address=this.officialName;
if(this.number!=null&&this.number!=""){if(this.idStadioImmobile==null||this.idStadioImmobile==""){if(this.geocodeObject.diverrore!=null){this.geocodeObject.diverrore.style.display="block";
this.geocodeObject.spanerrore.innerHTML="Manca l'informazione sull'id dell'indirizzo"
}this.geocodeObject.findResult="Manca l'informazione sull'id dell'indirizzo";
this.geocodeObject.events.triggerEvent("loadFailure");
return 
}this.geocodeObject.numero=this.number;
if(this.subciv!=null&&this.subciv!=""){this.geocodeObject.esponente=this.subciv
}this.geocodeObject.lonlatCivico=this.lonlat;
this.geocodeObject.idStadioImmobileCivico=this.idStadioImmobile;
this.geocodeObject.loadObjectFromIdCivico(this.geocodeObject.ente,this.geocodeObject.idStadioImmobileCivico)
}else{this.geocodeObject.lonlatVia=this.lonlat;
this.geocodeObject.idStadioImmobileVia=this.idStadioImmobile;
var C="Indirizzo:<br/>"+this.geocodeObject.address;
this.geocodeObject.showMarker(this.geocodeObject.lonlatVia,C);
if(this.geocodeObject.detailStreet==true&&this.geocodeObject.xsl!=null&&this.geocodeObject.idStadioImmobileVia!=null&&this.geocodeObject.idStadioImmobileVia!=""){var A={findUrl:this.geocodeObject.findUrl,xsl:this.geocodeObject.xsl,findVisuraPars:this.geocodeObject.findVisuraStreetPars,divDetail:this.geocodeObject.divDetail,urlDetail:this.geocodeObject.urlDetail};
this.geocodeObject.findVisura=new MW.Control.Aci.FindVisura(A);
this.geocodeObject.map.addControl(this.geocodeObject.findVisura);
this.geocodeObject.findVisura.events.register("loadComplete",this.geocodeObject.findVisura,this.geocodeObject.loadCompleteVisura.bind(this.geocodeObject));
this.geocodeObject.findVisura.events.register("loadFailure",this.geocodeObject.findVisura,this.geocodeObject.loadFailureVisura.bind(this.geocodeObject));
this.geocodeObject.findVisura.loadVisura(this.geocodeObject.ente,this.geocodeObject.idStadioImmobileVia)
}}},failureGeocode:function(A){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Errore di sistema"
}this.findResult="Errore di sistema";
this.events.triggerEvent("loadFailure");
return 
},createFindViaRequest:function(B,D,A){var C='<?xml version="1.0" encoding="UTF-8"?><RichiestaRicercaImmobili xmlns="http://elisa.it/aci" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><IdEnte>'+B+"</IdEnte><ParametriRicercaVia><IdEnte>"+B+"</IdEnte>";
if(D!=null&&D!=""){C=C+"<TipoToponimo>"+D+"</TipoToponimo>"
}C=C+'<NomeToponimo RicercaInterna="true">'+A+"</NomeToponimo></ParametriRicercaVia></RichiestaRicercaImmobili>";
return C
},createFindCivicoRequest:function(C,E,B,A){var D='<?xml version="1.0" encoding="UTF-8"?><RichiestaRicercaImmobili xmlns="http://elisa.it/aci" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><IdEnte>'+C+"</IdEnte><ParametriRicercaCivico><IdEnte>"+C+"</IdEnte><ImmobileCollegato><IdVia><IdAssolutoStadioImmobile>"+E+"</IdAssolutoStadioImmobile></IdVia></ImmobileCollegato><Numero>"+B+"</Numero>";
if(A!=null&&A!=""){D=D+"<Esponente>"+A+"</Esponente>"
}D=D+"</ParametriRicercaCivico></RichiestaRicercaImmobili>";
return D
},createGeocodeRequest:function(A){var B='<?xml version="1.0" encoding="UTF-8"?><GeocodeRequest xmlns="http://www.opengis.net/xls" xmlns:gml="http://www.opengis.net/gml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><Address countryCode="IT"><freeFormAddress>'+A+"</freeFormAddress></Address></GeocodeRequest>";
return B
},loadCompleteVisura:function(A){if(this.findVisura!=null){if(this.findVisura.htmlDetail!=null&&this.findVisura.htmlDetail!=""){this.htmlDetail=this.findVisura.htmlDetail
}if(this.findVisura.geometry!=""&&this.findVisura.geomety!=null&&this.layerSel!=null){var C=new OpenLayers.Format.WKT();
var B=C.read(this.findVisura.geometry);
this.layerSel.addFeatures([B])
}}this.findResult="ADDRESS LOADED";
this.events.triggerEvent("loadComplete")
},loadFailureVisura:function(A){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Errore di sistema"
}this.findResult="Errore di sistema";
this.events.triggerEvent("loadFailure");
return 
},reset:function(){this.markersLayer.clearMarkers();
this.idStadioImmobileVia=null;
this.idStadioImmobileCivico=null;
this.lonlatCivico=null;
this.lonlatVia=null;
this.findResult=null;
if(this.divDetail!=null){this.divDetail.style.display="none";
this.divDetail.innerHTML=""
}this.htmlDetail=null
},loadObjectFromIdCivico:function(B,A){},CLASS_NAME:"MW.Control.Aci"});MW.Control.Aci.FindStreetNumber=OpenLayers.Class(MW.Control.Aci.FindGeocoding,{findVisuraCivicoPars:"servizio=VisuraCivicoService&richiesta=",findVisuraBuildingPars:"servizio=VisuraEdificioService&richiesta=",detailStreetNumber:true,detailBuilding:true,idStadioImmobileBuilding:null,styleMap:new OpenLayers.StyleMap({"default":{fillColor:"#ffff00",fillOpacity:"0",hoverFillColor:"white",hoverFillOpacity:0.8,strokeColor:"#ffff00",strokeOpacity:1,strokeLinecap:"round",strokeWidth:2,strokeDashstyle:"solid",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:0.2,pointRadius:6,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"inherit"},temporary:{fillColor:"#ffff00",fillOpacity:"0",hoverFillColor:"white",hoverFillOpacity:0.8,strokeColor:"#ffff00",strokeOpacity:1,strokeLinecap:"round",strokeWidth:2,strokeDashstyle:"solid",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:0.2,pointRadius:6,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"inherit"}}),initialize:function(A){MW.Control.Aci.prototype.initialize.apply(this,[A]);
this.id=OpenLayers.Util.createUniqueID("AciStreetNumber");
this.layerSel=new OpenLayers.Layer.Vector("LayerSelStreetNumber",{styleMap:this.styleMap});
this.layerSel.displayInLayerSwitcher=false;
if(this.xslPath!=null&&this.xslPath!=""){var B=this.successXsl.bind(this);
var C=this.failureXsl.bind(this);
new OpenLayers.Ajax.Request(this.xslPath,{method:"get",parameters:null,onComplete:B,onFailure:C})
}},successXsl:function(A){this.xsl=A.responseXML
},failureXsl:function(A){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Impossibile caricare l'xsl"
}this.findResult="Impossibile caricare l'xsl";
this.events.triggerEvent("loadFailure");
return 
},draw:function(){this.loading=new MW.Control.LoadingMessage();
if(this.map!=null){this.map.addLayers([this.layerSel])
}if((this.map!=null)&&(this.loading!=null)){this.map.addControl(this.loading)
}if(this.div!=null){OpenLayers.Control.prototype.draw.apply(this,arguments);
this.div.className="MWControlFindStreetNumber";
this.divCivico=document.createElement("div");
this.divCivico.id="searchcivico";
this.divCivico.style.display="block";
this.divCivico.style.visibility="visible";
this.divCivico.className="MWControlStreetNumberCivico";
this.div.appendChild(this.divCivico);
this.span=document.createElement("span");
this.span.innerHTML="Ente: ";
this.divCivico.appendChild(this.span);
this.inputEnteVia=document.createElement("input");
this.inputEnteVia.type="text";
this.inputEnteVia.className="inputSmall";
this.inputEnteVia.id="entevia";
if(this.ente!=null&&this.ente!=""){this.inputEnteVia.value=this.ente
}this.divCivico.appendChild(this.inputEnteVia);
this.br=document.createElement("br");
this.divCivico.appendChild(this.br);
if(this.geocoding==true){this.span=document.createElement("span");
this.span.innerHTML="Indirizzo: ";
this.divCivico.appendChild(this.span);
this.inputAddress=document.createElement("input");
this.inputAddress.type="text";
this.inputAddress.className="inputLarge grigio";
this.inputAddress.id="address";
this.inputAddress.value="";
this.inputAddress.value="ad es. via dotti francesco 2/2";
OpenLayers.Event.observe(this.inputAddress,"click",this.clickAddress.bind(this.inputAddress));
this.divCivico.appendChild(this.inputAddress)
}else{this.span=document.createElement("span");
this.span.innerHTML="Tipo indirizzo: ";
this.divCivico.appendChild(this.span);
this.inputTipoToponimo=document.createElement("input");
this.inputTipoToponimo.type="text";
this.inputTipoToponimo.className="inputMedium";
this.inputTipoToponimo.id="tipotoponimo";
this.inputTipoToponimo.value="";
this.divCivico.appendChild(this.inputTipoToponimo);
this.br=document.createElement("br");
this.divCivico.appendChild(this.br);
this.span=document.createElement("span");
this.span.innerHTML="Indirizzo: ";
this.divCivico.appendChild(this.span);
this.inputVia=document.createElement("input");
this.inputVia.type="text";
this.inputVia.className="inputLarge";
this.inputVia.id="via";
this.inputVia.value="";
this.divCivico.appendChild(this.inputVia);
this.br=document.createElement("br");
this.divCivico.appendChild(this.br);
this.span=document.createElement("span");
this.span.innerHTML="Numero: ";
this.divCivico.appendChild(this.span);
this.inputNumero=document.createElement("input");
this.inputNumero.type="text";
this.inputNumero.className="inputSmall";
this.inputNumero.id="numero";
this.inputNumero.value="";
this.divCivico.appendChild(this.inputNumero);
this.span=document.createElement("span");
this.span.innerHTML="/";
this.divCivico.appendChild(this.span);
this.inputEsp=document.createElement("input");
this.inputEsp.type="text";
this.inputEsp.className="inputSmall";
this.inputEsp.id="esponente";
this.inputEsp.value="";
this.divCivico.appendChild(this.inputEsp)
}this.br=document.createElement("br");
this.div.appendChild(this.br);
this.divCommands=document.createElement("div");
this.divCommands.className="commands";
this.div.appendChild(this.divCommands);
this.input=document.createElement("input");
this.input.type="button";
this.input.className="inputButton";
this.input.value="Trova Indirizzo";
this.input.style.marginTop="5px";
this.input.style.cursor="pointer";
this.divCommands.appendChild(this.input);
OpenLayers.Event.observe(this.input,"click",this.load.bind(this));
this.br=document.createElement("br");
this.div.appendChild(this.br);
this.br=document.createElement("br");
this.div.appendChild(this.br);
this.divPanel=document.createElement("div");
this.divPanel.className="streetnumberpanel";
this.div.appendChild(this.divPanel);
this.br=document.createElement("br");
this.div.appendChild(this.br);
this.diverrore=document.createElement("div");
this.diverrore.className="findstreetnumbererrore";
this.div.appendChild(this.diverrore);
this.spanerrore=document.createElement("span");
this.diverrore.appendChild(this.spanerrore)
}return this.div
},clickAddress:function(A){this.select;
if(this.value=="ad es. via dotti francesco 2/2"){this.value=""
}this.className="inputLarge nero"
},destroy:function(){if(this.map!=null){if(this.markersLayer!=null){this.map.removeLayer(this.markersLayer,true);
this.markersLayer=null
}}this.map=null;
this.div=null;
if(this.events){this.events.destroy()
}this.events=null;
OpenLayers.Control.prototype.destroy.apply(this,arguments)
},loadObjectFromIdCivico:function(G,D){this.reset();
this.ente=G;
this.idStadioImmobileCivico=D;
if(this.diverrore!=null){this.diverrore.style.display="none";
this.spanerrore.innerHTML=""
}if(this.divPanel!=null){this.divPanel.style.display="none";
this.divPanel.innerHTML=""
}if(this.map!=null){this.loading.startLoad();
if(this.map.getLayer(this.markersLayer.id)==null){this.markersLayer.displayInLayerSwitcher=false;
this.map.addLayer(this.markersLayer)
}}if(this.lonlatCivico==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca informazione sulla geometria del civico"
}this.findResult="Manca informazione sulla geometria del civico";
this.events.triggerEvent("loadFailure");
return 
}if(this.detailBuilding==false&&this.detailStreetNumber==false){var H="";
if(this.geocoding==true){if(this.address==null||this.address==""){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca informazione sul civico"
}this.findResult="Manca informazione sul civico";
this.events.triggerEvent("loadFailure");
return 
}H="Indirizzo:<br/>"+this.address;
if(this.numero!=""&&this.numero!=null){H+=" "+this.numero;
if(this.esponente!=""&&this.esponente!=null){H+="/"+this.esponente
}}}else{if(this.via==null||this.via==""){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca informazione sul civico"
}this.findResult="Manca informazione sul civico";
this.events.triggerEvent("loadFailure");
return 
}H="Indirizzo:<br/>"+this.via;
if(this.numero!=""&&this.numero!=null){H+=" "+this.numero;
if(this.esponente!=""&&this.esponente!=null){H+="/"+this.esponente
}}}this.showMarker(this.lonlatCivico,H);
var I=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(this.lonlatCivico.lon,this.lonlatCivico.lat));
this.layerSel.addFeatures([I]);
this.findResult="STREET NUMBER LOADED";
this.events.triggerEvent("loadComplete");
return 
}if(this.detailBuilding==true||this.detailStreetNumber==true){if(D==""||D==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca informazione sul civico"
}this.findResult="Manca informazione sul civico";
this.events.triggerEvent("loadFailure");
return 
}var E=this.successVisuraStreetNumber.bind(this);
var A=this.failureVisuraStreetNumber.bind(this);
var B=this.createFindVisuraRequest(G,D);
var F=this.findVisuraCivicoPars+B;
var C=this.findUrl;
if(MW.Proxy&&this.findUrl.startsWith("http")){C=MW.Proxy+MW.Util.escapeUri(this.findUrl)
}OpenLayers.Console.debug("Ajax request url: "+C+F);
new OpenLayers.Ajax.Request(C+F,{method:"post",parameters:null,onComplete:E,onFailure:A})
}},successVisuraStreetNumber:function(F){if(F.responseXML==null&&F.responseText==null){return 
}var A=F.responseXML;
if(!A||F.fileType!="XML"){A=OpenLayers.parseXMLString(F.responseText)
}var K=A.getElementsByTagName("ErroreVisuraImmobili");
if(K!=null&&K[0]!=null&&K.length>0){var N=K[0];
var I=N.getElementsByTagName("FormatoRichiestaErrato")[0];
var J=N.getElementsByTagName("RicercaFallita")[0];
var D=N.getElementsByTagName("ErroreSistema")[0];
if(I!=null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Formato richiesta errato nella ricerca del civico"
}this.findResult="Formato richiesta errato nella ricerca del civico";
this.events.triggerEvent("loadFailure");
return 
}if(J!=null){if(this.diverrore!=null){this.diverrore.style.display="block";
if(J.firstChild!=null&&J.firstChild.nodeValue!=""){this.spanerrore.innerHTML=J.firstChild.nodeValue
}else{this.spanerrore.innerHTML="Nessun dato trovato con i criteri impostati"
}}if(J.firstChild!=null&&J.firstChild.nodeValue!=""){this.findResult=J.firstChild.nodeValue
}else{this.findResult="Nessun dato trovato con i criteri impostati"
}this.events.triggerEvent("loadFailure");
return 
}if(D!=null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML=D.getElementsByTagName("Descrizione")[0].firstChild.nodeValue
}this.findResult=D.getElementsByTagName("Descrizione")[0].firstChild.nodeValue;
this.events.triggerEvent("loadFailure");
return 
}}var Q=A.getElementsByTagName("ImmobiliCollegatiCivico");
if(Q!=null&&Q[0]!=null){var H=Q[0];
var S=H.getElementsByTagName("RelazioneEdificio");
if(S!=null&&S.length>0||S[0]!=null){var P=S[0];
var B=P.getElementsByTagName("IdAssolutoStadioImmobile")[0];
if(B!=null&&B.firstChild!=null){this.idStadioImmobileBuilding=B.firstChild.nodeValue
}}}if(this.idStadioImmobileBuilding!=null&&this.idStadioImmobileBuilding!=""&&this.detailBuilding==true){var O="";
if(this.geocoding==true){if(this.address==null||this.address==""){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca informazione sul civico"
}this.findResult="Manca informazione sul civico";
this.events.triggerEvent("loadFailure");
return 
}O="Indirizzo:<br/>"+this.address;
if(this.numero!=""&&this.numero!=null){O+=" "+this.numero;
if(this.esponente!=""&&this.esponente!=null){O+="/"+this.esponente
}}}else{if(this.via==null||this.via==""){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca informazione sul civico"
}this.findResult="Manca informazione sul civico";
this.events.triggerEvent("loadFailure");
return 
}O="Indirizzo:<br/>"+this.via;
if(this.numero!=""&&this.numero!=null){O+=" "+this.numero;
if(this.esponente!=""&&this.esponente!=null){O+="/"+this.esponente
}}}O+='<br/><a href="#" id="'+this.id+"_linkDetailBuilding\">Scheda informativa dell'edificio</a>";
this.showMarker(this.lonlatCivico,O);
var M=$(this.id+"_linkDetailBuilding");
Event.observe(M,"click",this.submitVisuraBuilding.bind(this))
}else{var O="";
if(this.geocoding==true){if(this.address==null||this.address==""){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca informazione sul civico"
}this.findResult="Manca informazione sul civico";
this.events.triggerEvent("loadFailure");
return 
}O="Indirizzo:<br/>"+this.address;
if(this.numero!=""&&this.numero!=null){O+=" "+this.numero;
if(this.esponente!=""&&this.esponente!=null){O+="/"+this.esponente
}}}else{if(this.via==null||this.via==""){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca informazione sul civico"
}this.findResult="Manca informazione sul civico";
this.events.triggerEvent("loadFailure");
return 
}O="Indirizzo:<br/>"+this.via;
if(this.numero!=""&&this.numero!=null){O+=" "+this.numero;
if(this.esponente!=""&&this.esponente!=null){O+="/"+this.esponente
}}}this.showMarker(this.lonlatCivico,O);
var G=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(this.lonlatCivico.lon,this.lonlatCivico.lat));
this.layerSel.addFeatures([G]);
if(this.detailStreetNumber==true){if(this.xsl!=null){var E=F.responseText;
var L=MW.transformXml(E,this.xsl);
L=L.replace(/&lt;/g,"<");
L=L.replace(/&gt;/g,">");
this.htmlDetail=L;
if(this.divDetail!=null){this.divDetail.style.display="block";
this.divDetail.innerHTML=L
}else{if(this.urlDetail!=null){var C=window.open(this.urlDetail);
C.focus();
var R=document.createElement("div");
R.innerHTML=L;
C.document.body.appendChild(R)
}}}}}this.findResult="STREET NUMBER LOADED";
this.events.triggerEvent("loadComplete")
},failureVisuraStreetNumber:function(A){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Errore di sistema"
}this.findResult="Errore di sistema";
this.events.triggerEvent("loadFailure");
return 
},submitVisuraBuilding:function(A){this.loadVisuraBuilding(this.ente,this.idStadioImmobileBuilding)
},loadVisuraBuilding:function(B,A){this.findResult=null;
this.htmlDetail=null;
if(this.divDetail!=null){this.divDetail.style.display="none";
this.divDetail.innerHTML=""
}this.ente=B;
this.idStadioImmobileBuilding=A;
if(this.div!=null){if(this.diverrore!=null){this.diverrore.style.display="none";
this.spanerrore.innerHTML=""
}}if(A==""||A==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca informazione sull'edificio"
}this.findResult="Manca informazione sull'edificio";
this.events.triggerEvent("loadFailure");
return 
}var F=this.successVisuraBuilding.bind(this);
var G=this.failureVisuraBuilding.bind(this);
var E=this.createFindVisuraRequest(B,A);
var C=this.findVisuraBuildingPars+E;
var D=this.findUrl;
if(MW.Proxy&&this.findUrl.startsWith("http")){D=MW.Proxy+MW.Util.escapeUri(this.findUrl)
}if(this.map!=null){this.loading.startLoad();
if(this.map.getLayer(this.markersLayer.id)==null){this.markersLayer.displayInLayerSwitcher=false;
this.map.addLayer(this.markersLayer)
}}OpenLayers.Console.debug("Ajax request url: "+D+C);
new OpenLayers.Ajax.Request(D+C,{method:"post",parameters:null,onComplete:F,onFailure:G})
},successVisuraBuilding:function(F){if(F.responseXML==null&&F.responseText==null){return 
}var E=F.responseXML;
if(!E||F.fileType!="XML"){E=OpenLayers.parseXMLString(F.responseText)
}var G=E.getElementsByTagName("ErroreVisuraImmobili");
if(G!=null&&G[0]!=null&&G.length>0){var D=G[0];
var M=D.getElementsByTagName("FormatoRichiestaErrato")[0];
var J=D.getElementsByTagName("RicercaFallita")[0];
var O=D.getElementsByTagName("ErroreSistema")[0];
if(M!=null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Formato richiesta errato nella ricerca dell'edificio"
}this.findResult="Formato richiesta errato nella ricerca dell'edificio";
this.events.triggerEvent("loadFailure");
return 
}if(J!=null){if(this.diverrore!=null){this.diverrore.style.display="block";
if(J.firstChild!=null&&J.firstChild.nodeValue!=""){this.spanerrore.innerHTML=J.firstChild.nodeValue
}else{this.spanerrore.innerHTML="Nessun dato trovato con i criteri impostati"
}}if(J.firstChild!=null&&J.firstChild.nodeValue!=""){this.findResult=J.firstChild.nodeValue
}else{this.findResult="Nessun dato trovato con i criteri impostati"
}this.events.triggerEvent("loadFailure");
return 
}if(O!=null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML=O.getElementsByTagName("Descrizione")[0].firstChild.nodeValue
}this.findResult=O.getElementsByTagName("Descrizione")[0].firstChild.nodeValue;
this.events.triggerEvent("loadFailure");
return 
}}var C=E.getElementsByTagName("InfoSpecificheStadioEdificio");
if(C==null||C.length==0||C[0]==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Errore nel recuperare il dettaglio dell'edificio"
}this.findResult="Errore nel recuperare il dettaglio dell'edificio";
this.events.triggerEvent("loadFailure");
return 
}var A=null;
var N=C[0];
if(N.getElementsByTagName("GeometriaWKT")!=null&&N.getElementsByTagName("GeometriaWKT")[0]!=null){A=N.getElementsByTagName("GeometriaWKT")[0].firstChild.nodeValue
}if(A!=""&&A!=null){var L=new OpenLayers.Format.WKT();
var B=L.read(A);
this.layerSel.addFeatures([B])
}if(this.xsl!=null){var I=F.responseText;
var H=MW.transformXml(I,this.xsl);
H=H.replace(/&lt;/g,"<");
H=H.replace(/&gt;/g,">");
this.htmlDetail=H;
if(this.divDetail!=null){this.divDetail.style.display="block";
this.divDetail.innerHTML=H
}else{if(this.urlDetail!=null){var K=window.open(this.urlDetail);
K.focus();
var P=document.createElement("div");
P.innerHTML=H;
K.document.body.appendChild(P)
}}}this.findResult="BUILDING LOADED";
this.events.triggerEvent("loadComplete")
},failureVisuraBuilding:function(A){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Errore di sistema"
}this.findResult="Errore di sistema";
this.events.triggerEvent("loadFailure");
return 
},loadLink:function(B){var A=window.open(B);
A.focus()
},load:function(D){this.reset();
var E=this.inputEnteVia.value;
var F=null;
var G=null;
var C=null;
var A=null;
var B=null;
if(this.geocoding==true){B=this.inputAddress.value
}else{F=this.inputVia.value;
G=this.inputTipoToponimo.value;
C=this.inputNumero.value;
A=this.inputEsp.value
}this.ente=null;
this.via=null;
this.tipovia=null;
this.numero=null;
this.esponente=null;
this.address=null;
this.civico=true;
if(this.geocoding==true){if(B=="ad es. via dotti francesco 2/2"){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Inserire l'indirizzo"
}this.findResult="Inserire l'indirizzo";
this.events.triggerEvent("loadFailure");
return 
}this.loadObjectFromGeocode(E,B)
}else{this.loadObjectFromVia(E,G,F,C,A)
}},createFindVisuraRequest:function(A,B){var C='<?xml version="1.0" encoding="UTF-8"?><RichiestaVisuraImmobili xmlns="http://elisa.it/aci" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><IdEnte>'+A+"</IdEnte><IdAssolutoStadioImmobile>"+B+"</IdAssolutoStadioImmobile></RichiestaVisuraImmobili>";
return C
},reset:function(){this.markersLayer.clearMarkers();
if(this.divDetail!=null){this.divDetail.style.display="none";
this.divDetail.innerHTML=""
}this.idStadioImmobileCivico=null;
this.idStadioImmobileBuilding=null;
this.findResult=null;
this.htmlDetail=null;
if(this.layerSel.features!=null){this.layerSel.destroyFeatures(this.layerSel.features)
}},CLASS_NAME:"MW.Control.Aci.FindStreetNumber"});MW.Control.Aci.Info=OpenLayers.Class(MW.Control.Aci,{type:OpenLayers.Control.TYPE_TOOL,wfsUrl:null,lonlatInfo:null,namespace_uri_mapwork:"http://schemas.corenet.it/mapwork/servizi",namespace_prefix_mapwork:"mapwork",layers:[{physicalName:"mapwork:STRADE",logicalName:"Vie",fieldGeometryName:"SHAPE",fieldIdStdName:"ID",fieldsName:["ID","CODVIA","NOMEVIA"],fieldsDescription:["Id via","Codice via","Nome via"],detail:true},{physicalName:"mapwork:CIVICI_INTERNI",logicalName:"Civici",fieldGeometryName:"SHAPE",fieldIdStdName:"ID",fieldsName:["ID","CODVIA","CIVICO","SUBCIV"],fieldsDescription:["Id civico","Codice via","Civico","Esponente"],detail:true},{physicalName:"mapwork:EDIFICI",logicalName:"Edifici",fieldIdStdName:"ID",fieldGeometryName:"SHAPE",fieldsName:["ID","CODFAB","DESCTIPO"],fieldsDescription:["Id stadio edificio","Codice fabbricato","Tipo edificio"],detail:true},{physicalName:"mapwork:LOTTI",logicalName:"Lotti",fieldIdStdName:"IDSTDLOTTO",fieldGeometryName:"SHAPE",fieldsName:["IDSTDLOTTO","IDLOTTO"],fieldsDescription:["Id stadio lotto","Id lotto"]},{physicalName:"mapwork:CIVICI_PROV",logicalName:"Civici provvisori",fieldIdStdName:"ID",fieldGeometryName:"SHAPE",fieldsName:["ID","ID_STD_VIA","NUMERO","ESPONENTE"],fieldsDescription:["Id civico","Id stadio via","Civico","Esponente"]},{physicalName:"mapwork:EDIFICI_PROV",logicalName:"Edifici provissori",fieldIdStdName:"ID",fieldGeometryName:"SHAPE",fieldsName:["ID","ID_STD_LOTTO"],fieldsDescription:["Id edificio","Id stadio lotto"]}],tolerance:10,extent:null,initialize:function(A){MW.Control.Aci.prototype.initialize.apply(this,[A]);
this.id=OpenLayers.Util.createUniqueID("AciInfo");
if(this.xslPath!=null&&this.xslPath!=""){var B=this.successXsl.bind(this);
var C=this.failureXsl.bind(this);
new OpenLayers.Ajax.Request(this.xslPath,{method:"get",parameters:null,onComplete:B,onFailure:C})
}},successXsl:function(A){this.xsl=A.responseXML
},failureXsl:function(A){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Impossibile caricare l'xsl"
}this.findResult="Impossibile caricare l'xsl";
this.events.triggerEvent("loadFailure");
return 
},draw:function(){this.loading=new MW.Control.LoadingMessage();
this.handler=new OpenLayers.Handler.Drag(this,{down:this.defaultMouseDown});
if((this.map!=null)&&(this.loading!=null)){this.map.addControl(this.loading)
}if(this.div!=null){OpenLayers.Control.prototype.draw.apply(this,arguments);
this.div.className="MWControlAciInfo";
this.diverrore=document.createElement("div");
this.diverrore.className="aciinfoerrore";
this.div.appendChild(this.diverrore);
this.spanerrore=document.createElement("span");
this.spanerrore.style.marginLeft="5px";
this.diverrore.appendChild(this.spanerrore)
}return this.div
},defaultMouseDown:function(I){var F=this.map.getLonLatFromPixel(new OpenLayers.Pixel(I.x,I.y));
var H=this.map.getLonLatFromPixel(new OpenLayers.Pixel(I.x,I.y));
this.lonlatInfo=this.map.getLonLatFromPixel(new OpenLayers.Pixel(I.x,I.y));
t=this.tolerance;
t/=2;
F.lon-=t;
F.lat-=t;
H.lon+=t;
H.lat+=t;
var A=new OpenLayers.Bounds(F.lon,F.lat,H.lon,H.lat);
this.extent=A;
var G=[];
for(var C=0;
C<this.layers.length;
C++){var B=this.layers[C].physicalName;
for(var D=0;
D<this.map.layers.length;
D++){var E=this.map.layers[D];
if(E.CLASS_NAME=="MW.Layer.WMS"){if(E.params.LAYERS.indexOf(B)!=-1){G.push(this.layers[C]);
break
}}}}this.loadFeature(G)
},destroy:function(){if(this.map!=null){if(this.markersLayer!=null){this.map.removeLayer(this.markersLayer,true);
this.markersLayer=null
}}this.map=null;
this.div=null;
if(this.events){this.events.destroy()
}this.events=null;
OpenLayers.Control.prototype.destroy.apply(this,arguments)
},loadFeature:function(C){this.reset();
if(C==null||C.length==0){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Specificare i layer su cui effettuare l'info"
}this.findResult="Specificare i layer su cui effettuare l'info";
this.events.triggerEvent("loadFailure");
return 
}if(this.extent==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Specificare l'estensione su cui effettuare l'info"
}this.findResult="Specificare l'estensione su cui effettuare l'info";
this.events.triggerEvent("loadFailure");
return 
}if(this.wfsUrl==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Specificare l'url del servizio wfs per effettuare l'info"
}this.findResult="Specificare l'url del servizio wfs per effettuare l'info";
this.events.triggerEvent("loadFailure");
return 
}var A=this.createGetFeatureWfsRequest(C);
if(this.map!=null){this.loading.startLoad();
if(this.map.getLayer(this.markersLayer.id)==null){this.markersLayer.displayInLayerSwitcher=false;
this.map.addLayer(this.markersLayer)
}}var B={layersInfo:C,info:this};
new OpenLayers.Ajax.Request(this.wfsUrl,{method:"post",postBody:A,onComplete:this.successLoadFeature.bind(B),onFailure:this.errorLoadFeature.bind(B)})
},successLoadFeature:function(E){if(E.responseXML==null&&E.responseText==null){return 
}var A=E.responseXML;
if(!A||E.fileType!="XML"){A=OpenLayers.parseXMLString(E.responseText)
}var J=OpenLayers.Ajax.getElementsByTagNameNS(A,this.info.namespace_uri_gml,this.info.namespace_prefix_gml,"featureMember");
if(J==null||J.length==0){if(this.info.diverrore!=null){this.info.diverrore.style.display="block";
this.info.spanerrore.innerHTML="Nessun oggetto trovato"
}this.info.findResult="Nessun oggetto trovato";
this.info.events.triggerEvent("loadFailure");
return 
}else{var P="";
for(var W=0;
W<this.layersInfo.length;
W++){var G=this.layersInfo[W].physicalName;
var d=this.layersInfo[W].logicalName;
var U=this.layersInfo[W].fieldIdStdName;
var R=this.layersInfo[W].fieldsName;
var L=this.layersInfo[W].fieldsDescription;
var b=this.layersInfo[W].detail;
var V=G;
var I=G.indexOf(":");
if(I!=-1){V=G.substring(I+1)
}var c=OpenLayers.Ajax.getElementsByTagNameNS(A,this.info.namespace_uri_mapwork,this.info.namespace_prefix_mapwork,V);
if(c!=null&&c.length>0){P+='<a href="#" id="'+this.id+"_"+G+'">'+d+'</a><br/><ul style="display:block;" id="'+this.id+"_"+G+'_ul">';
for(var T=0;
T<c.length;
T++){var F=c[T];
var M=OpenLayers.Ajax.getElementsByTagNameNS(F,this.info.namespace_uri_mapwork,this.info.namespace_prefix_mapwork,U)[0];
var e=null;
if(M!=null&&M.firstChild!=null){e=M.firstChild.nodeValue
}if(e==null||e==""){if(this.info.diverrore!=null){this.info.diverrore.style.display="block";
this.info.spanerrore.innerHTML="Errore di sistema"
}this.info.findResult="Errore di sistema";
this.info.events.triggerEvent("loadFailure");
return 
}if(b!=null&&b==true){P+='<li><span class="link" id="'+e+'">'
}else{P+="<li>"
}if(R!=null&&R.length>0&&L!=null&&L.length>0){var K="";
for(var S=0;
S<R.length;
S++){var D=R[S];
var H=L[S];
var Y=OpenLayers.Ajax.getElementsByTagNameNS(F,this.info.namespace_uri_mapwork,this.info.namespace_prefix_mapwork,D)[0];
var O=null;
if(Y!=null&&Y.firstChild!=null){O=Y.firstChild.nodeValue
}if(O!=null&&O!=""){if(K==""){if(H!=null&&H!=""){K=H+": "
}}else{if(H!=null&&H!=""){K+=", "+H+": "
}}K+=O
}}P+=K
}else{P+=e
}if(b!=null&&b==true){P+="</span></li>"
}else{P+="</li>"
}}P+="</ul>"
}}if(P==""||P==null){if(this.info.diverrore!=null){this.info.diverrore.style.display="block";
this.info.spanerrore.innerHTML="Nessun oggetto trovato"
}this.info.findResult="Nessun oggetto trovato";
this.info.events.triggerEvent("loadFailure");
return 
}this.info.showMarkerNoZoom(this.info.lonlatInfo,P);
var X={findUrl:this.info.findUrl,xsl:this.info.xsl,divDetail:this.info.divDetail,urlDetail:this.info.urlDetail};
this.info.findVisura=new MW.Control.Aci.FindVisura(X);
this.info.map.addControl(this.info.findVisura);
for(var W=0;
W<this.layersInfo.length;
W++){var G=this.layersInfo[W].physicalName;
var d=this.layersInfo[W].logicalName;
var b=this.layersInfo[W].detail;
var Q=$(this.id+"_"+G);
var B=$(this.id+"_"+G+"_ul");
if(Q!=null&&B!=null){Event.observe(Q,"click",this.info.showHideList.bind(B))
}var a=$(this.id+"_"+G+"_ul");
if(a!=null&&a.childNodes.length>0&&b!=null&&b==true){for(var T=0;
T<a.childNodes.length;
T++){var Z=a.childNodes[T];
var N=Z.childNodes[0];
var C={ente:this.info.ente,idStadioImmobile:N.id,layer:d,visura:this.info.findVisura};
Event.observe(N,"click",this.info.findVisura.submitVisura.bindAsEventListener(C))
}}}}this.info.findResult="OBJECTS LOADED";
this.info.events.triggerEvent("loadComplete")
},createGetFeatureWfsRequest:function(H){var G='<?xml version="1.0"?><wfs:GetFeature version="1.0.0" service="WFS" outputFormat="GML2" xmlns:wfs="http://www.opengis.net/wfs" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc">';
for(var F=0;
F<H.length;
F++){var E=H[F].physicalName;
var C=H[F].fieldsName;
var A=H[F].fieldGeometryName;
var D=H[F].fieldIdStdName;
if(E==null||E==""||A==null||A==""){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Errore di sistema"
}this.findResult="Errore di sistema";
this.events.triggerEvent("loadFailure");
return 
}G+='<wfs:Query typeName="'+E+'">';
if(C!=null&&C.length>0){for(var B=0;
B<C.length;
B++){G+="<ogc:PropertyName>"+C[B]+"</ogc:PropertyName>"
}}if(D!=null&&D!=""){G+="<ogc:PropertyName>"+D+"</ogc:PropertyName>"
}G+="<ogc:Filter><ogc:BBOX><ogc:PropertyName>"+A+"</ogc:PropertyName><gml:Box><gml:coordinates>"+this.extent.left+","+this.extent.bottom+" "+this.extent.right+","+this.extent.top+"</gml:coordinates></gml:Box></ogc:BBOX></ogc:Filter></wfs:Query>"
}G+="</wfs:GetFeature>";
return G
},showHideList:function(A){if(this.style.display=="none"){this.style.display="block"
}else{this.style.display="none"
}},errorLoadFeature:function(A){if(this.info.diverrore!=null){this.info.diverrore.style.display="block";
this.info.spanerrore.innerHTML="Errore nella chiamata wfs"
}this.info.findResult="Errore nella chiamata wfs";
this.info.events.triggerEvent("loadFailure");
return 
},reset:function(){this.markersLayer.clearMarkers();
this.findResult=null;
if(this.diverrore!=null){this.diverrore.style.display="none";
this.spanerrore.innerHTML=""
}if(this.divDetail!=null){this.divDetail.style.display="none";
this.divDetail.innerHTML=""
}this.htmlDetail=null
},CLASS_NAME:"MW.Control.Aci.Info"});MW.Control.Aci.FindApartment=OpenLayers.Class(MW.Control.Aci.FindGeocoding,{idStadioImmobileBuilding:null,idStadioImmobileApartment:null,tipoApartment:null,destApartment:null,istatApartment:null,lonlatApartment:null,apartmentList:null,idStadioImmobileApartmentList:null,findApartmentPars:"servizio=RicercaUnitaEdiliziaService&richiesta=",findVisuraApartmentPars:"servizio=VisuraUnitaEdiliziaService&richiesta=",findVisuraCivicoPars:"servizio=VisuraCivicoService&richiesta=",findVisuraBuildingPars:"servizio=VisuraEdificioService&richiesta=",initialize:function(A){MW.Control.Aci.prototype.initialize.apply(this,[A]);
if(this.xslPath!=null&&this.xslPath!=""){var B=this.successXsl.bind(this);
var C=this.failureXsl.bind(this);
new OpenLayers.Ajax.Request(this.xslPath,{method:"get",parameters:null,onComplete:B,onFailure:C})
}},successXsl:function(A){this.xsl=A.responseXML
},failureXsl:function(A){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Impossibile caricare l'xsl"
}this.findResult="Impossibile caricare l'xsl";
this.events.triggerEvent("loadFailure");
return 
},draw:function(){this.loading=new MW.Control.LoadingMessage();
if((this.map!=null)&&(this.loading!=null)){this.map.addControl(this.loading)
}if(this.div!=null){OpenLayers.Control.prototype.draw.apply(this,arguments);
this.div.className="MWControlFindApartment";
this.apartmentcivico=document.createElement("input");
this.apartmentcivico.name="search";
this.apartmentcivico.type="checkbox";
this.apartmentcivico.checked=true;
this.apartmentcivico.defaultChecked=true;
this.apartmentcivico.value="1";
this.div.appendChild(this.apartmentcivico);
this.span=document.createElement("span");
this.div.appendChild(this.span);
this.span.innerHTML="Indirizzo";
this.apartmentcatasto=document.createElement("input");
this.apartmentcatasto.name="search";
this.apartmentcatasto.type="checkbox";
this.apartmentcatasto.value="2";
this.div.appendChild(this.apartmentcatasto);
this.span=document.createElement("span");
this.div.appendChild(this.span);
this.span.innerHTML="Catasto";
var A={input:this.apartmentcivico,apartment:this};
OpenLayers.Event.observe(this.apartmentcivico,"click",this.toggleSearch.bind(A));
var A={input:this.apartmentcatasto,apartment:this};
OpenLayers.Event.observe(this.apartmentcatasto,"click",this.toggleSearch.bind(A));
this.br=document.createElement("br");
this.div.appendChild(this.br);
this.divCivico=document.createElement("div");
this.divCivico.id="searchcivico";
this.divCivico.style.display="block";
this.divCivico.style.visibility="visible";
this.divCivico.className="MWControlApartmentCivico";
this.div.appendChild(this.divCivico);
this.span=document.createElement("span");
this.span.innerHTML="Ente: ";
this.divCivico.appendChild(this.span);
this.inputEnteVia=document.createElement("input");
this.inputEnteVia.type="text";
this.inputEnteVia.className="inputSmall";
this.inputEnteVia.id="entevia";
if(this.ente!=null&&this.ente!=""){this.inputEnteVia.value=this.ente
}this.divCivico.appendChild(this.inputEnteVia);
this.br=document.createElement("br");
this.divCivico.appendChild(this.br);
if(this.geocoding==true){this.span=document.createElement("span");
this.span.innerHTML="Indirizzo: ";
this.divCivico.appendChild(this.span);
this.inputAddress=document.createElement("input");
this.inputAddress.type="text";
this.inputAddress.className="inputLarge grigio";
this.inputAddress.id="address";
this.inputAddress.value="";
this.inputAddress.value="ad es. via dotti francesco 2/2";
OpenLayers.Event.observe(this.inputAddress,"click",this.clickAddress.bind(this.inputAddress));
this.divCivico.appendChild(this.inputAddress)
}else{this.span=document.createElement("span");
this.span.innerHTML="Tipo indirizzo: ";
this.divCivico.appendChild(this.span);
this.inputTipoToponimo=document.createElement("input");
this.inputTipoToponimo.type="text";
this.inputTipoToponimo.className="inputMedium";
this.inputTipoToponimo.id="tipotoponimo";
this.inputTipoToponimo.value="";
this.divCivico.appendChild(this.inputTipoToponimo);
this.br=document.createElement("br");
this.divCivico.appendChild(this.br);
this.span=document.createElement("span");
this.span.innerHTML="Indirizzo: ";
this.divCivico.appendChild(this.span);
this.inputVia=document.createElement("input");
this.inputVia.type="text";
this.inputVia.className="inputLarge";
this.inputVia.id="via";
this.inputVia.value="";
this.divCivico.appendChild(this.inputVia);
this.br=document.createElement("br");
this.divCivico.appendChild(this.br);
this.span=document.createElement("span");
this.span.innerHTML="Numero: ";
this.divCivico.appendChild(this.span);
this.inputNumero=document.createElement("input");
this.inputNumero.type="text";
this.inputNumero.className="inputSmall";
this.inputNumero.id="numero";
this.inputNumero.value="";
this.divCivico.appendChild(this.inputNumero);
this.span=document.createElement("span");
this.span.innerHTML="/";
this.divCivico.appendChild(this.span);
this.inputEsp=document.createElement("input");
this.inputEsp.type="text";
this.inputEsp.className="inputSmall";
this.inputEsp.id="esponente";
this.inputEsp.value="";
this.divCivico.appendChild(this.inputEsp)
}this.br=document.createElement("br");
this.divCivico.appendChild(this.br);
this.br=document.createElement("br");
this.divCivico.appendChild(this.br);
this.span=document.createElement("span");
this.span.innerHTML="Cerca anche per:";
this.divCivico.appendChild(this.span);
this.br=document.createElement("br");
this.divCivico.appendChild(this.br);
this.span=document.createElement("span");
this.span.innerHTML="Numero interno: ";
this.divCivico.appendChild(this.span);
this.inputNumeroInterno=document.createElement("input");
this.inputNumeroInterno.type="text";
this.inputNumeroInterno.className="inputSmall";
this.inputNumeroInterno.id="numerointerno";
this.inputNumeroInterno.value="";
this.divCivico.appendChild(this.inputNumeroInterno);
this.span=document.createElement("span");
this.span.innerHTML="/";
this.divCivico.appendChild(this.span);
this.inputEspInterno=document.createElement("input");
this.inputEspInterno.type="text";
this.inputEspInterno.className="inputSmall";
this.inputEspInterno.id="esponenteinterno";
this.inputEspInterno.value="";
this.divCivico.appendChild(this.inputEspInterno);
this.br=document.createElement("br");
this.divCivico.appendChild(this.br);
this.span=document.createElement("span");
this.span.innerHTML="Scala: ";
this.divCivico.appendChild(this.span);
this.inputScala=document.createElement("input");
this.inputScala.type="text";
this.inputScala.className="inputSmall";
this.inputScala.id="scala";
this.inputScala.value="";
this.divCivico.appendChild(this.inputScala);
this.span=document.createElement("span");
this.span.innerHTML="Piano";
this.divCivico.appendChild(this.span);
this.span.marginLeft="5px";
this.inputPiano=document.createElement("input");
this.inputPiano.type="text";
this.inputPiano.className="inputSmall";
this.inputPiano.id="piano";
this.inputPiano.value="";
this.divCivico.appendChild(this.inputPiano);
this.divParticella=document.createElement("div");
this.divParticella.id="searchparticella";
this.divParticella.style.display="none";
this.divParticella.style.visibility="hidden";
this.divParticella.className="MWControlApartmentParticella";
this.div.appendChild(this.divParticella);
this.divText=document.createElement("div");
this.divText.className="textACI";
this.divParticella.appendChild(this.divText);
this.span=document.createElement("span");
this.span.innerHTML="Ente: ";
this.divText.appendChild(this.span);
this.inputEnteParticella=document.createElement("input");
this.inputEnteParticella.type="text";
this.inputEnteParticella.className="inputSmall";
this.inputEnteParticella.id="enteparticella";
if(this.ente!=null&&this.ente!=""){this.inputEnteParticella.value=this.ente
}this.divParticella.appendChild(this.inputEnteParticella);
this.br=document.createElement("br");
this.divParticella.appendChild(this.br);
this.divText=document.createElement("div");
this.divText.className="textACI";
this.divParticella.appendChild(this.divText);
this.span=document.createElement("span");
this.span.innerHTML="Foglio: ";
this.divText.appendChild(this.span);
this.inputFoglio=document.createElement("input");
this.inputFoglio.type="text";
this.inputFoglio.className="inputMedium";
this.inputFoglio.id="foglio";
this.inputFoglio.value="";
this.divParticella.appendChild(this.inputFoglio);
this.br=document.createElement("br");
this.divParticella.appendChild(this.br);
this.divText=document.createElement("div");
this.divText.className="textACI";
this.divParticella.appendChild(this.divText);
this.span=document.createElement("span");
this.span.innerHTML="Mappale: ";
this.divText.appendChild(this.span);
this.inputMappale=document.createElement("input");
this.inputMappale.type="text";
this.inputMappale.className="inputMedium";
this.inputMappale.id="mappale";
this.inputMappale.value="";
this.divParticella.appendChild(this.inputMappale);
this.br=document.createElement("br");
this.divParticella.appendChild(this.br);
this.br=document.createElement("br");
this.divParticella.appendChild(this.br);
this.span=document.createElement("span");
this.span.innerHTML="Cerca anche per:";
this.divParticella.appendChild(this.span);
this.br=document.createElement("br");
this.divParticella.appendChild(this.br);
this.divText=document.createElement("div");
this.divText.className="textACI";
this.divParticella.appendChild(this.divText);
this.span=document.createElement("span");
this.span.innerHTML="Sezione: ";
this.divText.appendChild(this.span);
this.inputSezione=document.createElement("input");
this.inputSezione.type="text";
this.inputSezione.id="sezione";
this.inputSezione.className="inputMedium";
this.inputSezione.value="";
this.divParticella.appendChild(this.inputSezione);
this.br=document.createElement("br");
this.divParticella.appendChild(this.br);
this.divText=document.createElement("div");
this.divText.className="textACI";
this.divParticella.appendChild(this.divText);
this.span=document.createElement("span");
this.span.innerHTML="Subalterno: ";
this.divText.appendChild(this.span);
this.inputSub=document.createElement("input");
this.inputSub.type="text";
this.inputSub.className="inputMedium";
this.inputSub.id="sub";
this.inputSub.value="";
this.divParticella.appendChild(this.inputSub);
this.br=document.createElement("br");
this.div.appendChild(this.br);
this.br=document.createElement("br");
this.div.appendChild(this.br);
this.divCommands=document.createElement("div");
this.divCommands.className="commands";
this.div.appendChild(this.divCommands);
this.input=document.createElement("input");
this.input.type="button";
this.input.className="inputButton";
this.input.value="Trova Unita' Edilizia";
this.input.style.marginTop="5px";
this.input.style.cursor="pointer";
this.divCommands.appendChild(this.input);
OpenLayers.Event.observe(this.input,"click",this.load.bind(this));
this.br=document.createElement("br");
this.div.appendChild(this.br);
this.br=document.createElement("br");
this.div.appendChild(this.br);
this.divPanel=document.createElement("div");
this.divPanel.className="apartmentpanel";
this.div.appendChild(this.divPanel);
this.br=document.createElement("br");
this.div.appendChild(this.br);
this.diverrore=document.createElement("div");
this.diverrore.className="findapartmenterrore";
this.div.appendChild(this.diverrore);
this.spanerrore=document.createElement("span");
this.diverrore.appendChild(this.spanerrore)
}return this.div
},clickAddress:function(A){this.select;
if(this.value=="ad es. via dotti francesco 2/2"){this.value=""
}this.className="inputLarge nero"
},toggleSearch:function(A){if(this.input.value=="1"){this.apartment.divCivico.style.display="block";
this.apartment.divParticella.style.display="none";
this.apartment.divCivico.style.visibility="visible";
this.apartment.divParticella.style.visibility="hidden";
this.apartment.apartmentcivico.checked=true;
this.apartment.apartmentcatasto.checked=false;
this.apartment.civico=true;
if(this.apartment.div!=null){this.apartment.inputFoglio.value="";
this.apartment.inputMappale.value="";
this.apartment.inputSezione.value="";
this.apartment.inputSub.value=""
}}else{this.apartment.divCivico.style.display="none";
this.apartment.divParticella.style.display="block";
this.apartment.divCivico.style.visibility="hidden";
this.apartment.divParticella.style.visibility="visible";
this.apartment.apartmentcivico.checked=false;
this.apartment.apartmentcatasto.checked=true;
this.apartment.civico=false;
if(this.apartment.div!=null&&this.apartment.geocoding==true){this.apartment.inputAddress.value="ad es. via dotti francesco 2/2";
this.apartment.inputAddress.className="inputLarge grigio";
this.apartment.inputNumeroInterno.value="";
this.apartment.inputEspInterno.value="";
this.apartment.inputScala.value="";
this.apartment.inputPiano.value=""
}}if(this.apartment.div!=null){if(this.apartment.diverrore!=null){this.apartment.diverrore.style.display="none";
this.apartment.spanerrore.innerHTML=""
}if(this.apartment.divPanel!=null){this.apartment.divPanel.style.display="none";
this.apartment.divPanel.innerHTML=""
}}},destroy:function(){if(this.map!=null){if(this.markersLayer!=null){this.map.removeLayer(this.markersLayer,true);
this.markersLayer=null
}}this.map=null;
this.div=null;
if(this.events){this.events.destroy()
}this.events=null;
OpenLayers.Control.prototype.destroy.apply(this,arguments)
},loadObjectFromIdCivico:function(B,A){this.reset();
this.civico=true;
this.sezione=null;
this.foglio=null;
this.mappale=null;
this.sub=null;
this.apartmentList=null;
this.idStadioImmobileApartmentList=null;
this.ente=B;
this.idStadioImmobileCivico=A;
if(this.diverrore!=null){this.diverrore.style.display="none";
this.spanerrore.innerHTML=""
}if(this.divPanel!=null){this.divPanel.style.display="none";
this.divPanel.innerHTML=""
}if(B==""||B==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca informazione sull'ente"
}this.findResult="Manca informazione sull'ente";
this.events.triggerEvent("loadFailure");
return 
}if(A==""||A==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca informazione sul civico"
}this.findResult="Manca informazione sul civico";
this.events.triggerEvent("loadFailure");
return 
}var F=this.successApartment.bind(this);
var C=this.failureApartment.bind(this);
var G=this.createFindApartmentFromCivicoRequest(B,A,this.interno);
var D=this.findApartmentPars+G;
var E=this.findUrl;
if(MW.Proxy&&this.findUrl.startsWith("http")){E=MW.Proxy+MW.Util.escapeUri(this.findUrl)
}if(this.map!=null){this.loading.startLoad();
if(this.map.getLayer(this.markersLayer.id)==null){this.markersLayer.displayInLayerSwitcher=false;
this.map.addLayer(this.markersLayer)
}}OpenLayers.Console.debug("Ajax request url: "+E+D);
new OpenLayers.Ajax.Request(E+D,{method:"post",parameters:null,onComplete:F,onFailure:C})
},loadApartmentFromParticella:function(H,F,J,B,A){this.reset();
this.civico=false;
this.via=null;
this.tipovia=null;
this.numero=null;
this.esponente=null;
this.interno=null;
this.idStadioImmobileVia=null;
this.idStadioImmobileCivico=null;
this.apartmentList=null;
this.idStadioImmobileApartmentList=null;
this.ente=H;
this.sezione=F;
this.foglio=J;
this.mappale=B;
this.sub=A;
if(this.diverrore!=null){this.diverrore.style.display="none";
this.spanerrore.innerHTML=""
}if(this.divPanel!=null){this.divPanel.style.display="none";
this.divPanel.innerHTML=""
}if(H==""||H==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca l'informazione sull'ente"
}this.findResult="Manca 'informazione sull'ente";
this.events.triggerEvent("loadFailure");
return 
}if(J==""||J==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca 'nformazione sul foglio della particella"
}this.findResult="Manca 'informazione sul foglio della particella";
this.events.triggerEvent("loadFailure");
return 
}if(B==""||B==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca 'informazione sul mappale della particella"
}this.findResult="Manca 'informazione sul mappale della particella";
this.events.triggerEvent("loadFailure");
return 
}if(F!=""&&F!=null&&F.length>1){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="La sezione deve essere composta da un solo carattere"
}this.findResult="La sezione deve essere composta da un solo carattere";
this.events.triggerEvent("loadFailure");
return 
}if(J!=""&&J!=null&&J.length>5){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Il foglio deve essere composto al massimo da 5 numeri"
}this.findResult="Il foglio deve essere composto al massimo da 5 numeri";
this.events.triggerEvent("loadFailure");
return 
}if(B!=""&&B!=null&&B.length>5){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Il mappale deve essere composto al massimo da 5 numeri"
}this.findResult="Il mappale deve essere composto al massimo da 5 numeri";
this.events.triggerEvent("loadFailure");
return 
}if(A!=""&&A!=null&&A.length>4){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Il subalterno deve essere composto al massimo da 4 caratteri"
}this.findResult="Il subalterno deve essere composto al massimo da 4 caratteri";
this.events.triggerEvent("loadFailure");
return 
}if(F!=""&&F!=null&&F.length==1){F=F.toUpperCase();
pattern=/[A-Z]/;
if(!pattern.test(F)){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="La sezione deve essere un carattere compreso tra la A e la Z."
}this.findResult="La sezione deve essere un carattere compreso tra la A e la Z.";
this.events.triggerEvent("loadFailure");
return 
}}var I=this.successApartment.bind(this);
var G=this.failureApartment.bind(this);
var C=this.createFindApartmentFromParticellaRequest(H,F,J,B,A);
var E=this.findApartmentPars+C;
var D=this.findUrl;
if(MW.Proxy&&this.findUrl.startsWith("http")){D=MW.Proxy+MW.Util.escapeUri(this.findUrl)
}if(this.map!=null){this.loading.startLoad();
if(this.map.getLayer(this.markersLayer.id)==null){this.markersLayer.displayInLayerSwitcher=false;
this.map.addLayer(this.markersLayer)
}}OpenLayers.Console.debug("Ajax request url: "+D+E);
new OpenLayers.Ajax.Request(D+E,{method:"post",parameters:null,onComplete:I,onFailure:G})
},successApartment:function(H){if(H.responseXML==null&&H.responseText==null){return 
}var G=H.responseXML;
if(!G||H.fileType!="XML"){G=OpenLayers.parseXMLString(H.responseText)
}var I=G.getElementsByTagName("ErroreRicercaImmobili");
if(I!=null&&I[0]!=null&&I.length>0){var E=I[0];
var O=E.getElementsByTagName("FormatoRichiestaErrato")[0];
var L=E.getElementsByTagName("RicercaFallita")[0];
var J=E.getElementsByTagName("ParametriNonSelettivi")[0];
var P=E.getElementsByTagName("ErroreSistema")[0];
if(O!=null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Formato richiesta errato"
}this.findResult="Formato richiesta errato";
this.events.triggerEvent("loadFailure");
return 
}if(L!=null){if(this.diverrore!=null){this.diverrore.style.display="block";
if(L.firstChild!=null&&L.firstChild.nodeValue!=""){this.spanerrore.innerHTML=L.firstChild.nodeValue
}else{this.spanerrore.innerHTML="Nessun dato trovato con i criteri impostati"
}}if(L.firstChild!=null&&L.firstChild.nodeValue!=""){this.findResult=L.firstChild.nodeValue
}else{this.findResult="Nessun dato trovato con i criteri impostati"
}this.events.triggerEvent("loadFailure");
return 
}if(J!=null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML=J.firstChild.nodeValue
}this.findResult=J.firstChild.nodeValue;
this.events.triggerEvent("loadFailure");
return 
}if(P!=null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML=P.getElementsByTagName("Descrizione")[0].firstChild.nodeValue
}this.findResult=P.getElementsByTagName("Descrizione")[0].firstChild.nodeValue;
this.events.triggerEvent("loadFailure");
return 
}}this.idStadioImmobileApartmentList=G.getElementsByTagName("Identificativi");
this.apartmentList=G.getElementsByTagName("InfoSinteticheStadioUE");
if(this.apartmentList==null||this.apartmentList.length==0){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Nessun dato trovato con i criteri impostati"
}this.findResult="Nessun dato trovato con i criteri impostati";
this.events.triggerEvent("loadFailure");
return 
}if(this.apartmentList!=null&&this.apartmentList.length==1&&this.apartmentList[0]!=null){var N=G.getElementsByTagName("Identificativi");
if(N==null||N.length!=1){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Errore di sistema"
}this.findResult="Errore di sistema";
this.events.triggerEvent("loadFailure");
return 
}var F=null;
if(N!=null&&N.length==1){F=N[0].getElementsByTagName("IdAssolutoStadioImmobile")
}if(F==null||F[0]==null||F[0].firstChild.nodeValue==""||F[0].firstChild.nodeValue==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca l'informazione sull'id"
}this.findResult="Manca l'informazione sull'id";
this.events.triggerEvent("loadFailure");
return 
}if(F!=null&&F[0]!=null&&F[0].firstChild.nodeValue!=""&&F[0].firstChild.nodeValue!=null){this.idStadioImmobileApartment=F[0].firstChild.nodeValue;
this.loadVisuraApartment(this.ente,this.idStadioImmobileApartment);
return 
}}else{if(this.apartmentList!=null&&this.apartmentList.length>1){var N=G.getElementsByTagName("Identificativi");
if(N==null||N.length<=1){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Errore di sistema"
}this.findResult="Errore di sistema";
this.events.triggerEvent("loadFailure");
return 
}for(i=0;
i<this.apartmentList.length;
i++){if(this.divPanel!=null){var K=this.apartmentList[i];
var A=N[i];
if(A==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Errore di sistema"
}this.findResult="Errore di sistema";
this.events.triggerEvent("loadFailure");
return 
}if(i==0){this.divImg=document.createElement("div");
this.divImg.className="listResultsImg";
var M=function(){this.divPanel.style.display="none";
this.divPanel.innerHTML=""
};
OpenLayers.Event.observe(this.divImg,"click",M.bind(this));
this.divPanel.appendChild(this.divImg);
this.img=document.createElement("img");
this.img.src=OpenLayers.ImgPath+"chiusura.gif";
this.divImg.appendChild(this.img);
this.br=document.createElement("br");
this.divPanel.appendChild(this.br);
this.divlistResultsAddress=document.createElement("div");
this.divlistResultsAddress.className="listResultsAddress";
this.divPanel.appendChild(this.divlistResultsAddress)
}this.divHref=document.createElement("a");
this.divHref.href="#";
var B=null;
var D=A.getElementsByTagName("IdAssolutoStadioImmobile")[0];
if(D!=null&&D.firstChild!=null){B=D.firstChild.nodeValue
}if(B==null||B==""){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca l'informazione sull'id"
}this.findResult="Manca l'informazione sull'id";
this.events.triggerEvent("loadFailure");
return 
}this.divHref.innerHTML="Unita' edilizia: "+B;
this.divPanel.style.display="block";
this.divlistResultsAddress.appendChild(this.divHref);
if(i!=this.apartmentList.length-1){this.hr=document.createElement("hr");
this.divlistResultsAddress.appendChild(this.hr)
}var C={idapartment:B,ente:this.ente,findApartment:this};
OpenLayers.Event.observe(this.divHref,"click",this.submitApartment.bindAsEventListener(C))
}}}}this.findResult="APARTMENTS LOADED";
this.events.triggerEvent("loadComplete")
},failureApartment:function(A){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Errore di sistema"
}this.findResult="Errore di sistema";
this.events.triggerEvent("loadFailure");
return 
},loadVisuraApartment:function(B,F){this.reset();
this.ente=B;
this.idStadioImmobileApartment=F;
if(this.diverrore!=null){this.diverrore.style.display="none";
this.spanerrore.innerHTML=""
}if(F==""||F==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca informazione sull'id"
}this.findResult="Manca informazione sull'id";
this.events.triggerEvent("loadFailure");
return 
}var A=this.successVisuraApartment.bind(this);
var E=this.failureVisuraApartment.bind(this);
var G=this.createFindVisuraRequest(B,F);
var C=this.findVisuraApartmentPars+G;
var D=this.findUrl;
if(MW.Proxy&&this.findUrl.startsWith("http")){D=MW.Proxy+MW.Util.escapeUri(this.findUrl)
}if(this.map!=null){this.loading.startLoad();
if(this.map.getLayer(this.markersLayer.id)==null){this.markersLayer.displayInLayerSwitcher=false;
this.map.addLayer(this.markersLayer)
}}OpenLayers.Console.debug("Ajax request url: "+D+C);
new OpenLayers.Ajax.Request(D+C,{method:"post",parameters:null,onComplete:A,onFailure:E})
},successVisuraApartment:function(F){if(F.responseXML==null&&F.responseText==null){return 
}var A=F.responseXML;
if(!A||F.fileType!="XML"){A=OpenLayers.parseXMLString(F.responseText)
}var L=A.getElementsByTagName("ErroreVisuraImmobili");
if(L!=null&&L[0]!=null&&L.length>0){var O=L[0];
var J=O.getElementsByTagName("FormatoRichiestaErrato")[0];
var K=O.getElementsByTagName("RicercaFallita")[0];
var D=O.getElementsByTagName("ErroreSistema")[0];
if(J!=null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Formato richiesta errato"
}this.findResult="Formato richiesta errato";
this.events.triggerEvent("loadFailure");
return 
}if(K!=null){if(this.diverrore!=null){this.diverrore.style.display="block";
if(K.firstChild!=null&&K.firstChild.nodeValue!=""){this.spanerrore.innerHTML=K.firstChild.nodeValue
}else{this.spanerrore.innerHTML="Nessun dato trovato con i criteri impostati"
}}if(K.firstChild!=null&&K.firstChild.nodeValue!=""){this.findResult=K.firstChild.nodeValue
}else{this.findResult="Nessun dato trovato con i criteri impostati"
}this.events.triggerEvent("loadFailure");
return 
}if(D!=null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML=D.getElementsByTagName("Descrizione")[0].firstChild.nodeValue
}this.findResult=D.getElementsByTagName("Descrizione")[0].firstChild.nodeValue;
this.events.triggerEvent("loadFailure");
return 
}}var N=A.getElementsByTagName("Identificativi");
if(N==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Errore di sistema"
}this.findResult="Errore di sistema";
this.events.triggerEvent("loadFailure");
return 
}var B=null;
if(N!=null||N[0]!=null){B=N[0].getElementsByTagName("IdAssolutoStadioImmobile")
}if(B==null||B[0]==null||B[0].firstChild.nodeValue==""||B[0].firstChild.nodeValue==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Nessun dato trovato con i criteri impostati"
}this.findResult="Nessun dato trovato con i criteri impostati";
this.events.triggerEvent("loadFailure");
return 
}if(B!=null&&B[0]!=null&&B[0].firstChild.nodeValue!=""&&B[0].firstChild.nodeValue!=null){this.idStadioImmobileApartment=B[0].firstChild.nodeValue
}var I=A.getElementsByTagName("InfoSpecificheStadioUE");
if(I==null||I.length==0||I[0]==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Nessun dato trovato con i criteri impostati"
}this.findResult="Nessun dato trovato con i criteri impostati";
this.events.triggerEvent("loadFailure");
return 
}if(I!=null&&I.length==1&&I[0]!=null){var W=I[0];
var S=W.getElementsByTagName("TipoUE")[0];
if(S!=null){this.tipoApartment=S.getAttribute("Descrizione")
}var G=W.getElementsByTagName("DestinazioneUso")[0];
if(G!=null){this.destApartment=G.getAttribute("Descrizione")
}var Q=W.getElementsByTagName("PianoIstat")[0];
if(Q!=null){this.istatApartment=Q.getAttribute("Descrizione")
}var P='<span style="font-color:black;font-weight:bold;">Unita\' Edilizia: '+this.idStadioImmobileApartment+"</span>";
if(this.civico==true&&this.geocoding==true){if(this.lonlatCivico!=null){this.showMarker(this.lonlatCivico,P)
}}else{if(this.civico==true&&this.geocoding==false){this.loadVisuraCivico(this.ente,this.idStadioImmobileCivico,P)
}else{if(this.civico==false){var R=A.getElementsByTagName("RelazioneCivico")[0];
if(R!=null){var H=R.getElementsByTagName("IdAssolutoStadioImmobile")[0].firstChild.nodeValue;
this.loadVisuraCivico(this.ente,H,P)
}else{var V=A.getElementsByTagName("RelazioneEdificio")[0];
if(V!=null){var T=V.getElementsByTagName("IdAssolutoStadioImmobile")[0].firstChild.nodeValue;
this.loadVisuraBuilding(this.ente,T,P)
}}}}}}this.findResult="APARTMENT LOADED";
this.events.triggerEvent("loadComplete");
if(this.xsl!=null){var E=F.responseText;
var M=MW.transformXml(E,this.xsl);
M=M.replace(/&lt;/g,"<");
M=M.replace(/&gt;/g,">");
this.htmlDetail=M;
if(this.divDetail!=null){this.divDetail.style.display="block";
this.divDetail.innerHTML=M
}else{if(this.urlDetail!=null){var C=window.open(this.urlDetail);
C.focus();
var U=document.createElement("div");
U.innerHTML=M;
C.document.body.appendChild(U)
}}}},failureVisuraApartment:function(A){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Errore di sistema"
}this.findResult="Errore di sistema";
this.events.triggerEvent("loadFailure");
return 
},loadVisuraCivico:function(H,D,I){this.ente=H;
this.idStadioImmobileBuilding=null;
this.idStadioImmobileCivico=D;
if(this.diverrore!=null){this.diverrore.style.display="none";
this.spanerrore.innerHTML=""
}if(D==""||D==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca informazione sul civico"
}this.findResult="Manca informazione sul civico";
this.events.triggerEvent("loadFailure");
return 
}var A={text:I,findApartment:this};
var G=this.successVisura.bind(A);
var E=this.failureVisura.bind(A);
var B=this.createFindVisuraRequest(H,D);
var F=this.findVisuraCivicoPars+B;
var C=this.findUrl;
if(MW.Proxy&&this.findUrl.startsWith("http")){C=MW.Proxy+MW.Util.escapeUri(this.findUrl)
}if(this.map!=null){this.loading.startLoad();
if(this.map.getLayer(this.markersLayer.id)==null){this.markersLayer.displayInLayerSwitcher=false;
this.map.addLayer(this.markersLayer)
}}OpenLayers.Console.debug("Ajax request url: "+C+F);
new OpenLayers.Ajax.Request(C+F,{method:"post",parameters:null,onComplete:G,onFailure:E})
},loadVisuraBuilding:function(H,E,I){this.ente=H;
this.idStadioImmobileBuilding=E;
if(this.diverrore!=null){this.diverrore.style.display="none";
this.spanerrore.innerHTML=""
}if(E==""||E==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca informazione sull'edificio "
}this.findResult="Manca informazione sull'edificio";
this.events.triggerEvent("loadFailure");
return 
}var A={text:I,findApartment:this};
var G=this.successVisura.bind(A);
var D=this.failureVisura.bind(A);
var B=this.createFindVisuraRequest(H,E);
var F=this.findVisuraBuildingPars+B;
var C=this.findUrl;
if(MW.Proxy&&this.findUrl.startsWith("http")){C=MW.Proxy+MW.Util.escapeUri(this.findUrl)
}if(this.map!=null){this.loading.startLoad();
if(this.map.getLayer(this.markersLayer.id)==null){this.markersLayer.displayInLayerSwitcher=false;
this.map.addLayer(this.markersLayer)
}}OpenLayers.Console.debug("Ajax request url: "+C+F);
new OpenLayers.Ajax.Request(C+F,{method:"post",parameters:null,onComplete:G,onFailure:D})
},successVisura:function(F){if(F.responseXML==null&&F.responseText==null){return 
}var B=F.responseXML;
if(!B||F.fileType!="XML"){B=OpenLayers.parseXMLString(F.responseText)
}var C=null;
if(B.getElementsByTagName("GeometriaWKT")[0]!=null&&B.getElementsByTagName("GeometriaWKT")[0].firstChild!=null){C=B.getElementsByTagName("GeometriaWKT")[0].firstChild.nodeValue
}if(C!=""&&C!=null){var E=new OpenLayers.Format.WKT();
var D=E.read(C);
if(D!=null&&D.geometry!=null){D.geometry.calculateBounds();
var A=(D.geometry.bounds.right+D.geometry.bounds.left)/2;
var G=(D.geometry.bounds.top+D.geometry.bounds.bottom)/2;
this.findApartment.lonlatApartment=new OpenLayers.LonLat(A,G)
}else{if(D!=null&&D[0]!=null&&D[0].geometry!=null){D[0].geometry.calculateBounds();
var A=(D[0].geometry.bounds.right+D[0].geometry.bounds.left)/2;
var G=(D[0].geometry.bounds.top+D[0].geometry.bounds.bottom)/2;
this.findApartment.lonlatApartment=new OpenLayers.LonLat(A,G)
}}}if(this.findApartment.lonlatApartment!=null){this.findApartment.showMarker(this.findApartment.lonlatApartment,this.text)
}},failureVisura:function(A){if(this.findApartment.diverrore!=null){this.findApartment.diverrore.style.display="block";
this.findApartment.spanerrore.innerHTML="Errore di sistema"
}this.findApartment.findResult="Errore di sistema";
this.findApartment.events.triggerEvent("loadFailure");
return 
},load:function(K){this.reset();
var B=this.inputEnteVia.value;
var D=this.inputEnteParticella.value;
var H=this.inputSezione.value;
var M=this.inputFoglio.value;
var C=this.inputMappale.value;
var A=this.inputSub.value;
var L=null;
var F=null;
var G=null;
var E=null;
var I=null;
if(this.geocoding==true){I=this.inputAddress.value
}else{L=this.inputVia.value;
F=this.inputTipoToponimo.value;
G=this.inputNumero.value;
E=this.inputEsp.value
}var J={numero:this.inputNumeroInterno.value,esponente:this.inputEspInterno.value,scala:this.inputScala.value,piano:this.inputPiano.value};
if(this.apartmentcivico.checked==true){this.civico=true;
this.ente=null;
this.sezione=null;
this.foglio=null;
this.mappale=null;
this.sub=null;
if(this.geocoding==true){if(I=="ad es. via dotti francesco 2/2"){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Inserire l'indirizzo"
}this.findResult="Inserire l'indirizzo";
this.events.triggerEvent("loadFailure");
return 
}this.loadApartmentFromGeocode(B,I,J)
}else{this.loadApartmentFromVia(B,F,L,G,E,J)
}}if(this.apartmentcatasto.checked==true){this.civico=false;
this.ente=null;
this.via=null;
this.tipovia=null;
this.numero=null;
this.esponente=null;
this.interno=null;
this.idStadioImmobileVia=null;
this.idStadioImmobileCivico=null;
this.loadApartmentFromParticella(D,H,M,C,A)
}},loadApartmentFromGeocode:function(C,A,B){this.interno=B;
this.civico=true;
this.loadObjectFromGeocode(C,A)
},loadApartmentFromVia:function(E,F,D,B,A,C){this.interno=C;
this.civico=true;
this.loadObjectFromVia(E,F,D,B,A)
},loadApartmentFromCivico:function(D,E,B,A,C){this.interno=C;
this.civico=true;
this.loadObjectFromCivico(D,E,B,A)
},submitApartment:function(A){if(this.idapartment!=null){this.findApartment.loadVisuraApartment(this.ente,this.idapartment)
}},createFindApartmentFromCivicoRequest:function(C,B,A){var D='<?xml version="1.0" encoding="UTF-8"?><RichiestaRicercaImmobili xmlns="http://elisa.it/aci" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><IdEnte>'+C+"</IdEnte><ParametriRicercaUE><IdEnte>"+C+"</IdEnte><IdCivico><IdAssolutoStadioImmobile>"+B+"</IdAssolutoStadioImmobile></IdCivico>";
if(A!=null){if((A.numero!=""&&A.numero!=null)||(A.esponente!=""&&A.esponente!=null)||(A.scala!=""&&A.scala!=null)||(A.piano!=""&&A.piano!=null)){D=D+"<IdInterno>";
if(A.numero!=""&&A.numero!=null){D=D+"<Numero>"+A.numero+"</Numero>"
}if(A.esponente!=""&&A.esponente!=null){D=D+"<Esponente>"+A.esponente+"</Esponente>"
}if(A.scala!=""&&A.scala!=null){D=D+"<Scala>"+A.scala+"</Scala>"
}if(A.piano!=""&&A.piano!=null){D=D+"<Piano>"+A.piano+"</Piano>"
}"</IdInterno>"
}}D=D+"</ParametriRicercaUE></RichiestaRicercaImmobili>";
return D
},createFindApartmentFromParticellaRequest:function(C,F,B,A,D){var E='<?xml version="1.0" encoding="UTF-8"?><RichiestaRicercaImmobili xmlns="http://elisa.it/aci" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><IdEnte>'+C+"</IdEnte><ParametriRicercaUE><IdEnte>"+C+"</IdEnte><DatiFabbricato>";
if(F!=null&&F!=""){E=E+"<Sezione>"+F+"</Sezione>"
}E=E+"<FoglioFabbricati>"+B+"</FoglioFabbricati><Mappale>"+A+"</Mappale>";
if(D!=null&&D!=""){E=E+"<Subalterno>"+D+"</Subalterno>"
}E=E+"</DatiFabbricato></ParametriRicercaUE></RichiestaRicercaImmobili>";
return E
},createFindVisuraRequest:function(A,B){var C='<?xml version="1.0" encoding="UTF-8"?><RichiestaVisuraImmobili xmlns="http://elisa.it/aci" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><IdEnte>'+A+"</IdEnte><IdAssolutoStadioImmobile>"+B+"</IdAssolutoStadioImmobile></RichiestaVisuraImmobili>";
return C
},reset:function(){this.markersLayer.clearMarkers();
this.idStadioImmobileBuilding=null;
this.idStadioImmobileApartment=null;
this.tipoApartment=null;
this.destApartment=null;
this.istatApartment=null;
this.lonlatApartment=null;
if(this.divDetail!=null){this.divDetail.style.display="none";
this.divDetail.innerHTML=""
}this.htmlDetail=null;
this.findResult=null
},CLASS_NAME:"MW.Control.Aci.FindApartment"});MW.Control.Aci.FindBuilding=OpenLayers.Class(MW.Control.Aci.FindGeocoding,{findBuildingPars:"servizio=RicercaEdificioService&richiesta=",findVisuraBuildingPars:"servizio=VisuraEdificioService&richiesta=",findVisuraParcelPars:"servizio=VisuraMappaleTerreniService&richiesta=",idStadioImmobileBuilding:null,statoBuilding:null,tipoBuilding:null,nomeBuilding:null,lonlatBuilding:null,lonlatParcel:null,buildingList:null,idStadioImmobileBuildingList:null,styleMap:new OpenLayers.StyleMap({"default":{fillColor:"#ffff00",fillOpacity:"0",hoverFillColor:"white",hoverFillOpacity:0.8,strokeColor:"#ffff00",strokeOpacity:1,strokeLinecap:"round",strokeWidth:2,strokeDashstyle:"solid",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:0.2,pointRadius:6,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"inherit"},temporary:{fillColor:"#ffff00",fillOpacity:"0",hoverFillColor:"white",hoverFillOpacity:0.8,strokeColor:"#ffff00",strokeOpacity:1,strokeLinecap:"round",strokeWidth:2,strokeDashstyle:"solid",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:0.2,pointRadius:6,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"inherit"}}),initialize:function(A){MW.Control.Aci.prototype.initialize.apply(this,[A]);
this.layerSel=new OpenLayers.Layer.Vector("LayerSelBuilding",{styleMap:this.styleMap});
this.layerSel.displayInLayerSwitcher=false;
if(this.xslPath!=null&&this.xslPath!=""){var B=this.successXsl.bind(this);
var C=this.failureXsl.bind(this);
new OpenLayers.Ajax.Request(this.xslPath,{method:"get",parameters:null,onComplete:B,onFailure:C})
}},successXsl:function(A){this.xsl=A.responseXML
},failureXsl:function(A){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Impossibile caricare l'xsl"
}this.findResult="Impossibile caricare l'xsl";
this.events.triggerEvent("loadFailure");
return 
},draw:function(){this.loading=new MW.Control.LoadingMessage();
if(this.map!=null){this.map.addLayers([this.layerSel])
}if((this.map!=null)&&(this.loading!=null)){this.map.addControl(this.loading)
}if(this.div!=null){OpenLayers.Control.prototype.draw.apply(this,arguments);
this.div.className="MWControlFindBuilding";
this.buildingcivico=document.createElement("input");
this.buildingcivico.name="search";
this.buildingcivico.type="checkbox";
this.buildingcivico.checked=true;
this.buildingcivico.defaultChecked=true;
this.buildingcivico.value="1";
this.div.appendChild(this.buildingcivico);
this.span=document.createElement("span");
this.div.appendChild(this.span);
this.span.innerHTML="Indirizzo";
this.buildingcatasto=document.createElement("input");
this.buildingcatasto.name="search";
this.buildingcatasto.type="checkbox";
this.buildingcatasto.value="2";
this.div.appendChild(this.buildingcatasto);
this.span=document.createElement("span");
this.div.appendChild(this.span);
this.span.innerHTML="Catasto";
var A={input:this.buildingcivico,building:this};
OpenLayers.Event.observe(this.buildingcivico,"click",this.toggleSearch.bind(A));
var A={input:this.buildingcatasto,building:this};
OpenLayers.Event.observe(this.buildingcatasto,"click",this.toggleSearch.bind(A));
this.br=document.createElement("br");
this.div.appendChild(this.br);
this.divCivico=document.createElement("div");
this.divCivico.id="searchcivico";
this.divCivico.style.display="block";
this.divCivico.style.visibility="visible";
this.divCivico.className="MWControlBuildingCivico";
this.div.appendChild(this.divCivico);
this.span=document.createElement("span");
this.span.innerHTML="Ente: ";
this.divCivico.appendChild(this.span);
this.inputEnteVia=document.createElement("input");
this.inputEnteVia.type="text";
this.inputEnteVia.className="inputSmall";
this.inputEnteVia.id="entevia";
if(this.ente!=null&&this.ente!=""){this.inputEnteVia.value=this.ente
}this.divCivico.appendChild(this.inputEnteVia);
this.br=document.createElement("br");
this.divCivico.appendChild(this.br);
if(this.geocoding==true){this.span=document.createElement("span");
this.span.innerHTML="Indirizzo: ";
this.divCivico.appendChild(this.span);
this.inputAddress=document.createElement("input");
this.inputAddress.type="text";
this.inputAddress.className="inputLarge grigio";
this.inputAddress.id="address";
this.inputAddress.value="";
this.inputAddress.value="ad es. via dotti francesco 2/2";
OpenLayers.Event.observe(this.inputAddress,"click",this.clickAddress.bind(this.inputAddress));
this.divCivico.appendChild(this.inputAddress)
}else{this.span=document.createElement("span");
this.span.innerHTML="Tipo indirizzo: ";
this.divCivico.appendChild(this.span);
this.inputTipoToponimo=document.createElement("input");
this.inputTipoToponimo.type="text";
this.inputTipoToponimo.className="inputMedium";
this.inputTipoToponimo.id="tipotoponimo";
this.inputTipoToponimo.value="";
this.divCivico.appendChild(this.inputTipoToponimo);
this.br=document.createElement("br");
this.divCivico.appendChild(this.br);
this.span=document.createElement("span");
this.span.innerHTML="Indirizzo: ";
this.divCivico.appendChild(this.span);
this.inputVia=document.createElement("input");
this.inputVia.type="text";
this.inputVia.className="inputLarge";
this.inputVia.id="via";
this.inputVia.value="";
this.divCivico.appendChild(this.inputVia);
this.br=document.createElement("br");
this.divCivico.appendChild(this.br);
this.span=document.createElement("span");
this.span.innerHTML="Numero: ";
this.divCivico.appendChild(this.span);
this.inputNumero=document.createElement("input");
this.inputNumero.type="text";
this.inputNumero.className="inputSmall";
this.inputNumero.id="numero";
this.inputNumero.value="";
this.divCivico.appendChild(this.inputNumero);
this.span=document.createElement("span");
this.span.innerHTML="/";
this.divCivico.appendChild(this.span);
this.inputEsp=document.createElement("input");
this.inputEsp.type="text";
this.inputEsp.className="inputSmall";
this.inputEsp.id="esponente";
this.inputEsp.value="";
this.divCivico.appendChild(this.inputEsp)
}this.divParticella=document.createElement("div");
this.divParticella.id="searchparticella";
this.divParticella.style.display="none";
this.divParticella.style.visibility="hidden";
this.divParticella.className="MWControlBuildingParticella";
this.div.appendChild(this.divParticella);
this.divText=document.createElement("div");
this.divText.className="textACI";
this.divParticella.appendChild(this.divText);
this.span=document.createElement("span");
this.span.innerHTML="Ente: ";
this.divText.appendChild(this.span);
this.inputEnteParticella=document.createElement("input");
this.inputEnteParticella.type="text";
this.inputEnteParticella.className="inputSmall";
this.inputEnteParticella.id="enteparticella";
if(this.ente!=null&&this.ente!=""){this.inputEnteParticella.value=this.ente
}this.divParticella.appendChild(this.inputEnteParticella);
this.br=document.createElement("br");
this.divParticella.appendChild(this.br);
this.divText=document.createElement("div");
this.divText.className="textACI";
this.divParticella.appendChild(this.divText);
this.span=document.createElement("span");
this.span.innerHTML="Foglio: ";
this.divText.appendChild(this.span);
this.inputFoglio=document.createElement("input");
this.inputFoglio.type="text";
this.inputFoglio.className="inputMedium";
this.inputFoglio.id="foglio";
this.inputFoglio.value="";
this.divParticella.appendChild(this.inputFoglio);
this.br=document.createElement("br");
this.divParticella.appendChild(this.br);
this.divText=document.createElement("div");
this.divText.className="textACI";
this.divParticella.appendChild(this.divText);
this.span=document.createElement("span");
this.span.innerHTML="Mappale: ";
this.divText.appendChild(this.span);
this.inputMappale=document.createElement("input");
this.inputMappale.type="text";
this.inputMappale.className="inputMedium";
this.inputMappale.id="mappale";
this.inputMappale.value="";
this.divParticella.appendChild(this.inputMappale);
this.br=document.createElement("br");
this.divParticella.appendChild(this.br);
this.br=document.createElement("br");
this.divParticella.appendChild(this.br);
this.span=document.createElement("span");
this.span.innerHTML="Cerca anche per:";
this.divParticella.appendChild(this.span);
this.br=document.createElement("br");
this.divParticella.appendChild(this.br);
this.divText=document.createElement("div");
this.divText.className="textACI";
this.divParticella.appendChild(this.divText);
this.span=document.createElement("span");
this.span.innerHTML="Sezione: ";
this.divText.appendChild(this.span);
this.inputSezione=document.createElement("input");
this.inputSezione.type="text";
this.inputSezione.id="sezione";
this.inputSezione.className="inputMedium";
this.inputSezione.value="";
this.divParticella.appendChild(this.inputSezione);
this.br=document.createElement("br");
this.divParticella.appendChild(this.br);
this.divText=document.createElement("div");
this.divText.className="textACI";
this.divParticella.appendChild(this.divText);
this.span=document.createElement("span");
this.span.innerHTML="Subalterno: ";
this.divText.appendChild(this.span);
this.inputSub=document.createElement("input");
this.inputSub.type="text";
this.inputSub.className="inputMedium";
this.inputSub.id="sub";
this.inputSub.value="";
this.divParticella.appendChild(this.inputSub);
this.br=document.createElement("br");
this.div.appendChild(this.br);
this.br=document.createElement("br");
this.div.appendChild(this.br);
this.divCommands=document.createElement("div");
this.divCommands.className="commands";
this.div.appendChild(this.divCommands);
this.input=document.createElement("input");
this.input.type="button";
this.input.className="inputButton";
this.input.value="Trova Edificio";
this.input.style.marginTop="5px";
this.input.style.cursor="pointer";
this.divCommands.appendChild(this.input);
OpenLayers.Event.observe(this.input,"click",this.load.bind(this));
this.br=document.createElement("br");
this.div.appendChild(this.br);
this.br=document.createElement("br");
this.div.appendChild(this.br);
this.divPanel=document.createElement("div");
this.divPanel.className="buildingpanel";
this.div.appendChild(this.divPanel);
this.br=document.createElement("br");
this.div.appendChild(this.br);
this.diverrore=document.createElement("div");
this.diverrore.className="findbuildingerrore";
this.div.appendChild(this.diverrore);
this.spanerrore=document.createElement("span");
this.diverrore.appendChild(this.spanerrore)
}return this.div
},clickAddress:function(A){this.select;
if(this.value=="ad es. via dotti francesco 2/2"){this.value=""
}this.className="inputLarge nero"
},toggleSearch:function(A){if(this.input.value=="1"){this.building.divCivico.style.display="block";
this.building.divParticella.style.display="none";
this.building.divCivico.style.visibility="visible";
this.building.divParticella.style.visibility="hidden";
this.building.buildingcivico.checked=true;
this.building.buildingcatasto.checked=false;
this.building.civico=true;
if(this.building.div!=null){this.building.inputFoglio.value="";
this.building.inputMappale.value="";
this.building.inputSezione.value="";
this.building.inputSub.value=""
}}else{this.building.divCivico.style.display="none";
this.building.divParticella.style.display="block";
this.building.divCivico.style.visibility="hidden";
this.building.divParticella.style.visibility="visible";
this.building.buildingcivico.checked=false;
this.building.buildingcatasto.checked=true;
this.building.civico=false;
if(this.building.div!=null&&this.building.geocoding==true){this.building.inputAddress.value="ad es. via dotti francesco 2/2";
this.building.inputAddress.className="inputLarge grigio"
}}if(this.building.div!=null){if(this.building.diverrore!=null){this.building.diverrore.style.display="none";
this.building.spanerrore.innerHTML=""
}if(this.building.divPanel!=null){this.building.divPanel.style.display="none";
this.building.divPanel.innerHTML=""
}}},destroy:function(){if(this.map!=null){if(this.markersLayer!=null){this.map.removeLayer(this.markersLayer,true);
this.markersLayer=null
}}this.map=null;
this.div=null;
if(this.events){this.events.destroy()
}this.events=null;
OpenLayers.Control.prototype.destroy.apply(this,arguments)
},loadObjectFromIdCivico:function(B,A){this.reset();
this.civico=true;
this.sezione=null;
this.foglio=null;
this.mappale=null;
this.sub=null;
this.buildingList=null;
this.idStadioImmobileBuildingList=null;
this.ente=B;
this.idStadioImmobileCivico=A;
if(this.diverrore!=null){this.diverrore.style.display="none";
this.spanerrore.innerHTML=""
}if(this.divPanel!=null){this.divPanel.style.display="none";
this.divPanel.innerHTML=""
}if(B==""||B==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca informazione sull'ente"
}this.findResult="Manca informazione sull'ente";
this.events.triggerEvent("loadFailure");
return 
}if(A==""||A==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca informazione sul civico"
}this.findResult="Manca informazione sul civico";
this.events.triggerEvent("loadFailure");
return 
}var F=this.successBuilding.bind(this);
var C=this.failureBuilding.bind(this);
var G=this.createFindBuildingFromCivicoRequest(B,A);
var D=this.findBuildingPars+G;
var E=this.findUrl;
if(MW.Proxy&&this.findUrl.startsWith("http")){E=MW.Proxy+MW.Util.escapeUri(this.findUrl)
}if(this.map!=null){this.loading.startLoad();
if(this.map.getLayer(this.markersLayer.id)==null){this.markersLayer.displayInLayerSwitcher=false;
this.map.addLayer(this.markersLayer)
}}OpenLayers.Console.debug("Ajax request url: "+E+D);
new OpenLayers.Ajax.Request(E+D,{method:"post",parameters:null,onComplete:F,onFailure:C})
},loadVisuraParcel:function(I,G,J,B,A){this.reset();
this.civico=false;
this.via=null;
this.tipovia=null;
this.numero=null;
this.esponente=null;
this.idStadioImmobileVia=null;
this.address=null;
this.idStadioImmobileCivico=null;
this.lonlatParcel=null;
this.ente=I;
this.sezione=G;
this.foglio=J;
this.mappale=B;
this.sub=A;
if(this.diverrore!=null){this.diverrore.style.display="none";
this.spanerrore.innerHTML=""
}if(I==""||I==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca l'informazione sull'ente"
}this.findResult="Manca 'informazione sull'ente";
this.events.triggerEvent("loadFailure");
return 
}if(J==""||J==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca 'nformazione sul foglio della particella"
}this.findResult="Manca 'informazione sul foglio della particella";
this.events.triggerEvent("loadFailure");
return 
}if(B==""||B==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca 'informazione sul mappale della particella"
}this.findResult="Manca 'informazione sul mappale della particella";
this.events.triggerEvent("loadFailure");
return 
}if(G!=""&&G!=null&&G.length>1){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="La sezione deve essere composta da un solo carattere"
}this.findResult="La sezione deve essere composta da un solo carattere";
this.events.triggerEvent("loadFailure");
return 
}if(J!=""&&J!=null&&J.length>5){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Il foglio deve essere composto al massimo da 5 numeri"
}this.findResult="Il foglio deve essere composto al massimo da 5 numeri";
this.events.triggerEvent("loadFailure");
return 
}if(B!=""&&B!=null&&B.length>5){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Il mappale deve essere composto al massimo da 5 numeri"
}this.findResult="Il mappale deve essere composto al massimo da 5 numeri";
this.events.triggerEvent("loadFailure");
return 
}if(A!=""&&A!=null&&A.length>4){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Il subalterno deve essere composto al massimo da 4 caratteri"
}this.findResult="Il subalterno deve essere composto al massimo da 4 caratteri";
this.events.triggerEvent("loadFailure");
return 
}if(G!=""&&G!=null&&G.length==1){G=G.toUpperCase();
pattern=/[A-Z]/;
if(!pattern.test(G)){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="La sezione deve essere un carattere compreso tra la A e la Z."
}this.findResult="La sezione deve essere un carattere compreso tra la A e la Z.";
this.events.triggerEvent("loadFailure");
return 
}}var E=this.successVisuraParcel.bind(this);
var H=this.failureVisuraParcel.bind(this);
var C=this.createFindVisuraParcelRequest(I,G,J,B,A);
var F=this.findVisuraParcelPars+C;
var D=this.findUrl;
if(MW.Proxy&&this.findUrl.startsWith("http")){D=MW.Proxy+MW.Util.escapeUri(this.findUrl)
}if(this.map!=null){this.loading.startLoad();
if(this.map.getLayer(this.markersLayer.id)==null){this.markersLayer.displayInLayerSwitcher=false;
this.map.addLayer(this.markersLayer)
}}OpenLayers.Console.debug("Ajax request url: "+D+F);
new OpenLayers.Ajax.Request(D+F,{method:"post",parameters:null,onComplete:E,onFailure:H})
},successVisuraParcel:function(E){if(E.responseXML==null&&E.responseText==null){return 
}var D=E.responseXML;
if(!D||E.fileType!="XML"){D=OpenLayers.parseXMLString(E.responseText)
}var F=D.getElementsByTagName("ErroreVisuraMappaleTerreni");
if(F!=null&&F[0]!=null&&F.length>0){var C=F[0];
var J=C.getElementsByTagName("FormatoRichiestaErrato")[0];
var G=C.getElementsByTagName("RicercaFallita")[0];
var L=C.getElementsByTagName("ErroreSistema")[0];
if(J!=null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Formato richiesta errato nella ricerca della particella"
}this.findResult="Formato richiesta errato nella ricerca della particella";
this.events.triggerEvent("loadFailure");
return 
}if(G!=null){if(this.diverrore!=null){this.diverrore.style.display="block";
if(G.firstChild!=null&&G.firstChild.nodeValue!=""){this.spanerrore.innerHTML=G.firstChild.nodeValue
}else{this.spanerrore.innerHTML="Nessun dato trovato con i criteri impostati"
}}if(G.firstChild!=null&&G.firstChild.nodeValue!=""){this.findResult=G.firstChild.nodeValue
}else{this.findResult="Nessun dato trovato con i criteri impostati"
}this.events.triggerEvent("loadFailure");
return 
}if(L!=null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML=L.getElementsByTagName("Descrizione")[0].firstChild.nodeValue
}this.findResult=L.getElementsByTagName("Descrizione")[0].firstChild.nodeValue;
this.events.triggerEvent("loadFailure");
return 
}}var I=D.getElementsByTagName("DettaglioParticella");
if(I!=null&&I[0]!=null){var N=I[0];
var A=null;
if(N.getElementsByTagName("GeometriaWKT")[0]!=null&&N.getElementsByTagName("GeometriaWKT")[0].firstChild!=null){A=N.getElementsByTagName("GeometriaWKT")[0].firstChild.nodeValue
}if(A!=""&&A!=null){var H=new OpenLayers.Format.WKT();
var B=H.read(A);
if(B!=null&&B.geometry!=null){B.geometry.calculateBounds();
var M=(B.geometry.bounds.right+B.geometry.bounds.left)/2;
var K=(B.geometry.bounds.top+B.geometry.bounds.bottom)/2;
this.lonlatParcel=new OpenLayers.LonLat(M,K)
}else{if(B!=null&&B[0]!=null&&B[0].geometry!=null){B[0].geometry.calculateBounds();
var M=(B[0].geometry.bounds.right+B[0].geometry.bounds.left)/2;
var K=(B[0].geometry.bounds.top+B[0].geometry.bounds.bottom)/2;
this.lonlatParcel=new OpenLayers.LonLat(M,K)
}}}}this.loadBuildingFromParticella(this.ente,this.sezione,this.foglio,this.mappale,this.sub)
},failureVisuraParcel:function(A){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Errore di sistema"
}this.findResult="Errore di sistema";
this.events.triggerEvent("loadFailure");
return 
},loadBuildingFromParticella:function(I,H,J,C,A){this.reset();
this.via=null;
this.tipovia=null;
this.numero=null;
this.esponente=null;
this.idStadioImmobileVia=null;
this.address=null;
this.idStadioImmobileCivico=null;
this.civico=false;
this.buildingList=null;
this.idStadioImmobileBuildingList=null;
this.ente=I;
this.sezione=H;
this.foglio=J;
this.mappale=C;
this.sub=A;
if(this.diverrore!=null){this.diverrore.style.display="none";
this.spanerrore.innerHTML=""
}if(this.divPanel!=null){this.divPanel.style.display="none";
this.divPanel.innerHTML=""
}if(I==""||I==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca l'informazione sull'ente"
}this.findResult="Manca 'informazione sull'ente";
this.events.triggerEvent("loadFailure");
return 
}if(J==""||J==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca 'nformazione sul foglio della particella"
}this.findResult="Manca 'informazione sul foglio della particella";
this.events.triggerEvent("loadFailure");
return 
}if(C==""||C==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca 'informazione sul mappale della particella"
}this.findResult="Manca 'informazione sul mappale della particella";
this.events.triggerEvent("loadFailure");
return 
}if(H!=""&&H!=null&&H.length>1){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="La sezione deve essere composta da un solo carattere"
}this.findResult="La sezione deve essere composta da un solo carattere";
this.events.triggerEvent("loadFailure");
return 
}if(J!=""&&J!=null&&J.length>5){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Il foglio deve essere composto al massimo da 5 numeri"
}this.findResult="Il foglio deve essere composto al massimo da 5 numeri";
this.events.triggerEvent("loadFailure");
return 
}if(C!=""&&C!=null&&C.length>5){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Il mappale deve essere composto al massimo da 5 numeri"
}this.findResult="Il mappale deve essere composto al massimo da 5 numeri";
this.events.triggerEvent("loadFailure");
return 
}if(A!=""&&A!=null&&A.length>4){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Il subalterno deve essere composto al massimo da 4 caratteri"
}this.findResult="Il subalterno deve essere composto al massimo da 4 caratteri";
this.events.triggerEvent("loadFailure");
return 
}if(H!=""&&H!=null&&H.length==1){H=H.toUpperCase();
pattern=/[A-Z]/;
if(!pattern.test(H)){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="La sezione deve essere un carattere compreso tra la A e la Z."
}this.findResult="La sezione deve essere un carattere compreso tra la A e la Z.";
this.events.triggerEvent("loadFailure");
return 
}}var F=this.successBuilding.bind(this);
var B=this.failureBuilding.bind(this);
var D=this.createFindBuildingFromParticellaRequest(I,H,J,C,A);
var G=this.findBuildingPars+D;
var E=this.findUrl;
if(MW.Proxy&&this.findUrl.startsWith("http")){E=MW.Proxy+MW.Util.escapeUri(this.findUrl)
}if(this.map!=null){this.loading.startLoad();
if(this.map.getLayer(this.markersLayer.id)==null){this.markersLayer.displayInLayerSwitcher=false;
this.map.addLayer(this.markersLayer)
}}OpenLayers.Console.debug("Ajax request url: "+E+G);
new OpenLayers.Ajax.Request(E+G,{method:"post",parameters:null,onComplete:F,onFailure:B})
},successBuilding:function(H){if(H.responseXML==null&&H.responseText==null){return 
}var G=H.responseXML;
if(!G||H.fileType!="XML"){G=OpenLayers.parseXMLString(H.responseText)
}var I=G.getElementsByTagName("ErroreRicercaImmobili");
if(I!=null&&I[0]!=null&&I.length>0){var E=I[0];
var N=E.getElementsByTagName("FormatoRichiestaErrato")[0];
var K=E.getElementsByTagName("RicercaFallita")[0];
var J=E.getElementsByTagName("ParametriNonSelettivi")[0];
var P=E.getElementsByTagName("ErroreSistema")[0];
if(N!=null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Formato richiesta errato nella ricerca dell'edificio"
}this.findResult="Formato richiesta errato nella ricerca dell'edificio";
this.events.triggerEvent("loadFailure");
return 
}if(K!=null){if(this.diverrore!=null){this.diverrore.style.display="block";
if(K.firstChild!=null&&K.firstChild.nodeValue!=""){this.spanerrore.innerHTML=K.firstChild.nodeValue
}else{this.spanerrore.innerHTML="Nessun dato trovato con i criteri impostati"
}}if(K.firstChild!=null&&K.firstChild.nodeValue!=""){this.findResult=K.firstChild.nodeValue
}else{this.findResult="Nessun dato trovato con i criteri impostati"
}this.events.triggerEvent("loadFailure");
return 
}if(J!=null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML=J.firstChild.nodeValue
}this.findResult=J.firstChild.nodeValue;
this.events.triggerEvent("loadFailure");
return 
}if(P!=null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML=P.getElementsByTagName("Descrizione")[0].firstChild.nodeValue
}this.findResult=P.getElementsByTagName("Descrizione")[0].firstChild.nodeValue;
this.events.triggerEvent("loadFailure");
return 
}}this.idStadioImmobileBuildingList=G.getElementsByTagName("Identificativi");
this.buildingList=G.getElementsByTagName("InfoSinteticheStadioEdificio");
if(this.buildingList==null||this.buildingList.length==0){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Edificio non trovato."
}this.findResult="Edificio non trovato.";
this.events.triggerEvent("loadFailure");
return 
}if(this.buildingList!=null&&this.buildingList.length==1&&this.buildingList[0]!=null){var M=G.getElementsByTagName("Identificativi");
if(M==null||M.length==0){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Errore di sistema"
}this.findResult="Errore di sistema";
this.events.triggerEvent("loadFailure");
return 
}var F=null;
if(M!=null){F=M[0].getElementsByTagName("IdAssolutoStadioImmobile")
}if(F!=null&&F[0]!=null&&F[0].firstChild!=null&&F[0].firstChild.nodeValue!=""&&F[0].firstChild.nodeValue!=null){var O=this.buildingList[0];
this.idStadioImmobileBuilding=F[0].firstChild.nodeValue;
this.loadVisuraBuilding(this.ente,this.idStadioImmobileBuilding);
return 
}else{if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Errore di sistema"
}this.findResult="Errore di sistema";
this.events.triggerEvent("loadFailure");
return 
}}else{if(this.buildingList!=null&&this.buildingList.length>1){var M=G.getElementsByTagName("Identificativi");
if(M==null||M.length<=1){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Errore di sistema"
}this.findResult="Errore di sistema";
this.events.triggerEvent("loadFailure");
return 
}for(i=0;
i<this.buildingList.length;
i++){if(this.divPanel!=null){var O=this.buildingList[i];
var A=M[i];
if(A==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Errore di sistema"
}this.findResult="Errore di sistema";
this.events.triggerEvent("loadFailure");
return 
}if(i==0){this.divImg=document.createElement("div");
this.divImg.className="listResultsImg";
var L=function(){this.divPanel.style.display="none";
this.divPanel.innerHTML=""
};
OpenLayers.Event.observe(this.divImg,"click",L.bind(this));
this.divPanel.appendChild(this.divImg);
this.img=document.createElement("img");
this.img.src=OpenLayers.ImgPath+"chiusura.gif";
this.divImg.appendChild(this.img);
this.br=document.createElement("br");
this.divPanel.appendChild(this.br);
this.divlistResultsAddress=document.createElement("div");
this.divlistResultsAddress.className="listResultsAddress";
this.divPanel.appendChild(this.divlistResultsAddress)
}this.divHref=document.createElement("a");
this.divHref.href="#";
var B=null;
var D=A.getElementsByTagName("IdAssolutoStadioImmobile")[0];
if(D!=null&&D.firstChild!=null){B=D.firstChild.nodeValue
}if(B==null||B==""){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca l'informazione sull'id"
}this.findResult="Manca l'informazione sull'id";
this.events.triggerEvent("loadFailure");
return 
}this.divPanel.style.display="block";
this.divlistResultsAddress.appendChild(this.divHref);
if(i!=this.buildingList.length-1){this.hr=document.createElement("hr");
this.divlistResultsAddress.appendChild(this.hr)
}this.divHref.innerHTML="Edificio: "+B;
var C={idbuilding:B,ente:this.ente,findBuilding:this};
OpenLayers.Event.observe(this.divHref,"click",this.submitBuilding.bindAsEventListener(C))
}}}}},failureBuilding:function(A){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Errore di sistema"
}this.findResult="Errore di sistema";
this.events.triggerEvent("loadFailure");
return 
},submitBuilding:function(A){if(this.idbuilding!=null){this.findBuilding.loadVisuraLot(this.ente,this.idbuilding)
}},loadVisuraBuilding:function(B,A){this.reset();
this.ente=B;
this.idStadioImmobileBuilding=A;
if(this.diverrore!=null){this.diverrore.style.display="none";
this.spanerrore.innerHTML=""
}if(A==""||A==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca informazione sull'edificio"
}this.findResult="Manca informazione sull'edificio";
this.events.triggerEvent("loadFailure");
return 
}var F=this.successVisuraBuilding.bind(this);
var G=this.failureVisuraBuilding.bind(this);
var E=this.createFindVisuraBuildingRequest(B,A);
var C=this.findVisuraBuildingPars+E;
var D=this.findUrl;
if(MW.Proxy&&this.findUrl.startsWith("http")){D=MW.Proxy+MW.Util.escapeUri(this.findUrl)
}if(this.map!=null){this.loading.startLoad();
if(this.map.getLayer(this.markersLayer.id)==null){this.markersLayer.displayInLayerSwitcher=false;
this.map.addLayer(this.markersLayer)
}}OpenLayers.Console.debug("Ajax request url: "+D+C);
new OpenLayers.Ajax.Request(D+C,{method:"post",parameters:null,onComplete:F,onFailure:G})
},successVisuraBuilding:function(G){if(G.responseXML==null&&G.responseText==null){return 
}var A=G.responseXML;
if(!A||G.fileType!="XML"){A=OpenLayers.parseXMLString(G.responseText)
}var N=A.getElementsByTagName("ErroreVisuraImmobili");
if(N!=null&&N[0]!=null&&N.length>0){var Q=N[0];
var J=Q.getElementsByTagName("FormatoRichiestaErrato")[0];
var M=Q.getElementsByTagName("RicercaFallita")[0];
var D=Q.getElementsByTagName("ErroreSistema")[0];
if(J!=null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Formato richiesta errato nella ricerca dell'edificio"
}this.findResult="Formato richiesta errato nella ricerca dell'edificio";
this.events.triggerEvent("loadFailure");
return 
}if(M!=null){if(this.diverrore!=null){this.diverrore.style.display="block";
if(M.firstChild!=null&&M.firstChild.nodeValue!=""){this.spanerrore.innerHTML=M.firstChild.nodeValue
}else{this.spanerrore.innerHTML="Nessun dato trovato con i criteri impostati"
}}if(M.firstChild!=null&&M.firstChild.nodeValue!=""){this.findResult=M.firstChild.nodeValue
}else{this.findResult="Nessun dato trovato con i criteri impostati"
}this.events.triggerEvent("loadFailure");
return 
}if(D!=null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML=D.getElementsByTagName("Descrizione")[0].firstChild.nodeValue
}this.findResult=D.getElementsByTagName("Descrizione")[0].firstChild.nodeValue;
this.events.triggerEvent("loadFailure");
return 
}}var P=A.getElementsByTagName("Identificativi");
if(P==null||P.length==0){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Errore di sistema"
}this.findResult="Errore di sistema";
this.events.triggerEvent("loadFailure");
return 
}var U=A.getElementsByTagName("InfoSpecificheStadioEdificio");
if(U==null||U.length==0||U[0]==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Errore nel recuperare il dettaglio dell'edificio"
}this.findResult="Errore nel recuperare il dettaglio dell'edificio";
this.events.triggerEvent("loadFailure");
return 
}if(U!=null&&U[0]!=null){var E=U[0];
var B=null;
var V=E.getElementsByTagName("StatoEdificio")[0];
if(V!=null){this.statoBuilding=V.getAttribute("Descrizione")
}var I=E.getElementsByTagName("TipoEdificio")[0];
if(I!=null){this.tipoBuilding=I.getAttribute("Descrizione")
}if(E.getElementsByTagName("NomeEdificio")[0]!=null&&E.getElementsByTagName("NomeEdificio")[0].firstChild!=null){this.nomeBuilding=E.getElementsByTagName("NomeEdificio")[0].firstChild.nodeValue
}if(E.getElementsByTagName("GeometriaWKT")!=null&&E.getElementsByTagName("GeometriaWKT")[0]!=null){B=E.getElementsByTagName("GeometriaWKT")[0].firstChild.nodeValue
}if(B!=""&&B!=null){var T=new OpenLayers.Format.WKT();
var H=T.read(B);
this.layerSel.addFeatures([H]);
if(H!=null&&H.geometry!=null){H.geometry.calculateBounds();
var L=(H.geometry.bounds.right+H.geometry.bounds.left)/2;
var K=(H.geometry.bounds.top+H.geometry.bounds.bottom)/2;
this.lonlatBuilding=new OpenLayers.LonLat(L,K)
}else{if(H!=null&&H[0]!=null&&H[0].geometry!=null){H[0].geometry.calculateBounds();
var L=(H[0].geometry.bounds.right+H[0].geometry.bounds.left)/2;
var K=(H[0].geometry.bounds.top+H[0].geometry.bounds.bottom)/2;
this.lonlatBuilding=new OpenLayers.LonLat(L,K)
}}}if((this.geocoding==true&&this.civico==true)||(this.civico==false&&this.lonlatParcel!=null)){var R='<span style="font-weight:bold;font-color:black;">Edificio: '+this.idStadioImmobileBuilding+"</span><br/>";
if(this.geocoding==true&&this.civico==true&&this.lonlatCivico==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Errore nel recuperare la geometria del civico"
}this.findResult="Errore nel recuperare la geometria del civico";
this.events.triggerEvent("loadFailure");
return 
}if(this.geocoding==true&&this.civico==true){this.showMarker(this.lonlatCivico,R)
}if(this.civico==false&&this.lonlatParcel!=null){this.showMarker(this.lonlatParcel,R)
}}if((this.geocoding==false&&this.civico==true)||(this.civico==false&&this.lonlatParcel==null)){var R='<span style="font-weight:bold;font-color:black;">Edificio: '+this.idStadioImmobileBuilding+"</span><br/>";
if(this.lonlatBuilding==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Errore nel recuperare la geometria dell'edificio"
}this.findResult="Errore nel recuperare la geometria dell'edificio";
this.events.triggerEvent("loadFailure");
return 
}this.showMarker(this.lonlatBuilding,R)
}}if(this.xsl!=null){var F=G.responseText;
var O=MW.transformXml(F,this.xsl);
O=O.replace(/&lt;/g,"<");
O=O.replace(/&gt;/g,">");
this.htmlDetail=O;
if(this.divDetail!=null){this.divDetail.style.display="block";
this.divDetail.innerHTML=O
}else{if(this.urlDetail!=null){var C=window.open(this.urlDetail);
C.focus();
var S=document.createElement("div");
S.innerHTML=O;
C.document.body.appendChild(S)
}}}this.findResult="BUILDING LOADED";
this.events.triggerEvent("loadComplete")
},failureVisuraBuilding:function(A){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Errore di sistema"
}this.findResult="Errore di sistema";
this.events.triggerEvent("loadFailure");
return 
},load:function(J){this.reset();
var L=null;
var F=null;
var G=null;
var E=null;
var I=null;
if(this.geocoding==true){I=this.inputAddress.value
}else{L=this.inputVia.value;
F=this.inputTipoToponimo.value;
G=this.inputNumero.value;
E=this.inputEsp.value
}var C=this.inputEnteVia.value;
var D=this.inputEnteParticella.value;
var H=this.inputSezione.value;
var K=this.inputFoglio.value;
var B=this.inputMappale.value;
var A=this.inputSub.value;
if(this.buildingcivico.checked==true){this.civico=true;
this.ente=null;
this.sezione=null;
this.foglio=null;
this.mappale=null;
this.sub=null;
if(this.geocoding==true){if(I=="ad es. via dotti francesco 2/2"){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Inserire l'indirizzo"
}this.findResult="Inserire l'indirizzo";
this.events.triggerEvent("loadFailure");
return 
}this.loadObjectFromGeocode(C,I)
}else{this.loadObjectFromVia(C,F,L,G,E)
}}if(this.buildingcatasto.checked==true){this.civico=false;
this.via=null;
this.tipovia=null;
this.numero=null;
this.esponente=null;
this.idStadioImmobileVia=null;
this.ente=null;
this.address=null;
this.idStadioImmobileCivico=null;
this.loadVisuraParcel(D,H,K,B,A)
}},createFindBuildingFromCivicoRequest:function(B,A){var C='<?xml version="1.0" encoding="UTF-8"?><RichiestaRicercaImmobili xmlns="http://elisa.it/aci" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><IdEnte>'+B+"</IdEnte><ParametriRicercaEdificio><IdEnte>"+B+"</IdEnte><IdCivico><IdAssolutoStadioImmobile>"+A+"</IdAssolutoStadioImmobile></IdCivico></ParametriRicercaEdificio></RichiestaRicercaImmobili>";
return C
},createFindBuildingFromParticellaRequest:function(C,F,B,A,D){var E='<?xml version="1.0" encoding="UTF-8"?><RichiestaRicercaImmobili xmlns="http://elisa.it/aci" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><IdEnte>'+C+"</IdEnte><ParametriRicercaEdificio><IdEnte>"+C+"</IdEnte><DatiParticellaTerreni>";
if(F!=null&&F!=""){E=E+"<Sezione>"+F+"</Sezione>"
}E=E+"<FoglioTerreni>"+B+"</FoglioTerreni><Mappale>"+A+"</Mappale>";
if(D!=null&&D!=""){E=E+"<Subalterno>"+D+"</Subalterno>"
}E=E+"</DatiParticellaTerreni></ParametriRicercaEdificio></RichiestaRicercaImmobili>";
return E
},createFindVisuraBuildingRequest:function(A,B){var C='<?xml version="1.0" encoding="UTF-8"?><RichiestaVisuraImmobili xmlns="http://elisa.it/aci" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><IdEnte>'+A+"</IdEnte><IdAssolutoStadioImmobile>"+B+"</IdAssolutoStadioImmobile></RichiestaVisuraImmobili>";
return C
},createFindVisuraParcelRequest:function(C,F,B,A,D){var E='<?xml version="1.0" encoding="UTF-8"?><RichiestaVisuraMappaleTerreni xmlns="http://elisa.it/aci" xmlns:s3="http://www.sigmater.it" xmlns:aa="http://www.sigmater.it/ambitiamministrativi" xmlns:ct="http://www.sigmater.it/catasto" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><IdEnte>'+C+"</IdEnte><ct:S3RichiestaConsultParticella><ct:ModalitaConsultazioneParticella><ct:ModalitaSituazOgg>ATTUALE</ct:ModalitaSituazOgg></ct:ModalitaConsultazioneParticella><ct:IdentificativoParticella><aa:IdentificativoComune><aa:CodiceBelfioreComune>"+C+"</aa:CodiceBelfioreComune></aa:IdentificativoComune><ct:IdentificativoParzialeParticella>";
if(F!=null&&F!=""){E=E+"<ct:Sezione>"+F+"</ct:Sezione>"
}E=E+"<ct:Foglio>"+B+"</ct:Foglio><ct:Mappale>"+A+"</ct:Mappale>";
if(D!=null&&D!=""){E=E+"<ct:Subalterno>"+D+"</ct:Subalterno>"
}E=E+"</ct:IdentificativoParzialeParticella></ct:IdentificativoParticella></ct:S3RichiestaConsultParticella></RichiestaVisuraMappaleTerreni>";
return E
},reset:function(){this.markersLayer.clearMarkers();
this.idStadioImmobileBuilding=null;
this.statoBuilding=null;
this.lonlatBuilding=null;
this.tipoBuilding=null;
this.nomeBuilding=null;
if(this.layerSel.features!=null){this.layerSel.destroyFeatures(this.layerSel.features)
}if(this.divDetail!=null){this.divDetail.style.display="none";
this.divDetail.innerHTML=""
}this.htmlDetail=null;
this.findResult=null
},CLASS_NAME:"MW.Control.Aci.FindBuilding"});MW.Control.Aci.FindLot=OpenLayers.Class(MW.Control.Aci.FindGeocoding,{idStadioImmobileLot:null,statoLot:null,supLot:null,lonlatLot:null,lotList:null,idStadioImmobileLotList:null,findLotPars:"servizio=RicercaLottoService&richiesta=",findVisuraLotPars:"servizio=VisuraLottoService&richiesta=",styleMap:new OpenLayers.StyleMap({"default":{fillColor:"#ffff00",fillOpacity:"0",hoverFillColor:"white",hoverFillOpacity:0.8,strokeColor:"#ffff00",strokeOpacity:1,strokeLinecap:"round",strokeWidth:2,strokeDashstyle:"solid",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:0.2,pointRadius:6,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"inherit"},temporary:{fillColor:"#ffff00",fillOpacity:"0",hoverFillColor:"white",hoverFillOpacity:0.8,strokeColor:"#ffff00",strokeOpacity:1,strokeLinecap:"round",strokeWidth:2,strokeDashstyle:"solid",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:0.2,pointRadius:6,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"inherit"}}),initialize:function(A){MW.Control.Aci.prototype.initialize.apply(this,[A]);
this.layerSel=new OpenLayers.Layer.Vector("LayerSelLot",{styleMap:this.styleMap});
this.layerSel.displayInLayerSwitcher=false;
if(this.xslPath!=null&&this.xslPath!=""){var B=this.successXsl.bind(this);
var C=this.failureXsl.bind(this);
new OpenLayers.Ajax.Request(this.xslPath,{method:"get",parameters:null,onComplete:B,onFailure:C})
}},successXsl:function(A){this.xsl=A.responseXML
},failureXsl:function(A){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Impossibile caricare l'xsl"
}this.findResult="Impossibile caricare l'xsl";
this.events.triggerEvent("loadFailure");
return 
},draw:function(){this.loading=new MW.Control.LoadingMessage();
if(this.map!=null){this.map.addLayers([this.layerSel])
}if((this.map!=null)&&(this.loading!=null)){this.map.addControl(this.loading)
}if(this.div!=null){OpenLayers.Control.prototype.draw.apply(this,arguments);
this.div.className="MWControlFindLot";
this.lotcivico=document.createElement("input");
this.lotcivico.name="search";
this.lotcivico.type="checkbox";
this.lotcivico.checked=true;
this.lotcivico.defaultChecked=true;
this.lotcivico.value="1";
this.div.appendChild(this.lotcivico);
this.span=document.createElement("span");
this.div.appendChild(this.span);
this.span.innerHTML="Indirizzo";
this.lotcatasto=document.createElement("input");
this.lotcatasto.name="search";
this.lotcatasto.type="checkbox";
this.lotcatasto.value="2";
this.div.appendChild(this.lotcatasto);
this.span=document.createElement("span");
this.div.appendChild(this.span);
this.span.innerHTML="Catasto";
var A={input:this.lotcivico,lot:this};
OpenLayers.Event.observe(this.lotcivico,"click",this.toggleSearch.bind(A));
var A={input:this.lotcatasto,lot:this};
OpenLayers.Event.observe(this.lotcatasto,"click",this.toggleSearch.bind(A));
this.br=document.createElement("br");
this.div.appendChild(this.br);
this.divCivico=document.createElement("div");
this.divCivico.id="searchcivico";
this.divCivico.style.display="block";
this.divCivico.style.visibility="visible";
this.divCivico.className="MWControlLotCivico";
this.div.appendChild(this.divCivico);
this.span=document.createElement("span");
this.span.innerHTML="Ente: ";
this.divCivico.appendChild(this.span);
this.inputEnteVia=document.createElement("input");
this.inputEnteVia.type="text";
this.inputEnteVia.className="inputSmall";
this.inputEnteVia.id="entevia";
if(this.ente!=null&&this.ente!=""){this.inputEnteVia.value=this.ente
}this.divCivico.appendChild(this.inputEnteVia);
this.br=document.createElement("br");
this.divCivico.appendChild(this.br);
if(this.geocoding==true){this.span=document.createElement("span");
this.span.innerHTML="Indirizzo: ";
this.divCivico.appendChild(this.span);
this.inputAddress=document.createElement("input");
this.inputAddress.type="text";
this.inputAddress.className="inputLarge grigio";
this.inputAddress.id="address";
this.inputAddress.value="";
this.inputAddress.value="ad es. via dotti francesco 2/2";
OpenLayers.Event.observe(this.inputAddress,"click",this.clickAddress.bind(this.inputAddress));
this.divCivico.appendChild(this.inputAddress)
}else{this.span=document.createElement("span");
this.span.innerHTML="Tipo indirizzo: ";
this.divCivico.appendChild(this.span);
this.inputTipoToponimo=document.createElement("input");
this.inputTipoToponimo.type="text";
this.inputTipoToponimo.className="inputMedium";
this.inputTipoToponimo.id="tipotoponimo";
this.inputTipoToponimo.value="";
this.divCivico.appendChild(this.inputTipoToponimo);
this.br=document.createElement("br");
this.divCivico.appendChild(this.br);
this.span=document.createElement("span");
this.span.innerHTML="Indirizzo: ";
this.divCivico.appendChild(this.span);
this.inputVia=document.createElement("input");
this.inputVia.type="text";
this.inputVia.className="inputLarge";
this.inputVia.id="via";
this.inputVia.value="";
this.divCivico.appendChild(this.inputVia);
this.br=document.createElement("br");
this.divCivico.appendChild(this.br);
this.span=document.createElement("span");
this.span.innerHTML="Numero: ";
this.divCivico.appendChild(this.span);
this.inputNumero=document.createElement("input");
this.inputNumero.type="text";
this.inputNumero.className="inputSmall";
this.inputNumero.id="numero";
this.inputNumero.value="";
this.divCivico.appendChild(this.inputNumero);
this.span=document.createElement("span");
this.span.innerHTML="/";
this.divCivico.appendChild(this.span);
this.inputEsp=document.createElement("input");
this.inputEsp.type="text";
this.inputEsp.className="inputSmall";
this.inputEsp.id="esponente";
this.inputEsp.value="";
this.divCivico.appendChild(this.inputEsp)
}this.divParticella=document.createElement("div");
this.divParticella.id="searchparticella";
this.divParticella.style.display="none";
this.divParticella.style.visibility="hidden";
this.divParticella.className="MWControlLotParticella";
this.div.appendChild(this.divParticella);
this.divText=document.createElement("div");
this.divText.className="textACI";
this.divParticella.appendChild(this.divText);
this.span=document.createElement("span");
this.span.innerHTML="Ente: ";
this.divText.appendChild(this.span);
this.inputEnteParticella=document.createElement("input");
this.inputEnteParticella.type="text";
this.inputEnteParticella.className="inputSmall";
this.inputEnteParticella.id="enteparticella";
if(this.ente!=null&&this.ente!=""){this.inputEnteParticella.value=this.ente
}this.divParticella.appendChild(this.inputEnteParticella);
this.br=document.createElement("br");
this.divParticella.appendChild(this.br);
this.divText=document.createElement("div");
this.divText.className="textACI";
this.divParticella.appendChild(this.divText);
this.span=document.createElement("span");
this.span.innerHTML="Foglio: ";
this.divText.appendChild(this.span);
this.inputFoglio=document.createElement("input");
this.inputFoglio.type="text";
this.inputFoglio.className="inputMedium";
this.inputFoglio.id="foglio";
this.inputFoglio.value="";
this.divParticella.appendChild(this.inputFoglio);
this.br=document.createElement("br");
this.divParticella.appendChild(this.br);
this.divText=document.createElement("div");
this.divText.className="textACI";
this.divParticella.appendChild(this.divText);
this.span=document.createElement("span");
this.span.innerHTML="Mappale: ";
this.divText.appendChild(this.span);
this.inputMappale=document.createElement("input");
this.inputMappale.type="text";
this.inputMappale.className="inputMedium";
this.inputMappale.id="mappale";
this.inputMappale.value="";
this.divParticella.appendChild(this.inputMappale);
this.br=document.createElement("br");
this.divParticella.appendChild(this.br);
this.br=document.createElement("br");
this.divParticella.appendChild(this.br);
this.span=document.createElement("span");
this.span.innerHTML="Cerca anche per:";
this.divParticella.appendChild(this.span);
this.br=document.createElement("br");
this.divParticella.appendChild(this.br);
this.divText=document.createElement("div");
this.divText.className="textACI";
this.divParticella.appendChild(this.divText);
this.span=document.createElement("span");
this.span.innerHTML="Sezione: ";
this.divText.appendChild(this.span);
this.inputSezione=document.createElement("input");
this.inputSezione.type="text";
this.inputSezione.id="sezione";
this.inputSezione.className="inputMedium";
this.inputSezione.value="";
this.divParticella.appendChild(this.inputSezione);
this.br=document.createElement("br");
this.divParticella.appendChild(this.br);
this.divText=document.createElement("div");
this.divText.className="textACI";
this.divParticella.appendChild(this.divText);
this.span=document.createElement("span");
this.span.innerHTML="Subalterno: ";
this.divText.appendChild(this.span);
this.inputSub=document.createElement("input");
this.inputSub.type="text";
this.inputSub.className="inputMedium";
this.inputSub.id="sub";
this.inputSub.value="";
this.divParticella.appendChild(this.inputSub);
this.br=document.createElement("br");
this.div.appendChild(this.br);
this.br=document.createElement("br");
this.div.appendChild(this.br);
this.divCommands=document.createElement("div");
this.divCommands.className="commands";
this.div.appendChild(this.divCommands);
this.input=document.createElement("input");
this.input.type="button";
this.input.className="inputButton";
this.input.value="Trova Lotto";
this.input.style.marginTop="5px";
this.input.style.cursor="pointer";
this.divCommands.appendChild(this.input);
OpenLayers.Event.observe(this.input,"click",this.load.bind(this));
this.br=document.createElement("br");
this.div.appendChild(this.br);
this.br=document.createElement("br");
this.div.appendChild(this.br);
this.divPanel=document.createElement("div");
this.divPanel.className="lotpanel";
this.div.appendChild(this.divPanel);
this.br=document.createElement("br");
this.div.appendChild(this.br);
this.diverrore=document.createElement("div");
this.diverrore.className="findloterrore";
this.div.appendChild(this.diverrore);
this.spanerrore=document.createElement("span");
this.diverrore.appendChild(this.spanerrore)
}return this.div
},clickAddress:function(A){this.select;
if(this.value=="ad es. via dotti francesco 2/2"){this.value=""
}this.className="inputLarge nero"
},toggleSearch:function(A){if(this.input.value=="1"){this.lot.divCivico.style.display="block";
this.lot.divParticella.style.display="none";
this.lot.divCivico.style.visibility="visible";
this.lot.divParticella.style.visibility="hidden";
this.lot.lotcivico.checked=true;
this.lot.lotcatasto.checked=false;
this.lot.civico=true;
if(this.lot.div!=null){this.lot.inputFoglio.value="";
this.lot.inputMappale.value="";
this.lot.inputSezione.value="";
this.lot.inputSub.value=""
}}else{this.lot.divCivico.style.display="none";
this.lot.divParticella.style.display="block";
this.lot.divCivico.style.visibility="hidden";
this.lot.divParticella.style.visibility="visible";
this.lot.lotcivico.checked=false;
this.lot.lotcatasto.checked=true;
this.lot.civico=false;
if(this.lot.div!=null&&this.lot.geocoding==true){this.lot.inputAddress.value="ad es. via dotti francesco 2/2";
this.lot.inputAddress.className="inputLarge grigio"
}}if(this.lot.div!=null){if(this.lot.diverrore!=null){this.lot.diverrore.style.display="none";
this.lot.spanerrore.innerHTML=""
}if(this.lot.divPanel!=null){this.lot.divPanel.style.display="none";
this.lot.divPanel.innerHTML=""
}}},destroy:function(){if(this.map!=null){if(this.markersLayer!=null){this.map.removeLayer(this.markersLayer,true);
this.markersLayer=null
}}this.map=null;
this.div=null;
if(this.events){this.events.destroy()
}this.events=null;
OpenLayers.Control.prototype.destroy.apply(this,arguments)
},loadObjectFromIdCivico:function(D,B){this.reset();
this.civico=true;
this.sezione=null;
this.foglio=null;
this.mappale=null;
this.sub=null;
this.lotList=null;
this.idStadioImmobileLotList=null;
this.ente=D;
this.idStadioImmobileCivico=B;
if(this.diverrore!=null){this.diverrore.style.display="none";
this.spanerrore.innerHTML=""
}if(this.divPanel!=null){this.divPanel.style.display="none";
this.divPanel.innerHTML=""
}if(D==""||D==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca informazione sull'ente"
}this.findResult="Manca informazione sull'ente";
this.events.triggerEvent("loadFailure");
return 
}if(B==""||B==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca informazione sul civico"
}this.findResult="Manca informazione sul civico";
this.events.triggerEvent("loadFailure");
return 
}var C=this.successLot.bind(this);
var A=this.failureLot.bind(this);
var G=this.createFindLotFromCivicoRequest(D,B);
var E=this.findLotPars+G;
var F=this.findUrl;
if(MW.Proxy&&this.findUrl.startsWith("http")){F=MW.Proxy+MW.Util.escapeUri(this.findUrl)
}if(this.map!=null){this.loading.startLoad();
if(this.map.getLayer(this.markersLayer.id)==null){this.markersLayer.displayInLayerSwitcher=false;
this.map.addLayer(this.markersLayer)
}}OpenLayers.Console.debug("Ajax request url: "+F+E);
new OpenLayers.Ajax.Request(F+E,{method:"post",parameters:null,onComplete:C,onFailure:A})
},loadLotFromParticella:function(H,G,J,B,A){this.reset();
this.civico=false;
this.via=null;
this.tipovia=null;
this.numero=null;
this.esponente=null;
this.idStadioImmobileVia=null;
this.idStadioImmobileCivico=null;
this.lotList=null;
this.idStadioImmobileLotList=null;
this.ente=H;
this.sezione=G;
this.foglio=J;
this.mappale=B;
this.sub=A;
if(this.diverrore!=null){this.diverrore.style.display="none";
this.spanerrore.innerHTML=""
}if(this.divPanel!=null){this.divPanel.style.display="none";
this.divPanel.innerHTML=""
}if(H==""||H==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca l'informazione sull'ente"
}this.findResult="Manca 'informazione sull'ente";
this.events.triggerEvent("loadFailure");
return 
}if(J==""||J==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca 'nformazione sul foglio della particella"
}this.findResult="Manca 'informazione sul foglio della particella";
this.events.triggerEvent("loadFailure");
return 
}if(B==""||B==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca 'informazione sul mappale della particella"
}this.findResult="Manca 'informazione sul mappale della particella";
this.events.triggerEvent("loadFailure");
return 
}if(G!=""&&G!=null&&G.length>1){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="La sezione deve essere composta da un solo carattere"
}this.findResult="La sezione deve essere composta da un solo carattere";
this.events.triggerEvent("loadFailure");
return 
}if(J!=""&&J!=null&&J.length>5){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Il foglio deve essere composto al massimo da 5 numeri"
}this.findResult="Il foglio deve essere composto al massimo da 5 numeri";
this.events.triggerEvent("loadFailure");
return 
}if(B!=""&&B!=null&&B.length>5){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Il mappale deve essere composto al massimo da 5 numeri"
}this.findResult="Il mappale deve essere composto al massimo da 5 numeri";
this.events.triggerEvent("loadFailure");
return 
}if(A!=""&&A!=null&&A.length>4){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Il subalterno deve essere composto al massimo da 4 caratteri"
}this.findResult="Il subalterno deve essere composto al massimo da 4 caratteri";
this.events.triggerEvent("loadFailure");
return 
}if(G!=""&&G!=null&&G.length==1){G=G.toUpperCase();
pattern=/[A-Z]/;
if(!pattern.test(G)){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="La sezione deve essere un carattere compreso tra la A e la Z."
}this.findResult="La sezione deve essere un carattere compreso tra la A e la Z.";
this.events.triggerEvent("loadFailure");
return 
}}var I=this.successLot.bind(this);
var C=this.failureLot.bind(this);
var D=this.createFindLotFromParticellaRequest(H,G,J,B,A);
var F=this.findLotPars+D;
var E=this.findUrl;
if(MW.Proxy&&this.findUrl.startsWith("http")){E=MW.Proxy+MW.Util.escapeUri(this.findUrl)
}if(this.map!=null){this.loading.startLoad();
if(this.map.getLayer(this.markersLayer.id)==null){this.markersLayer.displayInLayerSwitcher=false;
this.map.addLayer(this.markersLayer)
}}OpenLayers.Console.debug("Ajax request url: "+E+F);
new OpenLayers.Ajax.Request(E+F,{method:"post",parameters:null,onComplete:I,onFailure:C})
},successLot:function(G){if(G.responseXML==null&&G.responseText==null){return 
}var F=G.responseXML;
if(!F||G.fileType!="XML"){F=OpenLayers.parseXMLString(G.responseText)
}var H=F.getElementsByTagName("ErroreRicercaImmobili");
if(H!=null&&H[0]!=null&&H.length>0){var D=H[0];
var N=D.getElementsByTagName("FormatoRichiestaErrato")[0];
var J=D.getElementsByTagName("RicercaFallita")[0];
var I=D.getElementsByTagName("ParametriNonSelettivi")[0];
var O=D.getElementsByTagName("ErroreSistema")[0];
if(N!=null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Formato richiesta errato nella ricerca del lotto"
}this.findResult="Formato richiesta errato nella ricerca del lotto";
this.events.triggerEvent("loadFailure");
return 
}if(J!=null){if(this.diverrore!=null){this.diverrore.style.display="block";
if(J.firstChild!=null&&J.firstChild.nodeValue!=""){this.spanerrore.innerHTML=J.firstChild.nodeValue
}else{this.spanerrore.innerHTML="Nessun dato trovato con i criteri impostati"
}}if(J.firstChild!=null&&J.firstChild.nodeValue!=""){this.findResult=J.firstChild.nodeValue
}else{this.findResult="Nessun dato trovato con i criteri impostati"
}this.events.triggerEvent("loadFailure");
return 
}if(I!=null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML=I.firstChild.nodeValue
}this.findResult=I.firstChild.nodeValue;
this.events.triggerEvent("loadFailure");
return 
}if(O!=null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML=O.getElementsByTagName("Descrizione")[0].firstChild.nodeValue
}this.findResult=O.getElementsByTagName("Descrizione")[0].firstChild.nodeValue;
this.events.triggerEvent("loadFailure");
return 
}}this.idStadioImmobileLotList=F.getElementsByTagName("Identificativi");
this.lotList=F.getElementsByTagName("InfoSinteticheStadioLotto");
if(this.lotList==null||this.lotList.length==0){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Nessun lotto trovato"
}this.findResult="Nessun lotto trovato";
this.events.triggerEvent("loadFailure");
return 
}if(this.lotList!=null&&this.lotList.length==1&&this.lotList[0]!=null){var M=F.getElementsByTagName("Identificativi");
if(M==null||M.length!=1){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Errore di sistema"
}this.findResult="Errore di sistema";
this.events.triggerEvent("loadFailure");
return 
}var E=null;
if(M!=null&&M.length==1){E=M[0].getElementsByTagName("IdAssolutoStadioImmobile")
}if(E==null||E[0]==null||E[0].firstChild.nodeValue==""||E[0].firstChild.nodeValue==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca l'informazione sull'id"
}this.findResult="Manca l'informazione sull'id";
this.events.triggerEvent("loadFailure");
return 
}if(E!=null&&E[0]!=null&&E[0].firstChild.nodeValue!=""&&E[0].firstChild.nodeValue!=null){this.idStadioImmobileLot=E[0].firstChild.nodeValue;
this.loadVisuraLot(this.ente,this.idStadioImmobileLot);
return 
}}else{if(this.lotList!=null&&this.lotList.length>1){var M=F.getElementsByTagName("Identificativi");
if(M==null||M.length<=1){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Errore di sistema"
}this.findResult="Errore di sistema";
this.events.triggerEvent("loadFailure");
return 
}for(i=0;
i<this.lotList.length;
i++){if(this.divPanel!=null){var P=this.lotList[i];
var A=M[i];
if(A==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Errore di sistema"
}this.findResult="Errore di sistema";
this.events.triggerEvent("loadFailure");
return 
}if(i==0){this.divImg=document.createElement("div");
this.divImg.className="listResultsImg";
var K=function(){this.divPanel.style.display="none";
this.divPanel.innerHTML=""
};
OpenLayers.Event.observe(this.divImg,"click",K.bind(this));
this.divPanel.appendChild(this.divImg);
this.img=document.createElement("img");
this.img.src=OpenLayers.ImgPath+"chiusura.gif";
this.divImg.appendChild(this.img);
this.br=document.createElement("br");
this.divPanel.appendChild(this.br);
this.divlistResultsAddress=document.createElement("div");
this.divlistResultsAddress.className="listResultsAddress";
this.divPanel.appendChild(this.divlistResultsAddress)
}this.divHref=document.createElement("a");
this.divHref.href="#";
var L=null;
var C=A.getElementsByTagName("IdAssolutoStadioImmobile")[0];
if(C!=null&&C.firstChild!=null){L=C.firstChild.nodeValue
}if(L==null||L==""){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca l'informazione sull'id"
}this.findResult="Manca l'informazione sull'id";
this.events.triggerEvent("loadFailure");
return 
}this.divPanel.style.display="block";
this.divlistResultsAddress.appendChild(this.divHref);
if(i!=this.lotList.length-1){this.hr=document.createElement("hr");
this.divlistResultsAddress.appendChild(this.hr)
}this.divHref.innerHTML="Lotto: "+L;
var B={idlot:L,ente:this.ente,findLot:this};
OpenLayers.Event.observe(this.divHref,"click",this.submitLot.bindAsEventListener(B))
}}}}this.findResult="LOTS LOADED";
this.events.triggerEvent("loadComplete")
},failureLot:function(A){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Errore di sistema"
}this.findResult="Errore di sistema";
this.events.triggerEvent("loadFailure");
return 
},loadVisuraLot:function(B,F){this.reset();
this.ente=B;
this.idStadioImmobileLot=F;
if(this.diverrore!=null){this.diverrore.style.display="none";
this.spanerrore.innerHTML=""
}if(F==""||F==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca informazione sul lotto"
}this.findResult="Manca informazione sul lotto";
this.events.triggerEvent("loadFailure");
return 
}var E=this.successVisuraLot.bind(this);
var A=this.failureVisuraLot.bind(this);
var G=this.createFindVisuraLotRequest(B,F);
var C=this.findVisuraLotPars+G;
var D=this.findUrl;
if(MW.Proxy&&this.findUrl.startsWith("http")){D=MW.Proxy+MW.Util.escapeUri(this.findUrl)
}if(this.map!=null){this.loading.startLoad();
if(this.map.getLayer(this.markersLayer.id)==null){this.markersLayer.displayInLayerSwitcher=false;
this.map.addLayer(this.markersLayer)
}}OpenLayers.Console.debug("Ajax request url: "+D+C);
new OpenLayers.Ajax.Request(D+C,{method:"post",parameters:null,onComplete:E,onFailure:A})
},successVisuraLot:function(I){if(I.responseXML==null&&I.responseText==null){return 
}var A=I.responseXML;
if(!A||I.fileType!="XML"){A=OpenLayers.parseXMLString(I.responseText)
}var P=A.getElementsByTagName("ErroreVisuraImmobili");
if(P!=null&&P[0]!=null&&P.length>0){var S=P[0];
var K=S.getElementsByTagName("FormatoRichiestaErrato")[0];
var O=S.getElementsByTagName("RicercaFallita")[0];
var F=S.getElementsByTagName("ErroreSistema")[0];
if(K!=null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Formato richiesta errato nella ricerca del lotto"
}this.findResult="Formato richiesta errato nella ricerca del lotto";
this.events.triggerEvent("loadFailure");
return 
}if(O!=null){if(this.diverrore!=null){this.diverrore.style.display="block";
if(O.firstChild!=null&&O.firstChild.nodeValue!=""){this.spanerrore.innerHTML=O.firstChild.nodeValue
}else{this.spanerrore.innerHTML="Nessun dato trovato con i criteri impostati"
}}if(O.firstChild!=null&&O.firstChild.nodeValue!=""){this.findResult=O.firstChild.nodeValue
}else{this.findResult="Nessun dato trovato con i criteri impostati"
}this.events.triggerEvent("loadFailure");
return 
}if(F!=null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML=F.getElementsByTagName("Descrizione")[0].firstChild.nodeValue
}this.findResult=F.getElementsByTagName("Descrizione")[0].firstChild.nodeValue;
this.events.triggerEvent("loadFailure");
return 
}}var R=A.getElementsByTagName("Identificativi");
if(R==null||R.length==0){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Lotto non trovato"
}this.findResult="Lotto non trovato";
this.events.triggerEvent("loadFailure");
return 
}var B=null;
if(R!=null||R[0]!=null){B=R[0].getElementsByTagName("IdAssolutoStadioImmobile")
}if(B==null||B[0]==null||B[0].firstChild.nodeValue==""||B[0].firstChild.nodeValue==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Lotto non trovato"
}this.findResult="Lotto non trovato";
this.events.triggerEvent("loadFailure");
return 
}if(B!=null&&B[0]!=null&&B[0].firstChild.nodeValue!=""&&B[0].firstChild.nodeValue!=null){this.idStadioImmobileLot=B[0].firstChild.nodeValue
}var L=A.getElementsByTagName("InfoSpecificheStadioLotto");
if(L==null||L.length==0||L[0]==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Lotto non trovato"
}this.findResult="Lotto non trovato";
this.events.triggerEvent("loadFailure");
return 
}if(L!=null&&L.length==1&&L[0]!=null){var E=L[0];
var G=E.getElementsByTagName("StatoLotto")[0];
if(G!=null){this.statoLot=G.getAttribute("Descrizione")
}if(E.getElementsByTagName("SuperficieFondiaria")[0]!=null&&E.getElementsByTagName("SuperficieFondiaria")[0].firstChild!=null){this.supLot=E.getElementsByTagName("SuperficieFondiaria")[0].firstChild.nodeValue
}var C=null;
if(E.getElementsByTagName("GeometriaWKT")[0]!=null&&E.getElementsByTagName("GeometriaWKT")[0].firstChild!=null){C=E.getElementsByTagName("GeometriaWKT")[0].firstChild.nodeValue
}if(C!=""&&C!=null){var V=new OpenLayers.Format.WKT();
var J=V.read(C);
this.layerSel.addFeatures([J]);
if(J!=null&&J.geometry!=null){J.geometry.calculateBounds();
var N=(J.geometry.bounds.right+J.geometry.bounds.left)/2;
var M=(J.geometry.bounds.top+J.geometry.bounds.bottom)/2;
this.lonlatLot=new OpenLayers.LonLat(N,M)
}else{if(J!=null&&J[0]!=null&&J[0].geometry!=null){J[0].geometry.calculateBounds();
var N=(J[0].geometry.bounds.right+J[0].geometry.bounds.left)/2;
var M=(J[0].geometry.bounds.top+J[0].geometry.bounds.bottom)/2;
this.lonlatLot=new OpenLayers.LonLat(N,M)
}}}if(this.lonlatLot==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Errore nel recuperare la geometria del lotto"
}this.findResult="Errore nel recuperare la geometria del lotto";
this.events.triggerEvent("loadFailure");
return 
}if(this.lonlatLot!=null){var T='<span style="font-weight:bold;font-color:black;">Lotto: '+this.idStadioImmobileLot+"</span>";
this.showMarker(this.lonlatLot,T)
}}if(this.xsl!=null){var H=I.responseText;
var Q=MW.transformXml(H,this.xsl);
Q=Q.replace(/&lt;/g,"<");
Q=Q.replace(/&gt;/g,">");
this.htmlDetail=Q;
if(this.divDetail!=null){this.divDetail.style.display="block";
this.divDetail.innerHTML=Q
}else{if(this.urlDetail!=null){var D=window.open(this.urlDetail);
D.focus();
var U=document.createElement("div");
U.innerHTML=Q;
D.document.body.appendChild(U)
}}}this.findResult="LOT LOADED";
this.events.triggerEvent("loadComplete")
},failureVisuraLot:function(A){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Errore di sistema"
}this.findResult="Errore di sistema";
this.events.triggerEvent("loadFailure");
return 
},load:function(J){this.reset();
var B=this.inputEnteVia.value;
var D=this.inputEnteParticella.value;
var H=this.inputSezione.value;
var L=this.inputFoglio.value;
var C=this.inputMappale.value;
var A=this.inputSub.value;
var K=null;
var F=null;
var G=null;
var E=null;
var I=null;
if(this.geocoding==true){I=this.inputAddress.value
}else{K=this.inputVia.value;
F=this.inputTipoToponimo.value;
G=this.inputNumero.value;
E=this.inputEsp.value
}if(this.lotcivico.checked==true){this.ente=null;
this.sezione=null;
this.foglio=null;
this.mappale=null;
this.sub=null;
this.civico=true;
if(this.geocoding==true){if(I=="ad es. via dotti francesco 2/2"){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Inserire l'indirizzo"
}this.findResult="Inserire l'indirizzo";
this.events.triggerEvent("loadFailure");
return 
}this.loadObjectFromGeocode(B,I)
}else{this.loadObjectFromVia(B,F,K,G,E)
}}if(this.lotcatasto.checked==true){this.ente=null;
this.via=null;
this.tipovia=null;
this.numero=null;
this.esponente=null;
this.idStadioImmobileVia=null;
this.idStadioImmobileCivico=null;
this.civico=false;
this.loadLotFromParticella(D,H,L,C,A)
}},submitLot:function(A){if(this.idlot!=null){this.findLot.loadVisuraLot(this.ente,this.idlot)
}},createFindLotFromCivicoRequest:function(B,A){var C='<?xml version="1.0" encoding="UTF-8"?><RichiestaRicercaImmobili xmlns="http://elisa.it/aci" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><IdEnte>'+B+"</IdEnte><ParametriRicercaLotto><IdEnte>"+B+"</IdEnte><IdCivico><IdAssolutoStadioImmobile>"+A+"</IdAssolutoStadioImmobile></IdCivico></ParametriRicercaLotto></RichiestaRicercaImmobili>";
return C
},createFindLotFromParticellaRequest:function(C,F,B,A,D){var E='<?xml version="1.0" encoding="UTF-8"?><RichiestaRicercaImmobili xmlns="http://elisa.it/aci" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><IdEnte>'+C+"</IdEnte><ParametriRicercaLotto><IdEnte>"+C+"</IdEnte><DatiParticellaTerreni>";
if(F!=null&&F!=""){E=E+"<Sezione>"+F+"</Sezione>"
}E=E+"<FoglioTerreni>"+B+"</FoglioTerreni><Mappale>"+A+"</Mappale>";
if(D!=null&&D!=""){E=E+"<Subalterno>"+D+"</Subalterno>"
}E=E+"</DatiParticellaTerreni></ParametriRicercaLotto></RichiestaRicercaImmobili>";
return E
},createFindVisuraLotRequest:function(A,B){var C='<?xml version="1.0" encoding="UTF-8"?><RichiestaVisuraImmobili xmlns="http://elisa.it/aci" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><IdEnte>'+A+"</IdEnte><IdAssolutoStadioImmobile>"+B+"</IdAssolutoStadioImmobile></RichiestaVisuraImmobili>";
return C
},reset:function(){this.markersLayer.clearMarkers();
this.idStadioImmobileLot=null;
this.statoLot=null;
this.supLot=null;
this.lonlatLot=null;
this.findResult=null;
if(this.layerSel.features!=null){this.layerSel.destroyFeatures(this.layerSel.features)
}},CLASS_NAME:"MW.Control.Aci.FindLot"});MW.Control.Aci.FindParcel=OpenLayers.Class(MW.Control.Aci.FindGeocoding,{lonlatParcel:null,parcelList:null,findParcelPars:"servizio=RicercaMappaleTerreniService&richiesta=",findVisuraParcelPars:"servizio=VisuraMappaleTerreniService&richiesta=",namespace_uri_ct:"http://www.sigmater.it/catasto",namespace_prefix_ct:"ns5",epsg:"26591",styleMap:new OpenLayers.StyleMap({"default":{fillColor:"#ffff00",fillOpacity:"0",hoverFillColor:"white",hoverFillOpacity:0.8,strokeColor:"#ffff00",strokeOpacity:1,strokeLinecap:"round",strokeWidth:2,strokeDashstyle:"solid",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:0.2,pointRadius:6,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"inherit"},temporary:{fillColor:"#ffff00",fillOpacity:"0",hoverFillColor:"white",hoverFillOpacity:0.8,strokeColor:"#ffff00",strokeOpacity:1,strokeLinecap:"round",strokeWidth:2,strokeDashstyle:"solid",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:0.2,pointRadius:6,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"inherit"}}),initialize:function(A){MW.Control.Aci.prototype.initialize.apply(this,[A]);
this.layerSel=new OpenLayers.Layer.Vector("LayerSelParcel",{styleMap:this.styleMap});
this.layerSel.displayInLayerSwitcher=false;
if(this.xslPath!=null&&this.xslPath!=""){var B=this.successXsl.bind(this);
var C=this.failureXsl.bind(this);
new OpenLayers.Ajax.Request(this.xslPath,{method:"get",parameters:null,onComplete:B,onFailure:C})
}},successXsl:function(A){this.xsl=A.responseXML
},failureXsl:function(A){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Impossibile caricare l'xsl"
}this.findResult="Impossibile caricare l'xsl";
this.events.triggerEvent("loadFailure");
return 
},draw:function(){this.loading=new MW.Control.LoadingMessage();
if(this.map!=null){this.map.addLayers([this.layerSel])
}if((this.map!=null)&&(this.loading!=null)){this.map.addControl(this.loading)
}if(this.div!=null){OpenLayers.Control.prototype.draw.apply(this,arguments);
this.div.className="MWControlFindParcel";
this.divParticella=document.createElement("div");
this.divParticella.id="searchparticella";
this.divParticella.className="MWControlParcelParticella";
this.div.appendChild(this.divParticella);
this.divText=document.createElement("div");
this.divText.className="textACI";
this.divParticella.appendChild(this.divText);
this.span=document.createElement("span");
this.span.innerHTML="Ente: ";
this.divText.appendChild(this.span);
this.inputEnteParticella=document.createElement("input");
this.inputEnteParticella.type="text";
this.inputEnteParticella.className="inputSmall";
this.inputEnteParticella.id="enteparticella";
if(this.ente!=null&&this.ente!=""){this.inputEnteParticella.value=this.ente
}this.divParticella.appendChild(this.inputEnteParticella);
this.br=document.createElement("br");
this.divParticella.appendChild(this.br);
this.divText=document.createElement("div");
this.divText.className="textACI";
this.divParticella.appendChild(this.divText);
this.span=document.createElement("span");
this.span.innerHTML="Foglio: ";
this.divText.appendChild(this.span);
this.inputFoglio=document.createElement("input");
this.inputFoglio.type="text";
this.inputFoglio.className="inputMedium";
this.inputFoglio.id="foglio";
this.inputFoglio.value="";
this.divParticella.appendChild(this.inputFoglio);
this.br=document.createElement("br");
this.divParticella.appendChild(this.br);
this.divText=document.createElement("div");
this.divText.className="textACI";
this.divParticella.appendChild(this.divText);
this.span=document.createElement("span");
this.span.innerHTML="Mappale: ";
this.divText.appendChild(this.span);
this.inputMappale=document.createElement("input");
this.inputMappale.type="text";
this.inputMappale.className="inputMedium";
this.inputMappale.id="mappale";
this.inputMappale.value="";
this.divParticella.appendChild(this.inputMappale);
this.br=document.createElement("br");
this.divParticella.appendChild(this.br);
this.br=document.createElement("br");
this.divParticella.appendChild(this.br);
this.span=document.createElement("span");
this.span.innerHTML="Cerca anche per:";
this.divParticella.appendChild(this.span);
this.br=document.createElement("br");
this.divParticella.appendChild(this.br);
this.divText=document.createElement("div");
this.divText.className="textACI";
this.divParticella.appendChild(this.divText);
this.span=document.createElement("span");
this.span.innerHTML="Sezione: ";
this.divText.appendChild(this.span);
this.inputSezione=document.createElement("input");
this.inputSezione.type="text";
this.inputSezione.id="sezione";
this.inputSezione.className="inputMedium";
this.inputSezione.value="";
this.divParticella.appendChild(this.inputSezione);
this.br=document.createElement("br");
this.divParticella.appendChild(this.br);
this.divText=document.createElement("div");
this.divText.className="textACI";
this.divParticella.appendChild(this.divText);
this.span=document.createElement("span");
this.span.innerHTML="Subalterno: ";
this.divText.appendChild(this.span);
this.inputSub=document.createElement("input");
this.inputSub.type="text";
this.inputSub.className="inputMedium";
this.inputSub.id="sub";
this.inputSub.value="";
this.divParticella.appendChild(this.inputSub);
this.br=document.createElement("br");
this.div.appendChild(this.br);
this.br=document.createElement("br");
this.div.appendChild(this.br);
this.divCommands=document.createElement("div");
this.divCommands.className="commands";
this.div.appendChild(this.divCommands);
this.input=document.createElement("input");
this.input.type="button";
this.input.className="inputButton";
this.input.value="Trova particella terreni";
this.input.style.marginTop="5px";
this.input.style.cursor="pointer";
this.divCommands.appendChild(this.input);
OpenLayers.Event.observe(this.input,"click",this.load.bind(this));
this.br=document.createElement("br");
this.div.appendChild(this.br);
this.br=document.createElement("br");
this.div.appendChild(this.br);
this.divPanel=document.createElement("div");
this.divPanel.className="parcelpanel";
this.div.appendChild(this.divPanel);
this.br=document.createElement("br");
this.div.appendChild(this.br);
this.diverrore=document.createElement("div");
this.diverrore.className="findparcelerrore";
this.div.appendChild(this.diverrore);
this.spanerrore=document.createElement("span");
this.diverrore.appendChild(this.spanerrore)
}return this.div
},destroy:function(){if(this.map!=null){if(this.markersLayer!=null){this.map.removeLayer(this.markersLayer,true);
this.markersLayer=null
}}this.map=null;
this.div=null;
if(this.events){this.events.destroy()
}this.events=null;
OpenLayers.Control.prototype.destroy.apply(this,arguments)
},loadParcelFromParticella:function(H,G,J,B,A){this.reset();
this.civico=false;
this.via=null;
this.tipovia=null;
this.numero=null;
this.esponente=null;
this.idStadioImmobileVia=null;
this.idStadioImmobileCivico=null;
this.parcelList=null;
this.ente=H;
this.sezione=G;
this.foglio=J;
this.mappale=B;
this.sub=A;
if(this.diverrore!=null){this.diverrore.style.display="none";
this.spanerrore.innerHTML=""
}if(this.divPanel!=null){this.divPanel.style.display="none";
this.divPanel.innerHTML=""
}if(H==""||H==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca l'informazione sull'ente"
}this.findResult="Manca 'informazione sull'ente";
this.events.triggerEvent("loadFailure");
return 
}if(J==""||J==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca 'nformazione sul foglio della particella"
}this.findResult="Manca 'informazione sul foglio della particella";
this.events.triggerEvent("loadFailure");
return 
}if(B==""||B==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca 'informazione sul mappale della particella"
}this.findResult="Manca 'informazione sul mappale della particella";
this.events.triggerEvent("loadFailure");
return 
}if(G!=""&&G!=null&&G.length>1){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="La sezione deve essere composta da un solo carattere"
}this.findResult="La sezione deve essere composta da un solo carattere";
this.events.triggerEvent("loadFailure");
return 
}if(J!=""&&J!=null&&J.length>5){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Il foglio deve essere composto al massimo da 5 numeri"
}this.findResult="Il foglio deve essere composto al massimo da 5 numeri";
this.events.triggerEvent("loadFailure");
return 
}if(B!=""&&B!=null&&B.length>5){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Il mappale deve essere composto al massimo da 5 numeri"
}this.findResult="Il mappale deve essere composto al massimo da 5 numeri";
this.events.triggerEvent("loadFailure");
return 
}if(A!=""&&A!=null&&A.length>4){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Il subalterno deve essere composto al massimo da 4 caratteri"
}this.findResult="Il subalterno deve essere composto al massimo da 4 caratteri";
this.events.triggerEvent("loadFailure");
return 
}if(G!=""&&G!=null&&G.length==1){G=G.toUpperCase();
pattern=/[A-Z]/;
if(!pattern.test(G)){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="La sezione deve essere un carattere compreso tra la A e la Z."
}this.findResult="La sezione deve essere un carattere compreso tra la A e la Z.";
this.events.triggerEvent("loadFailure");
return 
}}var E=this.successParcel.bind(this);
var I=this.failureParcel.bind(this);
var C=this.createFindParcelFromParticellaRequest(H,G,J,B,A);
var F=this.findParcelPars+C;
var D=this.findUrl;
if(MW.Proxy&&this.findUrl.startsWith("http")){D=MW.Proxy+MW.Util.escapeUri(this.findUrl)
}if(this.map!=null){this.loading.startLoad();
if(this.map.getLayer(this.markersLayer.id)==null){this.markersLayer.displayInLayerSwitcher=false;
this.map.addLayer(this.markersLayer)
}}OpenLayers.Console.debug("Ajax request url: "+D+F);
new OpenLayers.Ajax.Request(D+F,{method:"post",parameters:null,onComplete:E,onFailure:I})
},successParcel:function(G){if(G.responseXML==null&&G.responseText==null){return 
}var D=G.responseXML;
if(!D||G.fileType!="XML"){D=OpenLayers.parseXMLString(G.responseText)
}var H=D.getElementsByTagName("ErroreRicercaMappaleTerreni");
if(H!=null&&H[0]!=null&&H.length>0){var C=H[0];
var M=C.getElementsByTagName("FormatoRichiestaErrato")[0];
var J=C.getElementsByTagName("RicercaFallita")[0];
var I=C.getElementsByTagName("ParametriNonSelettivi")[0];
var N=C.getElementsByTagName("ErroreSistema")[0];
if(M!=null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Formato richiesta errato nella ricerca della particella"
}this.findResult="Formato richiesta errato nella ricerca della particella";
this.events.triggerEvent("loadFailure");
return 
}if(J!=null){if(this.diverrore!=null){this.diverrore.style.display="block";
if(J.firstChild!=null&&J.firstChild.nodeValue!=""){this.spanerrore.innerHTML=J.firstChild.nodeValue
}else{this.spanerrore.innerHTML="Nessun dato trovato con i criteri impostati"
}}if(J.firstChild!=null&&J.firstChild.nodeValue!=""){this.findResult=J.firstChild.nodeValue
}else{this.findResult="Nessun dato trovato con i criteri impostati"
}this.events.triggerEvent("loadFailure");
return 
}if(I!=null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML=I.firstChild.nodeValue
}this.findResult=I.firstChild.nodeValue;
this.events.triggerEvent("loadFailure");
return 
}if(N!=null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Nessuna particella trovata"
}this.findResult="Nessuna particella trovata";
this.events.triggerEvent("loadFailure");
return 
}}this.parcelList=OpenLayers.Ajax.getElementsByTagNameNS(D,this.namespace_uri_ct,this.namespace_prefix_ct,"InformazioniParticella");
if(this.parcelList==null||this.parcelList.length==0){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Nessuna particella trovata"
}this.findResult="Nessuna particella trovata";
this.events.triggerEvent("loadFailure");
return 
}if(this.parcelList!=null&&this.parcelList.length==1&&this.parcelList[0]!=null){var P=this.parcelList[0];
var E=OpenLayers.Ajax.getElementsByTagNameNS(P,this.namespace_uri_ct,this.namespace_prefix_ct,"IdentificativoParzialeParticella")[0];
this.sezione=null;
this.foglio=null;
this.mappale=null;
this.sub=null;
if(E!=null){if(OpenLayers.Ajax.getElementsByTagNameNS(E,this.namespace_uri_ct,this.namespace_prefix_ct,"Sezione")[0]!=null&&OpenLayers.Ajax.getElementsByTagNameNS(E,this.namespace_uri_ct,this.namespace_prefix_ct,"Sezione")[0].firstChild!=null){this.sezione=OpenLayers.Ajax.getElementsByTagNameNS(E,this.namespace_uri_ct,this.namespace_prefix_ct,"Sezione")[0].firstChild.nodeValue
}if(OpenLayers.Ajax.getElementsByTagNameNS(E,this.namespace_uri_ct,this.namespace_prefix_ct,"Foglio")[0]!=null&&OpenLayers.Ajax.getElementsByTagNameNS(E,this.namespace_uri_ct,this.namespace_prefix_ct,"Foglio")[0].firstChild!=null){this.foglio=OpenLayers.Ajax.getElementsByTagNameNS(E,this.namespace_uri_ct,this.namespace_prefix_ct,"Foglio")[0].firstChild.nodeValue
}if(OpenLayers.Ajax.getElementsByTagNameNS(E,this.namespace_uri_ct,this.namespace_prefix_ct,"Mappale")[0]!=null&&OpenLayers.Ajax.getElementsByTagNameNS(E,this.namespace_uri_ct,this.namespace_prefix_ct,"Mappale")[0].firstChild!=null){this.mappale=OpenLayers.Ajax.getElementsByTagNameNS(E,this.namespace_uri_ct,this.namespace_prefix_ct,"Mappale")[0].firstChild.nodeValue
}if(OpenLayers.Ajax.getElementsByTagNameNS(E,this.namespace_uri_ct,this.namespace_prefix_ct,"Subalterno")[0]!=null&&OpenLayers.Ajax.getElementsByTagNameNS(E,this.namespace_uri_ct,this.namespace_prefix_ct,"Subalterno")[0].firstChild!=null){this.sub=OpenLayers.Ajax.getElementsByTagNameNS(E,this.namespace_uri_ct,this.namespace_prefix_ct,"Subalterno")[0].firstChild.nodeValue
}}if(this.foglio==null||this.foglio==""||this.mappale==null||this.mappale==""){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Nessuna particella trovata"
}this.findResult="Nessuna particella trovata";
this.events.triggerEvent("loadFailure");
return 
}this.loadVisuraParcel(this.ente,this.sezione,this.foglio,this.mappale,this.sub);
return 
}else{if(this.parcelList!=null&&this.parcelList.length>1){for(i=0;
i<this.parcelList.length;
i++){if(this.divPanel!=null){var P=this.parcelList[i];
if(i==0){this.divImg=document.createElement("div");
this.divImg.className="listResultsImg";
var L=function(){this.divPanel.style.display="none";
this.divPanel.innerHTML=""
};
OpenLayers.Event.observe(this.divImg,"click",L.bind(this));
this.divPanel.appendChild(this.divImg);
this.img=document.createElement("img");
this.img.src=OpenLayers.ImgPath+"chiusura.gif";
this.divImg.appendChild(this.img);
this.br=document.createElement("br");
this.divPanel.appendChild(this.br);
this.divlistResultsAddress=document.createElement("div");
this.divlistResultsAddress.className="listResultsAddress";
this.divPanel.appendChild(this.divlistResultsAddress)
}this.divHref=document.createElement("a");
this.divHref.href="#";
var F=null;
var K=null;
var B=null;
var O=null;
var E=OpenLayers.Ajax.getElementsByTagNameNS(P,this.namespace_uri_ct,this.namespace_prefix_ct,"IdentificativoParzialeParticella")[0];
if(E!=null){if(OpenLayers.Ajax.getElementsByTagNameNS(E,this.namespace_uri_ct,this.namespace_prefix_ct,"Sezione")[0]!=null&&OpenLayers.Ajax.getElementsByTagNameNS(E,this.namespace_uri_ct,this.namespace_prefix_ct,"Sezione")[0].firstChild!=null){F=OpenLayers.Ajax.getElementsByTagNameNS(E,this.namespace_uri_ct,this.namespace_prefix_ct,"Sezione")[0].firstChild.nodeValue
}if(OpenLayers.Ajax.getElementsByTagNameNS(E,this.namespace_uri_ct,this.namespace_prefix_ct,"Foglio")[0]!=null&&OpenLayers.Ajax.getElementsByTagNameNS(E,this.namespace_uri_ct,this.namespace_prefix_ct,"Foglio")[0].firstChild!=null){K=OpenLayers.Ajax.getElementsByTagNameNS(E,this.namespace_uri_ct,this.namespace_prefix_ct,"Foglio")[0].firstChild.nodeValue
}if(OpenLayers.Ajax.getElementsByTagNameNS(E,this.namespace_uri_ct,this.namespace_prefix_ct,"Mappale")[0]!=null&&OpenLayers.Ajax.getElementsByTagNameNS(E,this.namespace_uri_ct,this.namespace_prefix_ct,"Mappale")[0].firstChild!=null){B=OpenLayers.Ajax.getElementsByTagNameNS(E,this.namespace_uri_ct,this.namespace_prefix_ct,"Mappale")[0].firstChild.nodeValue
}if(OpenLayers.Ajax.getElementsByTagNameNS(E,this.namespace_uri_ct,this.namespace_prefix_ct,"Subalterno")[0]!=null&&OpenLayers.Ajax.getElementsByTagNameNS(E,this.namespace_uri_ct,this.namespace_prefix_ct,"Subalterno")[0].firstChild!=null){O=OpenLayers.Ajax.getElementsByTagNameNS(E,this.namespace_uri_ct,this.namespace_prefix_ct,"Subalterno")[0].firstChild.nodeValue
}if(F!=null&&F!=""){this.divHref.innerHTML="Sezione: "+F+"; "
}this.divHref.innerHTML=this.divHref.innerHTML+"Foglio: "+K+"; Mappale: "+B;
if(O!=null&&O!=""){this.divHref.innerHTML="; Subalterno: "+O
}}if(K==null||K==""||B==null||B==""){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Errore di sistema"
}this.findResult="Errore di sistema";
this.events.triggerEvent("loadFailure");
return 
}this.divPanel.style.display="block";
this.divlistResultsAddress.appendChild(this.divHref);
if(i!=this.parcelList.length-1){this.hr=document.createElement("hr");
this.divlistResultsAddress.appendChild(this.hr)
}var A={ente:this.ente,sezione:F,foglio:K,mappale:B,sub:O,findParcel:this};
OpenLayers.Event.observe(this.divHref,"click",this.submitParcel.bindAsEventListener(A))
}}}}this.findResult="PARCELS LOADED";
this.events.triggerEvent("loadComplete")
},failureParcel:function(A){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Errore di sistema"
}this.findResult="Errore di sistema";
this.events.triggerEvent("loadFailure");
return 
},loadVisuraParcel:function(I,G,J,B,A){this.reset();
this.ente=I;
this.sezione=G;
this.foglio=J;
this.mappale=B;
this.sub=A;
if(this.diverrore!=null){this.diverrore.style.display="none";
this.spanerrore.innerHTML=""
}if(I==""||I==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca l'informazione sull'ente"
}this.findResult="Manca 'informazione sull'ente";
this.events.triggerEvent("loadFailure");
return 
}if(J==""||J==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca 'nformazione sul foglio della particella"
}this.findResult="Manca 'informazione sul foglio della particella";
this.events.triggerEvent("loadFailure");
return 
}if(B==""||B==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Manca 'informazione sul mappale della particella"
}this.findResult="Manca 'informazione sul mappale della particella";
this.events.triggerEvent("loadFailure");
return 
}if(G!=""&&G!=null&&G.length>1){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="La sezione deve essere composta da un solo carattere"
}this.findResult="La sezione deve essere composta da un solo carattere";
this.events.triggerEvent("loadFailure");
return 
}if(J!=""&&J!=null&&J.length>5){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Il foglio deve essere composto al massimo da 5 numeri"
}this.findResult="Il foglio deve essere composto al massimo da 5 numeri";
this.events.triggerEvent("loadFailure");
return 
}if(B!=""&&B!=null&&B.length>5){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Il mappale deve essere composto al massimo da 5 numeri"
}this.findResult="Il mappale deve essere composto al massimo da 5 numeri";
this.events.triggerEvent("loadFailure");
return 
}if(A!=""&&A!=null&&A.length>4){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Il subalterno deve essere composto al massimo da 4 caratteri"
}this.findResult="Il subalterno deve essere composto al massimo da 4 caratteri";
this.events.triggerEvent("loadFailure");
return 
}if(G!=""&&G!=null&&G.length==1){G=G.toUpperCase();
pattern=/[A-Z]/;
if(!pattern.test(G)){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="La sezione deve essere un carattere compreso tra la A e la Z."
}this.findResult="La sezione deve essere un carattere compreso tra la A e la Z.";
this.events.triggerEvent("loadFailure");
return 
}}var E=this.successVisuraParcel.bind(this);
var H=this.failureVisuraParcel.bind(this);
var C=this.createFindVisuraParcelRequest(I,G,J,B,A);
var F=this.findVisuraParcelPars+C;
var D=this.findUrl;
if(MW.Proxy&&this.findUrl.startsWith("http")){D=MW.Proxy+MW.Util.escapeUri(this.findUrl)
}if(this.map!=null){this.loading.startLoad();
if(this.map.getLayer(this.markersLayer.id)==null){this.markersLayer.displayInLayerSwitcher=false;
this.map.addLayer(this.markersLayer)
}}OpenLayers.Console.debug("Ajax request url: "+D+F);
new OpenLayers.Ajax.Request(D+F,{method:"post",parameters:null,onComplete:E,onFailure:H})
},successVisuraParcel:function(F){if(F.responseXML==null&&F.responseText==null){return 
}var A=F.responseXML;
if(!A||F.fileType!="XML"){A=OpenLayers.parseXMLString(F.responseText)
}var N=A.getElementsByTagName("ErroreVisuraMappaleTerreni");
if(N!=null&&N[0]!=null&&N.length>0){var P=N[0];
var I=P.getElementsByTagName("FormatoRichiestaErrato")[0];
var M=P.getElementsByTagName("RicercaFallita")[0];
var D=P.getElementsByTagName("ErroreSistema")[0];
if(I!=null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Formato richiesta errato nella ricerca della particella"
}this.findResult="Formato richiesta errato nella ricerca della particella";
this.events.triggerEvent("loadFailure");
return 
}if(M!=null){if(this.diverrore!=null){this.diverrore.style.display="block";
if(M.firstChild!=null&&M.firstChild.nodeValue!=""){this.spanerrore.innerHTML=M.firstChild.nodeValue
}else{this.spanerrore.innerHTML="Nessun dato trovato con i criteri impostati"
}}if(M.firstChild!=null&&M.firstChild.nodeValue!=""){this.findResult=M.firstChild.nodeValue
}else{this.findResult="Nessun dato trovato con i criteri impostati"
}this.events.triggerEvent("loadFailure");
return 
}if(D!=null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML=D.getElementsByTagName("Descrizione")[0].firstChild.nodeValue
}this.findResult=D.getElementsByTagName("Descrizione")[0].firstChild.nodeValue;
this.events.triggerEvent("loadFailure");
return 
}}var G=A.getElementsByTagName("DettaglioParticella");
if(G==null||G[0]==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Nessuna particella trovata"
}this.findResult="Nessuna particella trovata";
this.events.triggerEvent("loadFailure");
return 
}if(G!=null&&G.length==1&&G[0]!=null){var J=G[0];
var B=null;
if(J.getElementsByTagName("GeometriaWKT")[0]!=null&&J.getElementsByTagName("GeometriaWKT")[0].firstChild!=null){B=J.getElementsByTagName("GeometriaWKT")[0].firstChild.nodeValue
}if(B!=""&&B!=null){var S=new OpenLayers.Format.WKT();
var H=S.read(B);
this.layerSel.addFeatures([H]);
if(H!=null&&H.geometry!=null){H.geometry.calculateBounds();
var L=(H.geometry.bounds.right+H.geometry.bounds.left)/2;
var K=(H.geometry.bounds.top+H.geometry.bounds.bottom)/2;
this.lonlatParcel=new OpenLayers.LonLat(L,K)
}else{if(H!=null&&H[0]!=null&&H[0].geometry!=null){H[0].geometry.calculateBounds();
var L=(H[0].geometry.bounds.right+H[0].geometry.bounds.left)/2;
var K=(H[0].geometry.bounds.top+H[0].geometry.bounds.bottom)/2;
this.lonlatParcel=new OpenLayers.LonLat(L,K)
}}}if(this.lonlatParcel==null){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Nessuna geometria trovata"
}this.findResult="Nessuna geometria trovata";
this.events.triggerEvent("loadFailure");
return 
}if(this.lonlatParcel!=null){var Q="";
if(this.sezione!=null&&this.sezione!=""){Q='<span style="font-color:black;">Sezione: '+this.sezione+"; </span>"
}Q=Q+'<span style="font-color:black;">Foglio: '+this.foglio+"; </span>";
Q=Q+'<span style="font-color:black;">Mappale: '+this.mappale+"</span>";
if(this.sub!=null&&this.sub!=""){Q='<span style="font-color:black;">; Subalterno: '+this.sub+"</span>"
}this.showMarker(this.lonlatParcel,Q)
}}if(this.xsl!=null){var E=F.responseText;
var O=MW.transformXml(E,this.xsl);
O=O.replace(/&lt;/g,"<");
O=O.replace(/&gt;/g,">");
this.htmlDetail=O;
if(this.divDetail!=null){this.divDetail.style.display="block";
this.divDetail.innerHTML=O
}else{if(this.urlDetail!=null){var C=window.open(this.urlDetail);
C.focus();
var R=document.createElement("div");
R.innerHTML=O;
C.document.body.appendChild(R)
}}}this.findResult="PARCEL LOADED";
this.events.triggerEvent("loadComplete")
},failureVisuraParcel:function(A){if(this.diverrore!=null){this.diverrore.style.display="block";
this.spanerrore.innerHTML="Errore di sistema"
}this.findResult="Errore di sistema";
this.events.triggerEvent("loadFailure");
return 
},load:function(C){this.reset();
var E=this.inputEnteParticella.value;
var F=this.inputSezione.value;
var B=this.inputFoglio.value;
var A=this.inputMappale.value;
var D=this.inputSub.value;
this.civico=false;
this.ente=null;
this.via=null;
this.tipovia=null;
this.numero=null;
this.esponente=null;
this.idStadioImmobileVia=null;
this.idStadioImmobileCivico=null;
this.loadParcelFromParticella(E,F,B,A,D)
},submitParcel:function(A){this.findParcel.loadVisuraParcel(this.ente,this.sezione,this.foglio,this.mappale,this.sub)
},createFindParcelFromCivicoRequest:function(B,A){var C='<?xml version="1.0" encoding="UTF-8"?><RichiestaRicercaImmobili xmlns="http://elisa.it/aci" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><IdEnte>'+B+"</IdEnte><ParametriRicercaMappaleTerreni><IdEnte>"+B+"</IdEnte><DatiIndirizzo><IdCivico><IdAssolutoStadioImmobile>"+A+"</IdAssolutoStadioImmobile></IdCivico></DatiIndirizzo></ParametriRicercaMappaleTerreni></RichiestaRicercaImmobili>";
return C
},createFindParcelFromParticellaRequest:function(C,F,B,A,D){var E='<?xml version="1.0" encoding="UTF-8"?><RichiestaRicercaMappaleTerreni xmlns="http://elisa.it/aci" xmlns:aa="http://www.sigmater.it/ambitiamministrativi" xmlns:ct="http://www.sigmater.it/catasto" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><IdEnte>'+C+"</IdEnte><ct:S3RichiestaInformazioniParticelle><ct:IdentificativoParticella><aa:IdentificativoComune><aa:CodiceBelfioreComune>"+C+"</aa:CodiceBelfioreComune></aa:IdentificativoComune><ct:IdentificativoParzialeParticella>";
if(F!=null&&F!=""){E=E+"<ct:Sezione>"+F+"</ct:Sezione>"
}E=E+"<ct:Foglio>"+B+"</ct:Foglio><ct:Mappale>"+A+"</ct:Mappale>";
if(D!=null&&D!=""){E=E+"<ct:Subalterno>"+D+"</ct:Subalterno>"
}E=E+"</ct:IdentificativoParzialeParticella></ct:IdentificativoParticella></ct:S3RichiestaInformazioniParticelle></RichiestaRicercaMappaleTerreni>";
return E
},createFindVisuraParcelRequest:function(C,F,B,A,D){var E='<?xml version="1.0" encoding="UTF-8"?><RichiestaVisuraMappaleTerreni xmlns="http://elisa.it/aci" xmlns:s3="http://www.sigmater.it" xmlns:aa="http://www.sigmater.it/ambitiamministrativi" xmlns:ct="http://www.sigmater.it/catasto" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><IdEnte>'+C+"</IdEnte><ct:S3RichiestaConsultParticella><ct:ModalitaConsultazioneParticella><ct:ModalitaSituazOgg>ATTUALE</ct:ModalitaSituazOgg></ct:ModalitaConsultazioneParticella><ct:IdentificativoParticella><aa:IdentificativoComune><aa:CodiceBelfioreComune>"+C+"</aa:CodiceBelfioreComune></aa:IdentificativoComune><ct:IdentificativoParzialeParticella>";
if(F!=null&&F!=""){E=E+"<ct:Sezione>"+F+"</ct:Sezione>"
}E=E+"<ct:Foglio>"+B+"</ct:Foglio><ct:Mappale>"+A+"</ct:Mappale>";
if(D!=null&&D!=""){E=E+"<ct:Subalterno>"+D+"</ct:Subalterno>"
}E=E+"</ct:IdentificativoParzialeParticella></ct:IdentificativoParticella></ct:S3RichiestaConsultParticella><ParametriCartografia><SrsCartografia>EPSG:"+this.epsg+"</SrsCartografia></ParametriCartografia></RichiestaVisuraMappaleTerreni>";
return E
},reset:function(){this.markersLayer.clearMarkers();
this.sezione=null;
this.foglio=null;
this.mappale=null;
this.sub=null;
this.lonlatParcel=null;
this.findResult=null;
if(this.layerSel.features!=null){this.layerSel.destroyFeatures(this.layerSel.features)
}},CLASS_NAME:"MW.Control.Aci.FindParcel"});MW.Control.FloatingPanel.Info.GetFeatureInfo=OpenLayers.Class(MW.Control.FloatingPanel.Info,{layers:[],xy:null,xslPath:"../resources/xsl/buildGetFeatureInfoArcgis.xsl",info_format:"text/html",xsl:null,srs:"EPSG:3003",EVENT_TYPES:["loadComplete","loadFailure"],fallThrough:false,events:null,contextPath:null,errorXSLLoadingMessage:"Error on loading xsl",initialize:function(A){MW.Control.FloatingPanel.Info.prototype.initialize.apply(this,[A]);
this.events=new OpenLayers.Events(this,this,this.EVENT_TYPES,this.fallThrough);
var B=this.successXsl.bind(this);
var C=this.failureXsl.bind(this);
this.srs=A.srs;
OpenLayers.Console.debug("Ajax request url: "+this.xslPath);
new OpenLayers.Ajax.Request(this.xslPath,{method:"get",parameters:null,onComplete:B,onFailure:C})
},destroy:function(){MW.Control.FloatingPanel.Info.prototype.destroy.apply(this,arguments)
},loadFeature:function(){var A=this.url;
if(MW.Proxy&&this.url.startsWith("http")){A=MW.Proxy+MW.Util.escapeUri(this.url)
}if(!(this.url&&this.layers&&this.featureCount)){OpenLayers.Console.error("Some parameters are missing")
}else{A+="REQUEST=GetFeatureInfo&INFO_FORMAT="+this.info_format+"&FORMAT=jpeg&SRS="+this.srs+"&VERSION=1.1.1&HEIGHT="+this.map.size.h+"&WIDTH="+this.map.size.w+"&X="+this.xy.x+"&Y="+this.xy.y+"&BBOX="+this.map.getExtent().toBBOX()+"&FEATURE_COUNT="+this.featureCount+"&QUERY_LAYERS="+this.layers.join(",")+"&LAYERS="+this.layers.join(",")
}OpenLayers.Console.debug("Ajax request url: "+A);
new OpenLayers.Ajax.Request(A,{method:"get",parameters:null,onComplete:this.successLoadFeature.bind(this),onFailure:this.errorLoadFeature.bind(this)})
},successLoadFeature:function(B){if((B.responseXML&&B.responseXML.getElementsByTagName("ServiceException")[0]!=null)||this.statusCode=="loadFailure"){OpenLayers.Console.error("Error in response from server: "+B.responseText);
this.divInfo.innerHTML="<b>Errore nella richiesta, contattare l'amministratore.<b>"
}else{if(B.responseText){if(this.info_format.toUpperCase()=="TEXT/HTML"){var F=6;
var H=B.responseText;
var A=H.substring(H.indexOf("<body>")+F,H.indexOf("</body>"));
if(this.stringClean(A)==""){this.divInfo.innerHTML="<b>Nessun oggetto trovato nell'area selezionata.</b>"
}else{this.divInfo.innerHTML=B.responseText
}}else{var D=B.responseText;
D=this.replaceSpecialChars(D);
var E=MW.transformXml(D,this.xsl);
E=E.replace(/&lt;/g,"<");
E=E.replace(/&gt;/g,">");
this.divInfo.innerHTML=E
}}}this.statusCode="loadComplete";
this.events.triggerEvent("loadComplete");
this.div.style.display="block";
this.div.style.height=this.size.h+"px";
var G=this.size.h-25;
this.childElement.style.height=G+"px";
if(document.getElementById(this.childElement.id)==null){this.div.appendChild(this.childElement);
var C=document.getElementById("sbImgNascondi"+this.idname);
if(C!=null){C.src=OpenLayers.ImgPath+"floating/nascondi.gif"
}}this.loading.stopLoad()
},stringClean:function(A){return A.replace(/\s|\r|\n|\t/g,"")
},replaceSpecialChars:function(B){var A=B.replace("&","&amp;");
A=A.replace(/ï¿½/gi,"&agrave;");
A=A.replace(/ï¿½/gi,"&egrave;");
A=A.replace(/ï¿½/gi,"&eacute;");
A=A.replace(/ï¿½/gi,"&igrave;");
A=A.replace(/ï¿½/gi,"&ograve;");
A=A.replace(/ï¿½/gi,"&ugrave;");
return A
},errorLoadFeature:function(A){OpenLayers.Console.error("WMS loading error");
this.statusCode="loadFailure";
this.events.triggerEvent("loadFailure")
},setMousePosition:function(A){this.xy=A
},successXsl:function(A){this.xsl=A.responseXML
},failureXsl:function(A){alert(this.errorXSLLoadingMessage)
},toggleChild:function(){if(document.getElementById(this.childElement.id)==null){this.div.appendChild(this.childElement);
var A=document.getElementById("sbImgNascondi"+this.idname);
if(A!=null){A.src=OpenLayers.ImgPath+"floating/nascondi.gif"
}this.div.style.height=this.size.h+"px"
}else{this.div.removeChild(this.childElement);
var A=document.getElementById("sbImgNascondi"+this.idname);
if(A!=null){A.src=OpenLayers.ImgPath+"floating/ripristina.gif"
}this.div.style.height=""
}},CLASS_NAME:"MW.Control.FloatingPanel.Info.GetFeatureInfo"});MW.Tile=OpenLayers.Class(OpenLayers.Tile,{});MW.Tile.Image=OpenLayers.Class(OpenLayers.Tile.Image,{initialize:function(D,A,E,B,C){OpenLayers.Tile.Image.prototype.initialize.apply(this,arguments)
},initImgDiv:function(){var D=this.layer.imageOffset;
var B=this.layer.getImageSize();
if(this.layerAlphaHack){this.imgDiv=OpenLayers.Util.createAlphaImageDiv(null,D,B,null,"relative",null,null,null,true)
}else{this.imgDiv=OpenLayers.Util.createImage(null,D,B,null,"relative",null,null,true)
}this.imgDiv.className="olTileImage";
this.frame.style.zIndex=this.isBackBuffer?0:1;
this.frame.appendChild(this.imgDiv);
this.layer.div.appendChild(this.frame);
if(this.layer.opacity!=null){OpenLayers.Util.modifyDOMElement(this.imgDiv,null,null,null,null,null,null,this.layer.opacity)
}this.imgDiv.map=this.layer.map;
var C=function(){if(this.isLoading){this.isLoading=false;
this.events.triggerEvent("loadend")
}};
if(this.layerAlphaHack){OpenLayers.Event.observe(this.imgDiv.childNodes[0],"load",OpenLayers.Function.bind(C,this))
}else{OpenLayers.Event.observe(this.imgDiv,"load",OpenLayers.Function.bind(C,this))
}var A=function(){this.layer.events.triggerEvent("loadend");
if(this.imgDiv._attempts>OpenLayers.IMAGE_RELOAD_ATTEMPTS){C.call(this)
}};
OpenLayers.Event.observe(this.imgDiv,"error",OpenLayers.Function.bind(A,this))
},renderTile:function(){if(this.imgDiv==null){this.initImgDiv()
}this.imgDiv.viewRequestID=this.layer.map.viewRequestID;
if(this.layer.url instanceof Array){this.imgDiv.urls=this.layer.url.slice()
}var A=this.layer.getURL(this.bounds);
if(A!=null){this.url=this.layer.getURL(this.bounds);
OpenLayers.Util.modifyDOMElement(this.frame,null,this.position,this.size);
var B=this.layer.getImageSize();
if(this.layerAlphaHack){OpenLayers.Util.modifyAlphaImageDiv(this.imgDiv,null,null,B,this.url)
}else{OpenLayers.Util.modifyDOMElement(this.imgDiv,null,null,B);
this.imgDiv.src=this.url
}}else{this.imgDiv.style.display="none";
this.layer.events.triggerEvent("loadend");
this.isLoading=false;
this.layer.numLoadingTiles=0
}return true
}});
