/* - - - - - - - - - - - - - - - - - - - - - - -
 JavaScript
 30 maj 2009 11:03:42
 - - - - - - - - - - - - - - - - - - - - - - - */
 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.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=ISO-8859-2");
         xmlhttp.open("GET",'/ajax/checkLogin.php?login='+login+'&sessid='+sessid+cmsUrlDatetime(),true);
         xmlhttp.send(null);
         //alert('/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"
            logSaveAction(xmlhttp.responseText);
            if (xmlhttp.responseText.length==0){
                return;
            }
            if (xmlhttp.responseText=='null'){
            }
            //alert(xmlhttp.responseText);
            //var result=cmsAjaxResultDecode(xmlhttp.responseText);
            var result=unserialize(xmlhttp.responseText);
            if (result['error']!=null){
               _('error').innerHTML=result['error'];
            }else{
               _('error').innerHTML='';
            }
    }
  else
    {
    alert("Problem retrieving data:" + xmlhttp.statusText);
    }
  }
}
/*
 var xmlhttpCheckName;
function checkName(name)
{
if (name.length==0) return;
xmlhttpCheckName=null;
if (window.XMLHttpRequest)
  {// code for Firefox, Opera, IE7, etc.
  xmlhttpCheckName=new XMLHttpRequest();
  }
else if (window.ActiveXObject)
  {// code for IE6, IE5
  xmlhttpCheckName=new ActiveXObject("Microsoft.XMLHTTP");
  }
if (xmlhttpCheckName!=null)
  {
         xmlhttpCheckName.onreadystatechange=checkNameStateChange;
         xmlhttpCheckName.open("GET",'/ajax/checkName.php?name='+name+'&sessid='+sessid+cmsUrlDatetime(),true);
         xmlhttpCheckName.send(null);
         //alert('/ajax/checkLogin.php?name='+name+'&sessid='+sessid+cmsUrlDatetime());
  }
else
  {
  alert("Your browser does not support XMLHTTP.");
  }
}


function checkNameStateChange()
{
//alert(xmlhttpCheckName.readyState);
if (xmlhttpCheckName.readyState==4)
  {// 4 = "loaded"
  if (xmlhttpCheckName.status==200)
    {// 200 = "OK"

            if (xmlhttpCheckName.responseText.length==0){
                return;
            }
            if (xmlhttpCheckName.responseText=='null'){
            }
            //alert(xmlhttpCheckName.responseText);
            var result=cmsAjaxResultDecode(xmlhttpCheckName.responseText);
            var result=unserialize(xmlhttpCheckName.responseText);
            if (result['error']!=null){
               _('error').innerHTML=result['error'];
            }else{
               _('error').innerHTML='';
            }
    }
  else
    {
    alert("Problem retrieving data:" + xmlhttpCheckName.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",'/ajax/checkEmail.php?email='+email+'&sessid='+sessid+cmsUrlDatetime(),true);
         xmlhttpCheckEmail.send(null);
         //alert('/ajax/checkEmail.php?email='+email+'&sessid='+sessid+cmsUrlDatetime());
  }
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'){
            }
            //alert(xmlhttpCheckEmail.responseText);
            //var result=cmsAjaxResultDecode(xmlhttpCheckEmail.responseText);
            var result=unserialize(xmlhttpCheckEmail.responseText);
            if (result['error']!=null){
               _('error').innerHTML=result['error'];
            }else{
               _('error').innerHTML='';
            }
    }
  else
    {
    alert("Problem retrieving data:" + xmlhttpCheckEmail.statusText);
    }
  }
}