// =======================
// Elxis Shouter Ajax v1.1
// Copyright: (C) 2008 Ioannis Sannos.
// Author: Ioannis Sannos (isopensource.com)
// E-mail:  datahell@elxis.org
// use ajax_new.js (sack version 1.6.1)
//=======================

var shajax = new sack();

function whenLoadingShouter(){
	var e = document.getElementById('shouterAjaxMsg');
	e.innerHTML = '<img src="modules/mod_shouter/shouterload.gif" border="0" alt="loading" />';
}

function whenLoadedShouter(){
	var e = document.getElementById('shouterAjaxMsg');
	e.innerHTML = '<img src="modules/mod_shouter/shouterload.gif" border="0" alt="loading" />';
}

function whenInteractiveShouter(){
	var e = document.getElementById('shouterAjaxMsg');
	e.innerHTML = '<img src="modules/mod_shouter/shouterload.gif" border="0" alt="loading" />';

	var form = document.getElementById('shouterForm');
    form.shoutermsg.value = '';
}

function whenRefreshingShouter(){
}

function runShouter(){
	var form = document.getElementById('shouterForm');
	var e = document.getElementById('shouterAjaxMsg'); 
	e.style.display = "";

    shajax.setVar("shoutact", 'add');
    shajax.setVar("shoutermsg", form.shoutermsg.value);
    shajax.setVar("shouterauthor", form.shouterauthor.value);
    shajax.setVar("option", form.option.value);
    shajax.setVar("task", form.task.value);
    shajax.setVar("Itemid", form.Itemid.value);

	shajax.requestFile = "index.php";

	shajax.method = 'POST';
	shajax.element = 'shouterAjaxMsg';
	shajax.onLoading = whenLoadingShouter;
	shajax.onLoaded = whenLoadedShouter;
	shajax.onInteractive = whenInteractiveShouter;
	shajax.runAJAX();

}

function shouterRefresh(autoref) {
	var form = document.getElementById('shouterForm');
	var e = document.getElementById('shouterAjaxMsg'); 
	e.style.display = "";

	var c = document.getElementById('shouterDIV');
    c.innerHTML = "";

    shajax.setVar("shoutact", 'refresh');
    shajax.setVar("option", form.option.value);
    shajax.setVar("task", form.task.value);
    shajax.setVar("Itemid", form.Itemid.value);

	shajax.requestFile = "index.php";

	shajax.method = 'POST';
	shajax.element = 'shouterAjaxMsg';
	shajax.onLoading = whenRefreshingShouter;
	shajax.onLoaded = whenRefreshingShouter;
	shajax.onInteractive = whenRefreshingShouter;
	shajax.runAJAX();

    if (autoref==1) {
	   setTimeout("shouterRefresh('1')", 7000);
	}
}

