var flipflop=1;
var storedata;
var fl_status=0;
var indexflag;
var validatedisplayflag;

function OnloadPage()
{
    if($.browser.msie){
        //Configuring ajax
        $.ajaxSetup({
            cache: false
        });
    }

   fetchTimestamp = function(){
        return parseInt($('#timestamp').text());
    };

    // Default frequency for auction updating and time sync
    var auctionUpdateTime = 0.5;
	var counterUpdateTime = 1000;

    if($('#auctionupdatefrequency').text()){
        auctionUpdateTime = parseInt($('#auctionupdatefrequency').text());
    }

    // Convert it to milisecond
    auctionUpdateTime = auctionUpdateTime * 5000;

    // Variable to hold auction data
    var auctions = '';
	var prices = '';
	var auctions1 = '';

// Collecting auction data, the layer id and auction id
    $('.auction-item').each(function(){
        var auctionId    = $(this).attr('id');
        var auctionTitle = $(this).attr('title');
		auctions = auctions + auctionId + '=' + auctionTitle + '&';
		//if(auctions=='')
		//{
			//auctions = auctionTitle;
			
		//}
		//else
		//{
			//auctions = auctions + "," + auctionTitle;	
		//}
    });
//	alert(auctions);
//	$('.style10_price').each(function(){
//        var priceid    = $(this).attr('id');
		//auctions = auctions + auctionId + '=' + auctionTitle + '&';
		//if(prices=='')
		//{
			//prices = priceid;
			
		//}
		//else
		//{
			//prices = prices + "," + priceid;	
		//}
  //  });
	
	/* Please uncomment here to start the script  */
	var firstimage_bold;
	
	if($('.firstimagebold').length)
	{
		firstimage_bold = document.getElementById('firstimage_bold').innerHTML;
	}
	
	setInterval(function(){
        if(auctions){
			    
                getStatusUrl2 = 'update_time.php';
				//alert(auctions); 
            $.ajax({
                url: getStatusUrl2,
                dataType: 'json',
                type: 'POST',
                data: auctions,
				global: false,
                success: function(data){
					var f=0;
					$.each(data, function(i, item){
						auction_id = item.auction.id;
						auction_time = item.auction.time;
						pausestatus = item.auction.pause;
						auctionstatus= item.auction.astatus; 
						finalprice= item.auction.afinalprice; 
						if(auction_time=='0' || auction_time<'0' )
						{
						   
						   //document.getElementById('auction_timer_'+ auction_id).className ='waiting_font';
							//alert("ended"+newclassflag); 
							
							if(auctionstatus==3)
							{
							  if(validatedisplayflag==1)
							  {
							  	/*condition to show the ended properly */
								document.getElementById('counter_index_page_' + auction_id).className = '';
							  }
							  if(indexflag==1)
							  {
							  	/*condition to show the ended properly */
								document.getElementById('counter_index_page_' + auction_id).className = '';
							  }
							 //newcode added by the lokesh on 2 dec //
							 if(fl_status==0 && validatedisplayflag==1)
							 {
								
							  	document.getElementById('counter_index_page_' + auction_id).innerHTML = '<span style="color:#CC0000">Validating </span>';								fl_status++;
						   	 //	validatedisplayflag++;
							 }
							 else  //else  added by the lokesh on 2 dec //
							 {
							 document.getElementById('counter_index_page_' + auction_id).innerHTML = '<span style="color:#000000">Ended</span>';
							 }
							}
							else
							{
							document.getElementById('counter_index_page_' + auction_id).style.color ='';
							//document.getElementById('counter_index_page_' + auction_id).className ='';
							document.getElementById('counter_index_page_' + auction_id).className ='waiting_font';
							//document.getElementById('counter_index_page_' + auction_id).innerHTML = 'wait123';					
							document.getElementById('counter_index_page_' + auction_id).innerHTML = waitingforbids;
							}
							if($('.history_auctionid').length)
							{	
								if(document.getElementById('history_auctionid').innerHTML==auction_id)
								{
									//document.getElementById('bookbidbutlerbutton').name = "";// commented by lokesh on 19 nov 2010
//									alert(document.getElementById('bookbidbutlerbutton').className);
									//document.getElementById('image_main_' + auction_id).src = allimagepath + "BIG_SOLD_btn.png";
								}
								else
								{
									//document.getElementById('image_main_' + auction_id).src = allimagepath + "SOLD_btn.png";
								}
							}
							else
							{
								if(f<firstimage_bold)
								{
									//document.getElementById('image_main_' + auction_id).src = allimagepath + "SOLD_btn.png";
								}
								else
								{
									//document.getElementById('image_main_' + auction_id).src = allimagepath + "SOLD_btn2.png";
								}
							}
						}
						else if(auctionstatus==3)
						{
							 /*display of the validating for the product display page */
							 //alert("fl"+fl_status+"flag"+validatedisplayflag);
							 if(fl_status==0 && validatedisplayflag==1)
							 {
								document.getElementById('price_index_page_'+ auction_id).innerHTML = finalprice;
							  	document.getElementById('counter_index_page_' + auction_id).innerHTML = '<span style="color:#CC0000">Validating </span>';								fl_status++;
						   	 //	validatedisplayflag++;
							 }
							 else
							 {
							 //	alert("ended");
								document.getElementById('counter_index_page_' + auction_id).innerHTML = '<span style="color:#000000">Ended</span>';
							 }
							  
							  if(indexflag==1)
							{
							 	document.getElementById('price_index_page_'+ auction_id).innerHTML = finalprice;
							 	//document.getElementById('price_index_page_'+ auction_id).innerHTML = finalprice;
							}

							 //document.getElementById('counter_index_page_' + auction_id).innerHTML = 'Ended';
							 if(document.getElementById('bidder_label_' + auction_id)!=null)
							 {
							 	document.getElementById('bidder_label_' + auction_id).innerHTML="Winner:";
							 }
							 document.getElementById('image_main_' + auction_id).onclick="";
							 document.getElementById('image_main_' + auction_id).name="";
							 document.getElementById('image_main_' + auction_id).onmouseover="";
							 document.getElementById('image_main_' + auction_id).onmouseout="";
							 document.getElementById('image_main_' + auction_id).src = allimagepath + "SOLD_btn.png";
						}
						else if(pausestatus==1)
						{
							
							document.getElementById('counter_index_page_' + auction_id).innerHTML = 'Pause';
							if($('.history_auctionid').length){
								if(document.getElementById('history_auctionid').innerHTML == auction_id)
								{
									document.getElementById('image_main_' + auction_id).src = allimagepath + "BIG_BID_btn.png";									
								}
								else
								{
									document.getElementById('image_main_' + auction_id).src = allimagepath + "BID_btn.png";									
								}
							}
							else

							{
								//commented by lokesh*/ 
								/*if(f<firstimage_bold)
								{
									document.getElementById('image_main_' + auction_id).src = allimagepath + "BID_btn.png";
								}
								else
								{
									document.getElementById('image_main_' + auction_id).src = allimagepath + "BID_btn2.png";
								}*/
							}
							document.getElementById('image_main_' + auction_id).onclick="";
							document.getElementById('image_main_' + auction_id).onmouseover="";
							document.getElementById('image_main_' + auction_id).name="";							
							document.getElementById('image_main_' + auction_id).onmouseout="";
						}
						else
						{
							if(auction_time<60)
							{
								if(indexflag==1)
                                {
                                  document.getElementById('counter_index_page_' + auction_id).className = '';	//new line added at 10 nov
                                }
                                document.getElementById('counter_index_page_' + auction_id).style.color = '#E80000';	
								document.getElementById('counter_index_page_' + auction_id).innerHTML = calc_counter_from_time(auction_time);
							    
                            }
							else
							{
								document.getElementById('counter_index_page_' + auction_id).style.color = '#000000';	
							
								document.getElementById('counter_index_page_' + auction_id).innerHTML = calc_counter_from_time(auction_time);
							}
							
							
							if(newclassflag==2)
							{
								document.getElementById('counter_index_page_'+auction_id).className = 'body_inner_box_price_heading';
							}
							else
							{
							     if(indexflag!=1)/*do  not blank the class name in case of the index page */
								 {
									document.getElementById('counter_index_page_'+auction_id).className = '';
								 }
							}
							
							
						}
						f++;
					  }
					  );
					},
					error: function(XMLHttpRequest,textStatus, errorThrown){
					}
			});
		}
	}, counterUpdateTime);
	
	var GlobalVar = 0;
	//var finalrowdata = auctions + '&' + prices;
    // Main countdown for updating auction and flashing
     /* Please uncomment here to start the script  */

  setInterval(function(){
        if(auctions){
            getStatusUrl = 'update_information.php?flp=' + flipflop;
		    $.ajax({
                url: getStatusUrl,
                dataType: 'json',
                type: 'POST',
                data: auctions,
				global: false,
                success: function(data){
					storedata = data;
					//alert("success");
					//data = auctions1
					$.each(data, function(i, item){
					var auction_price;
					auction_id = item.auction.id;
					auction_price = item.auction.price;
					auction_bidder_name = item.auction.username;
				    auc_status = item.auction.auc_status;
					if(auction_bidder_name=="")
				    {
					   //auction_bidder_name="---" 
				       auction_bidder_name="No Bids Yet"; 
					}
					//alert("auction price"+auction_price+" price"+document.getElementById('price_index_page_' + auction_id).innerHTML);
					if(auc_status==3 && auction_bidder_name!='')
						{
							document.getElementById('product_bidder_' + auction_id).innerHTML = auction_bidder_name;
						}
					if(document.getElementById('price_index_page_' + auction_id).innerHTML != auction_price)
					{
						if(auc_status!=3)
						{
						
							//if(GlobalVar == 1 && validatedisplayflag!=1 )	
							if(GlobalVar == 1)
							{
								var forhoverid = new Spry.Effect.Highlight('price_index_page_' + auction_id , {duration: 500, from:'#f79909', to:'#FFFFFF', restoreColor: '#FFFFFF'});
								var forhoverid2 = new Spry.Effect.Highlight('currencysymbol_' + auction_id , {duration: 500, from:'#f79909', to:'#FFFFFF', restoreColor: '#FFFFFF'});
								forhoverid.start();
								forhoverid2.start();
					}
					   document.getElementById('price_index_page_' + auction_id).innerHTML = auction_price;  
                   		document.getElementById('currencysymbol_' + auction_id).innerHTML = "&#36;";
					//document.getElementById('product_bidder_' + auction_id).innerHTML = auction_bidder_name;
					}
						
					document.getElementById('product_bidder_' + auction_id).innerHTML = auction_bidder_name;
					}
					else
					{
						document.getElementById('price_index_page_' + auction_id).style.backgroundColor = "white";	
					}
//						alert(item.auction.price);					  
					});
					GlobalVar = 1;
					},
					error: function(XMLHttpRequest,textStatus, errorThrown){
//						alert(XMLHttpRequest);
//						alert(textStatus);
//						alert(errorThrown);
					}
			});
		}
		if(flipflop==1) { flipflop = 2; }
		else if(flipflop==2) { flipflop = 1;}
		//ChangeCountdownData(storedata);
	}, auctionUpdateTime); 

    // Function for bidding
    $('.bid-button-link').click(function(){
//        var auctionElement = $(this).parent().parent().parent().attr('id');
//        var bidButton      = $(this).parent().parent().children('.bid-button');
//        var bidLoading     = $(this).parent().parent().children('.bid-loading');

//        bidButton.hide(1);
//        bidLoading.show(1);
            
        $.ajax({
            url: $(this).attr('name'),
            dataType: 'json',
            success: function(data){
				$.each(data, function(i, item){
				result = item.result;
				aid=item.aid;
				if(result=="unsuccess")
				{
					if(confirm(plsrechargebid))
					{
						window.location.href='buybids.html';
					}
				}
				/* code added to display the message */
				
				if(result=="cannotbid")
				{
					//alert("you can not bid again in the row in this auction");					
				}
				
				//document.getElementById('counter_index_page_' + auction_id).className ='';
				/* code added to display the message End */
				if(result=="success")
				{
					//alert("newclassflag"+newclassflag);
					obj = document.getElementById('bids_count');
					objvalue = document.getElementById('bids_count').innerHTML;
					//alert("outside");
					if(validatedisplayflag==1)
					{
						//alert("222");
						update_saving_box(aid);
					}
				
					if(obj.innerHTML!='0')
					{
						obj.innerHTML = Number(objvalue) - 1;
						document.getElementById('counter_index_page_' + aid).innerHTML ='&nbsp;';
						//alert("newclassflag"+newclassflag);
						if(newclassflag==2)
							{
								document.getElementById('counter_index_page_'+aid).className = 'body_inner_box_price_heading';
							}
						else
						{
						//document.getElementById('counter_index_page_' + aid).className ='body_inner_box_price_heading';
						}
					}
				}
               if(result=="bpsuccess")
				{
					
					obj = document.getElementById('bidpoints_count');
					objvalue = document.getElementById('bidpoints_count').innerHTML;
					
					if(validatedisplayflag==1)
					{
						update_saving_box(aid);
					}
					if(obj.innerHTML!='0')
					{
						obj.innerHTML = Number(objvalue) - 1;
					   // document.getElementById('counter_index_page_' + aid).className ='';
						document.getElementById('counter_index_page_' + aid).innerHTML ='&nbsp;';
                        if(newclassflag==2)
							{
								document.getElementById('counter_index_page_'+aid).className = 'body_inner_box_price_heading';
							}
					}
					
				} 



/*			    if($('.index_setting').length){
					oldused = Number(document.getElementById("totalusedbids_index").innerHTML);
					document.getElementById("totalusedbids_index").innerHTML = oldused + 1;
				}
*/			});
            },
			error: function(XMLHttpRequest,textStatus, errorThrown){
			//alert(textStatus);
			}
        });

        return false;
    });


	if($('.productImageThumb').length){
    setInterval(function(){
		auctionhisid = document.getElementById('history_auctionid').innerHTML;

		oldprice = document.getElementById('curproductprice').innerHTML;
//		alert(oldprice);
		newprice = document.getElementById('price_index_page_' + auctionhisid).innerHTML;
	if(oldprice!=newprice)
	{
		getStatusUrl3 = 'updatehistory.php?aucid_new='+auctionhisid;
		//alert(getStatusUrl3);
		//alert(auctions); 
	$.ajax({
		url: getStatusUrl3,
		dataType: 'json',
		success: function(data){

			data1 = eval('(' + data.responseText + ')');
			for(i=0;i<data.histories.length;i++)
			{
				biddingprice = data.histories[i].history.bprice;
				biddingusername = data.histories[i].history.username;
				biddingtype = data.histories[i].history.bidtype;
                bidflag = data.histories[i].history.bidflag;
				document.getElementById('bid_price_' + i).innerHTML = "&#36;" + biddingprice;
				document.getElementById('bid_user_name_' + i).innerHTML = biddingusername;
                if(bidflag=='d')
				{
				if(biddingtype=='s')
				{
					document.getElementById('bid_type_' + i).innerHTML = placesinglebid;
				}
				else if(biddingtype=='b')
				{
					document.getElementById('bid_type_' + i).innerHTML = placebidbuddy;
				}
				else if(bidding_type=='m')
				{
					document.getElementById('bid_type_' + i).innerHTML = placesmsbid;
				}}
				else
				{
				   document.getElementById('bid_type_' + i).innerHTML = bidpointbid;
				}
			}
			
			if(data.myhistories.length)
			{
				for(j=0;j<data.myhistories.length;j++)
				{
					biddingprice1 = data.myhistories[j].myhistory.bprice;
					biddingusername1 = data.myhistories[j].myhistory.time;
					biddingtype1 = data.myhistories[j].myhistory.bidtype;
                    biddingflag1 = data.myhistories[j].myhistory.bidflag;  
					document.getElementById('my_bid_price_' + j).innerHTML ="&#36;" + biddingprice1;
					document.getElementById('my_bid_time_' + j).innerHTML = biddingusername1;
	
					if(biddingflag1=='d')
				{
					if(biddingtype1=='s')
					{
						document.getElementById('my_bid_type_' + j).innerHTML = placesinglebid;
					}
					else if(biddingtype1=='b')
					{
						document.getElementById('my_bid_type_' + j).innerHTML = placebidbuddy;
					}
					else if(biddingtype1=='m')
					{
						document.getElementById('my_bid_type_' + j).innerHTML = placesmsbid;
					}
				}
				else
				{
				   document.getElementById('my_bid_type_' + j).innerHTML = bidpointbid;
				}
				
				}
			}
			document.getElementById('curproductprice').innerHTML = "&#36;" + data.histories[0].history.bprice;
		},
		error: function(XMLHttpRequest,textStatus, errorThrown){
//			alert(textStatus);	
		}
		   });
	}
	 },counterUpdateTime);
    }

    $('.bookbidbutlerbutton').click(function(){
	if(document.getElementById('bookbidbutlerbutton').name!="")
	{
		var bidbutstartprice;
		var bidbutendprice;
		var totalbids;
			
		
		bidbutstartprice = Number(document.bidbutler.bidbutstartprice.value);
		bidbutendprice = Number(document.bidbutler.bidbutendprice.value);
		totalbids = document.bidbutler.totalbids.value;
		
		if(bidbutstartprice=="")
		{
			alert(entbutsprice);
			return false;
		}
		if(bidbutendprice=="")
		{
			alert(entbuteprice);
			return false;
		}
		if(totalbids=="")
		{
			alert(entbutbids);
			return false;
		}
		if(totalbids<=1)
		{
			alert(entmoreone);
			return false;
		}
		
		if(bidbutendprice>bidbutstartprice)
		{
			alert(spricegreat);
			return false;
		}
		if(bidbutstartprice==bidbutendprice)
		{
			alert(spricegreat);
			return false;
		}
       /*validation code added to limit the mo of bids for the bidbuddy*/
	   if(totalbids>50)
		{
		 alert(spricelower);
		 return false;
		}
		if(totalbids<2)
		{
		 alert(lessbidvalidation);
		 return false;
		}
		aucid=$(this).attr('name');
		$.ajax({
            url: "addbidbutler.php?aid="+$(this).attr('name')+"&bidsp="+bidbutstartprice+"&bidep="+bidbutendprice+"&totb="+totalbids,
            dataType: 'json',
            success: function(data){
				$.each(data, function(i, item){
				result = item.result;
				
				if(result=="unsuccessprice")
				{
				    //code added to display the validation div (bid price lower validation) */
				document.getElementById("validationdiv").style.display='block';
				document.getElementById("main_div").className='validate_change'; //code added on 6 dex 2010//
				document.getElementById("testbody").className='yui-skin-sam withdivbody';
				document.getElementById("validationdiv").innerHTML='<span style="margin-top:5px;"><strong>Welcome! BID FROM Value needs to be 1$ lower than the Current Auction Price!</strong></span>';
				setTimeout("close_div()",10000);   
				}
				else if(result=="unsuccess")
				{
					alert(plsrechargebid);
				}
				else if(result=="alreadyactivebuddy")
				{
				/* code added to display the validation for the single active bidbuddy*/
				document.getElementById("validationdiv").style.display='block';
				document.getElementById("main_div").className='validate_change'; //code added on 6 dex 2010//
				document.getElementById("testbody").className='yui-skin-sam withdivbody';
				document.getElementById("validationdiv").innerHTML='<span style="margin-top:5px;"><strong>Welcome! You cannot add a Bidbuddy because there is an active Bidbuddy running!</strong></span>';
				setTimeout("close_div()",10000);   
				/* code Ended  Here */
				}
				else if(result=="donthavebid")
				{
				  /* code added to display the validation for user who add the bidbuddy without placing bids on that auction*/
				document.getElementById("validationdiv").style.display='block';
				document.getElementById("main_div").className='validate_change'; //code added on 6 dex 2010//
				document.getElementById("testbody").className='yui-skin-sam withdivbody';
				document.getElementById("validationdiv").innerHTML='<span style="margin-top:5px;"><strong>Welcome! You must place a single bid before adding a BidBuddy.</strong></span>';
				setTimeout("close_div()",10000);   
				/* code Ended  Here */
				 
				
				}
				
				else
				{
                    //alert("in else condition");
					document.bidbutler.bidbutstartprice.value="";
					document.bidbutler.bidbutendprice.value="";
					document.bidbutler.totalbids.value="";
					document.getElementById('butlermessage').style.display='block';
					changeMessageTimer = setInterval("ChangeButlerImageSecond()",3000);
					changedatabutler(data,"abut",totalbids,aucid);
				}
			  });
			},
			error: function(XMLHttpRequest,textStatus, errorThrown){
//				alert(textStatus);
			}
        });

        return false;
	 }
    });

    /* function to call the bidbuddy */
checkBidbuddy();
updateauction();  



}
//setTimeout("updateauction();",10000)
 
