/**
 * @author chl
 */

// Create an mzone and put it on the map.
function createArea(coordinates,data) {
    
    var area = new ItemArea(toCoordinates(coordinates));
    var coords = toCoordinates(coordinates);
	
    area.setOpacity(0.4);
    area.setFillColor('#FF0000');
    area.setTitle(data['descr']);

    map.add(area);
}




function map_position(coords)
{
    var centerOnLocation = new CoordinateRT90(coords[0], coords[1]);
 	map.setCenter(centerOnLocation);
}


/**
 * @author chl
 */
function get_mzone(mcode){ 
    $.getJSON('selections/get_mzone/' + mcode,
        function(json){
            $.each(json,
                function(i, item){					
            		for(var x = 0; x < item.Zones.length; x++) {
            			createArea(item.Zones[x].Coordinates, item.Mzone,x);
					}

                }
            );
            
        }
    );

}