var xmlHttp

function reg(cid,p1,p2,email,fname,lname,pref)
{ 
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="dbinsert.php";
url=url+"?cid="+cid+"&p1="+p1+"&p2="+p2+"&email="+email+"&fname="+fname+"&lname="+lname+"&pref="+pref;
//url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function stateChanged() 
{ 
if (xmlHttp.readyState==4)
{
var res=xmlHttp.responseText;
var output=res.split(",");
if(output[0]=="OK")
{
	document.getElementById("cid").innerHTML=output[1];
	hideregister();
	showdiv('pc-finish');
}
else
{
	alert(output[0]);
	register('pc-reg1');
}
ajaxstat=1;
}
}

function getID()
{ 
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="getid.php";
//url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChangedGID;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function stateChangedGID() 
{ 
if (xmlHttp.readyState==4)
{
document.getElementById("tchikkaid").value=xmlHttp.responseText;
ajaxstat=1;
}
}

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