var form_guestbook_make_post = function(form){
	this.requestUrl = base_url + 'guestbook/make-post/';
	this.$_form		= form;
	this.init();

    this.doRequest 	=	function()
						{
							if (this.requestUrl != null)
							{
								var $this = this;
								if (this._data == null)
								{
									//this._data = this.$_form.serialize();
									this._data = {
										country				: $('#id_country').val(),
										email				: $('#id_email').val(),
										first_name			: $('#id_first_name').val(),
										last_name			: $('#id_last_name').val(),
										street				: $('#id_street').val(),
										zipcode				: $('#id_zipcode').val(),
										city				: $('#id_city').val(),
										comment				: $('#id_comment').val(),
										allow_display		: ( $('#id_allow_display').is(':checked') === true ? 1 : 0 ),
										allow_newsletter	: ( $('#id_allow_newsletter').is(':checked') === true ? 1 : 0 )
									};
								}

								$.post(this.requestUrl, this._data, function(response)
								{
									$this.onResponse(response);
								}, 'json');

								this._data = null;
							}
							else
							{
								alert ('Missing request url.');
							}
						};

	this.onSucces	= 	function()
						{
							redirect('guestbook/');
						}
};
form_guestbook_make_post.prototype = new form();

$(document)
	.ready( 
		function()
		{
			var $form = $('#form-make-post');
			if ($form.length > 0)
			{
				var form = new form_guestbook_make_post($form);
				
				$form.find('#close-button .hitbox')
						.click(
							function()
							{
								$(this).parents('.lightbox').hide();	
							}
						);
			}
			
			$('.make-post-button .hitbox')
				.click(
					function()
					{
						$('#lightbox-make-post').insertBefore('#canvas');
						lightbox_show('lightbox-make-post');
	
						sifrGenericButtons();
						sifrHeadlines();
					}
				);
			
		}
);