// JavaScript Document



//Changement de l'affichage des vignettes/listes videos...

function changeClassCarousel(){
	
	

  
// pour IE
document.getElementById("ConteneurVideoVignette").setAttribute("className", "infiniteCarousel");
document.getElementById("SliderVideo").setAttribute("className", "wrapper");

// pour FF
document.getElementById("ConteneurVideoVignette").setAttribute("class", "infiniteCarousel");
document.getElementById("SliderVideo").setAttribute("class", "wrapper");





}

function changeClassVignette(){

// pour IE
document.getElementById("ConteneurVideoVignette").setAttribute("className", "infiniteCarouselVignette");
document.getElementById("SliderVideo").setAttribute("className", "wrapperVignette");

// pour FF
document.getElementById("ConteneurVideoVignette").setAttribute("class", "infiniteCarouselVignette");
document.getElementById("SliderVideo").setAttribute("class", "wrapperVignette");




}

function changeClassListe(){

// pour IE
document.getElementById("ConteneurVideoVignette").setAttribute("className", "infiniteCarouselListe");
document.getElementById("SliderVideo").setAttribute("className", "wrapperListe");

// pour FF
document.getElementById("ConteneurVideoVignette").setAttribute("class", "infiniteCarouselListe");
document.getElementById("SliderVideo").setAttribute("class", "wrapperListe");




}	





$(window).load( function () {
$("img.flyerpala").animate({ 
        marginLeft: "0px"
  
     }, 800 );
 
$("#flyer").fadeIn("slow");

});



