
$(document).ready( function(){
	$("img[@src$=png], #global, #header").pngfix();
	
	$('#filterActivity').slideToggle(1);
	/*
	updateBottomHeight();
	
	$(window).bind("resize", function(){  
	     updateBottomHeight();
	});
	
	function updateBottomHeight(){
		var h = $(window).height()-$('#top').height();
		$('#bottom').height(h);
	}
	*/
	
	var activity = "";
	$('#melangeur_btn').click(function(event){
		event.preventDefault();
		$('#filterActivity').slideToggle("fast");
		if( $('#melangeur_btn').hasClass('opened') ){
			$('#melangeur_btn').removeClass('opened');
		}else{
			$('#melangeur_btn').addClass('opened');
		}
	});
	

	
	$('#filterActivity ul li a').click(function(event){
		event.preventDefault();
		// alert( $(this).html() );
		activity = "";
		if( $(this).hasClass("checked") ){
			$(this).removeClass("checked");
			
		}else{
			$(this).addClass("checked");
		}
	});
	
	
	$('#filterAll_btn').click(function(event){
		event.preventDefault();
		// alert( "ALL" );
		activity = "all";
		$('#filterActivity ul li a').addClass("checked");
	});
	
	
	$('#filterNone_btn').click(function(event){
		event.preventDefault();
		// alert( "NONE" );
		activity = "";
		$('#filterActivity ul li a').removeClass("checked");
	});
	
	
	$('#filter_btn').click(function(event){
		event.preventDefault();
		// var menuArtist = $('columnArtist');
		// alert("menuArtist:"+menuArtist);
		// alert("menuArtist:"+menuArtist[0].html() );
		// $('ul#menuArtist li', menuArtist).hide();

		if( activity != "all" ){
			activity = "";
			$('#filterActivity ul li a').each(function(){
				if( $(this).hasClass('checked') )
				{
					if(activity != "" )
					{
						activity += "_";
					}
					activity += $(this).attr("id");
					// alert("activity = "+activity);
					// $('ul#menuArtist li.'+activity+'').show();
				}
			});
		}
		if(activity != "" )
		{

			window.location.replace('./index.php?activity='+activity);
			// $("#columnArtist").attr({src:'./includes/menu.php?activity='+activity});
		}
		$("#melangeur_btn").trigger('click');
		
	});
	
	$('.close_btn').click(function(event){
		event.preventDefault();
		
		if( $(this).parent().is('#filterActivity') ||  $(this).parent().is('#filterCommand') ) {
			$("#melangeur_btn").trigger('click');
		}else{
			$(this).parent().toggle();
		}
	});
	
/*
  	$('a[@rel*=lightbox]').click( function(event){
		event.preventDefault();
		alert("temp : "+$(window).find('#global #temp'));
		var myLightBoxLink = $(window).find('#global #temp').append($(this).html());
		alert("myLightBoxLink = "+myLightBoxLink);
		myLightBoxLink.lightBox();
	});
 */


});

