// JavaScript Document

//############################
// ADD LEADING ZERO
//############################

function calcage(secs, num1, num2) {

  LeadingZero = true;

  s = ((Math.floor(secs/num1))%num2).toString();
  if (LeadingZero && s.length < 2)
    s = "0" + s;
  return "" + s + "";
}
   
//############################
// TIME FORMAT FOR LIVE AUCTION
//############################
  
  function TimeFormatter(gsecs, id, reserve_price, high_bid){
           
           gsecs = gsecs - 6;   
  
if (gsecs < -9) {
    
    
    
    if ( high_bid == 0 ) {
    document.getElementById(id).innerHTML = "<font color=red><BR>NOT SOLD!</font>";
    }
    
    if ( high_bid > 0 ) {
    
    if ( reserve_price < high_bid ) {
    
    document.getElementById(id).innerHTML = "<font color=red><BR>S O L D!</font>";
    }
     if ( reserve_price > high_bid ) {
   document.getElementById(id).innerHTML="<font color=red ><BR>Reserve Not Met</font>";
    }
    
    } 
    
  }
      
   if (gsecs <0) {
//   if (gsecs > 9 ){
//    document.getElementById(id).innerHTML = "<font color=red>00:00:09</font>";
//    }
  }
  
 if (gsecs == 0 ){
    document.getElementById(id).innerHTML = "<font color=red>S O L D</font>";

  } 
  
 if (gsecs == 1 ){
    document.getElementById(id).innerHTML = "<font color=red>00:00:01</font>";

  } 
  
if (gsecs == 2 ){
    document.getElementById(id).innerHTML = "<font color=red>00:00:02</font>";

  } 
                                                                 
if (gsecs == 3 ){
    document.getElementById(id).innerHTML = "<font color=red>00:00:03</font>";

  } 
  
if (gsecs == 4 ){
    document.getElementById(id).innerHTML = "<font color=red>00:00:04</font>";

  }        
if (gsecs == 5 ){
    document.getElementById(id).innerHTML = "<font color=red>00:00:05</font>";

  } 
                  
if (gsecs == 6 ){
    document.getElementById(id).innerHTML = "<font color=red>00:00:06</font>";

  }   
       
if (gsecs == 7 ){
    document.getElementById(id).innerHTML = "<font color=red>00:00:07</font>";

  }        
if (gsecs == 8 ){
    document.getElementById(id).innerHTML = "<font color=red>00:00:08</font>";

  }

if (gsecs == 9 ){
    document.getElementById(id).innerHTML = "<font color=red>00:00:09</font>";

  } 
  var days=calcage(gsecs,86400,100000);
  
if (days != 00) {


DisplayFormat = "%%D%% Days <BR> %%H%%:%%M%%:%%S%%";

  DisplayStr = DisplayFormat.replace(/%%D%%/g, calcage(gsecs,86400,100000));
  DisplayStr = DisplayStr.replace(/%%H%%/g, calcage(gsecs,3600,24));
  DisplayStr = DisplayStr.replace(/%%M%%/g, calcage(gsecs,60,60));
  DisplayStr = DisplayStr.replace(/%%S%%/g, calcage(gsecs,1,60));

if (gsecs > 30) {

  document.getElementById(id).innerHTML = DisplayStr;
  
  }

if (gsecs < 31 && gsecs > 9) {

  document.getElementById(id).innerHTML = "<font color=red>"+ DisplayStr +"</font>";
  
  }


}

    
if (days == 00) {

DisplayFormat2 = "<BR>%%H%%:%%M%%:%%S%%";

  DisplayStr = DisplayFormat2.replace(/%%H%%/g, calcage(gsecs,3600,24));
  DisplayStr = DisplayStr.replace(/%%M%%/g, calcage(gsecs,60,60));
  DisplayStr = DisplayStr.replace(/%%S%%/g, calcage(gsecs,1,60));


if (gsecs > 30) {

  document.getElementById(id).innerHTML = DisplayStr;
  
  }
  
  if (gsecs < 31 && gsecs > 9) {

  document.getElementById(id).innerHTML = "<font color=red>"+ DisplayStr +"</font>";
  
  }
  
    }     
         
//(new Spry.Effect.Highlight(document.getElementById(id), {from:'#EF0000', to:'#FFFFFF', restoreColor: '#FFFFFF'})).start();


        
}


