//<div id="load_div"><img src="images/wait.gif" alt="" /><br /><br /><b>Loading...</b></div>
//javascript:GET('login.php?action=in', 'main_div');
function GET(http, div_name) {
	var LINK_xmlhttp = false;

	try { LINK_xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); }
	catch (e) { try { LINK_xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); }
	catch (e) { try { LINK_xmlhttp = new XMLHttpRequest(); }
	catch (e) { LINK_xmlhttp = false; }}}
	if (!LINK_xmlhttp) return null;
	
	document.getElementById('load_div').style.visibility="visible";

	LINK_xmlhttp.open("GET", http, true);

	LINK_xmlhttp.onreadystatechange = function() {
		if (LINK_xmlhttp.readyState == 4) {
			document.getElementById('load_div').style.visibility="hidden";

			if (LINK_xmlhttp.responseText.indexOf("<script type=\"text/javascript\">") > -1) {
				var x = LINK_xmlhttp.responseText.indexOf("<script type=\"text/javascript\">") + "<script type=\"text/javascript\">".length;
				var y = LINK_xmlhttp.responseText.indexOf("</script>") - x;
				eval(LINK_xmlhttp.responseText.substr(x, y));
			}

			if (LINK_xmlhttp.responseText.indexOf('ALERT|') > -1) {
				var x = LINK_xmlhttp.responseText.indexOf('ALERT|') + "ALERT|".length;
				var y = LINK_xmlhttp.responseText.indexOf('|ENDALERT') - x;
				window.alert(LINK_xmlhttp.responseText.substr(x , y));
			} else
				document.getElementById(div_name).innerHTML = LINK_xmlhttp.responseText + ' ';
		}
	}

	LINK_xmlhttp.send(null);  
	return false;
}


//<form id="login" onSubmit="return POST_ajax('login.php','login_div','login');">
function POST(http, div_name, frm_name) {
	var POST_xmlhttp = false;
	var frm = false
	var url = "";

	try { POST_xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); }
	catch (e) { try { POST_xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); }
	catch (e) { try { POST_xmlhttp = new XMLHttpRequest(); }
	catch (e) { POST_xmlhttp = false; }}}
	if (!POST_xmlhttp) return null;

	frm = document.getElementById(frm_name);

	document.getElementById('load_div').style.visibility="visible";

	url = "frm_name=" + frm_name;

	for (i = 0; i < frm.elements.length; i++) {
		frm.elements[i].disabled = true;
		if (frm.elements[i].type == "checkbox") {
			if (frm.elements[i].checked)
				frm.elements[i].value = 1;
			else
				frm.elements[i].value = 0;
		}
		url = url + "&" + frm.elements[i].name + "=" + escape(frm.elements[i].value);
	}

	POST_xmlhttp.open("POST", http, true);

	POST_xmlhttp.onreadystatechange = function() {
		if (POST_xmlhttp.readyState == 4) {
			document.getElementById('load_div').style.visibility="hidden";

			for (i = 0; i < frm.elements.length; i++) {
				if (frm.elements[i].type == "checkbox")
					frm.elements[i].checked = false;
				if (frm.elements[i].type == "password")
					frm.elements[i].value = "";
				frm.elements[i].disabled = false;
			}

			if (POST_xmlhttp.responseText.indexOf("<script type=\"text/javascript\">") > -1) {
				var x = POST_xmlhttp.responseText.indexOf("<script type=\"text/javascript\">") + "<script type=\"text/javascript\">".length;
				var y = POST_xmlhttp.responseText.indexOf("</script>") - x;
				eval(POST_xmlhttp.responseText.substr(x, y));
			}

			if (POST_xmlhttp.responseText.indexOf('ALERT|') > -1) {
				var x = POST_xmlhttp.responseText.indexOf('ALERT|') + "ALERT|".length;
				var y = POST_xmlhttp.responseText.indexOf('|ENDALERT') - x;
				window.alert(POST_xmlhttp.responseText.substr(x , y));
			} else
				document.getElementById(div_name).innerHTML = POST_xmlhttp.responseText + ' ';
		}
	}

	POST_xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	POST_xmlhttp.setRequestHeader("Content-length", url.length);
	POST_xmlhttp.setRequestHeader("Connection", "close");
	POST_xmlhttp.send(url);  

	return false;
}
