
// ------ ------ ------ ------ ------ ------ ------ ------ ------ ------ ------ ------ ------
// This software is copyright ? 2006 onwards by soniktechnologies.in
// Sonik Technologies Pvt Ltd - technical internet software security strategy consultants
// 
// Intellectual property rights and copyright title are vested with Sonik Technologies.
// Title to copyright in this software and any associated documentation will at all times //remain
// with the copyright holder.
// 
// This source file may contain confidential information or data and may be Legally //Privileged.
// Reproduction is not authorised without prior written agreement from the copyright holder.
// 
// Originally developed by Nischal Soni  (nischal.soni@gmail.com).
// www.soniktechnologies.in
// ------ ------ ------ ------ ------ ------ ------ ------ ------ ------ ------ ------ ------

var doc = null;

var Extend_timer = new Array(); 
var Extend_status = new Array();
var Old_Bidcounter = new Array();
var Auction_ids=0;
var Product_id=0;
var Pagename='';
var Timer_color="";  	
	
var Flashing_timer=0;
var Lang_path="";


function ajax() {
	// Make a new XMLHttp object

    if (window.XMLHttpRequest) {
        try {
            doc = new XMLHttpRequest();
        } catch(e)  {}
    } else if (window.ActiveXObject) {
        try {
            doc = new ActiveXObject('Msxml2.XMLHTTP');
        } catch(e)  {
          try {
              doc = new ActiveXObject('Microsoft.XMLHTTP');
          } catch(e)  {}
        }
    }
}

function Update_Bid_Detail()
{	
	 var doc=null;
	 	 if (window.XMLHttpRequest) {
        try {
            doc = new XMLHttpRequest();
        } catch(e)  {}
    } else if (window.ActiveXObject) {
        try {
            doc = new ActiveXObject('Msxml2.XMLHTTP');
        } catch(e)  {
          try {
              doc = new ActiveXObject('Microsoft.XMLHTTP');
          } catch(e)  {}
        }
    }
	
	
	doc.open('GET', "./timer_location.php?section=update_bid&Runngin_list="+Auction_ids+"&Product_id="+Product_id, true); 	
	doc.setRequestHeader('Content-Type','application/x-www-form-urlencoded');        
  
	doc.onreadystatechange = function() { 
			
	if(doc.readyState == 4)
		{
		if(doc.status == 200)
			{ 
			if(doc.responseText!='')
				{
					
					
				var arraylist=doc.responseText.split("|@|");
				for(var l=0;l<arraylist.length;l++)
					{
						
						var arraylist1=arraylist[l].split("**");
						var pro_id =(parseInt(arraylist1[0]));
						
						if(Extend_status[pro_id]!=arraylist1[1])
							Update_status(pro_id);
					
						if(Old_Bidcounter[pro_id]!=parseInt(arraylist1[2]))
							{
							Old_Bidcounter[pro_id]=parseInt(arraylist1[2]);	
															
							Update_Auction_Detail(pro_id);
							
							if(Product_id!=0)
								Update_bid_table();
					
							setTimeout('document.getElementById("price_index_div_'+pro_id+'").style.backgroundColor = "#88c136"', 10);
							setTimeout('document.getElementById("price_index_div_'+pro_id+'").style.backgroundColor = "#88c136"', 70);
							setTimeout('document.getElementById("price_index_div_'+pro_id+'").style.backgroundColor = "#88c136"', 130);	
							setTimeout('document.getElementById("price_index_div_'+pro_id+'").style.backgroundColor = "#88c136"', 200);
							setTimeout('document.getElementById("price_index_div_'+pro_id+'").style.backgroundColor = "#88c136"', 270);
							setTimeout('document.getElementById("price_index_div_'+pro_id+'").style.backgroundColor = "#88c136"', 330);
							setTimeout('document.getElementById("price_index_div_'+pro_id+'").style.backgroundColor = "#88c136"', 400);
							setTimeout('document.getElementById("price_index_div_'+pro_id+'").style.backgroundColor = "#88c136"', 470);
							setTimeout('document.getElementById("price_index_div_'+pro_id+'").style.backgroundColor = ""', 530);
						
							}	
						}
		
		}}}}; 
		
	 setTimeout('Update_Bid_Detail()', 3000); 
     doc.send(null);
}


