$(document).ready(function() {

	hs.graphicsDir = '/shop/lib/highslide/graphics/';
	hs.align = 'center';
	hs.transitions = ['expand', 'crossfade'];
	hs.wrapperClassName = 'dark borderless floating-caption';
	hs.width = 700;
	hs.height = 400;
	hs.zIndex = 1000;
	hs.fadeInOut = true;
	hs.dimmingOpacity = .75;
	
	$('.autres').hide();
	$('.coderefaviaxess').hide();
	$('.coderefautres').hide();
	
	/* ************ carousel ************** */
    jQuery('#mycarousel').jcarousel({
    	wrap: 'circular'
    });
	
	/* ************ livreor ************** */
	$(".formlivreor").hide();
	$("#formlivreor").toggle(function(){
		$(".formlivreor").show('slow');
	},function(){
		$(".formlivreor").hide('slow');
	});	
	
	/* ************ bubble ************** */
	$('#imgbillets').CreateBubblePopup({
		position : 'top',
		align	 : 'center',			
		innerHtml: 'Pas de frais de livraison, ni d\'attente, <br /> \
					Vous imprimez le ticket juste après l\'achat !',
		innerHtmlStyle: {
							color:'#FFFFFF', 
							'text-align':'center'
						},												
		themeName: 	'all-black',
		themePath: 	'images/jquerybubblepopup-theme'
	});	
	$('#imghelicolo').CreateBubblePopup({
		position : 'top',
		align	 : 'center',			
		innerHtml: 'AVIAXESS première compagnie d’hélicoptères compensée en CO², <br /> \
					pour une offre d’hélicoptères écologiques',
		innerHtmlStyle: {
							color:'#FFFFFF', 
							'text-align':'center'
						},												
		themeName: 	'all-black',
		themePath: 	'images/jquerybubblepopup-theme'
	});
	$('#imgtemoigne').CreateBubblePopup({
		position : 'top',
		align	 : 'center',			
		innerHtml: 'Ils ont aimé ce vol,<br /> \
					lisez leur témoignage...',
		innerHtmlStyle: {
							color:'#FFFFFF', 
							'text-align':'center'
						},												
		themeName: 	'all-black',
		themePath: 	'images/jquerybubblepopup-theme'
	});	
	$('#imgnew').CreateBubblePopup({
		position : 'top',
		align	 : 'center',			
		innerHtml: 'Nouveautés',
		innerHtmlStyle: {
							color:'#FFFFFF', 
							'text-align':'center'
						},												
		themeName: 	'all-black',
		themePath: 	'images/jquerybubblepopup-theme'
	});	
	$('#imgbest').CreateBubblePopup({
		position : 'top',
		align	 : 'center',			
		innerHtml: 'Top des ventes !',
		innerHtmlStyle: {
							color:'#FFFFFF', 
							'text-align':'center'
						},												
		themeName: 	'all-black',
		themePath: 	'images/jquerybubblepopup-theme'
	});	
	$('#recommander').CreateBubblePopup({
		position : 'top',
		align	 : 'center',			
		innerHtml: 'Recommandez à un ami !',
		innerHtmlStyle: {
							color:'#FFFFFF', 
							'text-align':'center'
						},												
		themeName: 	'all-black',
		themePath: 	'images/jquerybubblepopup-theme'
	});
	/* ************ div opening reste ouverte ************ */
	var jeton = 0;
	$(".opening input").focus(function(e){
		jeton++;
	});
	$(".opening input").blur(function(e){
		jeton--;
	});
	
	$(".opening").hover(function(e){
		$('.hidding',this).show();
	},function(e){
	if(!jeton)
		$('.hidding',this).hide();
	else
		$('.hidding',this).addClass("ouvert");
	});
	
	/* ************ Liste resa date mois jour heure ************ */
	$(".mesjour ul").hide();

	if($(".mesjour .on").size())
		$(".mesjour .on").parent().show();
	else
		$(".mois:first .mesjour:first ul:first").show();
		$(".mesjour:first").addClass('mesjourSelection');
		
	$(".mesjour").click(function(){
		$(".mesjour").removeClass('mesjourSelection');
	    $(".mesjour ul").hide();
	    $("ul", this).show();
		$(this).addClass('mesjourSelection');
	});		
	
	$(".mesjour ul li").click(function(){
		var dateChoisie = $("#date_choisie").val();
		if(dateChoisie != '')
		{
			$('.btnGris').remove();
			$('.ligneBoutons').html('<button type="submit" name="submit" value="valider" class="bouton right">Valider</button>');
		}
		else{
			$('.ligneBoutons .bouton').remove();
			$('.ligneBoutons').html('<span class="btnGris right">Valider</span>');
		}
	});
	
	/* ************************************************ */
	
	$(".diaporama .produitBoucle").hide();
	window.onload = function () {
	
		$(".diaporama .produitBoucle").show();
		$(".loading").hide();
		$('.diaporama').cycle( 
		{
			fx:     'fade', 
			speed:  'slow', 
			timeout: 6000,  
			pause:	1, 
			next:   '#next', 
			prev:   '#prev' 
		});
		$('.diaporama').before('<div id="nav">').cycle({
			fx:     'fade', 
			speed:  'slow', 
			timeout: 6000, 
			pager:  '#nav',
			pause:  1,
			before: function(){$(this).css("background", "transparent");},
			after: function(){$(this).css("background", "transparent");}
		});
	};
  });
