var Feedback = new Class({
	options: {
		checkUrl: '',
		errorElem : ''
	},

	initialize: function( options) {
		this.setOptions(options);
		this.form = $('feedback_form').addEvent('submit', this.check.bind(this, null, true));
	},
	
	formValidate : function ()
	{
		var FieldNames = new Array();
		
		FieldNames.push('input[name=name]');
		FieldNames.push('input[name=email]');
		FieldNames.push('textarea[name=message]');
		
		if( !TSF.FormValidate.checkAllFormFields( 'feedback_form', FieldNames, this.options.errorElem, fill_required_fields ) ) return false;
		if( !TSF.FormValidate.validateFieldValue( 'feedback_form', 'input[name=email]', 'mail', this.options.errorElem, invalid_email ) ) return false;
		return true;
	},
	
	check: function(ev) {
		ev.stop();
		
		if(!this.formValidate()) return false;
		TSF.page(this.options.checkUrl, this.form.toQueryString(), 'post');
	}
	
});
Feedback.implement(new Events, new Options);