function Run_timer()
{

	if(Auction_ids!='0')
		{
		
		var arraylist=Auction_ids.split(",");
			
		for(l=0;l<arraylist.length;l++)
		{	 
			var pro_id =(parseInt(arraylist[l]));
			
		
			if(Extend_timer[pro_id]>=0)
				{
				if(Extend_status[pro_id]=="E")
					{
						
						if(Extend_timer[pro_id]==5)
							Add_robot_bid(pro_id);

				document.getElementById('counter_index_div_'+pro_id).innerHTML = "<font color='red'>" + calc_counter_from_time_short(Extend_timer[pro_id]) + "</font>";
					}
				else if(Extend_status[pro_id]=="N")
					document.getElementById('counter_index_div_'+pro_id).innerHTML = '' + calc_counter_from_time(Extend_timer[pro_id]);
				else if(Extend_status[pro_id]=="P")
						{
							document.getElementById('bid_btn_'+pro_id).innerHTML = "PAUSED";
							document.getElementById('counter_index_div_'+pro_id).innerHTML = "<b>PAUSE</b>";
						}
					}
				else
					{
					if(Extend_status[pro_id]=="N")	
						{
						Extend_status[pro_id]='E';		
						Expire_home_bid(pro_id);
						}
					else if(Extend_status[pro_id]=='E')
						{
							Extend_status[pro_id]='S';
							document.getElementById('counter_index_div_'+pro_id).innerHTML = "<b>Waiting</b>";
							setTimeout('Expire_extend_bid('+pro_id+')', 1000);
						}
					else if(Extend_status[pro_id]=="P")
						{
							document.getElementById('bid_btn_'+pro_id).innerHTML = "<div style='padding-top:6px;'>PAUSED</div>";
							document.getElementById('counter_index_div_'+pro_id).innerHTML = "<b>PAUSE</b>";
						}	
					}
					Extend_timer[pro_id]=(Extend_timer[pro_id]-1);	
			}
		}
		setTimeout('Run_timer();', 950); 
	
	}
	

function Run_timer_product()
{

	if(Auction_ids!='0')
		{
		
		var arraylist=Auction_ids.split(",");
			
		for(l=0;l<arraylist.length;l++)
		{	 
			var pro_id =(parseInt(arraylist[l]));
			
		
			if(Extend_timer[pro_id]>=0)
				{
				if(Extend_status[pro_id]=="E")
					{
						//if(Extend_timer[pro_id]<=10 && Extend_timer[pro_id]>=3)
						if(Extend_timer[pro_id]==5)
							Add_robot_bid(pro_id);
					if(Extend_timer[pro_id]<=Flashing_timer)
						{
						if(pro_id==Product_id)
							document.getElementById('flashing_index_div_'+pro_id).innerHTML = '<img src="images/'+Lang_path+'/blink.gif" boder="0">';
							
							document.getElementById('counter_index_div_'+pro_id).innerHTML="<font color='"+Timer_color+"'>"+calc_counter_from_time_short(Extend_timer[pro_id])+"</font>";
						}
					else
				document.getElementById('counter_index_div_'+pro_id).innerHTML = "<font color='red'>" + calc_counter_from_time_short(Extend_timer[pro_id]) + "</font>";
					}
				else if(Extend_status[pro_id]=="N")
					document.getElementById('counter_index_div_'+pro_id).innerHTML = '' + calc_counter_from_time(Extend_timer[pro_id]);
				else if(Extend_status[pro_id]=="P")
						{
						if(pro_id==Product_id)
							{
							document.getElementById('bid_btn_'+pro_id).innerHTML = "<div style='padding-top:6px;'>PAUSED</div>";
							document.getElementById('counter_index_div_'+pro_id).innerHTML = "<b>--:--:--</b>";
							}
						else
							{
							document.getElementById('bid_btn_'+pro_id).innerHTML = "PAUSED";
							document.getElementById('counter_index_div_'+pro_id).innerHTML = "<b>PAUSE</b>";
							}
						}
					}
				else
					{
					if(Extend_status[pro_id]=="N")	
						{
						Extend_status[pro_id]='E';		
						Expire_home_bid(pro_id);
						}
					else if(Extend_status[pro_id]=='E')
						{
							Extend_status[pro_id]='S';
							document.getElementById('counter_index_div_'+pro_id).innerHTML = "<b>Waiting</b>";
							setTimeout('Expire_extend_bid('+pro_id+')', 1000);
						}
					else if(Extend_status[pro_id]=="P")
						{
						if(pro_id==Product_id)
							{
							document.getElementById('bid_btn_'+pro_id).innerHTML = "<div style='padding-top:8px;'>PAUSED</div>";
							document.getElementById('counter_index_div_'+pro_id).innerHTML = "<b>--:--:--</b>";
							}
						else
							{
							document.getElementById('bid_btn_'+pro_id).innerHTML = "<div style='padding-top:6px;'>PAUSED</div>";
							document.getElementById('counter_index_div_'+pro_id).innerHTML = "<b>PAUSE</b>";
							}
						}	
					}
					Extend_timer[pro_id]=(Extend_timer[pro_id]-1);	
			}
		}
		setTimeout('Run_timer_product();', 950); 
	
	}

