function Gallery() {

  this.dialogID = "galleryDialog";
  this.dialogDiv = '<div class="ui-corner-all" id="galleryDialog"></div>';

  this.initDialogDiv = function() {
    if (undefined == $('#'+this.dialogID) || null == $('#'+this.dialogID).html()) {
      $('body').append(this.dialogDiv);
      $('#'+this.dialogID).dialog({
		autoOpen: true,
		bgiframe: true,
		height: 380,
		width: 800,
		resizable: false,
		draggable: false,
		modal: true,
		closeOnEscape: false,
		title: 'GALLERY',
		zIndex: 9999
	  });
      $(".ui-dialog-titlebar").hide();
    }
  }

  this.getDialog = function() {
    $('#'+this.dialogID).remove();
    this.initDialogDiv();
	$('#'+this.dialogID).dialog('open');
  }  

  this.show = function(sourceID) {
    $('#gid_'+sourceID).blur();
    this.getDialog();
    
    $.get('/galleryDialog.jsp?galleryID='+sourceID, function(data) {
      $('#'+gallery.dialogID).html($.trim(data));
    });
  }

  this.update = function(sourceID) {
    $.get('/galleryDialog.jsp?galleryID='+sourceID, function(data) {
      $('#'+gallery.dialogID).html($.trim(data));
    });
  }

  this.close = function() {
	$('#'+this.dialogID).dialog('close');
  }  
}

function blank() {
  //
}

var gallery = new Gallery();
