var xmlHttp = false;
 
//XMLHttpRequest-Instanz erstellen
//... für Internet Explorer
try {
    xmlHttp  = new ActiveXObject("Msxml2.XMLHTTP");
} catch(e) {
    try {
        xmlHttp  = new ActiveXObject("Microsoft.XMLHTTP");
    } catch(e) {
        xmlHttp  = false;
    }
}
//... für Mozilla, Opera, Safari usw.
if (!xmlHttp  && typeof XMLHttpRequest != 'undefined') {
    xmlHttp = new XMLHttpRequest();
}

function rate(type,content_id,rating)
{
 if (xmlHttp) {
     xmlHttp.open('GET', 'http://www.sprueche-index.de/rating.php?rating='+rating+'&content='+content_id+'&type='+type, true);
     xmlHttp.onreadystatechange = function () {
         if (xmlHttp.readyState == 4) {
		        document.getElementById('c'+content_id).style.display = 'none';
		        document.getElementById('d'+content_id).style.display = 'inline';
		        document.getElementById('d'+content_id).innerHTML = xmlHttp.responseText;


                  /*if (xmlHttp.responseText == "Danke!")
         {
          a = document.cookie
          bewertung = a.substr(a.search('my_bewertung=')+13,a.search(';')) + 1;
          bewertungen = a.substr(a.search('my_bewertungen=')+15,a.search(';')) + rating;

          
          Verfallsdatum = new Date;
          Verfallsdatum.setMonth(Verfallsdatum.getMonth()+24)
          document.cookie="my_bewertung="+bewertung+";my_bewertungen="+bewertungen+";expires="+Verfallsdatum.toGMTString()+";path=/;"
         }*/
         
         }

         
     };
     xmlHttp.send(null);
 }
}

function ratez(type,content_id,rating)
{
 if (xmlHttp) {
     xmlHttp.open('GET', 'http://www.sprueche-index.de/rating.php?rating='+rating+'&content='+content_id+'&type='+type, true);
     xmlHttp.onreadystatechange = function () {
         if (xmlHttp.readyState == 4) {
		        document.getElementById('c'+content_id).style.display = 'none';
		        document.getElementById('d'+content_id).style.display = 'inline';
		        document.getElementById('d'+content_id).innerHTML = xmlHttp.responseText;
		        setTimeout("window.location.reload()",1000);
         }
     };
     xmlHttp.send(null);
 }
}

