


var doc = null;

var Extend_timer = 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 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)
				{
					document.getElementById('counter_index_div_'+pro_id).innerHTML = '' + calc_counter_from_time(Extend_timer[pro_id]);
				}
			else
				{
					Expire_home_bid(pro_id);
				}
				Extend_timer[pro_id]=(Extend_timer[pro_id]-1);	
			}
		}
		setTimeout('Run_timer();', 950); 
	
	}



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 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 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 hours + " : " + minutes + " : " + seconds;
}


function Add_bid(pro_id) {
    	
		alert("Sorry ! This Feature Not Allowed in Demo version! ");
		}

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 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 hidezoomdisplay(item_id){

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

}

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

