var _url_scale="";var _url_image="";var _w=0;var _h=0;var _scale="";function Map_Wrapper(){this._width=0;this._height=0;this._scale=0;this._id_map=0;this._list_of_layers=new Array();this._list_of_extents=new Array()}Map_Wrapper.prototype.update_map=function(b,a,d,c,p,k,o,j,n,f,m){try{this._width=parseFloat(new Number(n));this._height=parseFloat(new Number(f));this._scale=new Number(c);this._id_map=m;if(this._list_of_extents.length==0||this._list_of_extents[0]._min_x!=parseFloat(new Number(p))||this._list_of_extents[0]._min_y!=parseFloat(new Number(o))||this._list_of_extents[0]._max_x!=parseFloat(new Number(k))||this._list_of_extents[0]._max_y!=parseFloat(new Number(j))){this._list_of_extents.unshift(new Extent(parseFloat(new Number(p)),parseFloat(new Number(o)),parseFloat(new Number(k)),parseFloat(new Number(j))));if(this._list_of_extents.length>16){this._list_of_extents.splice(16)}}_url_scale=a;_url_image=b;_w=n;_h=f;_scale=c;var g=document.getElementById("reference_map");clear_node(g);var l=document.createElement("img");g.appendChild(l);l.style.top="0px";l.style.left="0px";l.style.width="100px";l.style.height="95px";if(d!=""){l.onload=function(){loaded_ref()};l.onclick=function(e){};l.src=d}else{loaded_ref()}}catch(i){alert("Map_Wrapper.update_map(): "+i);return false}};Map_Wrapper.prototype.convert_to_geo=function(a,g){var b=a/this._width;var e=1-(g/this._height);var d=this.get_current_extent();if(d!=null){var c=d._min_x+((d._max_x-d._min_x)*b);var f=d._min_y+((d._max_y-d._min_y)*e);if(_COORDINATE_PRECISION!=0){return new Array(parseFloat(new Number(c).toFixed(_COORDINATE_PRECISION)),(new Number(f).toFixed(_COORDINATE_PRECISION)))}else{return new Array(parseFloat(new Number(c)),(new Number(f)))}}else{return null}};Map_Wrapper.prototype.convert_to_pixel=function(b,f,a){b=parseFloat(b);f=parseFloat(f);var d=this.get_current_extent();var e=((b-d._min_x)*this._width)/(d._max_x-d._min_x);var c=((f-d._min_y)*this._height)/(d._max_y-d._min_y);c=a?this._height-c:c;return new Array(e,c)};Map_Wrapper.prototype.convert_point_to_pixel=function(b,a){var c=this.convert_to_pixel(b._x,b._y,a);return new Point(c[0],c[1])};Map_Wrapper.prototype.convert_point_to_geo=function(a){var b=this.convert_to_geo(a._x,a._y);return new Point(b[0],b[1])};Map_Wrapper.prototype.clear_map=function(){clear_node(document.getElementById(_MAP_ID))};Map_Wrapper.prototype.convert_to_absolute_screen_coords=function(c,e){var d=Ext.get(_MAP_ID);var b=d.getLeft();var a=d.getTop();return new Array(c+b,e+a)};Map_Wrapper.prototype.convert_to_relative_pixel_coords=function(i,f){var a=Ext.get(_MAP_ID);var e=a.getLeft();var d=a.getTop();var c=0;var b=0;var g=0;var h=0;if(typeof(window.pageYOffset)=="number"){g=window.pageYOffset;h=window.pageXOffset}else{if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){g=document.body.scrollTop;h=document.body.scrollLeft}else{if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){g=document.documentElement.scrollTop;h=document.documentElement.scrollLeft}}}c=i+h-e;b=f+g-d;return new Array(c,b)};Map_Wrapper.prototype.convert_to_reference_relative_pixel_coords=function(i,f){var a=Ext.get("reference_map");var e=a.getLeft();var d=a.getTop();var c=0;var b=0;var g=0;var h=0;if(typeof(window.pageYOffset)=="number"){g=window.pageYOffset;h=window.pageXOffset}else{if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){g=document.body.scrollTop;h=document.body.scrollLeft}else{if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){g=document.documentElement.scrollTop;h=document.documentElement.scrollLeft}}}c=i+h-e;b=f+g-d;return new Array(c,b)};Map_Wrapper.prototype.deg_to_rad=function(a){return a*Math.PI/180};Map_Wrapper.prototype.rad_to_deg=function(a){return a*180/Math.PI};Map_Wrapper.prototype.calculate_circle_point_from_2_points=function(m,l,g){var d=m.distance(l);var f=new Point((m._x+l._x)/2,(m._y+l._y)/2);var j=0,i=0;if(g>0){j=f._x+Math.sqrt(Math.pow(g,2)-Math.pow(d/2,2))*(m._y-l._y)/d;i=f._y+Math.sqrt(Math.pow(g,2)-Math.pow(d/2,2))*(l._x-m._x)/d}else{j=f._x-Math.sqrt(Math.pow(Math.abs(g),2)-Math.pow(d/2,2))*(m._y-l._y)/d;i=f._y-Math.sqrt(Math.pow(Math.abs(g),2)-Math.pow(d/2,2))*(l._x-m._x)/d}var b=new Point(j,i);if(isNaN(b._x)||isNaN(b._y)){throw _MSG_RADIUS_NOT_VALID}f=new Point((m._x+l._x)/2,(m._y+l._y)/2);var e=new Point(1,0);e._x=e._x*Math.abs(g);e._y=e._y*Math.abs(g);e._x=e._x+b._x;e._y=e._y+b._y;var c=new Array(e._x-b._x,e._y-b._y);var h=new Array(f._x-b._x,f._y-b._y);var a=parseInt(_MAP_WRAPPER.rad_to_deg(_GENERIC_GIS_UTILS.vectors_angle(c,h)));if(h[1]<0){a=360-a}var k=new Point(Math.cos(_MAP_WRAPPER.deg_to_rad(a)),Math.sin(_MAP_WRAPPER.deg_to_rad(a)));k._x=k._x*Math.abs(g);k._y=k._y*Math.abs(g);k._x=k._x+b._x;k._y=k._y+b._y;return k};Map_Wrapper.prototype.decode_multi_curve_from_xml=function(h){var a=new Line_Path();a._type="MULTICURVE";var s=h.getElementsByTagName("compound_curve");var o=h.getElementsByTagName("id_geometry")[0].hasChildNodes()?h.getElementsByTagName("id_geometry")[0].firstChild.nodeValue:"";a._id_geometry=o;for(var u=0;u<s.length;u++){var x=s[u];var k=new Line_Path();for(var v=0;v<x.childNodes.length;v++){var w=x.childNodes[v];if(w.nodeName=="arc"){var d=new Point(w.getElementsByTagName("point")[0].childNodes[0].firstChild.nodeValue,w.getElementsByTagName("point")[0].childNodes[1].firstChild.nodeValue);var c=new Point(w.getElementsByTagName("point")[1].childNodes[0].firstChild.nodeValue,w.getElementsByTagName("point")[1].childNodes[1].firstChild.nodeValue);var b=new Point(w.getElementsByTagName("point")[2].childNodes[0].firstChild.nodeValue,w.getElementsByTagName("point")[2].childNodes[1].firstChild.nodeValue);var l=new Arc(d,c,b);l._optimized_drawing=true;l._id_geometry=o;k.add_graphics(l)}if(w.nodeName=="linestring"){var d=null;var c=null;var m=null;var p=w.getElementsByTagName("point");for(var n=0;n<p.length;n++){if(n+1==p.length){break}d=new Point(w.getElementsByTagName("point")[n].childNodes[0].firstChild.nodeValue,w.getElementsByTagName("point")[n].childNodes[1].firstChild.nodeValue);c=new Point(w.getElementsByTagName("point")[(n+1)].childNodes[0].firstChild.nodeValue,w.getElementsByTagName("point")[(n+1)].childNodes[1].firstChild.nodeValue);m=new Line(d,c);m._optimized_drawing=true;m._id_geometry=o;k.add_graphics(m)}}if(w.nodeName=="circle"){var d=new Point(w.getElementsByTagName("point")[0].childNodes[0].firstChild.nodeValue,w.getElementsByTagName("point")[0].childNodes[1].firstChild.nodeValue);var b=new Point(w.getElementsByTagName("point")[2].childNodes[0].firstChild.nodeValue,w.getElementsByTagName("point")[2].childNodes[1].firstChild.nodeValue);var e=d.distance(b)/2;var r=new Point((d._x+b._x)/2,((d._y+b._y)/2));var f=new Circle(r,e);f._optimized_drawing=true;f._id_geometry=o;k.add_graphics(f)}}a.add_graphics(k)}var q=false;var v=0;while(true){if(v+1==a._list_of_graphics.length){break}var k=a._list_of_graphics[v];var t=a._list_of_graphics[v+1];q=false;var g=k._list_of_graphics[k._list_of_graphics.length-1];var y=t._list_of_graphics[0];if(g instanceof Line){if(y instanceof Line){if(g.equals(y)){q=true}}else{if(y instanceof Arc){if(g._p1.equals(y._p1)||g._p1.equals(y._p3)||g._p2.equals(y._p1)||g._p2.equals(y._p3)){q=true}}}}else{if(g instanceof Arc){if(y instanceof Line){if(g._p1.equals(y._p1)||g._p1.equals(y._p2)||g._p3.equals(y._p1)||g._p3.equals(y._p2)){q=true}}else{if(y instanceof Arc){if(g._p1.equals(y._p1)||g._p1.equals(y._p3)||g._p3.equals(y._p1)||g._p3.equals(y._p3)){q=true}}}}}if(q){k._list_of_graphics=k._list_of_graphics.concat(t._list_of_graphics);a._list_of_graphics.splice(v+1,1);v=0}else{v++}}return a};Map_Wrapper.prototype.decode_multi_surface_from_xml=function(a){var h=new Line_Path();var k=a.getElementsByTagName("curve_polygon");var d=a.getElementsByTagName("id_geometry")[0].hasChildNodes()?a.getElementsByTagName("id_geometry")[0].firstChild.nodeValue:"";h._id_geometry=d;h._type="MULTISURFACE";for(var c=0;c<k.length;c++){var f=k[c];var g=this.decode_compound_curve_from_xml(f.getElementsByTagName("exterior_ring")[0].getElementsByTagName("compound_curve")[0]);var e=f.getElementsByTagName("interior_ring");for(var b=0;b<e.length;b++){g.add_graphics(this.decode_compound_curve_from_xml(e[b].getElementsByTagName("compound_curve")[0]))}h.add_graphics(g)}return h};Map_Wrapper.prototype.decode_compound_curve_from_xml=function(r){var x=new Line_Path();for(var t=0;t<r.childNodes.length;t++){var v=r.childNodes[t];if(v.nodeName=="arc"){var c=new Point(v.getElementsByTagName("point")[0].childNodes[0].firstChild.nodeValue,v.getElementsByTagName("point")[0].childNodes[1].firstChild.nodeValue);var b=new Point(v.getElementsByTagName("point")[1].childNodes[0].firstChild.nodeValue,v.getElementsByTagName("point")[1].childNodes[1].firstChild.nodeValue);var a=new Point(v.getElementsByTagName("point")[2].childNodes[0].firstChild.nodeValue,v.getElementsByTagName("point")[2].childNodes[1].firstChild.nodeValue);var h=new Arc(c,b,a);h._optimized_drawing=true;x.add_graphics(h)}if(v.nodeName=="linestring"){var c=null;var b=null;var l=null;var n=v.getElementsByTagName("point");for(var m=0;m<n.length;m++){if(m+1==n.length){break}c=new Point(v.getElementsByTagName("point")[m].childNodes[0].firstChild.nodeValue,v.getElementsByTagName("point")[m].childNodes[1].firstChild.nodeValue);b=new Point(v.getElementsByTagName("point")[(m+1)].childNodes[0].firstChild.nodeValue,v.getElementsByTagName("point")[(m+1)].childNodes[1].firstChild.nodeValue);l=new Line(c,b);l._optimized_drawing=true;x.add_graphics(l)}}if(v.nodeName=="circle"){var c=new Point(v.getElementsByTagName("point")[0].childNodes[0].firstChild.nodeValue,v.getElementsByTagName("point")[0].childNodes[1].firstChild.nodeValue);var b=new Point(v.getElementsByTagName("point")[1].childNodes[0].firstChild.nodeValue,v.getElementsByTagName("point")[1].childNodes[1].firstChild.nodeValue);var a=new Point(v.getElementsByTagName("point")[2].childNodes[0].firstChild.nodeValue,v.getElementsByTagName("point")[2].childNodes[1].firstChild.nodeValue);var e=_GENERIC_GIS_UTILS.calculate_radius(c,b,a);var o=new Point((c._x+b._x)/2,(c._y+b._y)/2);var w=new Point((b._x+a._x)/2,(b._y+a._y)/2);var y=-1/((b._y-c._y)/(b._x-c._x));var g=-1/((a._y-b._y)/(a._x-b._x));var u=-y*o._x+o._y;var d=-g*w._x+w._y;var s=new Point(c._x,c._x*y+u);var p=new Point(b._x,b._x*g+d);var k=new Parametric_Line(o,s);var j=new Parametric_Line(w,p);var q=_GENERIC_GIS_UTILS.intersect_lines(k,j);var f=new Circle(q,e);f._optimized_drawing=true;x.add_graphics(f)}}return x};Map_Wrapper.prototype.decode_points_from_xml=function(c){var e=c.getElementsByTagName("point");var b=new Array();for(var d=0;d<e.length;d++){var a=new Point(e[d].getElementsByTagName("x")[0].firstChild.nodeValue,e[d].getElementsByTagName("y")[0].firstChild.nodeValue);a._id_geometry=e[d].getElementsByTagName("id_geometry")[0].firstChild.nodeValue;a._snap_type=e[d].getElementsByTagName("snap_type")[0].firstChild.nodeValue;b.push(a)}return b};Map_Wrapper.prototype.decode_linestring_from_xml=function(j){var b=new Line_Path();var a=j.getElementsByTagName("linestring");for(var c=0;c<a.length;c++){var e=a[c].getElementsByTagName("point");for(var g=0;g<e.length;g++){if(g+1==e.length){break}var f=new Point(e[g].getElementsByTagName("x")[0].firstChild.nodeValue,e[g].getElementsByTagName("y")[0].firstChild.nodeValue);var d=new Point(e[g+1].getElementsByTagName("x")[0].firstChild.nodeValue,e[g+1].getElementsByTagName("y")[0].firstChild.nodeValue);var h=new Line(f,d);h._optimized_drawing=true;b.add_graphics(h)}}return b};Map_Wrapper.prototype.gauss_elimination=function(h,d){var c=d;var k=h;var f,e;var g=new Array();b();l();for(f=0;f<c;++f){g[f]=k[f][c]}return g;function b(){var p,n,m,a,o;for(p=0;p<c;++p){a=p;for(n=p+1;n<c;++n){if(k[n][p]>k[a][p]){a=n}}for(n=0;n<c+1;++n){o=k[a][n];k[a][n]=k[p][n];k[p][n]=o}for(n=c;n>=p;--n){for(m=p+1;m<c;++m){k[m][n]-=k[m][p]/k[p][p]*k[p][n]}}}}function l(){var m,a;for(m=c-1;m>=0;--m){k[m][c]=k[m][c]/k[m][m];k[m][m]=1;for(a=m-1;a>=0;--a){k[a][c]-=k[a][m]*k[m][c];k[a][m]=0}}}};Map_Wrapper.prototype.check_is_layer_measure=function(a){if(a&&a._is_measure==true){return true}else{return false}};Map_Wrapper.prototype.clear_layers=function(){this._list_of_layers=new Array()};Map_Wrapper.prototype.add_layer=function(a){this._list_of_layers.push(a)};Map_Wrapper.prototype.activate_layers=function(){for(var a=0;a<this._list_of_layers.length;a++){this._list_of_layers[a]._active=true}};Map_Wrapper.prototype.deactivate_layers=function(){for(var a=0;a<this._list_of_layers.length;a++){this._list_of_layers[a]._active=false}};Map_Wrapper.prototype.activate_selected_layers=function(){for(var a=0;a<this._list_of_layers.length;a++){if(this.is_layer_selected(this._list_of_layers[a])){this._list_of_layers[a]._active=true}}};Map_Wrapper.prototype.deactivate_selected_layers=function(){for(var a=0;a<this._list_of_layers.length;a++){if(this.is_layer_selected(this._list_of_layers[a])){this._list_of_layers[a]._active=false}}};Map_Wrapper.prototype.change_layer_status=function(b){for(var a=0;a<this._list_of_layers.length;a++){if(this._list_of_layers[a]._name==b){if(this._list_of_layers[a]._active){this._list_of_layers[a]._active=false}else{this._list_of_layers[a]._active=true}}}};Map_Wrapper.prototype.get_layer_by_id=function(b){for(var a=0;a<this._list_of_layers.length;a++){if(this._list_of_layers[a]._id==b){return this._list_of_layers[a]}}return null};Map_Wrapper.prototype.get_layer_by_name=function(b){for(var a=0;a<this._list_of_layers.length;a++){if(this._list_of_layers[a]._name==b){return this._list_of_layers[a]}}return null};Map_Wrapper.prototype.evt_select_layer=function(a){var d=this.get_layer_by_id(a.id.split("_")[1]);if(d){if(d._selected==true){d._selected=false}else{if(!_CTRL_KEY_DOWN){for(var c=0;c<this._list_of_layers.length;c++){this._list_of_layers[c]._selected=false}}d._selected=true}var b=document.getElementById(_LAYERS_ID).firstChild;for(var c=0;c<b.rows.length;c++){d=this.get_layer_by_id(b.rows[c].id.split("_")[1]);if(d){if(d._selected){if(d._snap){b.rows[c].className="layer_snap_selected"}else{b.rows[c].className="layer_selected"}}else{if(d._snap){b.rows[c].className="layer_snap"}else{b.rows[c].className="layer"}}}}}};Map_Wrapper.prototype.evt_expand_layer=function(f,d){var c=this.get_layer_by_id(f.id.split("_")[1]);c._expand=d;var a=document.getElementById(_LAYERS_ID).firstChild;var e=false;for(var b=0;b<a.rows.length;b++){if(a.rows[b].id!=""){if(a.rows[b].id==f.id){e=true}else{e=false}continue}if(e){if(d){a.rows[b].style.display=""}else{a.rows[b].style.display="none"}}}clear_node(f);if(d){f.appendChild(document.createTextNode("-"))}else{f.appendChild(document.createTextNode("+"))}};Map_Wrapper.prototype.set_snap_selected_layers=function(a){try{if(a){var g="type=layer&action=check_metadata&layers=";for(var d=0;d<this._list_of_layers.length;d++){var c=this._list_of_layers[d];if(this.is_layer_selected(c)){if(!c._active){alert(c._name+": Livello non attivo!");return}g+=c._name+"#"}}loading_message(true);process_ajax_sync_call(g,_CNTR_LAYER_EDITOR,function(h){try{if(!h){for(var k=0;k<_MAP_WRAPPER._list_of_layers.length;k++){var j=_MAP_WRAPPER._list_of_layers[k];if(_MAP_WRAPPER.is_layer_selected(j)&&!_MAP_WRAPPER.is_layer_snap(j)){j._snap=true}}top.loading_message(false)}else{top.loading_message(false)}}catch(l){alert("process_ajax_call: "+l);top.loading_message(false)}})}else{for(var d=0;d<this._list_of_layers.length;d++){var c=this._list_of_layers[d];if(this.is_layer_selected(c)){c._snap=false}}}var b=document.getElementById(_LAYERS_ID).firstChild;for(var d=0;d<b.rows.length;d++){c=this.get_layer_by_id(b.rows[d].id.split("_")[1]);if(c){if(this.is_layer_selected(c)){if(this.is_layer_snap(c)){b.rows[d].className="layer_snap_selected"}else{b.rows[d].className="layer_selected"}}else{if(this.is_layer_snap(c)){b.rows[d].className="layer_snap"}else{b.rows[d].className="layer"}}}}}catch(f){throw"Map_Wrapper.set_snap_selected_layers: "+f}};Map_Wrapper.prototype.check_is_layer_selected=function(){if(this.count_layer_selected()!=1){_OP_USER=new Idle();alert(_MSG_SELECT_LAYER);return false}else{return true}};Map_Wrapper.prototype.count_layer_selected=function(){var b=0;for(var a=0;a<this._list_of_layers.length;a++){if(this._list_of_layers[a]._selected){b++}}return b};Map_Wrapper.prototype.is_layer_selected=function(b){for(var a=0;a<this._list_of_layers.length;a++){if(this._list_of_layers[a]._id==b._id&&this._list_of_layers[a]._name==b._name){return this._list_of_layers[a]._selected}}return false};Map_Wrapper.prototype.check_is_object_selected=function(){if(_LIST_OF_SELECTED_OBJECTS.length==0){_OP_USER=new Idle();alert(_MSG_SELECT_OBJECT);return false}else{return true}};Map_Wrapper.prototype.is_layer_snap=function(b){for(var a=0;a<this._list_of_layers.length;a++){if(this._list_of_layers[a]._id==b._id&&this._list_of_layers[a]._name==b._name){return this._list_of_layers[a]._snap}}return false};Map_Wrapper.prototype.is_layer_expanded=function(b){for(var a=0;a<this._list_of_layers.length;a++){if(this._list_of_layers[a]._id==b._id&&this._list_of_layers[a]._name==b._name){return this._list_of_layers[a]._expand}}return false};Map_Wrapper.prototype.get_selected_layer=function(){for(var a=0;a<this._list_of_layers.length;a++){if(this._list_of_layers[a]._selected){return this._list_of_layers[a]}}return null};Map_Wrapper.prototype.load_layers=function(a){try{_OP_USER._map_loading=true;var f;if(a){var c=Ext.get(_WINDOW_ID);f="type=layers&action=load&client_width="+c.getWidth()+"&client_height="+c.getHeight()}else{f="type=layers&action=update&layers=";for(var b=0;b<this._list_of_layers.length;b++){f+=this._list_of_layers[b].to_post_request()+"#"}}loading_message(true);process_ajax_sync_call(f,_CNTR_EVENTS_URL,function(u){try{if(!u){var t=document.getElementById(_LAYERS_ID);clear_node(t);t.style.visibility="hidden";var p=this.responseXML.getElementsByTagName("layer");var j=new Array();_IMAGES_TO_LOAD=this.responseXML.getElementsByTagName("object").length;var h=true;var r=document.createElement("table");if(typeof r.onselectstart!="undefined"){r.onselectstart=function(){return false}}else{if(typeof r.style.MozUserSelect!="undefined"){r.style.MozUserSelect="none"}else{r.onmousedown=function(){return false}}}t.appendChild(r);r.style.borderSpacing="0px";r.style.width="100%";r.style.borderCollapse="collapse";var l=null;var v=null;for(var n=0;n<p.length;n++){var o=new Layer();o._id=p[n].getElementsByTagName("id")[0].firstChild.nodeValue;o._name=p[n].getElementsByTagName("name")[0].firstChild.nodeValue;if(p[n].getElementsByTagName("active")[0].firstChild.nodeValue=="true"){o._active=true}else{o._active=false}if(p[n].getElementsByTagName("is_measure")[0].firstChild.nodeValue=="true"){o._is_measure=true}else{o._is_measure=false}j.push(o);l=r.insertRow(-1);l.id="layer_"+o._id;if(_MAP_WRAPPER.is_layer_selected(o)){if(o._active&&_MAP_WRAPPER.is_layer_snap(o)){l.className="layer_snap_selected";o._snap=true}else{l.className="layer_selected"}o._selected=true}else{if(o._active&&_MAP_WRAPPER.is_layer_snap(o)){l.className="layer_snap";o._snap=true}else{l.className="layer"}}l.onclick=function(){_MAP_WRAPPER.evt_select_layer(this)};Ext.get(l.id).on({contextmenu:function(x,i){var y=null;var e=_MAP_WRAPPER.get_layer_by_id(i.parentNode.id.split("_")[1]);if(e&&!_MAP_WRAPPER.is_layer_selected(e)){_MAP_WRAPPER.evt_select_layer(i.parentNode)}if(_MAP_WRAPPER.count_layer_selected()==1){y=factory_generic_gis_menu("context_menu_single")}else{if(_MAP_WRAPPER.count_layer_selected()>1){y=factory_generic_gis_menu("context_menu_multi")}}y.on({hide:function(){this.destroy()}});y.showAt(x.xy)},scope:this,preventDefault:true});v=l.insertCell(-1);v.className="testo_normale";var s=document.createElement("input");s.type="checkbox";s.name="livello";s.value=o._name;s.onclick=function(e){layer_change(this);if(!e){e=window.event}stop_propagating_event(e)};v.appendChild(s);v.appendChild(document.createTextNode(" "+o._name));if(o._active){s.checked=true;var k=p[n].getElementsByTagName("object");if(k.length>0){v=l.insertCell(-1);v.className="testo_normale";v.id="layer_"+o._id;v.style.width="2px";v.style.textAlign="center";if(_MAP_WRAPPER._list_of_layers.length==0||_MAP_WRAPPER.is_layer_expanded(o)){o._expand=true;v.appendChild(document.createTextNode("-"))}else{v.appendChild(document.createTextNode("+"));o._expand=false}v.onclick=function(i){var e=_MAP_WRAPPER.get_layer_by_id(this.id.split("_")[1]);if(_MAP_WRAPPER.is_layer_expanded(e)){_MAP_WRAPPER.evt_expand_layer(this,false)}else{_MAP_WRAPPER.evt_expand_layer(this,true)}if(!i){i=window.event}stop_propagating_event(i)}}else{v=l.insertCell(-1);v.style.width="2px"}for(var w=k.length-1;w>=0;w--){var g=k[w];l=r.insertRow(-1);if(!o._expand){l.style.display="none"}v=l.insertCell(-1);v.id="layer_"+n+"_object_"+w;v.className="testo_normale";v.colSpan="2";Ext.get(v.id).on({contextmenu:function(){},scope:this,preventDefault:true});var m=document.createElement("img");v.appendChild(m);m.src=g.getElementsByTagName("url")[0].firstChild.nodeValue;m.onload=layer_image_loaded;v.appendChild(document.createTextNode(" "+g.getElementsByTagName("name")[0].firstChild.nodeValue));h=false}}else{v=l.insertCell(-1);v.style.width="2px"}}_MAP_WRAPPER._list_of_layers=j;if(h){reload_map("type=map&action=load")}}else{top.loading_message(false)}}catch(q){alert("process_ajax_call: "+q);top.loading_message(false)}})}catch(d){throw"Map_Wrapper.load_layers: "+d;top.loading_message(false)}};Map_Wrapper.prototype.resize_map_image=function(k){try{clear_extra_graphics(_ALL_DRAWING_ENGINES);var c=document.getElementById(_MAP_ID);var g=c.firstChild;var i=this._width;var d=this._height;var f=i*k;var b=d*k;g.style.position="absolute";g.style.width=f+"px";g.style.height=b+"px";var a=(f-i);var h=(b-d);if(a>0){g.style.left="-"+a/2+"px";g.style.top="-"+h/2+"px"}else{if(a<=0){g.style.left=Math.abs(a/2)+"px";g.style.top=Math.abs(h/2)+"px"}}}catch(j){throw"Map_Wrapper.resize_map_image: "+j}};Map_Wrapper.prototype.get_current_extent=function(){try{return this._list_of_extents[0]}catch(a){throw"Map_Wrapper.get_current_extent: "+a}};Map_Wrapper.prototype.show_snap_point_icon=function(b,a,c){try{var f=document.getElementById("snap_point");f.style.visibility="visible";if(c==_SNAP_NEW_POINT){f.className="snap_new_point"}else{if(c==_SNAP_EXISTING_POINT){f.className="snap_existing_point"}}f.style.left=b+5+"px";f.style.top=a+5+"px"}catch(d){throw"Map_Wrapper.show_snap_point_icon: "+d}};Map_Wrapper.prototype.clear_snap_point=function(){try{clearTimeout(_TIMEOUT_FUNCTION);var b=document.getElementById("snap_point");b.style.visibility="hidden";b.style.left="-20px";b.style.top="-20px"}catch(a){throw"Map_Wrapper.show_snap_point_icon: "+a}};function loaded_ref(){loading_message(false);var c=document.getElementById(_SCALE_ID);clear_node(c);if(parseInt(_scale)>0){c.appendChild(document.createTextNode(_MSG_SCALE+": 1:"+parseInt(_scale)))}else{c.appendChild(document.createTextNode(_MSG_SCALE+": "+parseInt(1/_scale)+":1"))}var b=document.getElementById(_MAP_ID);clear_node(document.getElementById(_MAP_ID));b.style.left=0;b.style.top=0;var a=document.createElement("img");b.appendChild(a);a.width=_w;a.height=_h;a.top="0px";a.left="0px";a.style.overflow="hidden";a.onload=function(){loaded_map()};a.src=_url_image}function loaded_map(){if(_LIST_OF_EXTRA_GRAPHICS==null||_LIST_OF_EXTRA_GRAPHICS.lenght==0){alert("EXTRA_GRAPHICS NULL")}clear_extra_graphics(_ALL_DRAWING_ENGINES);draw_extra_graphics(true,_ALL_DRAWING_ENGINES);if(_WIN!=null&&_WIN.close){_WIN.close()}_EXT_ZOOMSLIDER.setValue(0);var a=_MAP_LOADED_LIST_OF_LISTENERS.length;for(var b=0;b<_MAP_LOADED_LIST_OF_LISTENERS.length;b++){_MAP_LOADED_LIST_OF_LISTENERS[b].call();if(_MAP_LOADED_LIST_OF_LISTENERS.length!=a){b+=(_MAP_LOADED_LIST_OF_LISTENERS.length-a);a--}}if(!_EXT_LAYERS_PANEL.hidden){document.getElementById(_LAYERS_ID).style.visibility="visible"}_OP_USER._map_loading=false};
