include("manageMenu.js", function() {
	ManageMenu("#menu", "simple");
});


function Manage(){		
	// gestion dépliage et apparition	
	if($('ssmenu')){ $('ssmenu').hide(); Effect.BlindDown('ssmenu', { duration: 0.5 }); }	
	$$('#article DIV').each(function(el){
		id = $(el).identify();
		if(id != 'mapcontainer' && id != 'homeColDroite' && id != 'etudedecas' && id != 'solutions' && !$(el).hasClassName('actu') && !$(el).hasClassName('spacer') && !$(el).hasClassName('offre')){			
			$(id).hide();
			if(id != 'axel' && id != 'antoine'){
				new Effect.BlindDown($(id), { duration: 0.5 });	
			}
		}		
		
	});	
	// changement de page
	$$('A').each(function(e){
		url = $(e).readAttribute('href');
		target = $(e).readAttribute('target');
		if(url != '' && url != '#' && url != 'javascript:void(0)' && target != '_blank'){
			Event.observe(e, "click", function(ev){			
				if($('ssmenu')) Effect.Fade('ssmenu', { duration: 0.1 });		
				if($('footer')) Effect.Fade('footer', { duration: 0.1 });
				if(!$('homeColDroite')){
					$$('#article DIV').each(function(el){
						Effect.Fade($(el).identify(), { duration: 0.1 });
					});
				}
			});
		}
	});	
	
	// flash
	if($('homeFlash')) setTimeout('flashMe("swf/animationWMM.swf", "homeFlash", 590, 288, "8.0.0", {}, {wmode: "transparent"}); ', 500);
	if($('homeFlashEn')) setTimeout('flashMe("swf/animationWMMEn.swf", "homeFlashEn", 590, 288, "8.0.0", {}, {wmode: "transparent"}); ', 500);
	
	if($('footer')){ 		
		$('footer').hide(); 
		setTimeout('Effect.BlindDown("footer", { duration: 1 }); ', 500);
	}
	
	// fiche nos offres
	if($('etudedecas')){
		$('solutions').hide();
		$('etudedecas').hide();
		$$('.rubriqueMetier').each(function(e){
			Event.observe($(e).identify(), "click", function(ev){
				el = Event.element(ev);
				$$('.rubriqueMetier').each(function(span){ $(span).removeClassName('active') });
				$(el).addClassName('active');
				if($(el).hasClassName('objectifs')){
					$('etudedecas').hide();	$('solutions').hide();	
					if($('objectifs').style.display == 'none')
						new Effect.BlindDown('objectifs', { duration: 0.5 });	
				}
				if($(el).hasClassName('etudedecas')){
					$('objectifs').hide(); $('solutions').hide();	
					if($('etudedecas').style.display == 'none')
						new Effect.BlindDown('etudedecas', { duration: 0.5 });	
				}
				if($(el).hasClassName('solutions')){
					$('etudedecas').hide(); $('objectifs').hide();	
					if($('solutions').style.display == 'none')
						new Effect.BlindDown('solutions', { duration: 0.5 });
				}
			});
		});
	}
}

Event.observe(window, "load", Manage);

function loadMap(){		
	
	$("mapcontainer").style.display = 'block';
	var map = new GMap2(document.getElementById("map"));	
	$("mapcontainer").style.display = 'none';	
	map.addControl(new GSmallMapControl());
	map.addControl(new GMapTypeControl());	
	map.enableDoubleClickZoom();
	map.setCenter(new GLatLng(48.84202745944457, 2.2200992703437805), 13);	
	var point = new GLatLng(48.84202745944457, 2.2200992703437805);	
	var icon = new GIcon();
	icon.image = 'pics/charte/white.png';
	icon.iconSize = new GSize(25, 33);
	icon.iconAnchor = new GPoint(15, 43);
	icon.infoWindowAnchor = new GPoint(5, 1);

	var marker = new GMarker(point, icon);		
	var message = '<div style="width:200px; height: 50px;"><strong>WHITE mobile media</strong> <br/>166 bureaux de la colline <br/>1 rue Royale - 92 213 Saint Cloud <br/>+33 (0)1 77 13 57 77</div>';		
	
	GEvent.addListener(marker, 'click', function() {
		marker.openInfoWindowHtml(message);
	});
	
	map.addOverlay(marker);		
	setTimeout('Effect.Appear("map", { duration: 1 });', 500);	
	Effect.BlindDown("mapcontainer", { duration: 1 });	
}

function manageEquipe(id){
	if($(id).style.overflow == 'visible' && $(id).style.display != 'none')
		Effect.BlindUp(id, { duration: 0.5 });
	else if($(id).style.overflow != 'visible' || $(id).style.display == 'none')
		Effect.BlindDown(id, { duration: 0.5 });
}
