var noResult = "Kein Ergebnis";
var bewerten_url = "http://"+ window.location.hostname +"/includes/bewerten.php";

function Bewerten(b_id,b_val,b_cat,action) {
   var httpRequest_b_id_b_id = false;
   if(window.XMLHttpRequest)  // Mozilla, Safari,...
       httpRequest_b_id = new XMLHttpRequest();
   else if(window.ActiveXObject) { // IE
       try {
           httpRequest_b_id = new ActiveXObject("Msxml2.XMLHTTP");
    }
       catch (e) {
           try {
               httpRequest_b_id = new ActiveXObject("Microsoft.XMLHTTP");
     }
           catch (e) {}
       }
   }
   if(!httpRequest_b_id) 
      return false;
   httpRequest_b_id.onreadystatechange = function() {
      if(httpRequest_b_id.readyState == 4) {
         if(httpRequest_b_id.status == 200) 
            handleHttpResponse_bewerten(httpRequest_b_id.responseText, b_id);
       else
          return false;
         }
    else
       return false;
   } 
  document.getElementById('bewertung_'+b_id).innerHTML = "<img src='http://"+ window.location.hostname +"/images/loading.gif' alt='wird geladen' />"; 
  httpRequest_b_id.open('get', bewerten_url+"?b_id="+b_id+"&b_val="+b_val+"&b_cat="+b_cat+"&action="+action, true);
   httpRequest_b_id.send(null);
}


function handleHttpResponse_bewerten(content, b_id) {
   if(!document.getElementById)
      return false;
   if(!document.getElementById('bewertung_'+b_id))
   return false;
   if(content == "FALSE")
      document.getElementById('bewertung_'+b_id).innerHTML = noResult;
   else
      document.getElementById('bewertung_'+b_id).innerHTML = content; 
} 
