var offset = 0;

function getHTTPObject()
{
	var xmlhttp;
	/*@cc_on
	@if(@_jscript_version >=5)
	try
	{
		xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(E)
		{
			xmlhttp=false;
		}
	}
	@else
		xmlhttp=false;
	@end @*/
	if(!xmlhttp && typeof XMLHttpRequest != 'undefined')
	{
		try
		{
			xmlhttp=new XMLHttpRequest();
		}
		catch(e)
		{
			xmlhttp=false;
		}
	}
	return xmlhttp;
}

function handleSelectionResults()
{
	if(http.readyState == 4)
	{
		//alert(http.responseText);
		document.getElementById("wrapper").innerHTML = http.responseText;
	}
}
function updateChoice()
{
	var cy = document.SeboSelectionForm.Cylinder.checked;
	var up = document.SeboSelectionForm.Upright.checked;
	var al = document.SeboSelectionForm.Allergies.checked;
	var pe = document.SeboSelectionForm.Pets.checked;
	var st = document.SeboSelectionForm.Stairs.checked;
	var uh = document.SeboSelectionForm.Upholstery.checked;
	var ca = document.SeboSelectionForm.CarpetCleaning.checked;
	var vh = document.SeboSelectionForm.AdjustableHeight.checked;
	var af = document.SeboSelectionForm.autofloor.checked;
	var bf = document.SeboSelectionForm.bronoff.checked;
	var vs = document.SeboSelectionForm.VariableSuction.checked;
	var lp = document.SeboSelectionForm.LoopPileCarpet.checked;
	var cp = document.SeboSelectionForm.CutPileCarpet.checked;
	var ev = document.SeboSelectionForm.EvenHardFloor.checked;
	var uv = document.SeboSelectionForm.UnevenHardFloor.checked;
	var de = document.SeboSelectionForm.DelicateFloor.checked;
		
	var url="choiceupdate.php?cy=" + cy + "&up=" + up + "&al=" + al + "&pe=" + pe + "&st=" + st + "&uh=" + uh + "&ca=" + ca + "&vh=" + vh + "&af=" + af + "&bf=" + bf + "&vs=" + vs + "&lp=" + lp + "&cp=" + cp + "&ev=" + ev + "&uv=" + uv + "&de=" + de;
//alert(url);
	http.open("GET",url, true);
	http.onreadystatechange=handleSelectionResults;
	http.send(null);
}
function handleEmailResults()
{
	if(http.readyState == 4)
	{
		//alert(http.responseText.length);
		if(http.responseText.length > 5)
		{
			document.appform.email.value = '';
		}
		document.getElementById("emailerror").innerHTML = http.responseText;
	}
}
function checkEmail()
{
	var email = document.getElementById("email").value;
	var url = "checkemail.php?email=" + email;
//alert(url);
	http.open("GET",url, true);
	http.onreadystatechange=handleEmailResults;
	http.send(null);
}
function checkPub(selelm)
{
	var adsrc = selelm.options[selelm.selectedIndex].value;
	if(adsrc == 'Press')
	{
		document.getElementById('whichpub').style.display = '';
	}
	else
	{
		document.getElementById('whichpub').style.display = 'none';
	}
}