function sendrequest(str)
{ 
xmlHttp=GetXmlHttpObject1();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="register_submit.php";

var username =document.getElementById("username").value;
    username = biuld_string(username);
var pass =document.getElementById("pass").value;
    pass = biuld_string(pass);
var txtconfirmation =document.getElementById("txtconfirmation").value;
    txtconfirmation = biuld_string(txtconfirmation);
/*var sec_qs =document.getElementById("sec_qs").value;
var txtseqanswer =document.getElementById("txtseqanswer").value;
    txtseqanswer = biuld_string(txtseqanswer);*/
	var txtseqanswer = ""; var sec_qs = "";
	
var txtemail_address =document.getElementById("txtemail_address").value;
	txtemail_address = biuld_string(txtemail_address);
var txtrestelephone =document.getElementById("txtrestelephone").value;
var txtmobtelephone =document.getElementById("txtmobtelephone").value;
var txtfirstname =document.getElementById("txtfirstname").value;
    txtfirstname = biuld_string(txtfirstname);
//var txtlastname =document.getElementById("txtlastname").value;
/*var txtAlemail=document.getElementById("txtAlemail").value;
    txtAlemail = biuld_string(txtAlemail);*/
	var txtAlemail = "";

var country = document.getElementById("country").value;

var txtAddress=document.getElementById("txtAddress").value;
     txtAddress = biuld_string(txtAddress);

var txtzip=document.getElementById("txtzip").value;
     txtzip = biuld_string(txtzip);

//alert(document.getElementById("wholeseller").checked);
 /*if(document.getElementById("wholeseller").checked==true){
  var wholeseller=1;
 } else {
  var wholeseller=0;
 }*/
 var wholeseller=0;

document.getElementById("work_progress").style.visibility='visible';
document.getElementById("work_progress").style.display='block';

document.getElementById("contact_form").style.visibility='hidden';
document.getElementById("contact_form").style.display='none';

document.getElementById("msg").style.visibility='hidden';
document.getElementById("msg").style.display='none';
//alert(zip);
url=url+"?username="+username+"&pass="+pass+"&txtconfirmation="+txtconfirmation+"&sec_qs="+sec_qs+"txtseqanswer="+txtseqanswer+"&txtemail_address="+txtemail_address+"&txtrestelephone="+txtrestelephone+"&txtmobtelephone="+txtmobtelephone+"&txtfirstname="+txtfirstname+"&txtAddress="+txtAddress+"&country="+country+"&txtzip="+txtzip+"&txtAlemail="+txtAlemail+"&wholeseller="+wholeseller;
url=url+"&sid="+Math.random();
//alert(url);
xmlHttp.onreadystatechange=stateChanged1;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function stateChanged1() 
{ 
if (xmlHttp.readyState==4)
{ 
document.getElementById("work_progress").style.visibility='hidden';
document.getElementById("work_progress").style.display='none';

document.getElementById("msg").style.visibility='visible';
document.getElementById("msg").style.display='block';

//alert(xmlHttp.responseText+'\n'+xmlHttp.responseText.length);
document.getElementById("msg").innerHTML=xmlHttp.responseText;
//alert(xmlHttp.responseText);

	//success
	//alert(xmlHttp.responseText.indexOf('Your Account Has Been Created'));
	if(xmlHttp.responseText.indexOf('Your Account Has Been Created')==-1) {
		document.getElementById("contact_form").style.visibility='visible';
		document.getElementById("contact_form").style.display='block';
	} else{
		document.getElementById("msg").innerHTML+='<br /><a href="login.php">Login</a>';
	}
	
	
	/*if(xmlHttp.responseText.length==1042) {
	  document.getElementById("msg").innerHTML+='<br /><a href="login.php">Login</a>';
	}
	if(xmlHttp.responseText.length!=1042) {
		document.getElementById("contact_form").style.visibility='visible';
		document.getElementById("contact_form").style.display='block';
	 }*/
	
	}
}

function GetXmlHttpObject1()
{
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 biuld_string(arg){
	
	arg = arg.replace("&","|amp|");
	arg = arg.replace("#","|has|");
	arg = arg.replace("=","|equl|");
    return arg; 	
}