// JavaScript Document
function getXMLHTTPRequest() {
	if(window.XMLHttpRequest) { req = new XMLHttpRequest(); }
	else {
		if(window.ActiveXObject) {
		try { req = new ActiveXObject("Msxm12.XMLHTTP"); }
			catch(err1) {
				try { req = new ActiveXObject("Microsoft.XMLHTTP"); }
				catch(err2) { req = false; }
			}
		} else { req = false; }	
	}
	return req;
}

function callAjaxGet(AjaxReq,url,get,id,type){	
	var ramdom = parseInt(Math.random()*99999999);
	if(get) { url += "?"+ get+"&"; } else { url += "?"; }
	url += "ramdom=" + ramdom;
	//alert(url);
	AjaxReq.open("GET", url, true);
	AjaxReq.id = id;
	if(type=="html") { AjaxReq.onreadystatechange = responseAjaxHTML; } 
	else { AjaxReq.onreadystatechange = responseAjaxJS; }
	AjaxReq.send(null);
}

function callAjaxPost(AjaxReq,url,get,post,id,type){	
	var ramdom = parseInt(Math.random()*99999999);
	if(get) { url += "?"+ get+"&"; } else { url += "?"; }
	url += "ramdom=" + ramdom;
	AjaxReq.open("POST", url, true);
	AjaxReq.id = id;
	AjaxReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	if(type=="html") { AjaxReq.onreadystatechange = responseAjaxHTML; } 
	else { AjaxReq.onreadystatechange = responseAjaxJS; }
	AjaxReq.send(post);
}

function responseAjaxJS() {
	if(this.readyState==4) {
		if(this.status == 200 ) { eval(this.responseText); } 
		else { alert("Problem: " + this.status); }
	} 
}
function responseAjaxHTML() {
	if(this.readyState==4) {
		if(this.status == 200 ) { 
				document.getElementById(this.id).innerHTML = this.responseText;
		} else { alert("Problem: " + this.status); }
	} 
}