function marquer_message(indice,id_msg)
{
   $.ajax({
   type: "POST",
   url: "marquer_lu.php",
   data: "id_msg="+id_msg,
   success: function(msg){
	 $('#div_message'+indice).removeClass('cadre_message_gris');
	 $('#bt_marquer_lu'+indice).remove();
   }
 });
 
 
}

//Ajouter plusieur Option à l'objet
function envoieRequete(page_retour,cible,id,indice,param)
{
	$("#"+cible+"").html('<span id="img_load" style="padding-left:40px; padding-right:40px;"><img src="images/img_load.gif" width="16" height="16" /></span>');
    //maj select
	$.ajax({
    type: "POST",
	cache: false,
    url: ""+page_retour+"",
    data: "id="+id+"&indice="+indice+param,
    success: function(msg){
     $("#"+cible+"").html(msg);
	 traiterUpload();
       }
    });	
		
}

//Supprimer element de avec ajax
function supprimerObjet(id,page_retour,cible,indice,param)
{
	   
	   $("#"+cible+"").remove();
	   
	   if(page_retour!='')
	     {
			 //maj select
	         $.ajax({
               type: "POST",
	           cache: false,
               url: ""+page_retour+"",
               data: "id="+id+"&indice="+indice+param,
               success: function(msg){  }
             });	
		 }
	
	  
}

$(document).ready(function(){

//fancybox
if($("#amsgbox").length>0)
{
$("#amsgbox").fancybox({
	'showCloseButton': false,
				'padding'			: 0,
				'titlePosition'		: 'inside',
				'transitionIn'		: 'none',
				'transitionOut'		: 'none'
			});
}		


//fancybox
if($("#amsgbox_val").length>0)
{
$("#amsgbox_val").fancybox({
	'showCloseButton': false,
				'padding'			: 0,
				'titlePosition'		: 'inside',
				'transitionIn'		: 'none',
				'transitionOut'		: 'none'
			});
}

	

if($(".boxfancy").length>0)
	{
	$(".boxfancy").fancybox({
		titleShow :false,
		showCloseButton:true,
		'padding'			: 0,
		ajax : {
		    type	: "POST",
		    data	: 'mydata=test'
		}
	});
	}
	
			
	if($(".ajaxfancy").length>0)
	{
	$(".ajaxfancy").fancybox({
		titleShow :false,
		showCloseButton:true,
		'padding'			: 0,
		'width'				: 50,
		'height'			: 50,
		ajax : {
		    type	: "POST",
		    data	: 'mydata=test'
			
		}
	});
	}
	
	if($(".frame").length>0) {
$(".frame").fancybox({
	            showCloseButton:true,
				'padding'			: 0,
				'titlePosition'		: 'inside',
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'type'				: 'iframe',
				'width'				: 860,
		        'height'			: 560,
			});
	}
	
	if($("#boxaj").length>0)
	$("#boxaj").click();

	if($("#msg1").length>0)
	{

$("#msg1").fancybox({
				'padding'			: 0,
				'titlePosition'		: 'inside',
				'transitionIn'		: 'none',
				'transitionOut'		: 'none'
			});
	}

// validation formulaire de contact
if($("#fcontact").length>0)
	{
	$("#fcontact").validate({
		onfocusout: false,
		onkeyup: false,
		meta: "validate",					   
		submitHandler: function(form) {
			//alert("test soummettre contact");
			form.submit();	
		},					  
		showErrors: function(errorMap, errorList){ 
			if (errorList.length > 0) {
				//alert("erreur");
				jQuery('#inline1').html( errorList[0].message); $("#amsgbox").click();
			}
		}
	}); 
	}
	


});
	
