function recommendation_post_class() {
	this.changeIsMet = function (val)
	{
		if (val == 1)
		{
			jQuery('#travelled_together_container').show();
			jQuery('#stayed_together_container').show();
			jQuery('#travelled_together_days').show();
			jQuery('#stayed_together_days').show();
		}
		else
		{
			jQuery('#travelled_together_container').hide();
			jQuery('#stayed_together_container').hide();
			jQuery('#travelled_together_days').hide();
			jQuery('#stayed_together_days').hide();
		}
	}
	
	this.validateForm = function ()
	{
		if (jQuery('.is_met:checked').length == 0)
		{
			alert('Please select met face by face option');
			return false;
		}
		if (jQuery('.friendship_type:checked').length == 0)
		{
			alert('Please select at least one Friendship type');
			return false;
		}
		if (jQuery.trim(jQuery('#recommendation_text').val()).length == 0)
		{
			jQuery('#recommendation_text').focus();
			alert('Please enter recommendation text');
			return false;
		}
		return true;
	}
	
	this.calculateCharactersLeft = function ()
	{
		if (jQuery('#recommendation_text').val().length > 500)
		{
			jQuery('#recommendation_text').val(jQuery('#recommendation_text').val().substr(0, 500));
			jQuery('#character_count_left').html(0);
			return false;
		}
		jQuery('#character_count_left').html(500-jQuery('#recommendation_text').val().length);
		return true;
	}
	
	this.clearForm = function ()
	{
		jQuery('.is_met:checked').removeAttr('checked');
		jQuery('#stayed_together_days').val(0);
		jQuery('#travelled_together_days').val(0);
		jQuery('#friends_since_month').val(0);
		jQuery('#friends_since_year').val(0);
		jQuery('.friendship_type:checked').removeAttr('checked');
		jQuery('#recommendation_text').val('');
	}
}

var recommendation_post = new recommendation_post_class();
