/*
Site	: http://www.sohamsounds.fr
Date	: 2007-02-01
*/

//
// Init
window.onload = init;
var current;

//
// Init.
// Setup elements & behaviours bindings.
function init(element){
	var menu   = $('menu');
	var links  = menu.getElementsByTagName('a');

	for(var i=0; i < links.length; i++){
		$(links[i]).onclick = navigation;
		$(links[i]).setAttribute('href','#');
	}

	if($('btn-sohamsounds')) $('btn-sohamsounds').onclick();
}

//
// Navigation.
// Handle section navigation.
function navigation(e){

	if(current != null && current.id == this.id) return;
	if(current != null) current.removeAttribute("class");

	this.setAttribute('class', 'current');

	if(current != null){
		pcontent = current.id.split('-')[1];
		ncontent = this.id.split('-')[1];

		if(pcontent != null){
			$(pcontent).setStyle({"z-index" : 0});
			Effect.Fade(pcontent);
		}

		if(ncontent != null){
			$(ncontent).setStyle({"z-index" : 1});
			Effect.Appear(ncontent);
		}
	}

	setTimeout("telltoflash()", 2000);
	current = this;
	return false;
}

//
// Flash
// Handle flash communication.
function telltoflash(){
	var player = $('player');
	player.SetVariable('message', current.id);
}