var xmlHttp, type;
var ready = 1;
function setfile(str,tpe){
	if(ready == 0){
		alert("wait");
	}else{
		type = tpe;
		document.getElementById(type).innerHTML = '<center><img src=\'images/load.gif\'></center>';
		xmlHttp = getXmlHttpObject();
		if(xmlHttp == null){
			alert("Sorry, but your browser doesn't support AJAX. Please install a newer browser");
			window.location = "http://www.getfirefox.com";
			return;
		}
		xmlHttp.onreadystatechange=mainframechange;
		xmlHttp.open("GET",str,true);
		xmlHttp.send(null);
	}
}

function mainframechange(){
	if(xmlHttp.readyState == 4 || xmlHttp.readyState == "Complete"){
		document.getElementById(type).innerHTML = xmlHttp.responseText;
	}
}

function getXmlHttpObject(){
	var xmlHttp = null;
	try{
		xmlHttp = new XMLHttpRequest();
	}catch(e){
		try{
			xmlHttp = new ActiveXObject("msxml2.XMLHTTP");
		}catch(e){
			xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
}
var xmlHttp;
var ready = 1;
function setfilepost(str,str2,tpe){
	if(ready == 0){
		alert("wait");
	}else{
		type = tpe;
		document.getElementById(type).innerHTML = '<center><img src=\'images/load.gif\'></center>';
		xmlHttp = getXmlHttpObject();
		if(xmlHttp == null){
			alert("Sorry, but your browser doesn't support AJAX. Google 'Firefox' to get the new Firefox browser");
			return;
		}
		ready = 0;
		xmlHttp.onreadystatechange=mainframechange;
		xmlHttp.open("POST",str,true);
		xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		xmlHttp.setRequestHeader("Content-length", str2.length);
		xmlHttp.setRequestHeader("Connection", "close");
		xmlHttp.send(str2);
	}
}

function mainframechange(){
	if(xmlHttp.readyState == 4 || xmlHttp.readyState == "Complete"){
		ready = 1;
		document.getElementById(type).innerHTML = xmlHttp.responseText;
	}
}

function show_message(msg){
	alert(msg);
}