/* function to upadate the future auctions */

function updateauction()
{
	if($.browser.msie){
        //Configuring ajax
        $.ajaxSetup({
            cache: false
        });
    }
	$.ajax({
		url: url = "update_auction_record.php",
		success: function(data){
         setTimeout("updateauction();",20000);    
        }});
}






/* functions for the bidbuddy functionality */



	
    
/* function to check the bidbuddy */
function checkBidbuddy()
{
	var auction_id='';
	if($.browser.msie){
        //Configuring ajax
        $.ajaxSetup({
            cache: false
        });
    }
	
   $.ajax({
		url: url = "check_bidbuddy.php",
		dataType: 'json',
		success: function(data){
		  /* code to show the effect when price changes by the bid buddy */  
	$.each(data, function(i, item){
							
							auction_id = item.auction.id;
							
							if(document.getElementById('price_index_page_' + auction_id) != null)
							{
							var forhoverid = new Spry.Effect.Highlight('price_index_page_' + auction_id , {duration: 500, from:'#f79909', to:'#FFFFFF', restoreColor: '#FFFFFF'});
							var forhoverid2 = new Spry.Effect.Highlight('currencysymbol_' + auction_id , {duration: 500, from:'#f79909', to:'#FFFFFF', restoreColor: '#FFFFFF'});

							forhoverid.start();
							forhoverid2.start();
							
							}
					
//						alert(item.auction.price);					  
					});
					GlobalVar = 1;
					
	/*********************************************************************************************************************/

}
});
	
	//timer = setTimeout("checkBidbuddy('"+ +"','"+aid+"');",1000);
	timer = setTimeout("checkBidbuddy();",1000);  
	}
		
		


 
