function submitForm(formid)
{
	var el = document.getElementById(formid);
	document.forms.login.submit();
}

function doLogin()
{ 
	inlognaam = document.getElementById('modlgn_username').value; 
	wachtwoord = document.getElementById('modlgn_passwd').value ; 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request");
		return;
	}
if(inlognaam != "" & wachtwoord != ""){
		//alert("hallo");
		var url = "http://www.anvastgoed.nl/ajax/login.php?inlognaam="+inlognaam+"&wachtwoord="+wachtwoord;
		//var url = "test.php";
		//alert(url);
		xmlHttp.onreadystatechange=login;
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);

	}else{
		if(inlognaam == "" & wachtwoord == ""){
			alert("You didn't gave a login name and password, try it again");
		}else{
			if(wachtwoord==""){
				alert("You didn't gave a password, try it again");
			}else{
				if(inlognaam==""){
					alert("You didn't gave a login name, try it again");
				}
			}
		}
	}
}

function login(){
	if ((xmlHttp.readyState == 4)  && (xmlHttp.status == 200))
	{
		var response = xmlHttp.responseText;
		if(response != "inloggen"){
			alert(response);
		}else{
			document.getElementById('login').action = "http://www.anvastgoed.nl/my-data.html";
			submitForm('login');
		}
	}
}

function GetXmlHttpObject()
{
	var xmlHttp=null;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		//Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
}


//<input type="image" src="images/login-button.png" name="submit" value="LOGIN" alt="login">

