
/*****************************************************************************
* Name:         guestbook.js
* Copyright:    2006 by Marcus Gnaß - gonatan (at) gmx (dot) de
* Created:      
* Modified:     $LastChangedRevision: 16 $
* License:      private use only
* Requirements: JavaScript
* Version:      0.0.1
* Description:  
******************************************************************************
* TODO:
* V0.0.2
* - 
*****************************************************************************/

window.onload = function() {

	make_entry_list_sortable();

}

/** Öffnet das Formular für einen neuen Eintrag in der Division #guestbook_form.
 *	Um den Link durch den dieses Script aufgerufen wird zu deaktivieren wird FALSE zurückgegeben.
 *	Diese Feature kann mit bln_show_inline_form deaktiviert werden.	 
 */	
function open_guestbook_form() {
	// mit bln_show_inline_form = false kann die Anzeige
	// des Formulares als InlineFormular deaktiviert werden.
	var bln_show_inline_form = true;
	// Formular als Effekt aufsliden
	if (bln_show_inline_form)
		var eff = new Effect.toggle('guestbook_form', 'blind');
	return (!bln_show_inline_form);
}

/**
*/
function guestbook_entry_delete(guestbook_entry_id) {

	var uri = app_url;
	uri += 'guestbook/ajax.guestbook.php';

	var qs = {};
	qs['ajax'] = 'guestbook_entry_delete';
	qs['guestbook_entry_id'] = guestbook_entry_id;

	var opt = {};
	opt['method'] = 'get';
	opt['parameters'] = $H(qs).toQueryString();

	/*
	opt['onError'] = function(){alert('onError');};
	opt['onSuccess'] = function(){alert('onSuccess');};
	opt['onException'] = function(){alert('onException');};
	*/

	var ajax = new Ajax.Request(uri, opt);

	new Effect.Fade('guestbook_entry_' + guestbook_entry_id, {duration: .5});

}

/**
	*/
function make_entry_list_sortable() {

	var opt = [];
	opt['tag'] = 'div';
	opt['dropOnEmpty'] = true;
	if (true) {
		opt['constraint'] = false;
		opt['ghosting'] = true;
	} else {
		opt['constraint'] = true;
		opt['ghosting'] = false;
	}

	Sortable.create('entry_list', opt);

}

