function check_email_ajax(email,company_id)
{
   httpcheck_email_ajax.open("GET","/apps/powerstore/includes/ajax/ajax_server.html?call=ping&status=check_username&email="+email+"&sci="+company_id,true);
   httpcheck_email_ajax.onreadystatechange = handleHttpcheck_email_ajax;
   httpcheck_email_ajax.send(null);
}

function handleHttpcheck_email_ajax() {
  if (httpcheck_email_ajax.readyState == 4) {
    // Split the comma delimited response into an array
	results = httpcheck_email_ajax.responseText;
	if (results==0) {
	  alert(lbl[34809]/*Email Verification Success. You may proceed the registration*/);
	  show_buyer_form();
    }
    if (results==1) {
	  alert(lbl[34810]/*Email already been used. Please key in the password if you confirm using this email*/);
	  show_buyer_form2();
    }
    if (results==2) {
	  alert(lbl[34811]/*This email already registered under this store.*/);
    }
    if (results==99) {
	  alert(lbl[34812]/*Invalid Email Address*/);
    }
  }
}

function check_user_email_ajax(email,company_id)
{
   httpcheck_user_email_ajax.open("GET","includes/ajax/ajax_server.html?call=ping&status=check_user_username&email="+email+"&sci="+company_id,true);
   httpcheck_user_email_ajax.onreadystatechange = handleHttpcheck_user_email_ajax;
   httpcheck_user_email_ajax.send(null);
}

function handleHttpcheck_user_email_ajax() {
  if (httpcheck_user_email_ajax.readyState == 4) {
    // Split the comma delimited response into an array
	results = httpcheck_user_email_ajax.responseText;
	if (results==0) {
	  alert(lbl[34809]/*Email Verification Success. You may proceed the registration*/);
	  show_user_form();
    }
    if (results==1) {
	  alert(lbl[34810]/*Email already been used. Please key in the password if you confirm using this email*/);
	  show_user_form2();
    }
    if (results==2) {
	  alert(lbl[34811]/*This email already registered under this store.*/);
    }
    if (results==99) {
	  alert(lbl[34812]/*Invalid Email Address*/);
    }
  }
}

function check_merchant_email_ajax(email,company_id)
{
   httpcheck_merchant_email_ajax.open("GET","includes/ajax/ajax_server.html?call=ping&status=check_merchant_username&email="+email+"&sci="+company_id,true);
   httpcheck_merchant_email_ajax.onreadystatechange = handleHttpcheck_merchant_email_ajax;
   httpcheck_merchant_email_ajax.send(null);
}

function handleHttpcheck_merchant_email_ajax() {
  if (httpcheck_merchant_email_ajax.readyState == 4) {
    // Split the comma delimited response into an array
	results = httpcheck_merchant_email_ajax.responseText;
	if (results==0) {
	     alert(lbl[34809]/*Email Verification Success. You may proceed the registration*/);
	  show_merchant_form();
    }
    if (results==1) {
	  alert(lbl[34810]/*Email already been used. Please key in the password if you confirm using this email*/);
	  show_merchant_form2();
    }
    if (results==2) {
	  alert(lbl[34811]/*This email already registered under this store.*/);
    }
    if (results==99) {
	  alert(lbl[34812]/*Invalid Email Address*/);
    }
  }
}

var httpcheck_merchant_email_ajax = getNewHTTPObject();
var httpcheck_user_email_ajax = getNewHTTPObject();
var httpcheck_email_ajax = getNewHTTPObject();
//var httpcheck_shipping_carrier_ajax = getNewHTTPObject();

function getNewHTTPObject() {
    if (typeof XMLHttpRequest != 'undefined') {
        return new XMLHttpRequest();
    }
    try {
        return new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
        try {
            return new ActiveXObject("Microsoft.XMLHTTP");
        } catch (e) {}
    }
    return false;
}

/*function check_shipping_carrier_ajax(status, method_id, address_id, weight, quantity, subtotal)
{
   httpcheck_shipping_carrier_ajax.open("GET","/apps/powerstore/commerce/cart/ajax_server.html?call=ping&status="+status+"&method_id="+method_id+"&address_id="+address_id+"&weight="+weight+"&quantity="+quantity+"&subtotal="+subtotal,true);
   httpcheck_shipping_carrier_ajax.onreadystatechange = handleHttpcheck_shipping_carrier_ajax;
   httpcheck_shipping_carrier_ajax.send(null);
}

function handleHttpcheck_shipping_carrier_ajax() {
  if (httpcheck_shipping_carrier_ajax.readyState == 4) {
	//document.writeln(httpcheck_shipping_carrier_ajax.responseText);
    // Split the comma delimited response into an array
	var shipping_service; 
	var address_id; 
	var status; 
	var instruction;
	eval(httpcheck_shipping_carrier_ajax.responseText);
	show_shipping_service_radio(shipping_service, address_id, status, instruction);
  }
}*/