function Update_status(Pro_id)
{
	var doc=null;
	
	if (window.XMLHttpRequest) {
    	try {
            doc = new XMLHttpRequest();
    	    } catch(e)  {}
	    } else if (window.ActiveXObject) {
    	    try {
        	    doc = new ActiveXObject('Msxml2.XMLHTTP');
		        } catch(e)  {
        	try {
              doc = new ActiveXObject('Microsoft.XMLHTTP');
		        } catch(e)  {}
	        }
  		}
		
	doc.open('GET', "./timer_location.php?section=update_status&Auction_ids="+Auction_ids+"&Pro_id="+Pro_id+"&Pagename="+Pagename+"&Product_id="+Product_id, true);
	doc.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); 
		
	doc.onreadystatechange = function()
	   	{ 
		if(doc.readyState == 4)
			{
			if(doc.status == 200)
				{
				if(doc.responseText!=0)
					{
						var Main_array=doc.responseText.split("**");	
						
						Extend_timer[Pro_id] = parseInt(Main_array[1]);		
						Extend_status[Pro_id]=Main_array[2];	
						if(Main_array[0]!="")
							document.getElementById('bid_btn_'+Pro_id).innerHTML = Main_array[0];	
							
					}
				}
			}
	    };
	doc.send(null);
}

function Update_timer()
{
		var doc=null;
	
	if (window.XMLHttpRequest) {
    	try {
            doc = new XMLHttpRequest();
    	    } catch(e)  {}
	    } else if (window.ActiveXObject) {
    	    try {
        	    doc = new ActiveXObject('Msxml2.XMLHTTP');
		        } catch(e)  {
        	try {
              doc = new ActiveXObject('Microsoft.XMLHTTP');
		        } catch(e)  {}
	        }
  		}
		
	doc.open('GET', "./timer_location.php?section=update_timer&Runngin_list="+Auction_ids, true);
	doc.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); 
		
	doc.onreadystatechange = function()
	   	{ 
		if(doc.readyState == 4)
			{
			if(doc.status == 200)
				{
				if(doc.responseText!=0)
					{
		  			var arraylist=doc.responseText.split("|@|");
						
					for(l=0;l<arraylist.length;l++)
						{	
						var Main_array=arraylist[l].split("**");
						var pro_id =(parseInt(Main_array[0]));
						Extend_timer[pro_id] = parseInt(Main_array[1]);	
						Extend_status[pro_id]=Main_array[2];	
						} 
					}
		}
				}
		  };
		 setTimeout('Update_timer();', 10000);  
     doc.send(null);
}	

