/* - - - - - - - - - - - - - - - - - - - - - - -
 michal@bajer.net.pl
 2009-07-10
 - - - - - - - - - - - - - - - - - - - - - - - */
 var xmlhttp;
function checkLogin(login)
{
if (login.length==0) return;
xmlhttp=null;
if (window.XMLHttpRequest)
  {// code for Firefox, Opera, IE7, etc.
  xmlhttp=new XMLHttpRequest();
  }
else if (window.ActiveXObject)
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
if (xmlhttp!=null)
  {
         xmlhttp.onreadystatechange=checkLoginStateChange;
         xmlhttp.open("GET",'/panel/plugins/member/ajax/checkLogin.php?login='+login+'&sessid='+sessid+cmsUrlDatetime(),true);
         xmlhttp.send(null);
         //alert('/panel/plugins/member/ajax/checkLogin.php?login='+login+'&sessid='+sessid+cmsUrlDatetime());
  }
else
  {
  alert("Your browser does not support XMLHTTP.");
  }
}


function checkLoginStateChange()
{
//alert(xmlhttp.readyState);
if (xmlhttp.readyState==4)
  {// 4 = "loaded"
  if (xmlhttp.status==200)
    {// 200 = "OK"

            if (xmlhttp.responseText.length==0){
                return;
            }
            if (xmlhttp.responseText=='null'){
            }
            var result=unserialize(xmlhttp.responseText);
            if (result['error']!=null){
               _('error').innerHTML=result['error'];
            }else{
               _('error').innerHTML='';
            }
    }
  else
    {
    alert("Problem retrieving data:" + xmlhttp.statusText);
    }
  }
}
var xmlhttpCheckEmail;
function checkEmail(email)
{
if (email.length==0) return;
xmlhttpCheckEmail=null;
if (window.XMLHttpRequest)
  {// code for Firefox, Opera, IE7, etc.
  xmlhttpCheckEmail=new XMLHttpRequest();
  }
else if (window.ActiveXObject)
  {// code for IE6, IE5
  xmlhttpCheckEmail=new ActiveXObject("Microsoft.XMLHTTP");
  }
if (xmlhttpCheckEmail!=null)
  {
         xmlhttpCheckEmail.onreadystatechange=checkEmailStateChange;
         xmlhttpCheckEmail.open("GET",'/panel/plugins/member/ajax/checkEmail.php?email='+email+'&sessid='+sessid+cmsUrlDatetime(),true);
         xmlhttpCheckEmail.send(null);

  }
else
  {
  alert("Your browser does not support XMLHTTP.");
  }
}


function checkEmailStateChange()
{
//alert(xmlhttpCheckEmail.readyState);
if (xmlhttpCheckEmail.readyState==4)
  {// 4 = "loaded"
  if (xmlhttpCheckEmail.status==200)
    {// 200 = "OK"

            if (xmlhttpCheckEmail.responseText.length==0){
                return;
            }
            if (xmlhttpCheckEmail.responseText=='null'){
            }
            var result=unserialize(xmlhttpCheckEmail.responseText);
            if (result['error']!=null){
               _('error').innerHTML=result['error'];
            }else{
               _('error').innerHTML='';
            }
    }
  else
    {
    alert("Problem retrieving data:" + xmlhttpCheckEmail.statusText);
    }
  }
}
