$.virta_registration = 
{
	params : {close_title : 'Отмена'},
	
	action_url : null,
	
	html_element_id : 'virta_registration-login-form',
	html_element_width : 700,
	html_element_top_default : 30,
	html_element_left_default : 30,
	html_content : null,
	html_element : null,
	
	left : null,
	top : null,
	width : null,
	fadeOut:  0,

	close_element : null,
	
	show : function(action_url)
	{
		this.action_url = action_url;
		this.loading.show();
		this.load_form();
	},
	
	show_process : function(data, $self)
	{
		$self.object().html(data);
		
		$self.loading.hide();
		
		$self.left = Math.max($('body').width() / 2 - $self.html_element_width / 2, $self.html_element_left_default);
		$self.top = $self.html_element_top_default;
		$self.width = $self.html_element_width;
		
		jQuery.blockUI({ message: $self.object(), css : {left: $self.left, top: $self.top, width: $self.width}});
		
//		$self.close_elsement($self).show();
	},
	
	hide : function()
	{
		jQuery.unblockUI();
//		this.close_elsement().hide();
	},
	
	close_elsement : function ($self)
	{
		if (!$self)
		{
			$self = this;
		}
		if (!$self.close_element)
		{
			$self.close_element = $('<a href="#" onclick="$.virta_registration.hide(); return false;" style="position: absolute; z-index: 10002"><img src="view/new_design/img/close.gif" alt="'+ $self.params.close_title +'" title="'+ $self.params.close_title +'" border="0" /></a>');
			$self.close_element
				.appendTo('body')
				.css({left: $self.left + $self.width - $self.close_element.width() - 20, top: $self.top + 20});
		}
		return $self.close_element;
	},
		
	object : function()
	{
		if (!this.html_element)
		{
			this.html_element = $('<div id="'+ this.html_element_id +'" style="display:none" />')
				.appendTo('body');
		}
		return this.html_element;
	},
	
	load_form : function()
	{
		process = this.show_process;
		$self = this;
		
		$.get
		(
			this.action_url,
			function (data) { process(data, $self) }
		);
	},
	
	loading : 
	{
		is_show : false,
		
		html_element_id : 'virta_registration-login-form-loading-zone',
		html_element : null,
		
		show : function ()
		{
			jQuery.blockUI({ message: this.object(), css: {border: '0', backgroundColor: 'transparent'} })
		},
		
		hide : function()
		{
			jQuery.unblockUI()
		},
		
		object : function()
		{
			if (!this.html_element)
			{
				this.html_element = $('<div id="'+ this.html_element_id +'" style="display:none" />')
					.html('<img src="view/new_design/img/loading/gauga.gif" />')
					.appendTo('body');
			}
			return this.html_element;
		}
	}
}