<script language="JavaScript1.2">
function home_detail()
{ 
get_details('<?=$pids?>');

//more_product_detail();

}

function get_details(pids)
{ 
	url= "<?=_BASEURL_?>/ajax_home_detail.php";	
	check_detail(url,pids);	
}
function check_detail(strURL,pids) { //alert(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('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)
{ 
		
	if(str==1)
	{
	<? 
	   $parr = explode(",",$pids);
	   for($a=0; $a < count($parr)-1;$a++)
	   { ?>	  
	   
	  document.getElementById("price_index_page_<?=$parr[$a]?>").style.background='';	  
	  document.getElementById("price_index_page_<?=$parr[$a]?>").innerHTML="" + document.frm.price_<?=$parr[$a]?>.value;	 
	  document.getElementById("winner_index_page_<?=$parr[$a]?>").innerHTML=document.frm.bider_<?=$parr[$a]?>.value;
	  
	    if(document.frm.diff_<?=$parr[$a]?>.value!='')
	    {
		differ_<?=$parr[$a]?> = document.frm.diff_<?=$parr[$a]?>.value;
		
		    if(differ_<?=$parr[$a]?> >= 1)
			{		
	       document.getElementById("button_finished_index_page_<?=$parr[$a]?>").style.display='';
		   document.getElementById("counter_index_page_<?=$parr[$a]?>").innerHTML=calc_counter_from_time22(differ_<?=$parr[$a]?>); 
			}
			else
			{
			bid_ended(<?=$parr[$a]?>);
			}
			
		document.frm.diff_<?=$parr[$a]?>.value = "";
		  
		  
		}
		else
		{
		differ_<?=$parr[$a]?> = differ_<?=$parr[$a]?> - 1;
		
		     if(differ_<?=$parr[$a]?> >= 1)
			{		
	        document.getElementById("button_finished_index_page_<?=$parr[$a]?>").style.display='';
		    document.getElementById("counter_index_page_<?=$parr[$a]?>").innerHTML=calc_counter_from_time22(differ_<?=$parr[$a]?>); 
			}
			else
			{
			bid_ended(<?=$parr[$a]?>);
			}
			
		}
    <? } ?>
	
	  
	start_looping();	
	}
	else
	{
	document.getElementById("product_detail").innerHTML = str;
	  <? 
	   $parr = explode(",",$pids);
	   for($a=0; $a < count($parr)-1;$a++)
	   { ?>	  
	  document.getElementById("price_index_page_<?=$parr[$a]?>").innerHTML="" + document.frm.price_<?=$parr[$a]?>.value;	 
	  document.getElementById("winner_index_page_<?=$parr[$a]?>").innerHTML=document.frm.bider_<?=$parr[$a]?>.value;
	  
	  if(document.frm.new_<?=$parr[$a]?>.value == '1')
	  {
	  document.getElementById("winner_index_page_<?=$parr[$a]?>").style.background='#F6851F';
	  document.getElementById("winner_index_page_<?=$parr[$a]?>").style.color='#fff';
	  document.getElementById("price_index_page_<?=$parr[$a]?>").style.background='#cc0000';	 
	  document.frm.new_<?=$parr[$a]?>.value='0';
	  }
	  else
	  {
	  document.getElementById("winner_index_page_<?=$parr[$a]?>").style.background='';
	  document.getElementById("winner_index_page_<?=$parr[$a]?>").style.color='';
	  document.getElementById("price_index_page_<?=$parr[$a]?>").style.background='';		  
	  }
	  if(document.frm.diff_<?=$parr[$a]?>.value >= 1)
	  {
	  document.getElementById("button_finished_index_page_<?=$parr[$a]?>").style.display='';
	  document.getElementById("counter_index_page_<?=$parr[$a]?>").innerHTML=calc_counter_from_time22(document.frm.diff_<?=$parr[$a]?>.value); 
	  }
	  else
	  bid_ended(<?=$parr[$a]?>);
	  
	 <? } ?>
	
	
	start_looping();
	}	
}
function start_looping()
{
setTimeout("get_details('<?=$pids?>')",200);
}



/*function more_product_detail()
{
<? $mpidarr=explode(",",$mpid);
   $mdiffarr=explode(",",$mdiff);
     for($w=0;$w < count($mpidarr)-1; $w++)
     { ?>
	  home_counter_<?=$mpidarr[$w]?>(<?=$mdiffarr[$w]?>);
   
  <? } ?>
}

<? $mpidarr=explode(",",$mpid);
   $mdiffarr=explode(",",$mdiff);
     for($w=0;$w < count($mpidarr)-1; $w++)
     { ?>
   
    function home_counter_<?=$mpidarr[$w]?>(diff)
	 {
	
	 timer=diff;
	 timer--;
	 document.getElementById("morecounter_<?=$mpidarr[$w]?>").innerHTML=calc_counter_from_time22(timer);
     
	 if(timer >1)
	 setTimeout("home_counter_<?=$mpidarr[$w]?>(" + timer + ")",1000);
	 else
	 home_bid_ended(<?=$mpidarr[$w]?>);
	 }
  <? } ?>*/
  
  
</script>