function Update_Auction_Detail(Pro_id)
{	
	 var doc=null;
	 	 if (window.XMLHttpRequest) {
        try {
            doc = new XMLHttpRequest();
        } catch(e)  {}
    } else if (window.ActiveXObject) {
        try {
            doc = new ActiveXObject('Msxml2.XMLHTTP');
        } catch(e)  {
          try {
              doc = new ActiveXObject('Microsoft.XMLHTTP');
          } catch(e)  {}
        }
    }
	
 doc.open('GET', "./timer_location.php?section=update_auction_details&Pagename="+Pagename+"&Pro_id="+Pro_id+"&product_id="+Product_id, true); 	
	doc.setRequestHeader('Content-Type','application/x-www-form-urlencoded');        
   
	doc.onreadystatechange = function() { 
			
	if(doc.readyState == 4)
		{
		if(doc.status == 200)
			{ 
			if(doc.responseText!='')
				{
				var Main_array=doc.responseText.split("=#=");

				var arraylist=Main_array[0].split("**");
				
				document.getElementById('winner_index_div_'+Pro_id).innerHTML = arraylist[0];
				document.getElementById('price_index_div_'+Pro_id).innerHTML = arraylist[1];	
				
				Extend_timer[Pro_id] = parseInt(arraylist[3]);		
					if(Pro_id==Product_id)
						{
							
							document.getElementById('flashing_index_div_'+Pro_id).innerHTML = arraylist[2];
							setTimeout('document.getElementById("flashing_index_div_'+Pro_id+'").innerHTML= ""', 2000);
							
							var arraylist3=Main_array[1].split("*@*");
				
						if(arraylist3[2]=="L")
							{
					  		//document.getElementById('place_bid_div_'+Pro_id).innerHTML = arraylist3[4];
							//document.getElementById('place_mybid_div_'+Pro_id).innerHTML = arraylist3[5];
				
							if(arraylist3[3]!="I")
								document.getElementById("bid_from").value = arraylist3[3];
									
							if(arraylist3[5]!="R")
								Update_bid_table();
							}
						else
							{
							if(arraylist3[2]!="R")
								Update_bid_table();	
							}

							document.getElementById('price_index1_div_'+Pro_id).innerHTML = arraylist3[0];
							document.getElementById('price_save_div_'+Pro_id).innerHTML = arraylist3[1];
						}
						
		}}}}; 

	 
     doc.send(null);
}

function Valid_username(login){
		ajax();
		// Load the result from the response page
		// ** As far a I know firefox will only load a document on the SAME domain!!	
	   if (doc){
	       doc.open("GET", "./location1.php?section=username&login="+login, false); 
	       doc.send(null);
	      return  doc.responseText;
	    }
}
function CheckAvail(id_region){
		var avail=document.getElementById(id_region).value;
		
		ajax();
	    if (doc){
	       doc.open("GET", "location1.php?section=tutoring&avail="+avail, false);
	       doc.send(null);

			if(doc.responseText==1) 
				{
				alert(document.getElementById('username_already_exist').innerHTML+"\n");
				return false;
				}
			else if(doc.responseText==2)
			 {
				alert(document.getElementById('this_username_available').innerHTML+"\n");
				return false; 
			 }
			else if(doc.responseText==3)
			 {
				alert(document.getElementById('please_enter_username').innerHTML+"\n");
				return false; 
			 } 
			else
			return true;
			 
		}	
	
	}
