$(document).ready(function() {
	$(".topmenu .sub-menu .parent a:first").click(function() {
		$(this).parent().children("ul").slideToggle(200);
		$(this).parent().toggleClass("open");
	});
			
	$("ul.tabs").tabs("> .tabcontent", {tabs: 'li'});
	$(".row .col:first-child").addClass("alpha");
	$(".row .col:last-child").addClass("omega"); 
	
// toggle content
	$(".toggle_content").hide(); 
	
	$("h3.toggle").toggle(function(){
		$(this).addClass("active");
		}, function () {
		$(this).removeClass("active");
	});
	
	$("h3.toggle").click(function(){
		$(this).next(".toggle_content").slideToggle();
	});
	
	// toggle options
		$(".toggle_content").hide(); 

		$("h4.toggle").toggle(function(){
			$(this).addClass("active");
			}, function () {
			$(this).removeClass("active");
		});

		$("h4.toggle").click(function(){
			$(this).next(".toggle_content").slideToggle();
		});
	
	// toggle content Identite
		$(".identity_slidedown").hide(); 

		$("h5.toggle").toggle(function(){
			$(this).addClass("active");
			}, function () {
			$(this).removeClass("active");
		});

		$("h5.toggle").click(function(){
			$(this).next(".identity_slidedown").slideToggle();
		});
		
		// toggle content club
			$(".club_slidedown").hide(); 

			$("h6.toggle").toggle(function(){
				$(this).addClass("active");
				}, function () {
				$(this).removeClass("active");
			});

			$("h6.toggle").click(function(){
				$(this).next(".club_slidedown").slideToggle();
			});	
			
			// toggle content stats
				$(".stats_slidedown").slideToggle(); 

				$("h7.toggle").toggle(function(){
					$(this).addClass("active");
					}, function () {
					$(this).removeClass("active");
				});

				$("h7.toggle").click(function(){
					$(this).next(".stats_slidedown").slideToggle();
				});
				
				// toggle content stats
					$(".stats_tableau_slidedown").slideToggle(); 

					$("h7.toggle").toggle(function(){
						$(this).addClass("active");
						}, function () {
						$(this).removeClass("active");
					});

					$("h7.toggle").click(function(){
						$(this).next(".stats_tableau_slidedown").slideToggle();
					});
	
				// toggle content stats
					$(".col1_compare_slidedown").hide(); 

					$("h8.toggle").toggle(function(){
						$(this).addClass("active");
						}, function () {
						$(this).removeClass("active");
					});

					$("h8.toggle").click(function(){
						$(this).next(".col1_compare_slidedown").slideToggle();
					});
					
					// toggle content stats
						$(".col2_compare_slidedown").hide(); 

						$("h9.toggle").toggle(function(){
							$(this).addClass("active");
							}, function () {
							$(this).removeClass("active");
						});

						$("h9.toggle").click(function(){
							$(this).next(".col2_compare_slidedown").slideToggle();
						});


// pagination
	var islast = $(".pagination .inner a:last").hasClass('page_current');
	if(islast) $(".pagination .inner").css('padding-right','35px');

	if ($.browser.msie  && parseInt($.browser.version) == 7) {
	 	var ispageprev = $(".pagination .inner a").hasClass('page_prev');
		if(ispageprev) $(".pagination, .pagination .inner").css('padding-left','0px');
	}



// gallery
	$(".gl_col_2 .gallery-item::nth-child(2n)").addClass("nomargin");
	$(".gl_col_3 .gallery-item::nth-child(3n)").addClass("nomargin");
	$(".gl_col_4 .gallery-item::nth-child(4n)").addClass("nomargin");
	
	$(".gallery-image a[rel^='prettyPhoto']").prettyPhoto({animationSpeed:'fast'});
		
});

$(function () {  
     $(window).scroll(function () {  
         if ($(this).scrollTop() != 0) {  
             $('.link-top').fadeIn();  
         } else {  
             $('.link-top').fadeOut();  
         }  
     });  
     $('.link-top').click(function () {  
         $('body,html').animate({  
             scrollTop: 0  
         },  
         1500);  
     });  
 });


function bascule(elem)
   {
   etat=document.getElementById(elem).style.display;
   if(etat=="none"){
   document.getElementById(elem).style.display="block";
   }
   else{
   document.getElementById(elem).style.display="none";
   }
   }
