
function deactivateEntry(id)
{
	if(confirm("Soll der Eintrag wirklich deaktiviert werden?"))
	{
		location.replace("/guestbook/entry/deactivate/id/"+ id);
	}
}

var formular = '';
var entry = '';
function editEntry(id)
{
	if(confirm("Soll der Eintrag wirklich bearbeitet werden?"))
	{
		formular = $('#divGuestbookform').html();		
		entry = $('#entry_'+ id).html();
		getPostForm(id);
	}
}


function getPostForm(id)
{
	$.ajax({
		type: "POST",
		url: "/guestbook/entry/edit/",
		data: 'id='+ id,
		success: function(responseText)
		{
			$('#divGuestbookform').html("");
			$('#entry_'+ id).html(responseText);
		}
	});
}



function showPreview()
{
	var author = ($('#author').val() != '') ? $('#author').val() : 'Nickname';
	var subject = ($('#subject').val() != '') ? $('#subject').val() : 'Betreff';
	var message = ($('#message').val() != '') ? $('#message').val() : 'Meine Nachricht';
	var color = ($('#colorclass').length > 0) ? $('#colorclass').val() : '';
	
	var template = $('#templateWrapper').html(); 
	$('#previewBox').hide().html(template);	
	
	$('#templSubject').html(subject);
	$('#templMessage').html(message);
	$('#templAuthor').html("Von "+ author);

	
	if(color != '')
	{
		$('#guestbookentryPreview').addClass(color);
	}
	
	$('#previewBox').show();
}