var xmlHttp

function substract(str)
{
if (str.length==0)
  { 
  document.getElementById("txtHint").innerHTML="";
  return;
  }
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="newtotal.php";
url=url+"?reward="+str;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=state3Changed;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
} 

function state3Changed() 
{ 
if (xmlHttp.readyState==4)
{ 
document.getElementById("txtHint").innerHTML=xmlHttp.responseText;
}
}

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;
}

function docheck()  
{
len=document.getElementById("street").value.length;

if(len<1)
{
alert("Please enter your delivery address.");
province.focus();
return false;
}
else if(document.getElementById("txtHint").innerHTML.length>100)
{
alert("The amount that you have entered is more than your reward points earned.");
}
else if (document.getElementById("tnc").checked == false)
{
alert("Please tick the box to confirm that you have read our terms and conditions.");
}
else
{
loadprofile('1','checkout.php',document.getElementById('reward').value);
} 

}





















