$(document).ready(function(){    
	$('.contentRightCol').hide();

	function showRecaptcha(element, submitButton, recaptchaButton, themeName) 
	{
		Recaptcha.destroy();
 	  	Recaptcha.create("<insert ReCAPTCHA key here>", element, {
        	theme: themeName,
        	tabindex: 0,
        	callback: Recaptcha.focus_response_field
 	 	});
	};
	 
 	 $(".contact_submit").hide();
  	 $(".recaptcha_required").show();
  	 //$("#"+recaptchaButton).hide();
 	 //$("#"+submitButton).show();



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

		//le id de l'element
		var idClicked=$(this).attr('id');

		//refresh le captcha
		showCaptcha(idClicked);
		
		
		
		//si on clique sur un deja ouvert
		if( $(this).hasClass("selectionSelected") ){
			$(this).css('background-position','top left');
			$(this).removeClass("selectionSelected");
			$(this).next().slideUp("fast");
		}else{
			//si on clique sur un qui est fermé
			$(".selectionSelected").css('background-position','top left');
			$(this).css('background-position','bottom left');
			
			$(".selectionSelected").next().slideUp("fast");
			$(".selectionSelected").removeClass("selectionSelected");
			$(this).next().slideDown("fast");
			$(this).addClass("selectionSelected");
		}
	

	});
	
	
	var listOptions = "";
	var d = new Date();
	var curr_year = d.getFullYear();

	for(i=0; i<4; i++){
		listOptions += '<option value="' + curr_year + '">' + curr_year + '</option>';
		curr_year++;
	}

	$("#year").html(listOptions);
	
	$('.refreshCaptcha').click(function(){
		var quel=$(this).attr("rel");
		return showCaptcha(quel);
	});
});


function showCaptcha(quel){
//Newsletter, Reminder

	$('#captcha'+quel).attr('src','securimage/securimage_show.php?' + Math.random());
	
	var txCaptcha=$('#txt_captcha'+quel);
	txCaptcha.val('');
	return false

}

