function fun_album(id_alb)
{  
		if (typeof id_alb != 'undefined'){//DELETE ALBUM
			$( "#dialog_alb" ).dialog({
					resizable: false,
					height:140,
					modal: true,
					buttons: {
						"Ok": function() {
						var data = "&id_alb=" + id_alb;

						$.ajax({
						  type: "POST",
						  url: "php/db_photos_gallery.php",
						  data: data,
						    error: function(html){ // Sull'errore invoco una funzione
							alert("Si è verificato un errore. Riprovare più tardi, se il problema persiste contattare il webmaster alla seguente email marco17669@inwind.it");
						    },
						  success: function(html){
							
							carica('php/photos_gallery.php');
							//alert(html); 

		
						  }
						});
						$( this ).dialog( "close" );
					},
					Cancel: function() {
						$( this ).dialog( "close" );
					}
				}
			});
		}else{	//ADD ALBUM
			var name_alb = $("#album_name").val();
			var data = "&name_alb=" + name_alb;
			if (name_alb.length<6) {
				$("#alb_err").css({"display" : "inline", "visibility": "visible"});
			}else{
				$.ajax({
					type: "POST",
					url: "php/db_photos_gallery.php",
					data: data,
					error: function(html){ // Sull'errore invoco una funzione
						alert("Si è verificato un errore. Riprovare più tardi, se il problema persiste contattare il webmaster alla seguente email marco17669@inwind.it");
					},
					success: function(html){
						carica('php/photos_gallery.php');
						//alert(html); 
					}
				});
			}
		};

//alert(id_alb);
};

function add_album(link)
{  
	link = '#' + link;
	$(link).fadeIn("slow");
};

function carica_alb(link_page, id_alb)
{  
	$("body *").css({"cursor" : "progress"});
	$("#left-content").fadeOut("slow", function () 
	{	
		var data = "&id_alb=" + id_alb;
		$("#left-content").load(link_page, data, function () 
		{	
	    		// start animation
			setTimeout("load()",500); //3000
		});
	});
};

function carica_alb2(link_page, id_alb)
{  
	$("body *").css({"cursor" : "progress"});
	$("#ajax_photo").slideUp("slow", function () 
	{	
		var data = "&id_alb=" + id_alb;
		$("#ajax_photo").load(link_page, data, function () 
		{	
	    		// start animation
				$("#ajax_photo").slideDown("slow", function () 
					{	
					$("body *").css({"cursor" : ""});
					});
		});
	});
};

