   /*
        Form Field Value Swap
    */
    
    
$(function() {

	swapValues = [];
	$(".clearform").each(function(i) {
		swapValues[i] = $(this).val();
		$(this).focus(function() {
			if ($(this).val() == swapValues[i]) {
				$(this).val("");
			}
		}).blur(function(){
			if ($.trim($(this).val()) == "") {
				$(this).val(swapValues[i]);
			}
		});
			
		
	 });

 
});

$(document).ready(function(){
	$('#searcharticle').submit(function(){

		if ($('input.clearform', this).val() == "" || $('input.clearform',this).val() == "Votre recherche") {
			alert('Vous devez taper des mots clés dans le champ de recherche');
			return false;
		}	
		    
	});
});



   /*
        Confirmation de suppression
    */
    
$(document).ready(function(){
     $(".supprimer").click( function(event) {
	 if (confirm('Etes-vous certain de vouloir supprimer cette info ?!')==false)
 	{
  	return false;
  	}
 });
 });

/*
	Options form
*/

$(document).ready(function(){

     $('p').filter("[@id^=options]").toggle( function() {
       var myId='#' + $(this).attr("id");
  		var idreg = new RegExp( "[0-9]+", "g" ) ;
  		var idoption = myId.match(idreg);
  		$('#formCache' + idoption).css({'display':'block'}) }, function () {
  		var myId='#' + $(this).attr("id");
  		var idreg = new RegExp( "[0-9]+", "g" ) ;
  		var idoption = myId.match(idreg);
	 $('#formCache' + idoption).css({'display':'none'})
 });
 });
 
