if ( typeof Feedback == 'undefined' )
{

Feedback = function( options )
{
	this.popup = new Popup();
	this.message = new Message();
	
	this.selectedSection = '';
	this.selectedTopic = '';
	
	this.init( options );
};


Feedback.prototype.init = function( options )
{
	for ( var i in options )
		this[ i ] = options[ i ];
	
	//Если выбрана тема
	if ( this.values.topic )
	{
		//Проверяем, какая тема выбрана
		var obSelf = this; 
		$('#feedback_form input[name=topic]').each( function( key ) {
			if ( $(this).attr('checked') )
			{
				if ( key <= 5 )
				{
					obSelf.show( 'bilet' );
					obSelf.hide( 'other' );
				}
				else
				{
					obSelf.show( 'other' );
					obSelf.hide( 'bilet' );
				}
					
				return false;
			}
		} );
	}
};


Feedback.prototype.show = function( id )
{
	$('#' + id).css( 'display', '' );
};


Feedback.prototype.hide = function( id )
{
	$('#' + id).css( 'display', 'none' );
};


Feedback.prototype.switcher = function( id )
{
	if ( $('#' + id).css( 'display' ) == 'none' )
	{
		this.selectedSection = id;
		this.show( id );
	}
	else
	{
		this.selectedSection = '';
		this.hide( id );
	}
	
	if ( this.selectedSection )
		this.show( 'main' );
	else
		this.hide( 'main' );
};


Feedback.prototype.checkForm = function()
{
	var selectedTopic = false;
	
	//Проверяем, какая тема выбрана
	$('#feedback_form input[name=topic]').each( function() {
		if ( this.checked )
		{
			selectedTopic = true;
			return false;
		}
	} );
	
	if ( !selectedTopic ) 
	{
		alert( this.langs.error.topic );
		return false;
	}
	else if ( !$('#message').val() )
	{
		alert( this.langs.error.message );
		return false;
	}
	
	return true;
}


}
