	/*   
Theme Name: VAT Voyages
Theme URI: http://www.webdesign.niums.com
Description: JS dusite VAT Voyages Designed by Niums
Author: Niums 
Author URI: http://www.webdesign.niums.com
- Menu : superfish
-
*/
	// initialise plugins menu
   $(document).ready(function(){ //on attend que la page soit chargée
							  
var siteUrl ="http://www.voyagesantillais.com/";							  
							  
/* ##################################################
						Liens header
###################################################*/							  
							  
$(".callStDenis").click(function(){window.location = siteUrl+"nous-contacter/agence-de-saint-denis/";});

 $(".callParis").click(function(){window.location = siteUrl+"nous-contacter/agence-paris/";});   
 
 $(".callUs").click(function(){window.location = siteUrl+"nous-contacter/demande-de-devis/";}); 
 
 $(".callGuadeloupe").click(function(){window.location = siteUrl+"nous-contacter/agence-de-guadeloupe/";}); 		
 
/* ##################################################
						Liens facilité de paiement
###################################################*/	

$(".content1").click(function(){window.location = siteUrl+"facilites-de-paiement/#modalites";});// cheque vac
$(".content2").click(function(){window.location = siteUrl+"facilites-de-paiement/#3fois";});// cheqe
$(".content3").click(function(){window.location = siteUrl+"facilites-de-paiement/#34fois";}); // carte
$(".content4").click(function(){window.location = siteUrl+"facilites-de-paiement/#acomptes";}); // accompte
 
 			  
							  
/* ##################################################
									Menu
###################################################*/
        //-------------------------------------------------      
	  $("ul.sf-menu")
	/*  .supersubs({ 
            minWidth:    12,   // minimum width of sub-menus in em units 
            maxWidth:    27,   // maximum width of sub-menus in em units 
            extraWidth:  1     // extra width can ensure lines don't sometimes turn over 
                               // due to slight rounding differences and font-family 
        }) */
	  .superfish({
            delay:       500,                            // one second delay on mouseout 
            animation:   {opacity:'show',height:'show'},  // fade-in and slide-down animation 
            speed:       'fast',                          // faster animation speed 
            autoArrows:  true,                           // disable generation of arrow mark-up 
            dropShadows: false                            // disable drop shadows 
	  });  // call supersubs first, then superfish, so that subs are 
                         // not display:none when measuring. Call before initialising 
                         // containing tabs for same reason. 

	//volsScroller 
	 $('#volsScroller').newsScroll({
		speed: 2000,
		delay: 600000
	});
	
	//sejoursScroller 
	 $('#sejoursScroller').newsScroll({
		speed: 2000,
		delay: 600000
	});
	
							 
/* ##################################################
							tab accueil
###################################################*/

var tabContainers = $('div.tabs > div');
    
    $('div.tabs ul.tabNavigation a').click(function () {
        tabContainers.hide().filter(this.hash).show();
        
        $('div.tabs ul.tabNavigation a').removeClass('selected');
        $(this).addClass('selected');
        
        return false;
    }).filter(':first').click();

/* ##################################################
									newsletter
###################################################*/

		$('#inscriptionNewsletter').hide();
	
		$('a.showNewsletter').click(function() {
			$('#inscriptionNewsletter').toggle('slow');
			return false;
		  });		 
		$('input.showNewsletter').click(function() {
			$('#inscriptionNewsletter').show('slow');
			return false;
		  });	
				

		  $('a.closeNewsletter').click(function() {
		  $('#inscriptionNewsletter').hide('fast');
			return false;
		  });
/* ##################################################
									Tooltip
###################################################*/

		/*
		$('#page-wrap a').tooltip({ 
				track: true, 
				delay: 0, 
				showURL: false, 
				showBody: " - ", 
				fade: 250 
			});
		*/
		
				
/* ##################################################
									slideshow
###################################################*/

//Configuration
		  var retour = true;
		  var tempsTransition = 1000;
		  var affichePlayPause = true;
		  var lectureAutomatique = true;
		  	var tempsAttente = 5000;
			
		  var icones = new Array();
		  		icones['play'] = '../images/play_slider.png';
		  		icones['pause'] = '../images/pause_slider.png';	
			
		  var currentPosition = 0;
		  var slideWidth = 960;
		  var slides = $('.slide');
		  var numberOfSlides = slides.length;
		  var interval;
		  var lectureEnCours = false;
  // Supprime la scrollbar en JS
  $('#slidesContainer').css('overflow', 'hidden');

  // Attribue  #slideInner  à toutes les div .slide
  slides
    .wrapAll('<div id="slideInner"></div>')
    // Float left to display horizontally, readjust .slides width
	.css({
      'float' : 'left',
      'width' : slideWidth
    });

  // Longueur de #slideInner égale au total de la longueur de tous les slides
  $('#slideInner').css('width', slideWidth * numberOfSlides);

  // Insert controls in the DOM
  $('#slideshow')
    .prepend('<span class="control" id="leftControl">Précédent</span>')
    .append('<span class="control" id="rightControl">Suivant</span>');


  
  // Hide left arrow control on first load
  manageControls(currentPosition);

  //Crée un écouteur d'évènement de type clic sur les classes .control
  $('.control').bind('click', function(){
		
    // Determine la nouvelle position
	currentPosition = ($(this).attr('id')=='rightControl') ? currentPosition+1 : currentPosition-1;
    
	if(currentPosition == numberOfSlides && retour == false ){
		currentPosition--;
		pause();
	}
	
	// Cache ou montre les controles
    manageControls(currentPosition);
    // Fais bouger le slide
    $('#slideInner').animate({
							 			'marginLeft' : slideWidth*(-currentPosition)
										},tempsTransition, 
										function() { 
														$('.photo-meta-data').slideDown('fast');
														}
	);
	$('.photo-meta-data').slideDown('up');
  });

  // manageControls: Cache ou montre les flêches de controle en fonction de la position courante
  function manageControls(position){
    // Cache la fleche "précédent" si on est sur le premier slide
	if(position==0){ $('#leftControl').hide() } else{ $('#leftControl').show() }
	// Cache la fleche "suivant" si on est sur le dernier slide (et que le retour automatique n'est pas activé)
    if(position==numberOfSlides-1 && retour == false){
		$('#rightControl').hide();
	} else {
		$('#rightControl').show();
	}
	if(position == numberOfSlides && retour == true){
		currentPosition = 0;
		 $('#leftControl').hide();
	}
  }
  
  function suivant(){
	$('#rightControl').click();
	$('.photo-meta-data').slideUp('fast');
	}
  
  function start() {
  	lectureEnCours = true;
    interval = setInterval(suivant, tempsAttente );
  }
  
  function pause() {
  	lectureEnCours = false;
   clearInterval(interval);
  }
  
  
 //Si le diapo est activé 
if(lectureAutomatique == true){
  start();
}
if(affichePlayPause == true){
	$('#slidesContainer').prepend('<img id="navDiapo" src="" alt="Navigation diaporama" />');
	if(lectureAutomatique == true){
		$('#navDiapo').attr('src',icones['pause']);
	}else{
		$('#navDiapo').attr('src',icones['play']);	
	}
	$('#navDiapo').bind('click', function(){
		if(lectureEnCours == true){
			$(this).attr('src',icones['play']);
			pause();
		}else{
			$(this).attr('src',icones['pause']);
			start();
		}
	});
}


/* ##################################################
									slide door
###################################################*/
	//if mouse over and mouse out
	$('.slidingDoor').hover(
	function () {

		value = $(this).find('img').outerHeight() * -1;

		//for left/right if you have different width and height, 
		//commented out because we are using up/down in this example
		//value = $(this).find('img').outerWidth() * -1); 
		
		//animate the image
		// you can change the sliding direction by changing bottom to left, right or top
		// if you changed this, you will have to change the position of the hover out as well
		$(this).find('img').stop().animate({bottom: value} ,{duration:500, easing: 'easeOutQuint'});	
		
	},
	function () {
		
		//reset the image
		// the position property (bottom), it must be same with the on in the mouseover
		$(this).find('img').stop().animate({bottom:0} ,{duration:500, easing: 'easeOutQuint'});	
	
	});
	
	//if user clicked on the thumbnail
	$('.slidingDoor').click(function () {	
		//grab and execute the first link in the thumbnail
		window.location = $(this).find('a:first').attr('href');
	});
	
	
/* ##################################################
									Menu Image
###################################################
	  	
	$("li:eq(1)").hover(
	  function () 
	  {
		$("span.menuImage").animate({"opacity":"100"}, "slow"); 
		$("span.menuImage").animate({"top": "+=100px"}, "slow");
	  }, 
	  function () 
	  {
		  $("span.menuImage").animate({"opacity":"0"}, "slow");
		$("span.menuImage").animate({"top": "-=100px"}, "slow");
	  }
	);

	*/
		//-------------------------------------------------

});
