function goodCondo(ele){	
	//alert($(ele).attr("int"));
	$("table.active").removeClass("active");
	$("#info-" + $(ele).attr("int")).addClass("active");
}
$(document).ready(function() {

	$("div").each(function() {
	   $(this).html($(this).html().replace(/[»]/g,"<span class='guillemets'>»</span>"));
	});
	
	$.fn.guillemets = function() {
		$(this).append("<span class='guillemets'>&nbsp»</span>");
	}
	$("ul.meta-navigation li a").guillemets();
	$("div.sub-menu ul li a").guillemets();

	$("ul.meta-navigation li.active a").click(function() {
		return false;
	});
	
	$("div.sub-menu ul li.active a").click(function() {
		return false;
	});

	$("div.offres-partenaires").click(function(){
		window.location = "/pages/view/id:26";
	});
	$('ul.navigation li').hover(function() {
       //alert('here');
       $(this).children('ul:hidden').slideDown('fast');
       $(this).children('a').addClass('active');
       }, function() {
       $(this).children('ul:visible').slideUp('fast');
       $(this).children('a').removeClass('active');
   });
   
   /*$("div.contact a.formulaire").prettyPhoto({
   		default_width: '480',
		default_height: '750',
		opacity: 0.50,
		allow_resize: false
   });*/
	
	//$('a.galerie').colorbox();
	$('.fichebox').click(function(){
		
		
	});
	
	$('.blocbox').click(function(){
		
		
	});
	if($('.fichebox').size() > 0) {
		
		$('.fichebox').prettyPhoto({
			allow_resize: false,
			default_width: 432,
			theme: 'light_square'
		});
	}

	if($("a[rel^='prettyPhoto']").size() > 0) {
		$("a[rel^='prettyPhoto']").prettyPhoto({
			theme: 'light_square'
		});
	}
	
	  $('div.projet-specifications h2 a').click(function() {
	  		if($(this).closest('div.projet-specifications').find('div').is(':hidden')) {
	  			$(this).closest('div.projet-specifications').find('div').slideDown();
	  			$(this).closest('div.projet-specifications').find('h2 a').addClass('open');
	  		}else{
	  			$(this).closest('div.projet-specifications').find('div').slideUp();
	  			$(this).closest('div.projet-specifications').find('h2 a').removeClass('open');
	  		}
	  		return false;
	  }); 
	  
		$('div.fiche div.reponse a.lire').click(function() {
	  		if($(this).closest('div.reponse').find('.reponse_suite').is(':hidden')) {
	  			$(this).closest('div.reponse').find('.reponse_suite').slideDown();
	  			$(this).addClass('active');
	  			$(this).html("Fermer");
	  		}else{
	  			$(this).closest('div.reponse').find('.reponse_suite').slideUp();
	  			$(this).removeClass('active');
	  			$(this).html("Lire la suite");
	  			
	  		}
	  		return false;
		}); 
	  
	  /*$('div.contact h2 a').click(function() {
	  		if($(this).closest('div.contact').find('#form').is(':hidden')) {
	  			$(this).closest('div.contact').find('#form').slideDown();
	  			$(this).closest('div.contact').find('h2 a').css('backgroundPosition', '98% -85px');
	  		}else{
	  			$(this).closest('div.contact').find('#form').slideUp();
	  			$(this).closest('div.contact').find('h2 a').css('backgroundPosition', '98% 15px');
	  		}
	  		return false;
	  }); */
	  
	  
	  $('div.ecorespo_lienmilieu li a').click(function() {
	  		if($(this).closest('li').find('div').is(':hidden')) {
	  			$(this).closest('li').find('div').slideDown();
	  			$(this).closest('li').find('a').addClass('open');
	  		}else{
	  			$(this).closest('li').find('div').slideUp();
	  			$(this).closest('li').find('a').removeClass('open');
	  		}
	  		return false;
	  });
	  	  
	/**** FAKE CHECKBOXES ****/ 
	$("label>input[type=checkbox]").css("opacity", "0");
	$("label>input[type=checkbox]:not(:checked)").parent().addClass("checkbox_non");
	$("label>input[type=checkbox]:checked").parent().addClass("checkbox_oui");
	$("label>input[type=checkbox]").parent().click( function() {
		if ($(this).children("input[type=checkbox]").attr("checked")) {
			$(this).children("input[type=checkbox]").attr("checked", "checked");
			$(this).removeClass("checkbox_non");
			$(this).addClass("checkbox_oui");
			}
		else {
			$(this).children("input[type=checkbox]").attr("checked", "");
			$(this).removeClass("checkbox_oui");
			$(this).addClass("checkbox_non");
			}
		});
	  
	  
	/**** FAKE SELECTS ****/
	
	$('div.fakeselect').each(function() {
				$(this).prepend('<div class="fakeclose"></div>');
			});
			
	
	
	$('#contactform div.selecteur').live('mouseleave', function(){
		$(this).find('div.fakeselect ul.selectlist:visible').slideUp();
	});
	
	$("#profs_submit").live('click', function (){
		if ($('form#profsSearch').size() > 0) {
			clearText();
		}
	});
	
	var block_lang = false;
	
	$('div.selectcurrent').live('click', function(){
		$('.fakeselect').css('z-index', '100');
		$(this).parent('.fakeselect').css('z-index', '1000');
		$(this).siblings('div.fakeclose').show();
		if(block_lang == true){}
		else{
			block_lang = true;
			$(this).parent('div').find('ul').slideToggle('fast', function(){
				block_lang = false;
			});
		}
	});
	
	$('div.fakeselect ul li').live('click', function(){
		var $li = $(this);
		var selNid = $(this).attr('nid');
		var selRel = $(this).parent('ul').attr('related');
		
		if($li.hasClass('selected')){
			$(this).parent('div').find('ul').slideUp('fast');
			$(this).parent('div.fakeselect').css('z-index', '100');
		}
		else{
			$(this).parent('ul').parent('div').find('span').text($li.text());
			$(this).parent('ul').parent('div').find('ul').slideUp('fast');
			$(this).parent('div.fakeselect').css('z-index', '100');
			thisValue = $(this).text();
			$(this).closest('.fakeselect').find('.hidden_input').val(thisValue);
		}
	});
	
	$('div.fakeclose').mouseover(function() {
		$(this).parent('div.fakeselect').find('ul').slideUp(300, function() {
			$(this).parent('div.fakeselect').css('z-index', '100');
		});
		$(this).hide();
		
	});
	
	
	$('.bientotDispo').click(function() {
		$('div.overLay').fadeTo(400, 0.7);
		$('img.pastilleHuge').fadeIn();
		return false;
	});
	
	$('div.overLay, img.pastilleHuge').click(function() {
		$('div.overLay, img.pastilleHuge').fadeOut();
	});
	

	
});
