$(document).ready(function(){

	$("#parGenre").change(function () {
	  	
	  	location.href = "/tmc/programmation/genre/"+$(this).val();
	})
	
	$("#parMois").change(function () {
		location.href = "/tmc/programmation/mois/"+$(this).val();
	})

	
	$("select.txtSmall").change(function () {
		tmp = $(this).val();
		$(this).val("");
		location.href = "/tmc/programmation/detail/"+tmp;
		
	})
	
	
	
	$("#mailingBtn").click(function() {
		$("#footerAlert").slideUp();
		$.post("/tmc/inscription/", { 
      						name: $('#name').val(), 
      						email: $('#email').val()				
      						 
      				},function(data){
      					//alert('DATA: '+data);
      					arrFormData = data.split('||');
      					if(arrFormData[1] == 'noNom' ){
      						$("#footerAlert").text("Entrez un nom");
      						$("#footerAlert").slideDown();
      					}else{
      						//alert('save Nom');
      						if(arrFormData[2] == 'noEmail'){
	      						$("#footerAlert").text("Entrez un courriel");
	      						$("#footerAlert").slideDown();
	      					}else{
	      						$("#mymail_add").submit();
	      						$("#footerAlert").text("Merci");
	      						$("#footerAlert").slideDown();
	      					}
      					}
      				});
	
	});
	$("#name").focus(function () {
         if($(this).val() == 'Entrez votre nom'){
         	$(this).val('');
         	$("#footerAlert").hide();
         }
    });
    
	$("#name").blur(function () {
         if($(this).val() == ''){
         	$(this).val('Entrez votre nom');
         }
    });
    
	$('#email').focus(function () {
         if($(this).val() == 'Entrez votre courriel'){
         	$(this).val('');
         	$("#footerAlert").hide();	
         }
    });
	
	$("#email").blur(function () {
         if($(this).val() == ''){
         	$(this).val('Entrez votre courriel');
         }
    });

	
});