soundManager.url = 'swf/';
soundManager.debugMode = false;
soundManager.onready(function(oStatus) {
  if (!oStatus.success) {
    return false;	
  }
  
  soundManager.createSound({
    id: 'javanaise',
    url: 'music/javanaise.mp3',
	volume: 20, 
	onfinish:function() {
		this.play();
	  }
  });

  soundManager.createSound({
    id: 'dance',
    url: 'music/dance.mp3',
	volume: 20, 
	onfinish:function() {
		this.play();
	  }
  });

  soundManager.createSound({
    id: 'tomorrow',
    url: 'music/tomorrow.mp3',
	volume: 20, 
	onfinish:function() {
		this.play();
	  }
  });

  soundManager.play('dance');

});
	



window.addEvent('load', function(){
			var scroll = new Fx.Scroll('wrapper', {
				wait: false,
				duration: 1500,
				offset: {'x': 0, 'y': 0},
				fps: 15,
				transition: Fx.Transitions.Linear
			});
			
		
			$$('.n-cave').addEvent('click', function(event) {
				event = new Event(event).stop();
				scroll.toElement('cave');
			});
			
			$$('.n-bistrot').addEvent('click', function(event) {
				event = new Event(event).stop();
				scroll.toElement('bistrot');
			});
			


			$$('.n-epicerie').addEvent('click', function(event) {
				event = new Event(event).stop();
				scroll.toElement('epicerie');
			});
			
			$$('.n-franck').addEvent('click', function(event) {
				event = new Event(event).stop();
				scroll.toElement('franck');
			});
			
			$$('.n-contact').addEvent('click', function(event) {
				event = new Event(event).stop();
				scroll.toElement('contact');
			});

       scroll.toElement('bistrot');
	   
	   	var mytips1 = new Tips('.tooltip');

}); 
		
function activatebtn(bid){
 document.getElementById("charcuterie").className = ""; 
 document.getElementById("terrine").className = ""; 
 document.getElementById("foie-gras").className = ""; 
 document.getElementById("boeuf").className = "";
 document.getElementById("poulet").className = "";
 document.getElementById("dessert").className = "";
 document.getElementById(bid).className = "active";
}
		
function activatebor(bid){
 document.getElementById("rhone").className = ""; 
 document.getElementById("loire").className = ""; 
 document.getElementById("languedoc").className = ""; 
 document.getElementById("bourgogne").className = "";
 document.getElementById("vnature").className = "";
 document.getElementById(bid).className = "active";
}

function activatefr(bid){
 document.getElementById("n-soul").className = ""; 
 document.getElementById("n-dest").className = ""; 
 document.getElementById("n-heart").className = ""; 
 document.getElementById(bid).className = "active";
}

function activateepi(bid){
 document.getElementById("liqueurs").className = ""; 
 document.getElementById("autourduvin").className = ""; 
 document.getElementById("confiserie").className = ""; 
 document.getElementById("oilvinegar").className = ""; 
 document.getElementById("condiments").className = ""; 
 document.getElementById(bid).className = "active";
}




