function ajax_details(pids)
{
        url= "http://www.hotbiet.de/ajax_test_count.php";
        check_timer(url,pids);

}
function check_timer(strURL,pids) {
    var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    	self.xmlHttpReq.open('POST', strURL, true);
     	self.xmlHttpReq.setRequestHeader("Pragma", "no-cache");
     	self.xmlHttpReq.setRequestHeader("Cache-Control", "must-revalidate");
     	self.xmlHttpReq.setRequestHeader("If-Modified-Since", document.lastModified);
    	self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    	self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
            updatepage(self.xmlHttpReq.responseText,pids);
        }
    }
    self.xmlHttpReq.send(getquery(pids));
}

function getquery(pids) {
    qstr = 'pids=' + pids ;
        return qstr;
}

function updatepage(str,pids)
{

       var ergebnis = str.split("},{");
       var len = ergebnis.length;
       for (var i = 0; i < len; i++)
       {
                 var test = eval('(' + str + ')');
                 var pid =(test.liste[i].id);
                 var diff =(test.liste[i].ze);
                 var gebot =(test.liste[i].ge);
                 var winner =(test.liste[i].bi);
                 var winnerpid = 'js_bieter_'+pid;
                 var gebotpid = 'js_actual_gebot_'+pid;
    if($("max_"+pid))
    {
                 if (diff <= 10)
                 {
                         $("max_"+pid).style.color = "#ca0000";
                 }
                 else
                 {
                         $("max_"+pid).style.color = "#000000";
                 }

                 if ($(gebotpid).innerHTML < gebot)
                 {
                        $(gebotpid).style.background='#FFFF00';
                 }
                 else
                 {
                        $(gebotpid).style.background='';
                 }
                 $(gebotpid).innerHTML = gebot+' &euro;';

                 if ($(winnerpid))
                 {
                         $('js_bieter_'+pid).innerHTML = winner;
                 }
    }

                 counter(diff,pid);
       }
       setTimeout('ajax_details("'+pids+'")', 800);



}

function counter(diff,pid)
{
        if (diff <= 0)
        {
                 $("max_"+pid).innerHTML = "Beendet";
        }
        if(diff > 0)
         {

                $('max_'+pid).innerHTML=calc_counter_from_time22(diff);
         }
}
