OpenLayersConcelloFacade = function(map) {

	this.init(map);
}

jQuery.extend(OpenLayersConcelloFacade.prototype, {
	
		map: null,
		
		init: function(map){
	
			this.map = map;
			this.obterConcello();
		},
		
		obterConcello: function(){
			
			context = {"map":this.map};
			
			this.map.events.register('click', context, function(evt) {

				var url =  this.map.baseLayer.getFullRequestString(
		                {
		                    REQUEST: "GetFeatureInfo",
		                    EXCEPTIONS: "application/vnd.ogc.se_xml",
		                    BBOX: this.map.getExtent().toBBOX(),
		                    X: evt.xy.x,
		                    Y: evt.xy.y,
		                    INFO_FORMAT: 'application/vnd.ogc.gml',
		                    QUERY_LAYERS: this.map.baseLayer.params.LAYERS,
		                    FEATURE_COUNT: 50,
		                    WIDTH: this.map.size.w,
		                    HEIGHT: this.map.size.h,
		                    srs: 'EPSG:900913'
		                },
		                "/geoserver/wfs"
		        );
				
				
				request = OpenLayers.Request.GET({
					   url: url,
					   async: false
				});

				
				var features = new OpenLayers.Format.GML().read(request.responseText);
				
				if(features[0].attributes.pd99){
				
					HTMLConcelloFacade.verConcello(features[0].attributes.cdmuni);
				}
			});
		}
});		