/**
 * @author Constantin Boiangiu ( constantin.b@gmail.com )
 * @copyright Constantin Boiangiu 2009
 * You may not use this script in any way without the author consent.
 */
var FeedbackForm = {
	start: function(){
		
		new AlertWindow({
			classStyle:'.FBK_alert',
			onComplete: function(elems){
				var f = elems.message.getElement('form').setStyle('display','block');
				FeedbackForm.form = f;
				f.addEvent('submit', function(){
					$('FBK_errors').setStyle('display','block').empty().addClass('loading');
					//$('FBK_submit').set({'disabled':'disabled'});
				})
			},
			onClose: function(){
				$('FBK_errors').setStyle('display','none');
				//$('FBK_submit').set({'disabled':''});					
			}
		});
		
		FeedbackForm.scollingLink();		
	},
	
	scollingLink: function(){
		var el = $('FBK_trigger');
		
		el.addEvents({
			'mouseover': function(event){
				event.stopPropagation();
				this.setStyle('width',65);
			},
			'mouseout': function(event){
				this.setStyle('width',55);
			}
		});		
	},
	
	errors: function(message){
		$('FBK_errors').removeClass('loading').set({'html':message});
		//$('FBK_submit').set({'disabled':''});
	},
	
	success: function(message){
		$('FBK_errors').removeClass('loading').set({'html':message});
		FeedbackForm.form.setStyle('display','none');
	}
}

window.addEvent('domready', FeedbackForm.start);