$(document).ready( function () {
							 
						 


 
 
$(".progClose").click( function () {
   $("#divProg").slideUp("slow");
});

$(".prog").click( function () {
   $("#divProg").slideDown("slow");
}); 
 
	
$(".infosClose").click( function () {
   $("#divInfos").slideUp("slow");
});

$(".infos").click( function () {
   $("#divInfos").slideDown("slow");
});


$(".ico_partage2").click( function () {
   $("#emailFriend").slideDown("slow");
   $(".ico_partage2").hide();
    $(".ico_partage2b").show();
   
});

$(".ico_partage2b").click( function () {
   $("#emailFriend").slideUp("slow");
    $(".ico_partage2b").hide();
    $(".ico_partage2").show();
});


 	
	
	
	<!--[----]--> 

$(".pubClose").click( function () {
$("#pub").slideUp("slow");
$("#conteneur").animate({ 
        top: "17px"
  
      }, 800 );

$("#IDclose").show();

});
	
	
	
	
	<!--[----]--> 
	
	
$(".fermerProg").click(function () {
    $(".StyleDegrade").slideUp("slow");
	$(".fermerProg").fadeOut();
	$("#nav").fadeOut();
	$(".fermerProgb").fadeIn();   
});
	
<!--[----]--> 
	
$(".fermerProgb").click(function () {
      
        $(".StyleDegrade").slideDown("slow");
		$("#nav").fadeIn();
		$(".fermerProgb").fadeOut();  
		$(".fermerProg").show();
      
    });





//$(function() {
  //   $("div#controller").jFlow({
    //     slides: "#slides",
      //   width: "700px",
         //height: "416px"
     // });
//});





	
	$(".fermer2").click(function () {
      
        $(".diapo-1").slideUp("slow");
		$(".fermer2").fadeOut();
		$(".fermer2b").fadeIn();   
      
    });
	
	
	 $(".fermer2b").click(function () {
      
        $(".diapo-1").slideDown("slow");
		$(".fermer2b").fadeOut();  
		$(".fermer2").fadeIn();
      
    });
	
	
	
	

	
	
	<!--[----]--> 
	

	
	<!--[----]--> 
	
	
	
	

	
	  
	
	$("#navigationVideoInter").animate({ 
        top: "-55px"
  
      }, 3000 ), $("#navigationVideoInter").fadeOut("slow"); 
  
 
	
	 
	 $("#navigationVideo").hover(function () {
	$("#navigationVideoInter").show(), $("#navigationVideoInter").animate({ 
        top: "-55px"
  
      }, 3000 ), $("#navigationVideoInter").fadeOut("slow");;
 
  
 });
	
	

 $(".Btnconcour").click(function () {
	$("#concours").fadeIn("slow");
	$("#popUp").animate({ 
        top: "254px"
  
      }, 1000 );
  
 });
	
	
	
	
	<!--[----]--> 
$(".fermer").click(function () {
	$("#concours").fadeOut("slow");
	$("#popUp").animate({ 
        top: "-300px"
  
      }, 1000 );
      
 });




 $(".rechercheBTN").click(function () {


$("#recherche").toggle();



 

});







 $(".proposeBTN").click(function () {


$("#proposition").toggle();
 

});








	

 




 


//Animated scrolling

 
$('a[href*=#]').click(function() {
 
    if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
 
    && location.hostname == this.hostname) {
 
      var $target = $(this.hash);
 
      $target = $target.length && $target
 
      || $('[name=' + this.hash.slice(1) +']');
 
      if ($target.length) {
  
        var targetOffset = $target.offset().top;
 
        $('html,body')
 
        .animate({scrollTop: targetOffset}, 800);
 
       return false;
 
      }
 
    }
 
  });



 

// animation de la page video quand on clique sur une vignette...

$('.thumbVideo').click(function() {
 

    var divOffset = $('object.myspace').offset().top;content
	//var divOffset = $('#content').offset().top;
 
    $('html,body').animate({scrollTop: divOffset}, 800);
	
 
  });
 





$("#concours").easydrag(true);





 



//La fonction JavaScript qui vérifie si les champs obligatoirs du formulaire ont été bien remplis
 
function envoyer(formulaire) {
if ( (document.getElementById('email').value.length>0)
&&(document.getElementById('email').value!='entrez votre adresse email')
 ){
 formulaire.submit();

} else
alert('INSCRIPTION A LA NEWSLETTER IMPOSSIBLE, VEUILLEZ ENTRER UNE ADRESSE VALIDE');
}



function ModifChamp()
{
	 
		document.getElementById('email').value='' 
}









 

(function () {
    $.fn.infiniteCarousel = function () {
        function repeat(str, n) {
            return new Array( n + 1 ).join(str);
        }
        
        return this.each(function () {
            // magic!
            var $wrapper = $('> div', this).css('overflow', 'hidden'),
                $slider = $wrapper.find('> ul').width(9999),
                $items = $slider.find('> li'),
                $single = $items.filter(':first')
                
                singleWidth = $single.outerWidth(),
                visible = Math.ceil($wrapper.innerWidth() / singleWidth),
                currentPage = 1,
                pages = Math.ceil($items.length / visible);
                
            /* TASKS */
            
            // 1. pad the pages with empty element if required
            if ($items.length % visible != 0) {
                // pad
                $slider.append(repeat('<li class="empty" />', visible - ($items.length % visible)));
                $items = $slider.find('> li');
            }
            
            // 2. create the carousel padding on left and right (cloned)
            $items.filter(':first').before($items.slice(-visible).clone().addClass('cloned'));
            $items.filter(':last').after($items.slice(0, visible).clone().addClass('cloned'));
            $items = $slider.find('> li');
            
            // 3. reset scroll
            $wrapper.scrollLeft(singleWidth * visible);
            
            // 4. paging function
            function gotoPage(page) {
                var dir = page < currentPage ? -1 : 1,
                    n = Math.abs(currentPage - page),
                    left = singleWidth * dir * visible * n;
                
                $wrapper.filter(':not(:animated)').animate({
                    scrollLeft : '+=' + left
                }, 500, function () {
                    // if page == last page - then reset position
                    if (page > pages) {
                        $wrapper.scrollLeft(singleWidth * visible);
                        page = 1;
                    } else if (page == 0) {
                        page = pages;
                        $wrapper.scrollLeft(singleWidth * visible * pages);
                    }
                    
                    currentPage = page;
                });
            }
            
            // 5. insert the back and forward link
            $wrapper.after('<a href="#" class="arrow back">&lt;</a><a href="#" class="arrow forward">&gt;</a>');
            
            // 6. bind the back and forward links
            $('a.back', this).click(function () {
                gotoPage(currentPage - 1);
                return false;
            });
            
            $('a.forward', this).click(function () {
                gotoPage(currentPage + 1);
                return false;
            });
            
            $(this).bind('goto', function (event, page) {
                gotoPage(page);
            });
            
            // THIS IS NEW CODE FOR THE AUTOMATIC INFINITE CAROUSEL
            $(this).bind('next', function () {
                gotoPage(currentPage + 1);
            });
        });
    };
})(jQuery);

$(document).ready(function () {
    // THIS IS NEW CODE FOR THE AUTOMATIC INFINITE CAROUSEL
    var autoscrolling = true;
    
    $('.infiniteCarousel').infiniteCarousel().mouseover(function () {
        autoscrolling = false;
    }).mouseout(function () {
        autoscrolling = false;
    });
    
    setInterval(function () {
        if (autoscrolling) {
            $('.infiniteCarousel').trigger('next');
        }
    }, 2000);
	
	
	// DIAPORAMA INTRO
	$('.diaporamaIntro').infiniteCarousel().mouseover(function () {
        autoscrolling = true;
    }).mouseout(function () {
        autoscrolling = true;
    });
    
    setInterval(function () {
        if (autoscrolling) {
            $('.diaporamaIntro').trigger('next');
        }
    }, 2000);
	
	
	
});





 
  
 function showHideSelect(Objet)
{
 
  var val = Objet.value.toLowerCase();
   var dest;
    switch (val) {

			

			
			case ("toutes"): 

				location.href='http://www.cat-bordeaux.com/indexA.php?page=archives-video&video_categorie=Live-au-cat-toutes';

				break;
				
			case ("hiphop"): 

				location.href='http://www.cat-bordeaux.com/indexA.php?page=archives-video&video_categorie=Live-au-cat-rap-hip-hop';

				break;
				
			case ("reggae"): 

				location.href='http://www.cat-bordeaux.com/indexA.php?page=archives-video&video_categorie=Live-au-cat-reggae-dancehall-dub';

				break;
				
			case ("electro"): 

				location.href='http://www.cat-bordeaux.com/indexA.php?page=archives-video&video_categorie=Live-au-cat-techno-electro-drum-bass';

				break;
				
			case ("live-au-cat-divers"): 

				location.href='http://www.cat-bordeaux.com/indexA.php?page=archives-video&video_categorie=Live-au-cat-divers';

				break;
				
				
				
				
				
				
				
				
				case ("clips-rap-hip-hop"): 

				location.href='http://www.cat-bordeaux.com/indexA.php?page=archives-video&video_categorie=Clips-rap-hip-hop';

				break;
				
				
				case ("clips-reggae-dancehall-dub"): 

				location.href='http://www.cat-bordeaux.com/indexA.php?page=archives-video&video_categorie=Clips-reggae-dancehall-dub';

				break;
				
				
				case ("clips-techno-electro-drum-bass"): 

				location.href='http://www.cat-bordeaux.com/indexA.php?page=archives-video&video_categorie=Clips-techno-electro-drum-bass';

				break;
				
				
				case ("clips-divers"): 

				location.href='http://www.cat-bordeaux.com/indexA.php?page=archives-video&video_categorie=Clips-divers';

				break;
				
				
				case ("clips-toutes"): 

				location.href='http://www.cat-bordeaux.com/indexA.php?page=archives-video&video_categorie=Clips-toutes';

				break;
				
				
				
				
				
				
				
				
					case ("artistes-a-venir-live"): 

				location.href='http://www.cat-bordeaux.com/indexA.php?page=archives-video&video_categorie=Artistes-a-venir-live';

				break;
				
				
					case ("artistes-a-venir-clips"): 

				location.href='http://www.cat-bordeaux.com/indexA.php?page=archives-video&video_categorie=Artistes-a-venir-clips';

				break;
				
				
					case ("artistes-a-venir-toutes"): 

				location.href='http://www.cat-bordeaux.com/indexA.php?page=archives-video&video_categorie=Artistes-a-venir-toutes';

				break;
				
				
				
				
				
				
					case ("toutes-les-videos"): 

				location.href='http://www.cat-bordeaux.com/indexA.php?page=archives-video&video_categorie=toutes-les-videos';

				break;
				
				
				
				
				
			// case "zone2" :
			//    dest="zones";
			//    break;	
				
				}
				
				// 
				//NewWindow('/sa/popup.php?id=2,5,4&empty=1&select=' + dest + '&target=text2','selectpopup','160','200','yes','center','no');
     
	
}






 



}); 










