// JavaScript Document
function my_ajax_update(target,url,pars,timer) 
{
	var myAjax = new Ajax.Updater(target, url, {
			method: 'get', 
			parameters: pars,
			evalScripts : true,
			onFailure: reportError,
			onComplete: function()
			{     
				//alert('Request Completed'); 
			}
		});
	if (timer > 0) setTimeout("my_ajax('"+target+"','"+url+"','"+pars+"',"+timer+")",timer);
}

function my_ajax_request(url,pars)
{
	var myAjax = new Ajax.Request(url, {
		method: 'post',
		postBody: pars,
		onFailure: reportError,
		evalScripts:true,
		asynchronous: true,
	    onSuccess: function(transport)
		{
			var response = transport.responseText || "";
			//Parse Values and Add them to Array
			if (response != "")
			{
				//On Success Message
			}
		},
		onComplete: function()
		{
			//On Complete Message
		}
	}
	)
}

function my_jshttp_request(target,url,pars)
{
	 JsHttpRequest.query(
            url, pars,
            // Function is called when an answer arrives. 
            function(result, errors) 
			{
				if (errors) 
				{
					alert("ERROR: " + errors);
				}
				// Write the result.
                if (result) 
				{
					document.getElementById(eval(target)).innerHTML = result; 
                }
            },
            false  // do not disable caching
        );	
}

function reportError(request)
{
	alert('Sorry. There was an error.' + request);
}
