$(document).ready(function(){
	var arrayImage = "";
	
    $("a[rel^='prettyPhoto']").prettyPhoto({ theme:'light_rounded', modal:true, overlay_gallery:false });
    
    $("a#addImage").click(function(){
    	$('#ichooser').toggle();
    	return false;
    });
    
    $("a#add_review_pic").click(function(){
    	$('#review_chooser').toggle();
    	return false;
    });
    
    $("a#addPDF").click(function(){
    	$('#pdf_loader').toggle();
    	return false;
    });
    
    $("a#addImage_2").click(function(){
    	$('#ichooser_2').toggle();
    	return false;
    });
    
    $("#fchooser_gal img").bind({
    	mouseenter: function(){
    		$(this).css('cursor','pointer');
    	},
    	mouseleave: function(){
    		$(this).css('cursor','');
    	},
    	click: function(){
    		var path = $(this).attr('rel');
			var oldcontent = $('#webStatus').val();
    		var image = "<img src='"+path+"' width='96' height='96' class='commentImage'/>";
    		arrayImage = arrayImage+image;
    		//alert(arrayImage);
    		var totalstring = "<div class='clearBoth'></div>"+arrayImage+"<div class='clearBoth'></div>";
    		$('#hiddengallery').val(totalstring);
    		$(this).css("opacity","0.6");
    		$("#image_attach").prepend("Hai allegato"+$(this).attr("alt")+"<br/>");
    		return false;
    	}
    });
    
    $("#review_chooser_gal img").bind({
    	mouseenter: function(){
    		$(this).css('cursor','pointer');
    	},
    	mouseleave: function(){
    		$(this).css('cursor','');
    	},
    	click: function(){
    		var path = $(this).attr('rel');
//    		alert(path);
    		var image = "<img src='"+path+"' width='96' height='96' class='commentImage'/>";
    		arrayImage = arrayImage+image;
    		//alert(arrayImage);
    		var totalstring = "<div class='clearBoth'></div>"+arrayImage+"<div class='clearBoth'></div>";
    		$('#hiddengallery').val(totalstring);
    		$(this).css("opacity","0.6");
    		return false;
    	}
    });
    
	
    

});
