var thisdiv;

function success_handler(o) {
	replace_html(thisdiv, o.responseText);
}
		
function failure_handler(o) {
	replace_html(thisdiv, 'Server or your connection is dead');
}
		
function replace_html(id, content) {
	thisdiv = id;
	document.getElementById(id).innerHTML = content;
}
		
function show_progressbar(id) {
	thisdiv = id;
	replace_html(id, '<div style="text-align: center;"><br /><br /><img src="/images/loading.gif" border="0" alt="Loading, please wait..." /><br />Loading...</div>');
}
		
function send_request(postData, postFile, divid) {
	thisdiv = divid;
	show_progressbar(divid);
	var callback = { success:success_handler,	failure:failure_handler };
	YAHOO.util.Connect.asyncRequest('POST', ''+postFile+'', callback, postData);
}
		
function test_failure() {
	show_progressbar(thisdiv);
	var callback = { success:success_handler,	failure:failure_handler, timeout: 10000 };
	YAHOO.util.Connect.asyncRequest('POST', 'http://www.google.com.au/idontexist.php', callback);
}
