// JavaScript Document
var xhr = false;
var xhp = false;

function getNewFile() {
	makeRequest("company/contact_popup.php");
	return false;
}

function makeRequest(url) {
	if (window.XMLHttpRequest) {
		xhr = new XMLHttpRequest();
	}
	else {
		if (window.ActiveXObject) {
			try {
				xhr = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e) { }
		}
	}
	if (xhr) {
		xhr.onreadystatechange = showContents;
		xhr.open("GET", url, true);
		xhr.send(null);
	}
}

function showContents() {
	if (xhr.readyState == 4) {
		if (xhr.status == 200) {
			var outMsg = xhr.responseText;
		}
		document.getElementById("updateArea").innerHTML = outMsg;
		document.getElementById("updateArea").className = "show_update_box";
	}
}

function close_update() {
	document.getElementById("updateArea").innerHTML = "&nbsp;";
	document.getElementById("updateArea").className = "hide_update_box";
}

function makePost() {
	if (window.XMLHttpRequest) {
		xhp = new XMLHttpRequest();
	}
	else {
		if (window.ActiveXObject) {
			try {
				xhp = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e) { }
		}
	}
	if (xhp) {
		var formid = document.getElementById("mno_list");
		var data = "";
		for (var i=0; i<formid.elements.length; i++) {
			data += formid.elements[i].name;
			data += "=";
			data += encodeURIComponent(formid.elements[i].value);
			data += "&";
		}
		xhp.onreadystatechange = close_post_update;
		xhp.open("POST", "company/contact_thanks.php", true);
		xhp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
		xhp.send(data);
	}
}

function close_post_update() {
	if (xhr.readyState == 4) {
		if (xhr.status == 200) {
			document.getElementById("updateArea").innerHTML = "&nbsp;";
			document.getElementById("updateArea").className = "hide_update_box";
		}
	}
}
						