//############################
// TIME FORMAT FOR UPCOMING AUCTION
//############################

function HoldingTimeFormatter(gsecs, id){

      
if (gsecs < 2) {
    document.getElementById(id).innerHTML = "<font color=red>NOW OPEN!</font>";

  }
  
  if (gsecs == 3) {
    document.getElementById(id).innerHTML = "<font color=red>GO!</font>";

  }
  
  if (gsecs == 4 ){
    document.getElementById(id).innerHTML = "<font color=red>GET SET!</font>";

  }
  
  if (gsecs == 5) {
    document.getElementById(id).innerHTML = "<font color=red>GET READY!</font>";

  }
 
 if (gsecs == 6) {
    document.getElementById(id).innerHTML = "<font color=red>ON YOUR MARK.</font>";

  }
 
    var days=calcage(gsecs,86400,100000);
  
if (days != 00) {


DisplayFormat = "%%D%% Days, %%H%%:%%M%%:%%S%%";

  DisplayStr = DisplayFormat.replace(/%%D%%/g, calcage(gsecs,86400,100000));
  DisplayStr = DisplayStr.replace(/%%H%%/g, calcage(gsecs,3600,24));
  DisplayStr = DisplayStr.replace(/%%M%%/g, calcage(gsecs,60,60));
  DisplayStr = DisplayStr.replace(/%%S%%/g, calcage(gsecs,1,60));



  document.getElementById(id).innerHTML = DisplayStr;
  



}

    
if (days == 00) {

DisplayFormat2 = "%%H%%:%%M%%:%%S%%";

  DisplayStr = DisplayFormat2.replace(/%%H%%/g, calcage(gsecs,3600,24));
  DisplayStr = DisplayStr.replace(/%%M%%/g, calcage(gsecs,60,60));
  DisplayStr = DisplayStr.replace(/%%S%%/g, calcage(gsecs,1,60));


if (gsecs > 30) {

  document.getElementById(id).innerHTML = DisplayStr;
  
  }
  
 if (gsecs < 31 && gsecs > 6) {

  document.getElementById(id).innerHTML = "<font color=red>"+ DisplayStr +"</font>";
  
  }
  
    }     
         
//(new Spry.Effect.Highlight(document.getElementById(id), {from:'#EF0000', to:'#FFFFFF', restoreColor: '#FFFFFF'})).start();


        
}


//############################
// TIME FORMAT FOR ITEM PAGE
//############################
   
   
   function ItemTimeFormatter(gsecs, id){
   
        gsecs = gsecs - 6;   
 
  
if (gsecs < -9) {
    
if ( high_bid == 0 ) {
    document.getElementById(id).innerHTML = "<font color=red>NOT SOLD!</font>";
    }
    
    if ( high_bid > 0 ) {
    
    if ( reserve_price < high_bid ) {
    
    document.getElementById(id).innerHTML = "<font color=red>S O L D!</font>";
    }
     if ( reserve_price > high_bid ) {
   document.getElementById(id).innerHTML="<font color=red >Reserve Not Met</font>";
    }
    
    } 
    
  }
      
   if (gsecs < 0) {
  }
  
 if (gsecs == 0 ){
    document.getElementById(id).innerHTML = "<font color=red>00:00:00</font>";

  } 
  
 if (gsecs == 1 ){
    document.getElementById(id).innerHTML = "<font color=red>00:00:01</font>";

  } 
  
if (gsecs == 2 ){
    document.getElementById(id).innerHTML = "<font color=red>00:00:02</font>";

  } 
                                                                 
if (gsecs == 3 ){
    document.getElementById(id).innerHTML = "<font color=red>00:00:03</font>";

  } 
  
if (gsecs == 4 ){
    document.getElementById(id).innerHTML = "<font color=red>00:00:04</font>";

  }        
if (gsecs == 5 ){
    document.getElementById(id).innerHTML = "<font color=red>00:00:05</font>";

  } 
                  
if (gsecs == 6 ){
    document.getElementById(id).innerHTML = "<font color=red>00:00:06</font>";

  }   
       
if (gsecs == 7 ){
    document.getElementById(id).innerHTML = "<font color=red>00:00:07</font>";

  }        
if (gsecs == 8 ){
    document.getElementById(id).innerHTML = "<font color=red>00:00:08</font>";

  } 

if (gsecs == 9 ){
    document.getElementById(id).innerHTML = "<font color=red>00:00:09</font>";

  }                   
                  
  var days=calcage(gsecs,86400,100000);
  
if (days != 00) {


DisplayFormat = "%%D%% Days, %%H%%:%%M%%:%%S%%";

  DisplayStr = DisplayFormat.replace(/%%D%%/g, calcage(gsecs,86400,100000));
  DisplayStr = DisplayStr.replace(/%%H%%/g, calcage(gsecs,3600,24));
  DisplayStr = DisplayStr.replace(/%%M%%/g, calcage(gsecs,60,60));
  DisplayStr = DisplayStr.replace(/%%S%%/g, calcage(gsecs,1,60));

if (gsecs > 30) {

  document.getElementById(id).innerHTML = DisplayStr;
  
  }

if (gsecs < 31 && gsecs > 9) {

  document.getElementById(id).innerHTML = "<font color=red>"+ DisplayStr +"</font>";
  
  }


}

    
if (days == 00) {

DisplayFormat2 = "%%H%%:%%M%%:%%S%%";

  DisplayStr = DisplayFormat2.replace(/%%H%%/g, calcage(gsecs,3600,24));
  DisplayStr = DisplayStr.replace(/%%M%%/g, calcage(gsecs,60,60));
  DisplayStr = DisplayStr.replace(/%%S%%/g, calcage(gsecs,1,60));


if (gsecs > 30) {

  document.getElementById(id).innerHTML = DisplayStr;
  
  }
  
  if (gsecs < 31 && gsecs > 9) {

  document.getElementById(id).innerHTML = "<font color=red>"+ DisplayStr +"</font>";
  
  }
  
    }     
         
//(new Spry.Effect.Highlight(document.getElementById(id), {from:'#EF0000', to:'#FFFFFF', restoreColor: '#FFFFFF'})).start();


        
}


