var DMhttpObjValue;
var DMhttpObjInnerHTML;
var DMhttpObjKeepAlive;
var DMhttpObjErrors;

function DMgetResponseValue(url)
{
	DMhttpObjValue=DMGetXmlHttpObject();
	DMhttpObjValue.onreadystatechange=DMstateChangedValue
	DMhttpObjValue.open("GET",url,true)
	DMhttpObjValue.send(null)
}

function DMgetResponseInnerHtml(url)
{
	DMhttpObjInnerHTML=DMGetXmlHttpObject();
	DMhttpObjInnerHTML.onreadystatechange=DMstateChangedInnerHtml
	DMhttpObjInnerHTML.open("GET",url,true)
	DMhttpObjInnerHTML.send(null)
}

function DMgetResponse(url)
{
	DMhttpObjInnerHTML=DMGetXmlHttpObject();
	DMhttpObjInnerHTML.onreadystatechange=DMstateChanged
	DMhttpObjInnerHTML.open("GET",url,true)
	DMhttpObjInnerHTML.send(null)
}

function DMstateChanged()
{
	if (DMhttpObjInnerHTML.readyState==4 || DMhttpObjInnerHTML.readyState=="complete")
	{
		tmp = DMhttpObjInnerHTML.responseText;
		tmp = tmp.split(',');
		
		document.getElementById('DMEmail').value = tmp[0];
		document.getElementById('txtBirthdateDay').value = tmp[1];
		document.getElementById('txtBirthdateMonth').value = tmp[2];
		document.getElementById('txtBirthdateYear').value = tmp[3];
		document.getElementById('DMDriverslicense').value = tmp[4];
		document.getElementById('DMFirstName').value = tmp[5];
		document.getElementById('DMLastName').value = tmp[6];
		document.getElementById('DMContry').value = tmp[7];
		document.getElementById('DMPhone').value = tmp[8];
		document.getElementById('DMAddress').value = tmp[9];
		document.getElementById('DMPostalcode').value = tmp[10];
		document.getElementById('DMCity').value = tmp[11];
		document.getElementById('DMLokalAddress').value = tmp[12];
		document.getElementById('DMPasnummer').value = tmp[13];
		document.getElementById('DMPhone2').value = tmp[14];
		document.getElementById('DMFax').value = tmp[15];
	}
	document.getElementById('step3-4_form').style.display = 'inline';
}


function DMstateChangedValue()
{
	if (DMhttpObjValue.readyState==4 || DMhttpObjValue.readyState=="complete")
	{
		objValue.value=DMhttpObjValue.responseText
	}
}

function DMstateChangedInnerHtml()
{
	if (DMhttpObjInnerHTML.readyState==4 || DMhttpObjInnerHTML.readyState=="complete")
	{
		tmp = DMhttpObjInnerHTML.responseText;
		if (tmp!=" ")
			objInnerHTML.innerHTML=tmp;
			
		if (objInnerHTML2URL!="")
		{
			DMhttpObjErrors=DMGetXmlHttpObject();
			DMhttpObjErrors.onreadystatechange=DMstateChangedErrors
			DMhttpObjErrors.open("GET",objInnerHTML2URL,true)
			DMhttpObjErrors.send(null)
		}
	}
}

function DMstateChangedErrors()
{
	if (DMhttpObjErrors.readyState==4 || DMhttpObjErrors.readyState=="complete")
	{
		objInnerHTML2.innerHTML = DMhttpObjErrors.responseText;
	}
}


function DMGetXmlHttpObject()
{
	var objXMLHttp=null
	if (window.XMLHttpRequest)
	{
		objXMLHttp=new XMLHttpRequest()
	}
	else if (window.ActiveXObject)
	{
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
	}
	return objXMLHttp
}

function DMkeepAliveCall(url)
{
	DMhttpObjKeepAlive=DMGetXmlHttpObject();
	DMhttpObjKeepAlive.onreadystatechange=DMstateChangedKeepAlive
	DMhttpObjKeepAlive.open("GET",url,true)
	DMhttpObjKeepAlive.send(null)
}

function DMstateChangedKeepAlive()
{
	if (DMhttpObjKeepAlive.readyState==4 || DMhttpObjKeepAlive.readyState=="complete")
	{
		tmp = DMhttpObjKeepAlive.responseText;
		if (tmp=="1")
			objKeepAlive.value = "1";
		else
			objKeepAlive.value = "";
	}
}
