var Ihm_Ajax = Class.create(Ihm_Abstract_Effect,
{
	initialize: function ($super, conf)
	{
		var options = {
				ihm_containerId: 'ajaxLoading',
				ihmAction_start_afterFinish: Prototype.emptyFunction,
				ihmAction_stop_afterFinish: Prototype.emptyFunction,
				screen_containerId: 'ajaxOverlay',
				screenEffect_opacity: 0.8,
				screenEffect_backgroundColor: 'black'
		};

		Object.extend(options, conf || {});
		$super(options);
	},

	startScreenEffect: function ()
	{
		var element = $(this.options.screen_containerId);

		if(!element.visible()){
			element.setStyle({backgroundColor:this.options.screenEffect_backgroundColor, opacity:this.options.screenEffect_opacity}).show();
		}
	},

	stopScreenEffect: function ()
	{
		var element = $(this.options.screen_containerId);

		if(element.visible()) {
			element.hide();
		}
	},

	startIhmEffect: function ()
	{
		$(this.options.ihm_containerId).show();
	},

	stopIhmEffect: function ()
	{
		$(this.options.ihm_containerId).hide();
	},

	start: function ()
	{
		this.startScreenEffect();
		this.startIhmEffect();
		this.options.ihmAction_start_afterFinish.defer();
	},

	stop: function ()
	{
		this.stopIhmEffect();
		this.stopScreenEffect();
		this.options.ihmAction_stop_afterFinish.defer();
	}
}
);
