function init(pageContext){
	// dialog box galleria fotografica
	$('a.popin').click(function(){
		
	    var img = $(this).children("img")
	    var url = $(this).metadata().src;
	    var dida = $(this).metadata().dida;
	    var imgObj = new Image();
	    var $d = makeDialog(imgObj, dida);
	    
	  //  $(imgObj).load(function(){
	    	
	    	$d.dialog('open');
	    	$d.dialog('option', 'position', 'center');
	  //  });
	    imgObj.src = url;
	    return false;
	});
	
	// galleria fotografica jcarousel
	jQuery('#mycarousel').jcarousel({
		scroll : 2,
		visible: 6,
		buttonNextHTML: null,
	    buttonPrevHTML: null,
	    initCallback: function(carousel) {
	        jQuery('#carousel-control-next').bind('click', function() {
	            carousel.next();
	            return false;
	        });

	        jQuery('#carousel-control-prev').bind('click', function() {
	            carousel.prev();
	            return false;
	        });
	    }
	});
	
    // galleria audio/video
    var $d = makeDialog('', '', {width: 510, position: 'center',resizable: false, close: function(){$d.setContent('');}})
    $('.openvideo').click(function(){
    	$d.setDescription($("#descVideo").text());
    	
        // embed flash
        flashembed($d.getContentDom(), {
	            src: pageContext.videoPlayer,
	            width: 470,
	            height: 290,
	            wmode: "opaque",
	           	allowfullscreen: true,
	           	allowscriptaccess: "always" 
	        },
	        {
	        	file: $(this).attr("href"),
	        	autostart : 'true',
	        	streamer: videoParams.host + (videoParams.port ? ':' : '') + videoParams.port + "/" + videoParams.vod,
	        	skin: pageContext.videoSkin,
	        	plugins: 'sharing-1',
	        	'sharing.link': document.location.href
	        	//image: "preview.jpg",
	        	//streamer: "rtmp://edge01.fms.dutchview.nl/botr"
			}
   	    );
        
        $d.dialog("open");
        
        return false;
    });
    
    // DIALOG PREZZI
    $('a.open2').click(function(){
        $('#boxPrezzi').dialog('open');
        return false;
    }); 
    var buttonsMap = {};
   
    buttonsMap[pageContext.acquista] = function(){
        location.href = pageContext.urlAcquista;
		$(this).dialog('close');
	}
    
    $('#boxPrezzi').dialog({
    	
    	
    	autoOpen: false,
    	resizable: false,
		height: 550,
		width:  parseInt($('#boxPrezzi').metadata().w),
		modal: true,
		position: 'center',
		buttons: buttonsMap
    });
}
