
//Actu Accordeons
window.addEvent('domready', function() {

	//Creation de l'accordeons
	var myAccordion = new Accordion($('accordion'), 'div.actuToggle', 'div.actu-content-accordion', {
		opacity: false,
		onActive: function(toggler, element){
			toggler.className = "box-actu-select";
			// Short version
			var myFx = new Fx.Tween(element);
			myFx.start('opacity', '0', '1');
		},
		onBackground: function(toggler, element){
			toggler.className = "box-actu";
			var myFx = new Fx.Tween(element);
			myFx.start('opacity', '1', '0');
		}
	});

  // Fonctions pour afficher et cacher des éléments
  Element.implement({
    show: function() {
      this.setStyle('display', '');
    },
    hide: function() {
      this.setStyle('display', 'none');
    },
    toggle: function() {
      if(this.getStyle('display') == 'none')
        this.setStyle('display', '');
      else
        this.setStyle('display', 'none');
    }
  });
});


//Vitrine
function objVitrine_on(pElem){
	var elemChild = pElem.getElementsByTagName('span')[0]

	$(elemChild).set('morph', {duration: 750, transition: 'bounce:out'});
	$(elemChild).morph('.obj-vitrine-morph-over');
}

function objVitrine_off(pElem){
	var elemChild = pElem.getElementsByTagName('span')[0]

	$(elemChild).set('morph', {duration: 750, transition: 'bounce:out'});
	$(elemChild).morph('.obj-vitrine-morph-out');
}

//Game header menu
function resize_game(pW, pH){

	var elemChild1 = document.getElementById('box-top-flash-game');
	var elemChild2 = document.getElementById('flash-game');

	$(elemChild1).tween('width', pW);

	$(elemChild2).morph({
      'width': pW,
      'height': pH
    });

}

// Boîte de message
window.addEvent('domready', function() {
    setupCloseMessageBoxClicked();
});

function setupCloseMessageBoxClicked()
{
    $$('.message-box .close button').addEvent('click', function (event) {
        $$('.message-box').destroy();
    });
}

// Get the current session language.
function getLang()
{
  return document.getElement('html').get('lang');
}

//Langue
var timerLangue;

function openLang(){
	
	clearTimeout(timerLangue);
	var lang = document.getElementById('btnLangues');
	lang.style.display = "block";
	
}

function holdLang(){
	
	clearTimeout(timerLangue);
	
}

function closeLang(){
	
	timerLangue = setTimeout("closeLangEvent()",500);
	
}

function closeLangEvent(){
	
	clearTimeout(timerLangue);
	var lang = document.getElementById('btnLangues');
	lang.style.display = "none";
	
}
