$.fn.clearValue = function() {
	$(this).each(
		function() {			
			$(this).click(function() {
				this.initValue = $(this).attr('title');
				if(this.value == this.initValue) {
					this.value = '';
				}
			});
			
			$(this).blur(function() {
				if( this.value.length == 0 ) {
					this.value = this.initValue;
				}
			})
		}
	);
}

$ (function () {
	
	//$('div.contentscroll').jCustomScrollbar() ;		
	/* vidage des champs */
	
	$("input[@type='text']").click ( function () {
		this.value = "";
	});
	
	$("input[@type='password']").click ( function () {
		this.value = "";
	});
	
	$("textarea").click ( function () {
		this.value = "";
	});
	
	
	$('.typepwd').click(
		function() {
			$(this).hide();
			$(this).next('.realpwd')
				.val('')
				.show()
				.focus();
		}
	);
	
	$(".B_moncompte_form").find("input[@type='text']").not(".perso").unbind('click');
	$(".B_moncompte_form").find("textarea").not(".perso").unbind('click');
	
	$('#form_creer_alerte').find("input[@type='text']").each( function() {
		$(this)
			.unbind('click')
			.clearValue();
	});
	
	$(".formulaire").find("input[@type='text']").not(".input1").unbind('click');
	
	$(".formulaire").find("input[@type='text']").not(".input2").unbind('click');
	
	$(".moteur_recherche2").find("input[@type='text']").not(".input1").unbind('click');

	$(".moteur_recherche2").find("input[@type='text']").not(".input2").unbind('click');

	$(".Form_achat").find("input[@type='text']").not(".inputAchat").unbind('click');
	
	$(".recherche_annee").find("input[@type='text']").not(".input_annee").unbind('click');
	
	$(".form_rechercheE").find("input[@type='text']").not(".input").unbind('click');
	
	$('#form_recherche_indice').find("input[@type='text']").each( function() {
		$(this)
			.unbind('click')
			.clearValue();
	});
	
	$('#form_recherche_indice2').find("input[@type='text']").each( function() {
		$(this)
			.unbind('click')
			.clearValue();
	});
	
	
	$('#Form_achat').find("input[@type='text']").each( function() {
		$(this)
			.unbind('click')
			.clearValue();
	});
	
	$('#recherche_annee').find("input[@type='text']").each( function() {
		$(this)
			.unbind('click')
			.clearValue();
	});
	
	$('#Form_recherche_E').find("input[@type='text']").each( function() {
		$(this)
			.unbind('click')
			.clearValue();
	});
});
