function httpRequest( target_url, functionReference) {

	try {
		if( window.XMLHttpRequest ) {	
			httpObj = new XMLHttpRequest();
		} else if( window.ActiveXObject) {	
			httpObj = new ActiveXObject( "Microsoft.XMLHTTP" );
		} else {
			httpObj = false;
		}
	} catch( e ) {
		httpObj = false;
	}
	if( !httpObj ) {
		httpObjGenerateFail();
	}
	
	httpObj.open( "GET", target_url, true );

	httpObj.onreadystatechange = function() {
		if ( httpObj.readyState == 4 ) {
			if ( httpObj.status == 200 ) {
				functionReference( httpObj.responseText );
			} else {
		//		alert( httpObj.status + ':' + httpObj.statusText );
		//		return false;
			}
		}
	}

	httpObj.send(null);

}

function httpRequest_1( target_url, functionReference) {
	try {
		if( window.XMLHttpRequest ) {
			httpObj1 = new XMLHttpRequest();
		} else if( window.ActiveXObject) {
			httpObj1 = new ActiveXObject( "Microsoft.XMLHTTP" );
		} else {
			httpObj1 = false;
		}
	} catch( e ) {
		httpObj1 = false;
	}
	if( !httpObj1 ) {
		httpObjGenerateFail();
	}

	httpObj1.open( "GET", target_url, true );

	httpObj1.onreadystatechange = function() {
		if ( httpObj1.readyState == 4 ) {
			if ( httpObj1.status == 200 ) {
				functionReference( httpObj1.responseText );
			} else {
		//		alert( httpObj1.status + ':' + httpObj1.statusText );
		//		return false;
			}
		}
	}
	httpObj1.send(null);
}

//****************************************************
//*********** POST
//****************************************************

function newXMLHTTP() {
	if(window.XMLHttpRequest) {
		try {
			xmlhttp = new XMLHttpRequest();
		} catch(e) {
			return false;
		}
	} else if(window.ActiveXObject) {
		try {
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch(e) {
			try {
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			} catch(e) {
				return false;
			}
		}
	} else {
		return false;

	}
	return xmlhttp;
}

function postForm(obj, callback) {

	var xmlhttp = newXMLHTTP();
	if(!xmlhttp) return false;

	var child = obj.elements;
	var data = new Array();
	for(i = 0; i < child.length;i++) {

		if(child[i].tagName != "INPUT" && child[i].tagName != "TEXTAREA" && child[i].tagName != "SELECT") continue;

		if(child[i].type == "submit" || child[i].type == "button" || child[i].type == "reset") continue;

		if((child[i].type == "radio" || child[i].type == "checkbox") && !child[i].checked) continue;

		if(child[i].getAttributeNode("required") && !child[i].value) {
			child[i].style.backgroundColor = "#FF9";
			child[i].focus();
			return false;
		}
	   	data.push ( child[i].name+"="+child[i].value);
	}

	senddata = data.join("&");

	xmlhttp.open("POST", obj.action,true);
	xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	xmlhttp.send(senddata);

	xmlhttp.onreadystatechange = function() {
		if(xmlhttp.readyState == 4) {
			if(xmlhttp.status == 200) {
				callback(xmlhttp.responseText);
			} else {
			}
		}
	}
}

function _callback_report ( xmlhttp ) {

	response = xmlhttp.responseXML;
	var msg = response.getElementsByTagName("result")[0].firstChild.nodeValue;

	var s_btn = document.getElementById("sbm");
	var w_btn = document.getElementById("waiting");
	s_btn.style.display = "inline";
	w_btn.style.display = "none";

	alert ( msg );
	window.open ( window.location, '_self');
}