function CheckEmail(id_region){

		var emailadd=document.getElementById(id_region).value;
		
		ajax();
	    if (doc){
	       //destination.innerHTML = "Loading data...";	
	       doc.open("GET", "location1.php?section=availmail&emailadd="+emailadd, false);
	       doc.send(null);
	    	// Write the response to the div
			
			//document.getElementById('email_available').innerHTML = doc.responseText;
			
			if(doc.responseText==1) 
				{
				alert(document.getElementById('email_already_exist').innerHTML+"\n");
				return false;
				}
		else if(doc.responseText==2)
			 {
				alert(document.getElementById('this_email_available').innerHTML+"\n");
				return false; 
			 }
			else if(doc.responseText==3)
			 {
				alert(document.getElementById('please_enter_email').innerHTML+"\n");
				return false; 
			 } 
			else
			return true;
	    }	
	
	}	


function Valid_mobile(tel){
		ajax();
		// Load the result from the response page
		// ** As far a I know firefox will only load a document on the SAME domain!!	
	   if (doc){
	       doc.open("GET", "./location1.php?section=mobile&tel="+tel, false); 
	       doc.send(null);
	      return  doc.responseText;
	    }
}

function Edit_Valid_mobile(tel){
    	ajax();
		// Load the result from the response page
		// ** As far a I know firefox will only load a document on the SAME domain!!	
	   if (doc){
	       doc.open("GET", "./location1.php?section=edit_mobile&tel="+tel, false); 
	       doc.send(null);
		  
	      return  doc.responseText;
	    }
}

function Edit_Valid_username(login){
    	ajax();
		// Load the result from the response page
		// ** As far a I know firefox will only load a document on the SAME domain!!	
	   if (doc){
	       doc.open("GET", "./location1.php?section=edit_username&login="+login, false); 
	       doc.send(null);
		  
	      return  doc.responseText;
	    }
}



function Valid_email(email){
		
    	ajax();
		// Load the result from the response page
		// ** As far a I know firefox will only load a document on the SAME domain!!	
	   if (doc){
	       doc.open("GET", "./location1.php?section=email&email="+email, false);   
	       doc.send(null);
	      return  doc.responseText;
	    }
}

function Edit_Valid_email(email){
		
    	ajax();
		// Load the result from the response page
		// ** As far a I know firefox will only load a document on the SAME domain!!	
	   if (doc){
	       doc.open("GET", "./location1.php?section=edit_email&email="+email, false);   
	       doc.send(null);
	      return  doc.responseText;
	    }
}

function bid_list(item_id,table_type)
{
	ajax();
		// Load the result from the response page
		// ** As far a I know firefox will only load a document on the SAME domain!!	
	   if (doc){
	       doc.open("GET", "./location.php?section=bid_list_table&item_id="+item_id+"&table_type="+table_type, false);   
	       doc.send(null);
 			 var mainarraylist=doc.responseText.split("|**|");
			if(mainarraylist[1]=="bidlist")
			document.getElementById('bidlist_table_div').innerHTML = mainarraylist[0];
			
			if(table_type=='B')
				Update_bid_table();
	    }
}

function bidbutler_list(item_id,table_type)
{
	ajax();
		// Load the result from the response page
		// ** As far a I know firefox will only load a document on the SAME domain!!	
	   if (doc){
	       doc.open("GET", "./location.php?section=book_bidbutler_table&item_id="+item_id+"&table_type="+table_type, false);   
	       doc.send(null);
 			 var mainarraylist=doc.responseText.split("|**|");
			if(mainarraylist[1]=="book_bidbulter")
			document.getElementById('book_bidbutler_table_div').innerHTML =  mainarraylist[0];

	    }
}

function get_info_drop_dowm(promotion_id){

		ajax();
		// Load the result from the response page
		// ** As far a I know firefox will only load a document on the SAME domain!!	
	    if (doc){
	       doc.open("GET", "./location1.php?section=promotion&promotion_id=" + promotion_id, false);
	       doc.send(null);
	    	// Write the response to the div	    	
	       document.getElementById('info_div').innerHTML = doc.responseText;
	    }	
	}
	

	
	



