$(document).ready(function() {
	$(".moreinfos").hide();
	$(".more").click(function() {
	   $(this).parent().parent().next(".moreinfos").toggleRow();
	});
	$(".more").toggle(function(){
		$(this).addClass("active");
	}, function () {
		$(this).removeClass("active");
	});
	
	$(".slideshow").each(function(){
		slideshow(this);
	});
	//NETWORK MAP
	network_active = "";
	network_active_temp = "";
	$(".network_place div").mouseover(function(){
		$(this).addClass("active");
	});
	$(".network_place div").click(function(){
		
		if(network_active!=$(this).attr("id")){
			/*v = document.getElementById(network_active);
			$(v).removeClass("active");		*/
			$(".network_place div").removeClass("active");
			$(this).addClass("active");
			
			network_active = $(this).attr("id");
			callToActionscript(network_active);
			
			var aaa = "#network_info_"+$(this).attr("rel");
			$(".mapinfo").hide();
			$(aaa).show();
		}
	});
	$(".network_place div").mouseout(function(){
		if(network_active!=$(this).attr("id")){
			$(this).removeClass("active");
		}
	});
});


//SLIDESHOW
function slideshow(t){
	var active = 1;
	var total = $(".item", $(t)).size();
	var previous = 0;
	var time = 3000;
	var easing = "linear";
	var duration = 400;
	var callback = function(){if(jQuery.browser.msie){this.style.removeAttribute('filter');}};
	$(".item:gt(0)", $(t)).animate({opacity:0},0);
	function fadeIn(){
		$(".item:eq("+previous+")", $(t)).animate({opacity:0}, 400);
		$(".item:eq("+active+")", $(t)).animate({opacity:1},{easing:easing,duration:duration,complete:callback});
		setTimeout(fadeIn,time);
		previous = active;
		active++;
		if(active>total-1){
			active = 0;
		}
	}
	function startAnim() {
		setTimeout(fadeIn,time);
	}
	startAnim();
}

//NETWORK MAP II
function network_click(id){
	network_active = id;
	$("#"+network_active).addClass("active");
	var bbb = "#network_info_"+network_active;
	$(".mapinfo").hide();
	$(bbb).show();

}
function network_over(id){
	if(id==""){
		if(network_active_temp!=network_active){
			$("#network_place_"+network_active_temp).removeClass("active");
			network_active_temp = "";
		}
	}else{
		network_active_temp = id;
		$("#network_place_"+network_active_temp).addClass("active");
	}
}
function network_off(){
	$("#"+network_active).removeClass("active");
	$(".mapinfo").hide();
	network_active = -1;
	$(".network_place div").removeClass("active");
}
function getFlashMovie(movieName){
	var isIE = navigator.appName.indexOf("Microsoft") != -1;
	return (isIE) ? window[movieName] : document[movieName];
}
function callToActionscript(str){
	getFlashMovie("map_").sendToActionscript(str);
}