function ajax(username, password) {
	username = escape(username);
	password = escape(password);
	req = false;
	if(window.XMLHttpRequest) {
		try {
				req = new XMLHttpRequest();
		} catch(e) {
				req = false;
		}
	} else if(window.ActiveXObject) {
		try {
			req = new ActiveXObject("Msxml2.XMLHTTP");
		} catch(e) {
			try {
				req = new ActiveXObject("Microsoft.XMLHTTP");
			} catch(e) {
				req = false;
			}
		}
	}
	if(req) {
		req.onreadystatechange = login_response;
		req.open("POST", "/mt/plugins/Profile/profile.cgi", true);
		req.send("__mode=login&ajax=true&profile_username=" + username + "&profile_password=" + password);
	} else {
		// something didn't work
	}
}

function login_response() {
	if (req.readyState == 4) {
		if (req.responseText.match(/Success/)) {
			window.location.reload( false );

		} else {
			document.getElementById("loginMsg2").innerHTML = req.responseText;
			document.getElementById("loginMsg2").style.background = "#666666";
			document.getElementById("loginMsg2").style.color = "#ffcccc";
			document.getElementById("loginMsg2").style.padding = "2px 5px";
			document.getElementById("loginMsg2").style.fontWeight = "bold";
		}
	}
}

