
function activation() {

m = document.getElementById("email-activation").value;
    c = document.getElementById("code-activation").value;
document.getElementById("email-activation-text").innerHTML = 'e-mail';
	document.getElementById("code-activation-text").innerHTML = 'код';
    // execute the quickstart.php page from the server
    document.getElementById("error-activation-text").innerHTML = '<i>Пожалуйста, подождите</i>';
      var url = "/xml/activation.php";
var params = "email=" + m + "&code=" + c;
xmlHttp.open("POST", url, true);

//Send the proper header information along with the request
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", params.length);
xmlHttp.setRequestHeader("Connection", "close");


    // define the method to handle server responses
    xmlHttp.onreadystatechange = handleServerResponseActivation;
    // make the server request
    xmlHttp.send(params);
}
function handleServerResponseActivation() 
{
  // move forward only if the transaction has completed
  if (xmlHttp.readyState == 4) 
  {
    // status of 200 indicates the transaction completed successfully
    if (xmlHttp.status == 200) 
    {
      // extract the XML retrieved from the server
      xmlResponse = xmlHttp.responseXML;
      // obtain the document element (the root element) of the XML structure
      
       xmlRoot = xmlResponse.documentElement;  
      
      error = xmlRoot.getElementsByTagName("error");
	  if(error.length > 0) {
	  document.getElementById("error-activation-text").innerHTML = '';
        for (var i=0; i < error.length; i++) {
		    if(error.item(i).firstChild.data == 0) document.getElementById("email-activation-text").innerHTML = 'e-mail <span style="color: red">пользователь с таким e-mail не зарегистрирован или его учетная запись активирована</span>';
            if(error.item(i).firstChild.data == 1) document.getElementById("code-activation-text").innerHTML = 'код <span style="color: red">Неверный код</span>';
          if(error.item(i).firstChild.data == 2) document.getElementById("error-activation-text").innerHTML = '<span style="color: red">К сожелению письмо выслать не удалось, попробуйте позже</span>';
		}
	} else {
	document.getElementById("error-activation-text").innerHTML = '';
	    document.getElementById("activation-content").innerHTML = '<div style="padding: 10px;color: #666;   -moz-border-radius: 5px; background: #fbf9be; margin: 10px 0; font-size: 11px;border: 1px dotted #ccc;">Код активации выслан на Ваш e-mail</div>';
	}

	 
	
	  
	 
	
	  
      
      // restart sequence
    } 
    // a HTTP status different than 200 signals an error
    else 
    {
      alert("There was a problem accessing the server: " + xmlHttp.statusText);
    }
  }
}
