/**************************************************************************************************************/
// Create xmlhttp object based on browsertype
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();
	  xmlhttp.overrideMimeType("text/xml");
    } catch (e) {
      xmlhttp = false;
    }
  }
  return xmlhttp;
}
/**************************************************************************************************************/
// Define global variables to be used throughout
var tableBusy = false;
var tableHttp = getHTTPObject();
var step1Over = false;
var row = "";
var f1 = 1;
var f2 = 1;
var f3 = 1;
var f4 = 1;
var delids = '';
/**************************************************************************************************************/
function strim(s)
		{
			return s.replace(/\s+/g, '');
		}

function CheckEmail()
{
    CustEmail = document.getElementById('CustShipEmail').value;
    if (!tableBusy)
	{
		var url = "process.php?mode=step1&CustEmail=" + CustEmail + "&rands = "+Math.random();
		tableHttp.open("POST", url, true);
		tableHttp.onreadystatechange = GetStep1;
		tableBusy = true;
		tableHttp.send(null);
	}
}

function GetStep1()
{
	if (tableHttp.readyState == 4)
	{
		try
		{
			var output = tableHttp.responseText;
			tableBusy = false;
		}
		catch(e)
		{
			alert("Error: " + e) ;
		}
	}
}

function updateTimeRequest()
{
    if (!tableBusy)
	{
		var url = "ajax_action.php?mode=updatetime&rands = "+Math.random();
        tableHttp.open("POST", url, true);
	    tableHttp.onreadystatechange = UpdateTime;
		tableBusy = true;
		tableHttp.send(null);
 	}
}

function UpdateTime()
{
    if (tableHttp.readyState == 4)
	{
		try
		{
			var output = tableHttp.responseText;
//			alert("output: "+output);
			tableBusy = false;
			// do nothing
		}
		catch(e)
		{
			alert("Error: " + e) ;
		}
	}
}

