$(document).ready(function(){
	
    //- Variables --------------------------------------------------------------
    var $base_url = 'http://intra.esaybaie/';
    
    //- Initialisation ---------------------------------------------------------
	
	//Lien pour nouvelle page
	$("a[rel^='_blank']").click(function(){
		window.open(this.href, '_blank');
		return false;
    });
	
	//Efface le label dans la textbox quand focus
	if( $('input.label-inside').length ){
		var value = $('input.label-inside').val();
		
		$('input.label-inside').focus(function(){
			if( value == $('input.label-inside').val() ){
				$('input.label-inside').val(null);
			}
		});
		
		$('input.label-inside').blur(function(){
			if( $('input.label-inside').val() == '' ){
				$('input.label-inside').val(value);
			}
		});
	}
	
	//Effet sur le fond des textebox
	$('input:text').focus(function(){
		$(this).addClass('focus');
	});
	$('input:text').blur(function(){
		$(this).removeClass('focus');
	});
	
	//Effet pour le menu deroulant
	ddsmoothmenu.init({
		mainmenuid: "menu", //menu DIV id
		orientation: 'h', //Horizontal or vertical menu: Set to "h" or "v"
		classname: 'ddsmoothmenu', //class added to menu's outer DIV
		contentsource: "markup" //"markup" or ["container_id", "path_to_menu_file"]
	});
	
	//Efface les bulles d'un formulaire
	$('input.input-text, textarea').focus(function(){
		$(this).prevAll('div.error').animate({
			opacity: '0'
		},{
			duration: 500,
			complete: function(){
				$(this).prevAll('div.error').css('display', 'none');
		    }
		});
	});
	
	/*Surligne les corps de métier choisis*/
	$('.labelCheck').click(function(){
		$(this).parent('p').toggleClass('selectionne');
	});
});
