
function voute() {

   if(xmlHttp) { 
   	  var note = document.getElementById("note_value").value;
   	  cache.push("note=" + note);
   	}
    try {
      if((xmlHttp.readyState == 4 || xmlHttp.readyState == 0) && cache.length > 0) {
      	
      	var cacheEntry = cache.shift();
        xmlHttp.open("POST", 'index.php?m=Product_Details&e=voute', true);
        xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        xmlHttp.onreadystatechange = vouterHandleRequest;
        xmlHttp.send(cacheEntry);
      }
    }
    catch (e) {
      displayError(e.toString());
    }
  }


function vouterReadResponse() {

  var response = xmlHttp.responseText;
  
  if (response.indexOf("ERRNO") >= 0 || response.indexOf("error:") >= 0 || response.length == 0) {
  	throw(response.length == 0 ? "Server error." : response);
  }
  
  document.getElementById('vouter').style.display = 'none';
  var actual_note = document.getElementById('actual_note');
  actual_note.innerHTML = response;
  
  var vote_quant = document.getElementById('voute_quant');
  var inc = vote_quant.innerHTML;
  inc++;
  vote_quant.innerHTML = inc; 
 }

/*
 *	czyta odpowiedz z servera
 */

function vouterHandleRequest() {

  if(xmlHttp.readyState == 4) {
    if(xmlHttp.status == 200) {
      try {
        vouterReadResponse();
      }
      catch(e) {
        displayError(e.toString());
      }
    }
    else {
      displayError(xmlHttp.statusText);
    }
  }
}

function displayError($message) {
 
  if (showErrors) {
   
    showErrors = false;
    alert("Wystąpił błąd: \n" + $message);
    setTimeout("addToShopCart();", 10000);
  }
}