function Update_bid_table(){
		ajax();
		// Load the result from the response page
		// ** As far a I know firefox will only load a document on the SAME domain!!	
	    if (doc){
	       doc.open("GET", "./location.php?section=update_bid_table&product_id="+Product_id, false);
		   doc.send(null);
    	// Write the response to the div
	       var mainarraylist=doc.responseText.split("|**|");
		   if(mainarraylist[1]=="BidHistory")
		   {
             document.getElementById('bid_table_div1').innerHTML = mainarraylist[0];
			if(mainarraylist[3]=='I')
 			 document.getElementById("bid_from").value = mainarraylist[2];
		   }
		}
	}


function Update_session()
	{
		ajax();
		// Load the result from the response page
		// ** As far a I know firefox will only load a document on the SAME domain!!	
	   if (doc){
	       doc.open("GET", "./location1.php?section=update_session", false);   
	       doc.send(null);
			}
	}


function Expire_home_bid(pro_id) {
    ajax();
		// Load the result from the response page
		// ** As far a I know firefox will only load a document on the SAME domain!!	
	
	    if (doc){
	       doc.open("GET", "./location.php?section=expire_bid&pro_id="+pro_id, false);
 			doc.send(null);
			var mainarraylist=doc.responseText.split("|**|");
			if(mainarraylist[1]=="expire_bid_time")
			Extend_timer[pro_id] = parseInt(mainarraylist[0]);	
			
			}
}	

function Expire_extend_bid(pro_id) {
  			
  var doc=null;
	 	 if (window.XMLHttpRequest) {
        try {
            doc = new XMLHttpRequest();
        } catch(e)  {}
    } else if (window.ActiveXObject) {
        try {
            doc = new ActiveXObject('Msxml2.XMLHTTP');
        } catch(e)  {
          try {
              doc = new ActiveXObject('Microsoft.XMLHTTP');
          } catch(e)  {}
        }
    }
	
	  
	   doc.open('GET', "./location.php?section=expire_extend&pro_id="+pro_id, true);
        doc.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');        
       doc.onreadystatechange = function()
	   	{ 
	
	 	  if (doc.readyState == 4)
		  	{
				
	           if (doc.status == 200)
				{  
				
				var arraylist=doc.responseText.split("**");
				var pro_id =(parseInt(arraylist[1]));
				var Status=trim(arraylist[0]);

				if(Status=="S")
					{
					Extend_status[pro_id]='Y';
					document.getElementById('counter_index_div_'+pro_id).innerHTML = "<font color='red'><b>END</b></font>" ;
		
				if(pro_id==Product_id)				
					document.getElementById('bid_btn_'+pro_id).innerHTML = "<div style='padding-top:6px;'><font color='white'><b>SOLD</b></font></div>";
				else
					document.getElementById('bid_btn_'+pro_id).innerHTML = "<div style='padding-top:6px;'><font color='white'><b>SOLD</b></font></div>";

					if(pro_id==Product_id)	
						Congratulation_auction(pro_id); 
					}
				else
					{
					Extend_status[pro_id]='E';		
					Extend_timer[pro_id] = (parseInt(arraylist[2]));	
					}
				}
			}
		}
			doc.send(null);
}	

function trim(str, chars) {
return ltrim(rtrim(str, chars), chars);
}

function ltrim(str, chars) {
chars = chars || "\\s";
return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}

function rtrim(str, chars) {
chars = chars || "\\s";
return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}


function Start_auction() {
    ajax();
		// Load the result from the response page
		// ** As far a I know firefox will only load a document on the SAME domain!!	
	    if (doc){
	       doc.open("GET", "./location1.php?section=start_auction", false);
		   	doc.send(null);
			}
}