//############################
// Button Change
//############################

function button (img_name,img_src) {
document[img_name].src=img_src;
                }
                
                
                


//############################
// ITEM PAGE AJAX
//############################


function itemPageInfo(ajaxid)
{



sold1 = document.getElementById('time').innerHTML; 
  if ( sold1 != '<font color="red">SOLD!</font>' ) {
     //alert(sold1);
    if ( sold1 != '<font color="red">Reserve Not Met</font>' ) {
     //alert(sold1);   
     

var xmlhttp;
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else if (window.ActiveXObject)
  {
  // code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
else
  {
  alert("Your browser does not support XMLHTTP!");
  }
xmlhttp.onreadystatechange=function()
{
if(xmlhttp.readyState==4)
  {
 
 //alert(ajaxid);
       
var x1 = xmlhttp.responseText;

var x2=x1.split("|"); 
  
  bids_remaining = x2[1];
  //currenttime5 = new Date(x2[2]);
  // alert(currenttime5);      
  //end_time = new Date(x2[3]);
  reserve_price = x2[4];
  page_counter = x2[5];
  high_bidder = x2[6];
  high_bid = x2[7];
  number_of_bids = x2[8];
  
  bidder1 = x2[9];
  bidamount1 = x2[10];
    time1 = x2[11];
  
    bidder2 = x2[12];
  bidamount2 = x2[13];
    time2 = x2[14];
  
    bidder3 = x2[15];
  bidamount3 = x2[16];
    time3 = x2[17];
  
    bidder4 = x2[18];
  bidamount4 = x2[19];
    time4 = x2[20];
  
    bidder5 = x2[21];
  bidamount5 = x2[22];
    time5 = x2[23];
    /* autobidderbids = x2[24]; */
          if(high_bidxx == 'x') {


high_bidxx = high_bid;

 }


if(high_bidxx < high_bid) {

    
     
      (new Spry.Effect.Highlight(document.getElementById('ITEM_CURRENT_BID1'), {from:'#EF0000', to:'#FFFFFF', restoreColor: '#FFFFFF'})).start();      
  
                    high_bidxx = high_bid;

                 }                 
                              
      if ( bids_remaining != 'A' ) { 
       //alert(bids_remaining); 
       if ( bids_remaining != undefined ) {   
   document.getElementById('BIDSID').innerHTML=bids_remaining; 
   } 
   
      
                                  }      
    
    
  var reserve_symbol=document.getElementById('reserve_currency_symbol_get').innerHTML
             
               if ( reserve_price > 0 ) {
                  reserve_price22 = (reserve_price * 1) + 1;
              if ( reserve_price > high_bid ) {
//################################################################
// expected sale between edited to show 0% - 8% only by Andy
//################################################################
//   document.getElementById('item_reserve_price').innerHTML="<font color=#5B8902 >Expected Sale Between:<br>" +reserve_symbol+ "" +high_bid+" - " +reserve_symbol+ "" +reserve_price22+ "</font>";


//########### RUNNING Version Above BID Below BID  ##############
   document.getElementById('item_reserve_price').innerHTML="<font color=#5B8902 >Expected Sale: 0% - 8% <br>Above: " +reserve_symbol+ "" +high_bid+" - Below: " +reserve_symbol+ "" +reserve_price22+ "</font>";
                         }

            if ( reserve_price < high_bid ) {
//################################################################
// expected sale between edited to show 0% - 8% only by Andy
//################################################################
//   document.getElementById('item_reserve_price').innerHTML="<font color=#5B8902 >Expected Sale Between:<br>" +reserve_symbol+ "" +high_bid+" - " +reserve_symbol+ "" +reserve_price+ "</font>";


//########### 2nd Version Only Shows between 0% - 8% ##############
//   document.getElementById('item_reserve_price').innerHTML="<font color=#5B8902 >Expected Sale Between:<br> 0% - 8% Retail Value</font>";                         }


//########### RUNNING Version Above BID Below BID  ##############
   document.getElementById('item_reserve_price').innerHTML="<font color=#5B8902 >Expected Sale: 0% - 8% <BR>Above: " +reserve_symbol+ "" +high_bid+" - Below: " +reserve_symbol+ "" +reserve_price+ " </font>";                               }
  }         

          if ( high_bid != undefined ) {
                  
document.getElementById('itemcurrentbid1').innerHTML=high_bid; 
  
  }
             
              if ( high_bidder != undefined ) {
 document.getElementById('item_current_bidder1').innerHTML=high_bidder;
                    }
                    
          if ( page_counter != undefined ) {          
  document.getElementById('counter1').innerHTML=page_counter; 
                                }
                                
           if ( number_of_bids != undefined ) {                     
   document.getElementById('bids2').innerHTML=number_of_bids; 
                    }
    
   
        /*  if ( autobidderbids != 'login' )  {
          
          
        autobidderbidscheck=document.forms['conf'].maxbids.value
      
    if ( autobidderbidscheck != autobidderbids ) {
                               
    document.forms['conf'].maxbids.value=autobidderbids;
                              
                                                           
                               }
                               
                               }
                                    */         

    if ( bidder1 != undefined ) {
    
  document.getElementById('bidder11').innerHTML=bidder1;
  
  }
  
  if ( bidamount1 != undefined ) {
  
  document.getElementById('bidamount11').innerHTML=bidamount1;
  }
  
  if ( time1 != undefined ) {
  
  document.getElementById('time11').innerHTML=time1;
  }
  
    if ( bidder2 != undefined ) {
    
  document.getElementById('bidder22').innerHTML=bidder2;
  
  }
    if ( bidamount2 != undefined ) {
  document.getElementById('bidamount22').innerHTML=bidamount2;
  
    }
  
  if ( time2 != undefined ) {
  
  document.getElementById('time22').innerHTML=time2;
  
  }
      if ( bidder3 != undefined ) {
    
  document.getElementById('bidder33').innerHTML=bidder3;
  
    }
      if ( bidamount3 != undefined ) {
  document.getElementById('bidamount33').innerHTML=bidamount3;
  
    }
  
  if ( time3 != undefined ) {
  
  document.getElementById('time33').innerHTML=time3;
  }
  
      if ( bidder4 != undefined ) {
    
  document.getElementById('bidder44').innerHTML=bidder4;
  
  }
  
    if ( bidamount4 != undefined ) {
  document.getElementById('bidamount44').innerHTML=bidamount4;
  
    }
  
  if ( time4 != undefined ) {
  
  document.getElementById('time44').innerHTML=time4;
  }
  
      if ( bidder5 != undefined ) {
    
  document.getElementById('bidder55').innerHTML=bidder5;
  
  }
    if ( bidamount5 != undefined ) {
  document.getElementById('bidamount55').innerHTML=bidamount5;
    }
  
  if ( time5 != undefined ) {
  document.getElementById('time55').innerHTML=time5;
  
   }

    
  
  }
  
}

 

ajaxurl = "cronfiles/item_page_ajax" +ajaxid+ ".txt";

xmlhttp.open("GET",ajaxurl,true);
xmlhttp.setRequestHeader( "If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT" );
xmlhttp.send(null);


ajaxid2 = ajaxid;

setTimeout("itemPageInfo(ajaxid2)", 1000);

}
}
  }

//############################
// ITEM PAGE AJAX
//############################


function itemPageClock(ajaxid)
{


var xmlhttp;
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else if (window.ActiveXObject)
  {
  // code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
else
  {
  alert("Your browser does not support XMLHTTP!");
  }
xmlhttp.onreadystatechange=function()
{
if(xmlhttp.readyState==4)
  {


var y1 = xmlhttp.responseText;
var y2=y1.split("|"); 
currenttime5 = new Date(y2[0]);
startpos1 = y1.search(ajaxid);
endpos1 = 100;
z1=y1.substr(startpos1,endpos1);
var z2=z1.split("|"); 
end_time = new Date(z2[2]);
  
       //alert(y1);
     //alert(z2[2]);
     //alert(currenttime5);
   
    document.getElementById('currenttimee').innerHTML=currenttime5;
     document.getElementById('endtimee').innerHTML=end_time;
    
  }
  
}

 

ajaxurl = "cronfiles/get_time2.txt";

xmlhttp.open("GET",ajaxurl,true);
xmlhttp.setRequestHeader( "If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT" );
xmlhttp.send(null);


ajaxid2 = ajaxid;

setTimeout("itemPageClock(ajaxid2)", 1000);


  }





//############################
// ITEM PAGE CLOCK LIVE
//############################                
                
         high_bidxx = 'x';



function ItemCountdownTimer(currenttime1, auctionendtime, timecount1, timecount3) {
currenttime1 = new Date(currenttime1);secondsnow1 = currenttime1.getSeconds();
currenttime11 = currenttime1;
secondslater1 = secondsnow1 + 1;
currenttime11.setSeconds(secondslater1);
var dthen = new Date(auctionendtime); 
var dnow = currenttime11;  
ddiff = new Date(dthen-dnow);
gsecs = Math.floor(ddiff.valueOf()/1000);
auctiontimeend = auctionendtime; 
/*alert(auctiontimeend); */ 

/* setTimeout("ItemCountdownTimer(currenttime11, auctiontimeend)", 1000); */

timecount2 = ++timecount1;
timecount4 = ++timecount3;      

        
currenttime55=document.getElementById('currenttimee').innerHTML;
end_time55=document.getElementById('endtimee').innerHTML;

      //alert(currenttime55);
    //alert(end_time55);
   
if ( gsecs > 8 ) {
            if ( timecount2 > 15 ) {
            
                   timecount2 = 0;
                   currenttime11 = currenttime55;
                  //alert(currenttime5);           
            }
          }  
                  
  //alert(timecount2);
if( timecount4 == 900 ) {


window.location.reload();


}    


            
paused1=document.getElementById('paused').innerHTML;


setTimeout("ItemCountdownTimer(currenttime11, end_time55, timecount2, timecount4)", 1000);


if ( paused1 != 1 ) {

ItemTimeFormatter(gsecs, 'time'); 



gone = document.getElementById('time').innerHTML;


       

if ( document['ibb'].src == "images/bid_button_large_1.jpg" ){
    if ( bidbidbid == undefined ) { 

bidbidbid = document.getElementById('iibb').onclick;

}
 
if ( gsecs > 8 ) {
document.getElementById('iibb').onclick=bidbidbid;
}
}

if ( gsecs < 6 ) {
document.getElementById('iibb').onclick=" ";
document['ibb'].src="images/bid_button_large_3.jpg";
}

if( gsecs < -4 ) {
document['ibb'].src="images/bid_button_large_6.jpg";
          }
if( gsecs < -20 ) {
if ( gsecs > -40 ) {

cron();
          }
                    }

     }
     
     
     if ( paused1 == 1 ) {
                   
            document.getElementById('iibb').onclick=" ";       
                   
 document.getElementById('time').innerHTML = "<font color=red>PAUSED!</font>";
                                   
                  }

}




                  
                  


//############################
// ITEM PAGE CLOCK UPCOMING
//############################                
                
         high_bidxx = 'x';



function UpcomingItemCountdownTimer(currenttime1, auctionendtime, timecount1) {
currenttime1 = new Date(currenttime1);secondsnow1 = currenttime1.getSeconds();
currenttime11 = currenttime1;
secondslater1 = secondsnow1 + 1;
currenttime11.setSeconds(secondslater1);
var dthen = new Date(auctionendtime); 
var dnow = currenttime11;  
ddiff = new Date(dthen-dnow);
gsecs = Math.floor(ddiff.valueOf()/1000);
auctiontimeend = auctionendtime; 
/*alert(auctiontimeend); */ 

/* setTimeout("ItemCountdownTimer(currenttime11, auctiontimeend)", 1000); */

timecount2 = ++timecount1;
 end_time=auctionendtime;


setTimeout("UpcomingItemCountdownTimer(currenttime11, end_time, timecount2)", 1000);

    
HoldingTimeFormatter(gsecs, 'time'); 



}






//############################
// ITEM BID AJAX
//############################
                              
function bid(bidid)
{
var xmlhttp;
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else if (window.ActiveXObject)
  {
  // code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
else
  {
  alert("Your browser does not support XMLHTTP!");
  }
xmlhttp.onreadystatechange=function()
{
if(xmlhttp.readyState==4)
  {
 
 
  if ( gsecs > 3 ) {
document['ibb'].src="images/bid_button_large_5.jpg";
}
 
         var bidposted = xmlhttp.responseText;
         
  if ( bidposted == 'daily' ) { 
  
  alert ('Sorry, You Have Reached The Win Limits For Today, They Will Reset At Midnight');
    
  }   
     
   if ( bidposted == 'weekly' ) { 
  
  alert ('Sorry, You Have Reached The Win Limits For This Week, They Will Reset On Sunday');
    
  }       
     
      if ( bidposted == 'monthly' ) { 
  
  alert ('Sorry, You Have Reached The Win Limits For This Month, They Will Reset Next Month');
    
  }         
  
  /*
   var frontpage_bids_remaining=document.getElementById('BIDSID').innerHTML;
   if ( frontpage_bids_remaining > 0 ) {
  var frontpage_bids_remaining2= frontpage_bids_remaining - 1;
  document.getElementById('BIDSID').innerHTML=frontpage_bids_remaining2;
    
    
    
     } */
     
   
                               
                                   
  }
}
bidurl = "bid.php?id=" +bidid+ "";
xmlhttp.open("GET",bidurl,true);
xmlhttp.send(null);


}


       
//############################
// FRONTPAGE BID AJAX
//############################
                              
function frontpagebid(bidid,itembidbutton)
{

 var frontpage_bids_remaining=document.getElementById('BIDSID').innerHTML;
 
 if ( frontpage_bids_remaining > 0 ) {
var xmlhttp;
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else if (window.ActiveXObject)
  {
  // code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
else
  {
  alert("Your browser does not support XMLHTTP!");
  }
xmlhttp.onreadystatechange=function()
{
if(xmlhttp.readyState==4)
  {
  
   var bidposted = xmlhttp.responseText;
  
 
document[itembidbutton].src="images/bidbutton1.jpg"; 
  
      if ( bidposted == 'yes' ) { 
  var frontpage_bids_remaining=document.getElementById('BIDSID').innerHTML;
  
 
   if ( frontpage_bids_remaining > 0 ) {
  var frontpage_bids_remaining2= frontpage_bids_remaining - 1;
  document.getElementById('BIDSID').innerHTML=frontpage_bids_remaining2;
  document.getElementById('BIDSID2').innerHTML=frontpage_bids_remaining2;
  
     }
     }
     
     
  if ( bidposted == 'daily' ) { 
  
  alert ('Sorry, You Have Reached The Win Limits For Today, They Will Reset At Midnight');
    
  }   
     
   if ( bidposted == 'weekly' ) { 
  
  alert ('Sorry, You Have Reached The Win Limits For This Week, They Will Reset On Sunday');
    
  }       
     
      if ( bidposted == 'monthly' ) { 
  
  alert ('Sorry, You Have Reached The Win Limits For This Month, They Will Reset Next Month');
    
  }         
     
     
     
  }
}
bidurl = "bid.php?id=" +bidid+ "";
xmlhttp.open("GET",bidurl,true);
xmlhttp.send(null);

  }
}



//############################
// RUN AUCTION FINALIZATION CRON.PHP
//############################
                              
function cron()
{
var xmlhttp;
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else if (window.ActiveXObject)
  {
  // code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
else
  {
  alert("Your browser does not support XMLHTTP!");
  }
xmlhttp.onreadystatechange=function()
{
if(xmlhttp.readyState==4)
  {

  }
}
url = "cron.php";
xmlhttp.open("GET",url,true);
xmlhttp.send(null);


}



//############################
// DROP DOWN SELECT CATEGORY MENU
//############################
        
function openURL()
{

      // grab index number of the selected option
      selInd = document.categorypulldown.category.selectedIndex;

      // get value of the selected option
      goURL = document.categorypulldown.category.options[selInd].value;

      // redirect browser to the grabbed value (here a URL)
      top.location.href = goURL;

}



//############################
// Bid Reamining
//############################
                        
function bidsremaining(ajaxid)
{



var xmlhttp;
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else if (window.ActiveXObject)
  {
  // code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
else
  {
  alert("Your browser does not support XMLHTTP!");
  }
xmlhttp.onreadystatechange=function()
{
if(xmlhttp.readyState==4)
  {

 
  var x5 = xmlhttp.responseText;

var x3=x5.split("|"); 
  
  bids_remaining = x3[1];
  autobidderbids = x3[2];
  savings_current_bid = x3[3]; 
  savings_bid_credit_text = x3[4];
  savings_bid_credit_data = x3[5];
  savings_shipping_data = x3[6];
  savings_total_data = x3[7];
  buynow_bid_credit_text = x3[8];
  buynow_bid_credit_data = x3[9];
  buynow_shipping_data = x3[10];
  buynow_total_data = x3[11];
  
    document.getElementById('savings_current_bid2').innerHTML=savings_current_bid;
//  document.getElementById('savings_bids_text2').innerHTML=savings_bid_credit_text;
//  document.getElementById('savings_bids_total2').innerHTML=savings_bid_credit_data;
//  document.getElementById('savings_tsh2').innerHTML=savings_shipping_data;
    document.getElementById('savings_total').innerHTML=savings_total_data;
//  document.getElementById('buynow_bids_text2').innerHTML=savings_bid_credit_text;   
//  document.getElementById('buynow_bids_total2').innerHTML=buynow_bid_credit_data;    
    document.getElementById('buynow_tsh2').innerHTML=buynow_shipping_data;
    document.getElementById('buynow_total').innerHTML=buynow_total_data;
 
  
     if ( bids_remaining != 'A' ) { 
       //alert(bids_remaining); 
       if ( bids_remaining != undefined ) {   
   document.getElementById('BIDSID').innerHTML=bids_remaining; 
   } 
   
   }
 
      if ( autobidderbids != 'login' ) { 
       //alert(bids_remaining); 
       if ( autobidderbids != undefined ) {   
   document.forms['conf'].maxbids.value=autobidderbids;
   } 
   
   }
   
    if ( autobidderbids == 'login' ) { 
       //alert(bids_remaining); 
      
   document.forms['conf'].maxbids.value='login';
    
   
   }
                                               
 
           //document.forms['conf'].maxbids.value=autobidderbids;
          //alert(autobidderbids);
  }
}


bidsremainingurl = "bids_remaining_ajax.php?id=" +ajaxid+ "";
xmlhttp.open("GET",bidsremainingurl,true);
xmlhttp.send(null);

    ajaxid2 = ajaxid;

setTimeout("bidsremaining(ajaxid2)", 6000);


}

//############################
// ITEM PAGE CLOCK CLOSED
//############################                
                
       


function ItemCountdownTimerClosed() {
          
  reserve_price = document.getElementById('closed_reserve').innerHTML;
  high_bid = document.getElementById('closed_bid').innerHTML;        
          
                          if ( reserve_price > high_bid ) {
   document.getElementById('time').innerHTML="<font color=red >Reserve Not Met</font>";
    }
    
    if ( high_bid == 0 ) {
    document.getElementById('time').innerHTML = "<font color=red>NOT SOLD!</font>";
    }
    
    if ( high_bid > 0 ) {
    if ( reserve_price < high_bid ) {
    
    document.getElementById('time').innerHTML = "<font color=red>SOLD!</font>";
    }
    }
    
    
document.getElementById('iibb').onclick=" ";
document['ibb'].src="images/bid_button_large_6.jpg";

}

 
