var map_handler = new Class({
	
	initialize: function(region_id) {		
		$('container-overlay').setStyle('background', 'none');
		$('container-overlay').getElements('div')[0].setStyle('background', 'none');	
		div = new Element('div', {
			'styles': {
				'background-color': 'black',
				'opacity': '0.5',
				'-ms-filter': '\"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)\"',
				'filter': 'alpha(opacity=50)',       
				'height': document.getScrollSize().y + 'px',
				'width': '100%',
				'position': 'absolute',
				'top': '0',
				'left': '0',
				'z-index': '2'
			}
		});
		div.inject($('container-overlay'), 'before');
		$('head_login').dispose();
		el = $('region_' + region_id);
		if(el) {
			rad = new Element('span', {
				'styles': {'position': 'absolute',
							'width': '60px',
							'height': '60px',
							'top':	parseInt(el.getStyle('top'))-20+'px',
							'left': parseInt(el.getStyle('left'))+'px',
						 	'z-index': '0',
							'background': 'url("../img/new_layout/map/radius.png")'}
			});
			rad.inject(el, 'after');
		}		
		$('by_launch').toggle();
		$('container-overlay').setStyle('height', '650px');
		$('container-overlay').getElements('div.map').each(function(map){
			map.getElements('a').each(function(item) {
				region_id = item.id.split('_')[1];
				if(region_id) {
					item.set('href', document.location.pathname + ((document.location.pathname.substr(document.location.pathname.length-1,1) == '/') ? '' : '/') + 'region,' + region_id);
				}
			});
			/*map.getParent('div').getElements('p.country').each(function(p) {
				p.getElements('a').each(function(a){
				a.addEvent('click', function() {
						if(a.get('id') == 'country_at') {
							$('map_at').setStyle('display', 'block');
							$('map_by').setStyle('display', 'none');
						}
						else {
							$('map_at').setStyle('display', 'none');
							$('map_by').setStyle('display', 'block');
						}
						return false;
					});
				});
			});*/
		});
				
	}
});