function add_to_watchlist(item_id){

	ajax();
		// Load the result from the response page
		// ** As far a I know firefox will only load a document on the SAME domain!!	
	    if (doc){
	       doc.open("GET", "./location1.php?section=add_to_watchlist&item_id=" + item_id, false);
		   	doc.send(null);
			
			if(doc.responseText==1)
				alert("This product to be add in your watchlist successfully.");
			else if(doc.responseText==2)
				alert("This product has been watched.");
			}
}
	
	

	
	function calc_counter_from_time(diff) 
{

  if (diff > 0) {
	days=Math.floor(diff / (3600*24));
		  
    hours1=Math.floor((diff / 3600)-(days*24));
	  hours=Math.floor((diff / 3600));			
    minutes=Math.floor((diff / 3600 - hours1 -(days*24)) * 60);
	
    seconds=Math.round((((diff / 3600 - hours1-(days*24)) * 60) - minutes) * 60);
  } else {
	days=0;
    hours = 0;
    minutes = 0;
    seconds = 0;
  }

  if (seconds == 60) {
    seconds = 0;
  }

  if (minutes < 10) {
    if (minutes < 0) {
      minutes = 0;
    }
    minutes = '0' + minutes;
  }
  if (seconds < 10) {
    if (seconds < 0) {
      seconds = 0;
    }
    seconds = '0' + seconds;
  }
  if (hours < 10) {
    if (hours < 0) {
      hours = 0;
    }
    hours = '0' + hours;
  }
  

  return days + "d :"+ hours1 + "h :" + minutes + "m :" + seconds + "s";
 }


function calc_counter_from_time_short(diff) {

  if (diff > 0) {
    hours=Math.floor(diff / 3600)

    minutes=Math.floor((diff / 3600 - hours) * 60)

    seconds=Math.round((((diff / 3600 - hours) * 60) - minutes) * 60)
  } else {
    hours = 0;
    minutes = 0;
    seconds = 0;
  }

  if (seconds == 60) {
    seconds = 0;
  }

  if (minutes < 10) {
    if (minutes < 0) {
      minutes = 0;
    }
    minutes = '0' + minutes;
  }
  if (seconds < 10) {
    if (seconds < 0) {
      seconds = 0;
    }
    seconds = '0' + seconds;
  }
  if (hours < 10) {
    if (hours < 0) {
      hours = 0;
    }
    hours = '0' + hours;
  }

  return minutes + " : " + seconds;
}

function Add_robot_bid(pro_id) {

		ajax();
	    if (doc){
	       doc.open("GET", "./location.php?section=add_robot_bid&pro_id="+pro_id, false);
 			doc.send(null);
			}
		}



function Add_bid(pro_id) {
    	
		
		
		ajax();
	    if (doc){
	       doc.open("GET", "./location.php?section=add_bid&pro_id="+pro_id, false);
 			doc.send(null);
			if(parseInt(doc.responseText)==99999)
				document.location="login.html";
			else
				{
				var mainarraylist=doc.responseText.split("**");
				if(mainarraylist.length>3)
					{
					Old_Bidcounter[pro_id]=mainarraylist[3];	
															
					Update_Auction_Detail(pro_id);
							
					if(Product_id!=0)
						Update_bid_table();
					
					setTimeout('document.getElementById("price_index_div_'+pro_id+'").style.backgroundColor = "#88c136"', 10);
					setTimeout('document.getElementById("price_index_div_'+pro_id+'").style.backgroundColor = "#88c136"', 70);
					setTimeout('document.getElementById("price_index_div_'+pro_id+'").style.backgroundColor = "#88c136"', 130);	
					setTimeout('document.getElementById("price_index_div_'+pro_id+'").style.backgroundColor = "#88c136"', 200);
					setTimeout('document.getElementById("price_index_div_'+pro_id+'").style.backgroundColor = "#88c136"', 270);
					setTimeout('document.getElementById("price_index_div_'+pro_id+'").style.backgroundColor = "#88c136"', 330);
					setTimeout('document.getElementById("price_index_div_'+pro_id+'").style.backgroundColor = "#88c136"', 400);
					setTimeout('document.getElementById("price_index_div_'+pro_id+'").style.backgroundColor = "#88c136"', 470);
					setTimeout('document.getElementById("price_index_div_'+pro_id+'").style.backgroundColor = ""', 530);	
					
					document.getElementById('div_blance').innerHTML = mainarraylist[1];
					}
				else
					{
					if(mainarraylist[1]=="ADDBID")	
						alert(trim(mainarraylist[0]));
					}
				}
			}
		}

