var http;

function getHTTPObject() {
	if (typeof XMLHttpRequest != 'undefined') {
		return new XMLHttpRequest();
	} 
	
	try {
		return new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) { 
		try { 
			return new ActiveXObject("Microsoft.XMLHTTP");
		} catch (e) {
		}
	}
	
	return false;
}

function showLogin() {
	http = getHTTPObject();
	if (http) {
		// show the full login
		var myLogin = document.getElementById("login");
		if (myLogin){
			myLogin.style.display = "block";
		}
	}else{
		// show just the login button
		var myLogin = document.getElementbyId("no-login");
		if (myLogin){
			myLogin.style.display = "block";
		}
	}
}

function login(form){

	var username = form.username.value;
	var password = form.password.value;

	http.open("get", form.action, false, username, password);
	http.send("");
	if (http.status == 200) {
		document.location = form.action;
	} else {
		alert("Incorrect username and/or password.");
	}
	return false;
}

showLogin();

