glow.ready(function() 
{
							
	var p = glow.dom.get("#asset_description");
		
	var currentElement = glow.dom.get("#img_1").attr("alt");
		
	p.html(currentElement);
		
	var carousel = new glow.widgets.Carousel("#carousel", {
        size: 1,
        step: 1,
		pageNav: true
	});
		
	glow.events.addListener(carousel, "afterScroll", function(event) {

		var currentElement = glow.dom.get("#img_" + (event.position+1)).attr("alt");
			
		p.html(currentElement);
	
	});

});


function showLargeImage(image, width, height, html)
{
	
	$("#dialog").html(html);
	
	$(function() {
	
	$("#dialog").dialog({
		bgiframe: true,
		width: width + 100,
		height: height + 120,
		modal: true,
		closeOnEscape: false,
		draggable: false,
		resizable: false,
		autoOpen: false,
		buttons: {
				'Close Image': function() {
					$(this).dialog('close');
					$(this).dialog('destroy');
				}
			}
		});
	});
	
	$('.selector').dialog('option', 'position', 'top');
	
	$("#dialog").dialog('option', 'title', image);
	
	$("#dialog").dialog('option', 'width', width + 100);
	
	$("#dialog").dialog('option', 'height', height + 120);
	
	$("#dialog").dialog( 'open' );
	
	
}

/*
function showLargeImage(image, html)
{
	var newImg = new Image();
	newImg.src = image;
	var height = newImg.height;
	var width = newImg.width;
			
	if (width != 0 && height != 0)
	{
			
		var myOverlay = new glow.widgets.Panel(
			glow.dom.create(''+html+''), {
			modal: true,
			width: width + 50,
			height: height,
			anim: "fade"
		});
				
		myOverlay.show();
			
	}
}*/