function showdisplay(item_id){

	ajax();
		// Load the result from the response page
		// ** As far a I know firefox will only load a document on the SAME domain!!	
	    if (doc){
	       doc.open("GET", "./location1.php?section=show_detail&item_id=" + item_id, false);
		   	doc.send(null);
			//alert(doc.responseText);
			document.getElementById('auction_detail_'+parseInt(item_id)).innerHTML = doc.responseText;
					
			}
}

function hidedisplay(item_id){

document.getElementById('auction_detail_'+parseInt(item_id)).innerHTML = '';

}


function hidedisplay_auctiontype(div_id){
  el = document.getElementById(div_id);

  if (div_id == 'help_AUCTIONS_FLAG_1_CENT')
  {
    if (document.getElementById('help_AUCTIONS_FLAG_CLICK_ONLY'))
  {
    document.getElementById('help_AUCTIONS_FLAG_CLICK_ONLY').style.display = "none";
  }
  if (document.getElementById('help_AUCTIONS_FLAG_INTERNATIONAL'))
  {
    document.getElementById('help_AUCTIONS_FLAG_INTERNATIONAL').style.display = "none";
  }
  }
  if (div_id == 'help_AUCTIONS_FLAG_CLICK_ONLY')
  {
    if (document.getElementById('help_AUCTIONS_FLAG_1_CENT'))
  {
    document.getElementById('help_AUCTIONS_FLAG_1_CENT').style.display = "none";
  }
  if (document.getElementById('help_AUCTIONS_FLAG_INTERNATIONAL'))
  {
    document.getElementById('help_AUCTIONS_FLAG_INTERNATIONAL').style.display = "none";
  }
  }
  if (div_id == 'help_AUCTIONS_FLAG_INTERNATIONAL')
  {
    if (document.getElementById('help_AUCTIONS_FLAG_CLICK_ONLY'))
  {
    document.getElementById('help_AUCTIONS_FLAG_CLICK_ONLY').style.display = "none";
  }
  if (document.getElementById('help_AUCTIONS_FLAG_1_CENT'))
  {
    document.getElementById('help_AUCTIONS_FLAG_1_CENT').style.display = "none";
  }
  }

  if (el) {
    if (el.style.display == "none") {
      el.style.display = "";

    } else {
      el.style.display = "none";
    }
  }
}

function Congratulation_auction(item_id)
{
	ajax();
		// Load the result from the response page
		// ** As far a I know firefox will only load a document on the SAME domain!!	
	    if (doc){
	       doc.open("GET", "./location.php?section=congratulation_auction&item_id="+item_id, false);
 			doc.send(null);
            var mainarraylist=doc.responseText.split("|**|");
			if(mainarraylist[1]=="congraulation")
			document.getElementById('congratulation_auction_div_'+parseInt(item_id)).innerHTML = mainarraylist[0];
		}
	
}

function showzoomdisplay(item_id){

	ajax();
		// Load the result from the response page
		// ** As far a I know firefox will only load a document on the SAME domain!!	
	    if (doc){
	       doc.open("GET", "./location1.php?section=showzoomdisplay&item_id=" + item_id, false);
		   	doc.send(null);
			//alert(doc.responseText);
			document.getElementById('zoom_img_'+parseInt(item_id)).innerHTML = doc.responseText;
					
			}
}


function Update_credits() {
    ajax();
	  if (doc){
	       doc.open("GET", "./timer_location.php?section=update_credits", false);
 			doc.send(null);
			var mainarraylist=doc.responseText.split("|**|");
		   if(mainarraylist[1]=="update_balance")
		     document.getElementById('div_blance').innerHTML = mainarraylist[0];
			  
		  }
		setTimeout('Update_credits();',15000); 
	}



function hidezoomdisplay(item_id){

document.getElementById('zoom_img_'+parseInt(item_id)).innerHTML = '';

}

function Show_product_details(URL)
	{
	document.location=URL;
	}
