/*
 * Made by KATORA
 */

function ajax(FIL,REQ,RES){
	if(window.XMLHttpRequest)
		http = new XMLHttpRequest();
	else
		http = new ActiveXObject("Microsoft.XMLHTTP");
		
	//http=(navigator.appName == "Microsoft Internet Explorer") ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
	http.open('post', FIL+'.php');
	http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	http.send(REQ);
	http.onreadystatechange = function(){
		if(http.readyState == 4)
		{
			document.getElementById(RES).innerHTML= http.responseText;
			//document.getElementById(RES).innerHTML = '';
			//var wrapping = document.createElement('div');
			//wrapping.innerHTML = http.responseText;
			//document.getElementById(RES).appendChild(wrapping);
		}
	}
}

function __ajax(FIL, REQ, RES)
{
	if(window.XMLHttpRequest)
		http = new XMLHttpRequest();
	else
		http = new ActiveXObject("Microsoft.XMLHTTP");
		
	//http=(navigator.appName == "Microsoft Internet Explorer") ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
	http.onreadystatechange = function(){ showRes(http, RES) }
	http.open('post', FIL+'.php');
	http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	http.send(REQ);
	

}

function showRes(http, id)
{

	if(http.readyState == 4 && (http.status==200 || window.location.href.indexOf("http")==-1)){
		document.getElementById(id).innerHTML = http.responseText;
	} else {
		document.getElementById(id).innerHTML = 'Loading...';
	}

}

function hideLayer(id)
{
	ajax('internal_request', '', 'result');
}