/* functions for the bidbuddy functionality */

function DeleteBidButler(id,div_id,aid)
{
	$.ajax({
		url: url = "deletebutler.php?delid=" + id+"&aid="+aid,
		dataType: 'json',
		success: function(data){
		$.each(data, function(i, item){
			result = item.result;
			if(result=="unsuccess")
			{
				alert(youbidisrunning);
			}
			else
			{
				placebids = document.getElementById('butlerbids_' + div_id).innerHTML;
				objbids = document.getElementById('bids_count');
				objbidsvalue = document.getElementById('bids_count').innerHTML;
				if(objbids.innerHTML!='0')
				{
					objbids.innerHTML = Number(objbidsvalue) + Number(placebids);
				}
				changedatabutler(data,"dbut","");
			}
		});
	},
		error: function(XMLHttpRequest,textStatus, errorThrown){
//				alert(textStatus);
		}
	});
	return false;
}

   /* Please uncomment here to start the script  */
/*function ChangeCountdownData(resdata)
{
	if(resdata && resdata!="")
	{
		data = resdata;
		var f=0;
	$.each(data, function(i, item){
			auction_id = item.auction.id;
			auction_time = item.auction.time;
			pausestatus = item.auction.pause;
		if(auction_time)
		{
			//alert("auction tim,e si"+auction_time);
			if(auction_time=='0')
			{
				//alert("ended"+newclassflag); 
				//document.getElementById('counter_index_page_' + auction_id).style.font-size = '20px';
				document.getElementById('counter_index_page_' + auction_id).style.color ='';
				document.getElementById('counter_index_page_' + auction_id).className ='waiting_font';
			    //document.getElementById('counter_index_page_' + auction_id).style.color = '#000000';
				document.getElementById('counter_index_page_' + auction_id).innerHTML = waitingforbids;					
				//document.getElementById('image_main_' + auction_id).onclick="";
				//document.getElementById('image_main_' + auction_id).name="";
				//document.getElementById('image_main_' + auction_id).onmouseover="";
				//document.getElementById('image_main_' + auction_id).onmouseout="";
				if($('.history_auctionid').length)
				{	
					if(document.getElementById('history_auctionid').innerHTML==auction_id)
					{
						document.getElementById('bookbidbutlerbutton').name = "";
						//alert("hee");
						//document.getElementById('image_main_' + auction_id).src = allimagepath + "BIG_SOLD_btn.png";
					}
					else
					{
						document.getElementById('image_main_' + auction_id).src = allimagepath + "SOLD_btn.png";
					}
				}
				else
				{
					/*if(f<firstimage_bold)
					{
						document.getElementById('image_main_' + auction_id).src = allimagepath + "SOLD_btn.png";
					}
					else
					{
						document.getElementById('image_main_' + auction_id).src = allimagepath + "SOLD_btn2.png";
					}*/
		/*		}
			}
			else if(pausestatus==1)
			{
				document.getElementById('counter_index_page_' + auction_id).innerHTML = 'Pause';
				if($('.history_auctionid').length){
					if(document.getElementById('history_auctionid').innerHTML == auction_id)
					{
						document.getElementById('image_main_' + auction_id).src = allimagepath + "BIG_BID_btn.png";									
					}
					else
					{
						document.getElementById('image_main_' + auction_id).src = allimagepath + "BID_btn.png";									
					}
				}
				else
				{
					/*if(f<firstimage_bold)
					{
						document.getElementById('image_main_' + auction_id).src = allimagepath + "BID_btn.png";
					}
					else
					{
						document.getElementById('image_main_' + auction_id).src = allimagepath + "BID_btn2.png";
					}*/
			/*	}
				document.getElementById('image_main_' + auction_id).onclick="";
				document.getElementById('image_main_' + auction_id).onmouseover="";
				document.getElementById('image_main_' + auction_id).name="";							
				document.getElementById('image_main_' + auction_id).onmouseout="";
			}
			else
			{
				//if(auction_time<10)
				if(auction_time<60)
				{
				document.getElementById('counter_index_page_' + auction_id).style.color = '#E80000';	
				document.getElementById('counter_index_page_' + auction_id).innerHTML = calc_counter_from_time(auction_time);
				}
				else
				{
				document.getElementById('counter_index_page_' + auction_id).style.color = '#000000';	
				document.getElementById('counter_index_page_' + auction_id).innerHTML = calc_counter_from_time(auction_time);
				}
			}
		}
		f++;
	  }
  );
		
}
}*/



/* function to update the saving box on the product detail page */

function update_saving_box(aucid)
{
 	   $.ajax({
		url:"get_updated_auction_detail.php?id="+aucid,
		dataType: 'json',
		success: function(data){
		  /* code to show the effect when price changes by the bid buddy */  
		$.each(data, function(i, item){
							
							auction_id = item.auction.id;
							aucprice = item.auction.auc_price;
							totbid= item.auction.total_bid;
							totbidprice = item.auction.total_bid_price;
							price = item.auction.price;
							
							document.getElementById('auction_price1').innerHTML=aucprice;
							document.getElementById('placebidscount').innerHTML=totbid;
							document.getElementById('placebidsamount').innerHTML=totbidprice;
							document.getElementById('placebidssavingdisp').innerHTML=price;
							
					});		
				
			

}
});
	  
}


