window.addEvent('domready', function() {
    new Fx.Tween('closecave', {	link: 'chain',	property: 'opacity',duration: 0}).start(0);									 
									 
    var bm = new Fx.Slide($('bistrot-main'), {duration: 1500, mode: 'horizontal', transition: Fx.Transitions.Back.easeOut});
    var bm1 = new Fx.Slide($('bistrot-main'), {duration: 1200, mode: 'vertical', transition: Fx.Transitions.Back.easeOut});
	
	$('closebis').addEvent('click', function() {
		$('bistrot-main').load('cuisine-bistrot.html');
		activatebtn(this.id);
		new Fx.Tween('closebis', {	link: 'chain',	property: 'opacity',duration: 0}).start(0);
	});
	
	$('charcuterie').addEvent('click', function() {
		$('bistrot-main').load('charcuterie.html');
		activatebtn(this.id);
		bm.hide().toggle();
		new Fx.Tween('closebis', {	link: 'chain',	property: 'opacity',duration: 0}).start(0).wait(1500).start(1);

	});

	$('terrine').addEvent('click', function() {
		$('bistrot-main').load('terrine.html');
		activatebtn(this.id);
		bm1.hide().toggle();
		new Fx.Tween('closebis', {	link: 'chain',	property: 'opacity',duration: 0}).start(0).wait(1200).start(1);
	});

	$('foie-gras').addEvent('click', function() {
		$('bistrot-main').load('foie-gras.html');
        bm.hide().toggle();		
		activatebtn(this.id);
		new Fx.Tween('closebis', {	link: 'chain',	property: 'opacity',duration: 0}).start(0).wait(1500).start(1);
	});

	$('boeuf').addEvent('click', function() {
		$('bistrot-main').load('boeuf.html');
		activatebtn(this.id);
        bm1.hide().toggle();
		new Fx.Tween('closebis', {	link: 'chain',	property: 'opacity',duration: 0}).start(0).wait(1200).start(1);		
	});

	$('poulet').addEvent('click', function() {
		$('bistrot-main').load('poulet.html');
		activatebtn(this.id);
        bm.hide().toggle();	
		new Fx.Tween('closebis', {	link: 'chain',	property: 'opacity',duration: 0}).start(0).wait(1500).start(1);		
	});

	$('dessert').addEvent('click', function() {
		$('bistrot-main').load('dessert.html');
		activatebtn(this.id);
        bm1.hide().toggle();
		new Fx.Tween('closebis', {	link: 'chain',	property: 'opacity',duration: 0}).start(0).wait(1200).start(1);		
	});


   // var reqcave= new Fx.Reveal($('cavecontent'), {duration: 2000, transition: Fx.Transitions.Bounce.EaseOut});
    var reqcave = new Fx.Slide($('cavecontent'), {duration: 1000, link: 'chain',mode: 'horizontal', transition: Fx.Transitions.Quad.easeOut});

	//var closecave = Fx.Tween('closecave', {	link: 'chain',	property: 'opacity', duration: 0}) ; 

	$('closecave').addEvent('click', function() {
		$('cavecontent').load('cave.html');
		new Fx.Tween('closecave', {	link: 'chain',	property: 'opacity',duration: 0}).start(0);
		reqcave.show();
			
	});

	$('rhone').addEvent('click', function() {
		$('cavecontent').load('rhone.html');
		activatebor(this.id);
		reqcave.hide().toggle();
		new Fx.Tween('closecave', {	link: 'chain',	property: 'opacity',duration: 200}).start(0).wait(1000).start(1);
    });

	$('loire').addEvent('click', function() {
		$('cavecontent').load('loire.html');
		activatebor(this.id);
		reqcave.hide().toggle();		
		new Fx.Tween('closecave', {	link: 'chain',	property: 'opacity',duration: 200}).start(0).wait(800).start(1);
      });

	$('languedoc').addEvent('click', function() {
		$('cavecontent').load('languedoc.html');
		activatebor(this.id);
		reqcave.hide().toggle();	
		new Fx.Tween('closecave', {	link: 'chain',	property: 'opacity',duration: 200}).start(0).wait(800).start(1);
  	});

	$('bourgogne').addEvent('click', function() {
		$('cavecontent').load('bourgogne.html');
		activatebor(this.id);
		reqcave.hide().toggle();
		new Fx.Tween('closecave', {	link: 'chain',	property: 'opacity',duration: 200}).start(0).wait(800).start(1);
  	});
	
	$('vnature').addEvent('click', function() {
		$('cavecontent').load('vnature.html');
		activatebor(this.id);
		reqcave.hide().toggle();
		new Fx.Tween('closecave', {	link: 'chain',	property: 'opacity',duration: 200}).start(0).wait(800).start(1);
  	});


var fx1 = new Fx.Tween($('content-soul'),{duration: 1200});
var fx2 = new Fx.Tween($('content-dest'),{duration: 1200});
var fx3 = new Fx.Tween($('content-heart'),{duration: 1200});

var img1 = new Fx.Tween($('imgsoul'),{duration: 1200});
var img2 = new Fx.Tween($('imgdest'),{duration: 1200});
var img3 = new Fx.Tween($('imgheart'),{duration: 1200});


	$('n-soul').addEvent('click', function() {
		activatefr(this.id);
        fx1.start('opacity', '1');
		img1.start('opacity', '1');
		img2.start('opacity', '0');
		img3.start('opacity', '0');
		
	});

	$('n-dest').addEvent('click', function() {
   		activatefr(this.id);
		fx1.start('opacity', '0');
		fx2.start('opacity', '1');
		img1.start('opacity', '0');
		img2.start('opacity', '1');
		img3.start('opacity', '0');
	});

	$('n-heart').addEvent('click', function() {
   		activatefr(this.id);
		fx1.start('opacity', '0');
		fx2.start('opacity', '0');
		fx3.start('opacity', '1');
		img1.start('opacity', '0');
		img2.start('opacity', '0');
		img3.start('opacity', '1');
	});


	


	$$('.dance').addEvent('click', function() {
		soundManager.stop('javanaise');	
		soundManager.play('dance');	
		$('stoptrack').hide();
		$('javanaise').hide();
		$('dance').show();
		$('tomorrow').hide();
	});

	$$('.tomorrow').addEvent('click', function() {
		soundManager.stop('dance');	
		soundManager.play('tomorrow');	
		$('stoptrack').hide();
		$('javanaise').hide();
		$('dance').hide();
		$('tomorrow').show();
 	});

	$$('.javanaise').addEvent('click', function() {
		soundManager.stop('tomorrow');	
		soundManager.play('javanaise');	
		$('stoptrack').hide();
		$('dance').hide();
		$('tomorrow').hide();
		$('javanaise').show();
	});
	
	$$('.stoptrack').addEvent('click', function() {
		soundManager.stopAll(); 	
		$('stoptrack').show();
		$('javanaise').hide();
		$('dance').hide();
		$('tomorrow').hide();
	});



	var epicerietxt = new Fx.Morph($('epicerietxt'),{duration: 1000});
	var epiceriebg = new Fx.Morph($('epiceriebg'),{duration: 1000});

	$('closeepi').addEvent('click', function() {
		$('epicerietxt').load('epiceriedef.html');
		activateepi(this.id);
		epicerietxt.start({'opacity' : [0,1]});
		epiceriebg.start({'height': 330});		
new Fx.Move('closeepi', {  relativeTo: $('epiceriebg'),offset: {x: -1703, y: -2443},   position: 'upperRight', edge: 'upperRight',duration: 1000}).start();	});

	$('liqueurs').addEvent('click', function() {
		$('epicerietxt').load('liqueurs.html');
		activateepi(this.id);
		epicerietxt.start({'opacity' : [0,1]});
		epiceriebg.start({'height': 250});

new Fx.Move('closeepi', {  relativeTo: $('epiceriebg'),offset: {x: -1705, y: -443},   position: 'upperRight', edge: 'upperRight',duration: 1000}).start();
	//	new Fx.Tween('closeepi', {	link: 'chain',	property: 'opacity',duration: 100}).start(0).wait(500).start(1);
	});


	$('autourduvin').addEvent('click', function() {
		$('epicerietxt').load('autourduvin.html');
		activateepi(this.id);
		epicerietxt.start({'opacity' : [0,1]});
		epiceriebg.start({'height': 165});		
	//	new Fx.Tween('closeepi', {	link: 'chain',	property: 'opacity',duration: 100}).start(0).wait(500).start(1);	
		new Fx.Move('closeepi', {  relativeTo: $('epiceriebg'),offset: {x: -1705, y: -443},   position: 'upperRight', edge: 'upperRight',duration: 1000}).start();

	});
	
	$('confiserie').addEvent('click', function() {
		$('epicerietxt').load('confiserie.html');
		activateepi(this.id);
		epicerietxt.start({'opacity' : [0,1]});
		epiceriebg.start({'height': 290});		
	//	new Fx.Tween('closeepi', {	link: 'chain',	property: 'opacity',duration: 100}).start(0).wait(500).start(1);		
	new Fx.Move('closeepi', {  relativeTo: $('epiceriebg'),offset: {x: -1705, y: -443},   position: 'upperRight', edge: 'upperRight',duration: 1000}).start();
	});


	$('oilvinegar').addEvent('click', function() {
		$('epicerietxt').load('oilvinegar.html');
		activateepi(this.id);
		epicerietxt.start({'opacity' : [0,1]});
		epiceriebg.start({'height': 265});		
	//	new Fx.Tween('closeepi', {	link: 'chain',	property: 'opacity',duration: 100}).start(0).wait(500).start(1);	
		new Fx.Move('closeepi', {  relativeTo: $('epiceriebg'),offset: {x: -1705, y: -443},   position: 'upperRight', edge: 'upperRight',duration: 1000}).start();

	});

	$('condiments').addEvent('click', function() {
		$('epicerietxt').load('condiments.html');
		activateepi(this.id);
		epicerietxt.start({'opacity' : [0,1]});
		epiceriebg.start({'height': 245});		
	//	new Fx.Tween('closeepi', {	link: 'chain',	property: 'opacity',duration: 100}).start(0).wait(500).start(1);
		new Fx.Move('closeepi', {  relativeTo: $('epiceriebg'),offset: {x: -1705, y: -443},   position: 'upperRight', edge: 'upperRight',duration: 1000}).start();

	});


});

		
		



