// JavaScript Document
		var map,orto,topo,cada;
        function init(){
	    map = new OpenLayers.Map('map2', {
	    	maxExtent: new OpenLayers.Bounds(300000,4231159.51231902464,655000,4475000), 
		resolutions: new Array( 
				317.50063500127,
				158.750317500635,
				105.833545000423,
				52.9167725002117,
				26.4583862501058,
				13.2291931250529,
				6.61459656252646,
				5.29167725002117,
				3.96875793751588,
				2.64583862501058,
				1.32291931250529,
				0.661459656252646,
				0.264583862501058			
			),
                        
		tileOrigin: new OpenLayers.LonLat(300000,4475000),
		units: 'm',
		maxResolution: 317.50063500127, 
		projection:'EPSG:25831',
		tsize : new OpenLayers.Size(256,256)
	    } );

            orto = new OpenLayers.Layer.AGS( "Ortofotografia",
                "http://ideib.caib.es/arcgis/server/arcgiscache/public_Ortofoto/Layers", 
                {
                        layername: '_alllayers',
                        buffer:0, 
                        type:'jpg',
                        tileOrigin: new OpenLayers.LonLat(300000,4475000)
                } );           
            topo = new OpenLayers.Layer.AGS( "Mapa topogrāfic",
                "http://ideib.caib.es/arcgis/server/arcgiscache/public_MTIB/Layers", 
                {
                        layername: '_alllayers', 
                        type:'png',
                        buffer:0,
                        tileOrigin: new OpenLayers.LonLat(300000,4475000),
                        visibility:false
                } );
		
	     cada = new OpenLayers.Layer.WMS( "Cadastre)", 
                "http://ovc.catastro.meh.es/Cartografia/WMS/ServidorWMS.aspx?", 
                {
                    layers: 'Catastro'	
                }, 
                {
                    singleTile: true,
                    maxExtent: new OpenLayers.Bounds(300000,4231159,655000,4475000), 
                    maxResolution: 'auto', 
                    projection:'EPSG:25831',     
                    units: 'm'
                }
            );
		
	    var iconSize =  new OpenLayers.Size(15,15);
            var iconOffset = new OpenLayers.Pixel(-(iconSize.w/2), -iconSize.h);		
	    var marcadorsLayer = new OpenLayers.Layer.Markers("SITIBSA");
	    var marcador = new OpenLayers.Marker(
			new OpenLayers.LonLat(470460,4380430),
			new OpenLayers.Icon('i/marker.png',iconSize,iconOffset)
	    );
	    marcadorsLayer.addMarker(marcador);

	    map.addLayers([orto,topo,cada,marcadorsLayer]);

	    var scaleLine = new OpenLayers.Control.ScaleLine();
            scaleLine.bottomOutUnits = "";
            scaleLine.bottomInUnits = "";
            map.addControl(scaleLine);

            map.setCenter(new OpenLayers.LonLat(470460,4380430),9,true,true);
        }
	
	function canviar(opcio)
	{
		if (opcio==1)
			map.setBaseLayer(orto);
		else if (opcio==2)
			map.setBaseLayer(topo);
		else if (opcio==3)
      map.setBaseLayer(cada);		 
	}
