/* Dialog Popup --------------------------------------------------------- */
var dialogPopup = null;
function DialogPopup(){
	
	top = document.viewport.getScrollOffsets()[1] + 100;
	
	$('dialog_popup').setStyle({
	  top: top + 'px', 
	  display: 'block'
	});
	
	
	this.beforeClose = function(func){
		this.beforeCloseAction = func;
	}

	this.doAction = function(){
		eval(this.action);
		this.action = null;
	}
	
	this.show = function(content){
		
		$('dialog_body').innerHTML = content;
		
		
	
		new Effect.Appear('dialog_body', { duration: 0.2, from: 0.0, to: 1.0 });
		//new Effect.Appear('dialog_loading', { duration: 0.2, from: 1.0, to: 0.0 });
		
		
		//$('dialog_body').style.display = 'block';
		$('dialog_loading').style.display = 'none';
		
		this.open = true;
	}
	
	
	this.close = function(){
		this.open = false;
		eval( this.beforeCloseAction );
		this.beforeCloseAction = null;
		
		$('dialog_popup').setStyle({
		  display: 'none'
		});
		
		$('dialog_body').innerHTML = '';
		$('dialog_body').style.display = 'none';
		$('dialog_loading').style.display = 'block';
	}

}