// Methods for OP DB Viewer
//
// @author		Andreas Kundoch <typo3@mehrwert.de>
// @version		$Id: ajax.js 4050 2008-11-24 21:26:03Z ak $
// @package		TYPO3
// @subpackage	tx_mwaxopviewers
// @license		GPL
//
var OptimizedProtocols = {

	ajaxUri: null,
	eID: null,

		// Initialize the form
	init: function(elementID)	{
		new Ajax.Request(this.ajaxUri, {
			method: 'get',
			parameters: { eID: this.eID, page_uri: this.ajaxUri },
			onSuccess: function(xhr) { $(elementID).innerHTML = xhr.responseText; },
			onFailure: function() { alert('An error occured. (1)'); }
		});
	},
		// Refresh the form
	refresh: function(categoryID)	{
		$('cell_category').value = categoryID;
		$('optimized_protocol_list').innerHTML = '<div style="border: 0; width: 100%; height:  100%; padding: 100px 0 100px 0; text-align: center;"><img src="typo3conf/ext/mw_ax_op_viewers/res/images/icon_loader_32.gif" height="32" width="32" alt="Loading..." /><br /><span style="color: #ccc;">Loading...</span></div>';
		new Ajax.Request(this.ajaxUri, {
			method: 'get',
			parameters: $('tx_mwaxopviewers_form').serialize(true),
			onSuccess: function(xhr) { $('optimized_protocol_viewer_placeholder').innerHTML = xhr.responseText; },
			onFailure: function() { alert('An error occured. (1)'); }
		});
	},
		// Reset the form and keep the category
	resetForm: function(elementID, categoryID)	{
		new Ajax.Request(this.ajaxUri, {
			method: 'get',
			parameters: { eID: this.eID, page_uri: this.ajaxUri, cell_category: categoryID },
			onSuccess: function(xhr) { $(elementID).innerHTML = xhr.responseText; },
			onFailure: function() { alert('An error occured. (1)'); }
		});
	}
};

