
var ie=document.all
var ns6=document.getElementById && !document.all
var ShowReg=true;
var ShowContact=true;
var mouseX=0;
var mouseY=0;

document.onmousemove = function(event){
  mouseX=MouseCoord(event).X
  mouseY=MouseCoord(event).Y
}
  var MouseCoord = function(event) {
    event = event || window.event;
    var e = {
      _x: (event.pageX || event.clientX + (document.documentElement || document.body).scrollLeft),
      _y: (event.pageY || event.clientY + (document.documentElement || document.body).scrollTop)
      };

    var _console = function(o){
      document.getElementById(o).innerHTML = "X: "+e._x+" Y: "+e._y;
      };
    return {X: e._x, Y: e._y, toString: _console
    };
  };

function showPopUp(theForm)
{
	/*
  document.getElementById(theForm).style.left = mouseX
  document.getElementById(theForm).style.top = mouseY
  if(ShowReg==true)
  {
    ShowReg=false;
    document.all['pWinMessage'].innerHTML = ""
    document.forms[0].txtPassword.value = ""
    document.getElementById(theForm).style.visibility='visible';
    document.getElementById('dRegister').style.visibility='visible';
    //document.getElementById('dDownload').style.visibility='visible';
  }
  else
  {
    ShowReg=true;
    document.getElementById(theForm).style.visibility='hidden';
    document.getElementById('dRegister').style.visibility='hidden';
    //document.getElementById('dDownload').style.visibility='hidden';
  }
  */
  
  document.getElementById(theForm).style.left = mouseX
  document.getElementById(theForm).style.top = mouseY
  if(ShowReg==true)
  {
    ShowReg=false;
    document.getElementById(theForm).style.visibility='visible';
  }
  else
  {
    ShowReg=true;
    document.getElementById(theForm).style.visibility='hidden';
  }
  
}
function showContact(theForm)
{
  document.getElementById(theForm).style.left = mouseX
  document.getElementById(theForm).style.top = mouseY
  if(ShowContact==true)
  {
    ShowContact=false;
    document.getElementById(theForm).style.visibility='visible';
  }
  else
  {
    ShowContact=true;
    document.getElementById(theForm).style.visibility='hidden';
  }
}
var xmlhttp;
if(window.XMLHttpRequest){xmlhttp=new XMLHttpRequest();} else if (window.ActiveXObject){xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); }else{alert("Your browser does not support XMLHTTP for submitting registration.!");}
xmlhttp.onreadystatechange=returnState;
function sendRegistration()
{
if(window.XMLHttpRequest){xmlhttp=new XMLHttpRequest();} else if (window.ActiveXObject){xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); }else{alert("Your browser does not support XMLHTTP for submitting registration.!");}
  xmlhttp.onreadystatechange=returnState;
  document.getElementById('dRegister').style.visibility='hidden';
  //document.getElementById('dDownload').style.visibility='hidden';
  document.getElementById('pWinMessage').innerHTML = "Sending request, please wait ..."
  tFullName=document.forms[0].txtFullName.value
  tEmail=document.forms[0].txtEmail.value
  tTelephone=document.forms[0].txtTelephone.value
  xmlhttp.open("POST","http://www.statusauctions.co.za/getdoc.asp?sid=" + sid + "&tfn=" + tFullName + "&te=" + tEmail + "&tt=" + tTelephone,true);
  xmlhttp.send(null);
}

function sendGetDoc()
{
if(window.XMLHttpRequest){xmlhttp=new XMLHttpRequest();} else if (window.ActiveXObject){xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); }else{alert("Your browser does not support XMLHTTP for submitting registration.!");}
  xmlhttp.onreadystatechange=returnState2;
  document.getElementById('dRegister').style.visibility='hidden';
  //document.getElementById('dDownload').style.visibility='hidden';
  document.getElementById('pWinMessage').innerHTML = "Sending request, please wait ..."
  xmlhttp.open("POST", "http://www.statusauctions.co.za/getdoc.asp?did=" + document.forms[0].txtPassword.value + "&sid=" + sid + "", true);
  xmlhttp.send(null);
}

function returnState()
{
  if(xmlhttp.readyState==4)
  {
    response = xmlhttp.responseText
    if(response.substr(0,7)=="REGSETA")
    {
      //document.all['dDownload'].style.visibility='visible';
      document.all['pWinMessage'].innerHTML = response.substring(21)
    }
    if(response.substr(0,7)=="REGSETC")
    {
      document.all['pWinMessage'].innerHTML = response.substring(7)
    }
    if(response.substr(0,7)=="REGSETB")
    {
      document.all['pWinMessage'].innerHTML = 'ERROR:' + response.substring(7)
    }
  
  }
}
function returnState2()
{
  if(xmlhttp.readyState==4)
  {
    response = xmlhttp.responseText
    if(response.substr(0,7)=="REGSETA")
    {
     // document.all['dDownload'].style.visibility='visible';
      document.all['pWinMessage'].innerHTML = response.substring(21)
    }
    if(response.substr(0,7)=="REGSETC")
    {
      document.all['pWinMessage'].innerHTML = response.substring(7)
    }
    if(response.substr(0,7)=="REGSETB")
    {
      document.all['pWinMessage'].innerHTML = 'ERROR:' + response.substring(7)
    }
  
  }
}
