$(document).ready(function() {
	$(".mapinfo").hide();
	$(".netinfo").hide();
	
	level = "1";
	mapCountry = $(".mapCountry").html();

	$(".level").html("LEVEL "+level);
	$("#network_head_zoomOut").click(function(){
			$(".mapinfos div").hide();
			$(".netinfo").hide();
			$(".network_place li").removeClass("active");
			getFlashMovie("map_").sendToActionscript_zoomOut0();
			$("#network_head_title").html(mapCountry);
			level = "1";
	});
	
	//NETWORK MAP
	network_active = "";
	network_active_temp = "";
	$(".network_place li").mouseover(function(){
		$(this).addClass("active");
		$(".level").html("LEVEL "+level);
		if(level == "1"){
			$(this).find('.netinfo').show();
		}
	});
	$(".network_place li").click(function(){	
		if(network_active!=$(this).attr("id")){
			/*v = document.getElementById(network_active);
			$(v).removeClass("active");*/
			$(".network_place li").removeClass("active");
			$(this).addClass("active");
			 	
			network_active = $(this).attr("id");
			callToActionscript(network_active);
			
			$("#network_head_title").html($("h3",$(this)).html());
			
			var aaa = "#network_info_"+$(this).attr("id").replace(/network_place_/, '');
			$(".mapinfo").hide();
			$(aaa).show();
			// aaa = #network_info_ID
			
			$('.netinfo').hide();
			$(this).find('.netinfo').show();
			level = "2";
		}
	});
	$(".network_place li").mouseout(function(){
		if(network_active!=$(this).attr("id")){
			$(this).removeClass("active");
			if(level == "1"){
				$('.netinfo').hide();	
			}
		}
	});

});

// bbb = #network_info_ID

function network_click(id){
	network_active = id;
	$("#"+network_active).addClass("active");
	var bbb = "#network_info_"+network_active;
	$(".mapinfo").hide();
	$(bbb).show();
		
	var city = "#network_place_"+network_active;
	$(city).find('.netinfo').show();
	
	$("#network_head_title").html($("h3",$(city)).html());
	level = "2";
}

function network_over(id){
	if(level == "1"){
		if(id==""){
			if(network_active_temp!=network_active){
				$("#network_place_"+network_active_temp).removeClass("active");
				$('.netinfo').hide();
				network_active_temp = "";
			}
		}else{
			network_active_temp = id;
			$("#network_place_"+network_active_temp).addClass("active");
			$('.netinfo').hide();
			$("#network_place_"+network_active_temp).find('.netinfo').show();
		}
	}
}
function network_off(){
	$("#"+network_active).removeClass("active");
	$(".mapinfo").hide();
	network_active = -1;
	
	$(".mapinfos div").hide();
	$(".netinfo").hide();
	$(".network_place li").removeClass("active");
	$("#network_head_title").html("France");
	level = "1";
}

function getFlashMovie(movieName){
	var isIE = navigator.appName.indexOf("Microsoft") != -1;
	return (isIE) ? window[movieName] : document[movieName];
}
function callToActionscript(str){
	getFlashMovie("map_").sendToActionscript(str);
}
