var Helpdesk = new Class({
	options: {
		checkUrl: ''
	},

	initialize: function( options) {
		this.setOptions(options);
		if($('ghelpdesk_form'))
		this.form = $('ghelpdesk_form').addEvent('submit', this.check.bind(this));
		else if($('helpdesk_answer_form')) 
		this.form = $('helpdesk_answer_form').addEvent('submit', this.check.bind(this));
		else
		this.form = $('helpdesk_form').addEvent('submit', this.check.bind(this));
	},

	check: function(ev) {
		ev.stop();
		if($('helpdesk_answer_form'))
		TSF.page(this.options.checkUrl, this.form.toQueryString(),'POST');
		else if($('helpdesk_form')){
		checker = check_validat();
		if(checker)	
		TSF.page(this.options.checkUrl, this.form.toQueryString(),'POST');}else{
		checker = check_fields_filled_helpdesk();
		if(checker)	
		TSF.page(this.options.checkUrl, this.form.toQueryString(),'POST');
		}
	}
});
Helpdesk.implement(new Events, new Options);

