var xmlHttp

function checkForm(str, id)
{ 
	var country

	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
 		alert ("Browser does not support HTTP Request")
 		return
 	}
//	document.form1.jumpmenu.options[document.form1.jumpmenu.options.selectedIndex].value
		if (id == "b_zipcode")
			country = document.getElementById("b_country").options[document.getElementById("b_country").options.selectedIndex].value
		if (id == "s_zipcode")
			country = document.getElementById("s_country").options[document.getElementById("s_country").options.selectedIndex].value

		var url="AJAX.php?q="+str+"&id="+id+"&country="+country

		xmlHttp.onreadystatechange = function()
    {
    	if(xmlHttp.readyState==4)
			{
				text = xmlHttp.responseText
 				document.getElementById(id).style.borderColor = text.substring(0,7);
				if (id == "b_zipcode")
				{
					document.getElementById("b_city").value = text.substring(8)
				}
				if (id == "s_zipcode")
				{
					document.getElementById("s_city").value = text.substring(8)
				}
		}
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function klarna_get() 
{
	xmlHttp=GetXmlHttpObject();
	
	var obj = document.getElementById('ship2diff');
	var box = document.getElementById('ship_box');
	if (!obj || !box)
		return;

	box.style.display = "none";
	obj.checked = '';
	obj.disabled = 'disabled';
	
	if (xmlHttp==null)
	{
 		alert ("Browser does not support HTTP Request");
 		return;
 	}
	pnr = document.getElementById("tax_number").value;
	var url="AJAX.php?id=pno&q="+pnr;


	xmlHttp.onreadystatechange = function()
	{
		if(xmlHttp.readyState==4)
		{
			text = xmlHttp.responseText;
			if(text)
			{
				adr = text.split('|');
				document.getElementById('firstname').value = adr[0];
				document.getElementById('lastname').value = adr[1];
				document.getElementById('b_address').value = adr[2];
				document.getElementById('b_zipcode').value = adr[3];
				document.getElementById('b_city').value = adr[4].toUpperCase();
			}
		}
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)

}

function check_zip_code()
{
	return true;
}

function GetXmlHttpObject()
{
	var xmlHttp=null;
	try
 	{ 
		xmlHttp=new XMLHttpRequest();
 	}
	catch (e)
 	{
 		try
  		{
  			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  		}
 		catch (e)
  		{
  			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  		}
	 }
	return xmlHttp;
}

function ClearBox()
{
	document.getElementById("user").value = ""
	document.getElementById("mail").value = ""
	document.getElementById("fdate").value = "m - d - Y"
	SetTimer();
}

function SetTimer()
{
	return

	timers=GetXmlHttpObject()
	if (timers==null)
	{
 		alert ("Browser does not support HTTP Request")
 		return
 	}
	var url="AJAX.php?act=time"
	timers.onreadystatechange = function()
    {
    	if(timers.readyState==4)
		{
			document.getElementById("timer").innerHTML = timers.responseText
		}
	}
	timers.open("GET",url,true)
	timers.send(null)
	setTimeout("SetTimer()", 1000);
}

function SetDate(format)
{
	return

	dates=GetXmlHttpObject()
	if (timers==null)
	{
 		alert ("Browser does not support HTTP Request")
 		return
 	}
	var url="AJAX.php?act=date&f="+format
	dates.onreadystatechange = function()
    {
    	if(dates.readyState==4)
		{
			document.getElementById("date").innerHTML = dates.responseText
		}
	}
	dates.open("GET",url,true)
	dates.send(null)
}
