var c = {
	'loading': false,
	'slideDuration': 500,
	'fadeDuration': 500,
	'transition': Fx.Transitions.Quart.easeOut,
	
	u: function(_id, _url, _pars, _onComplete) {
		if(!this.loading) {
			this.loading = true;
			this.resetArrows();		
			new Ajax( _url+'.php',
					  { method: 'post',
						update: $(_id),
						data: _pars,
						onFailure: function() { alert('Ajax request error.') },
						onComplete: function() { eval(_onComplete) },
						evalScripts: true } ).request();
		}
	},
	
	slideLeft: function() {
		$('tempLoader').effect('margin-left', {duration: this.slideDuration, transition:this.transition}).start(-164, 0);
		$('mainLoader').effect('margin-left', {duration: this.slideDuration, transition:this.transition}).start(0, 164).chain( function() { c.loading = false; } );
		this.resetIDs();
	},
	
	slideRight: function() {
		$('mainLoader').effect('margin-left', {duration: this.slideDuration, transition:this.transition}).start(0, -164);
		$('tempLoader').effect('margin-left', {duration: this.slideDuration, transition:this.transition}).start(164, 0).chain( function() { c.loading = false; } );
		this.resetIDs();
	},
	
	fade: function() {
		new Fx.Style('tempLoader', 'opacity').set(0);
		new Fx.Style('tempLoader', 'margin-left').set(0);
		$('mainLoader').effect('opacity', {duration: this.fadeDuration, transition:this.transition}).start(1, 0);
		$('tempLoader').effect('opacity', {duration: this.fadeDuration, transition:this.transition}).start(0, 1).chain(
			function() { 
				new Fx.Style('mainLoader', 'margin-left').set(-999); 
				new Fx.Style('mainLoader', 'opacity').set(1);
				c.resetIDs();
				c.loading = false;
			} );
	},
	
	resetIDs: function() {
		$('mainLoader').id = 'temp';
		$('tempLoader').id = 'mainLoader';
		$('temp').id = 'tempLoader';
	},
	
	resetArrows: function() {
		new Fx.Style('label', 'margin-left').set(0);
		new Fx.Style('label', 'margin-right').set(0);
		$('arrowLeft').style.display = $('arrowRight').style.display = '';
	},
	
	hideLeftArrow: function() {
		new Fx.Style('label', 'margin-left').set(17);
		$('arrowLeft').style.display = 'none';
	},
	
	hideRightArrow: function() {
		new Fx.Style('label', 'margin-right').set(17);
		$('arrowRight').style.display = 'none';
	}	
}
