
function init_contact_upload_fields(contact_id){
  alert("t");
		drop = $('#contact_'+contact_id+' .fileupload').closest(".bottom")
	
	    $('#contact_'+contact_id+' .fileupload').fileupload({
			url: $(this).attr("action"),
	        dropZone: drop,
			autoUpload: true,
			progressall: function (e, data) {
			        var progress = parseInt(data.loaded / data.total * 100, 10);
			        if(progress == 100){
					$(this).find('.progress').html('traitement en cours.');
					}
					else{
					$(this).find('.progress').html(progress + '% téléchargé.');}
			    },
			always: function (e, data) {
			       	$(this).find('.progress').html("");
			    },
				
			drop: function (e, data) {
			
				$('#contact_'+contact_id+' .fileupload').closest(".bottom").css("background", "rgb(255, 255, 204)");
				}
	    });
		
		
		$(".contact .bottom").bind('dragover', function (e) {
			$(this).css("background", "#B7DF63");
		    
		});
		
		$(".contact .bottom").bind('dragleave', function (e) {
			$(this).css("background", "rgb(255, 255, 204)");
		    
		});

	
	


}


$(document).ready(function () {

	$("body").on("click", ".contact .add_files",function(){
	
		$(this).next('input').click();
		return false;
	});
	
});
