
// ------ ------ ------ ------ ------ ------ ------ ------ ------ ------ ------ ------ ------
// 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="";
var SESS_ID=0;

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 Add_autobid(pro_id) {

		ajax();
	    if (doc){
	       doc.open("GET", "./location.php?section=Add_autobid&pro_id="+pro_id, false);
 			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]==6)
					    	//Add_autobid(pro_id);
		if(Extend_timer[pro_id]<=Flashing_timer)
		{
		document.getElementById('counter_index_div_'+pro_id).innerHTML="<font color='ff0000'>"+calc_counter_from_time_short(Extend_timer[pro_id])+"</font>";
		}
		else
			document.getElementById('counter_index_div_'+pro_id).innerHTML = "<font color='#0069df'>" + 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 = "<a><b>PAUSED</b></a>";
						document.getElementById('counter_index_div_'+pro_id).innerHTML = "<a><b>Start On 9:00 AM</b></a>";
						}
					}
				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';
							setTimeout('Expire_extend_bid('+pro_id+')', 3000);
						}
					else if(Extend_status[pro_id]=="P")
						{
							document.getElementById('bid_btn_'+pro_id).innerHTML = "<a><div>PAUSED</div></a>";
							document.getElementById('counter_index_div_'+pro_id).innerHTML = "<a><b>Start On 9:00 AM</b></a>";
						}	
					}
					Extend_timer[pro_id]=(Extend_timer[pro_id]-1);	
			}
		}
		setTimeout('Run_timer();', 950); 
	
	}
function Run_timer_product()
{
	if(Extend_timer[Product_id]>0)
		{
			
		if(Extend_status[Product_id]=="E")
					{
					//if(Extend_timer[pro_id]==6)
					    	//Add_autobid(pro_id);
					if(Extend_timer[Product_id]<=Flashing_timer)
						{
			document.getElementById('flashing_index_div_'+Product_id).innerHTML = '<img src="images/'+Lang_path+'/blink.gif" boder="0">';
		document.getElementById('counter_index_div_'+Product_id).innerHTML="<font color='ff0000'>"+calc_counter_from_time_short(Extend_timer[Product_id])+"</font>";
					}
				else
				document.getElementById('counter_index_div_'+Product_id).innerHTML = "<font color='#560000'>" + calc_counter_from_time_short(Extend_timer[Product_id]) + "</font>";
					}
				else if(Extend_status[Product_id]=="N")
				document.getElementById('counter_index_div_'+Product_id).innerHTML = '' + calc_counter_from_time(Extend_timer[Product_id]);
				else if(Extend_status[Product_id]=="P")
						{
							document.getElementById('bid_btn_'+Product_id).innerHTML = "<a><div>PAUSED</div></a>";
							document.getElementById('counter_index_div_'+Product_id).innerHTML = "<b>Start On 9:00 AM</b>";
						}
					}
				else
					{
					if(Extend_status[Product_id]=="N")	
						{
						Extend_status[Product_id]='E';		
						Expire_home_bid(Product_id);
						}
					else if(Extend_status[Product_id]=='E')
						{
							Extend_status[Product_id]='S';
							setTimeout('Expire_extend_bid('+Product_id+')', 3000);
						}
					else if(Extend_status[Product_id]=="P")
						{
							document.getElementById('bid_btn_'+Product_id).innerHTML = "<a><div>PAUSED</div></a>";
							document.getElementById('counter_index_div_'+Product_id).innerHTML = "<b>Start On 9:00 AM</b>";
						
						}	
					}
					Extend_timer[Product_id]=(Extend_timer[Product_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();', 5000);  
     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&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 arraylist=doc.responseText.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[2]);		
				
				
		}}}}; 

	 
     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 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
		// alert(doc.responseText);
	       var mainarraylist=doc.responseText.split("|**|");
		   if(mainarraylist[2]=="BidHistory")
		   {
             document.getElementById('bid_table_div1').innerHTML = mainarraylist[0];			 
			
					var arraylist3=mainarraylist[1].split("*@*");
				
					if(SESS_ID!='0')
						document.getElementById("bid_from").value = arraylist3[6];						
					
					if(arraylist3[4]=="Y")
					{
						if(SESS_ID!='0')
							{
							document.getElementById('place_mybid_div_'+Product_id).innerHTML = arraylist3[2];
							document.getElementById('place_bid_div_'+Product_id).innerHTML = arraylist3[3];
							}
					}
										
					document.getElementById('price_index1_div_'+Product_id).innerHTML = arraylist3[0];
					document.getElementById('price_save_div_'+Product_id).innerHTML = arraylist3[1];
					
		   }
		}
	}

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); 
							Show_buy_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 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(document.getElementById('Watch_Auction').innerHTML+"\n");
			else if(doc.responseText==2)
			alert(document.getElementById('added_this_product').innerHTML+"\n");
			}
}
	
	

	
	function calc_counter_from_time(diff) 
{

  if (diff > 0) {
	  
	 
	days=Math.floor(diff / (3600*24));
		  
    hours=Math.floor((diff / 3600)-(days*24));
				
	//  hours=Math.floor((diff / 3600));
	
    minutes=Math.floor((diff / 3600 - hours -(days*24)) * 60);
	
    seconds=Math.round((((diff / 3600 - hours-(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;
  }
  
	if(days>0)
	 	return days + "d:" + hours + ":" + minutes + ":" + seconds;
	else
	 	return hours + ":" + minutes + ":" + seconds;
}


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){
			
			var Autiontimer=(Extend_timer[pro_id]+1);
	       doc.open("GET", "./location.php?section=add_bid&pro_id="+pro_id+"&extend_timer="+Autiontimer, 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 = "Balance ["+mainarraylist[1]+" Credits]";
					}
				else
					{
					if(mainarraylist[1]=="ADDBID")	
						alert(document.getElementById(trim(mainarraylist[0])).innerHTML);
					}
				}
			}
		
		}

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 Show_buy_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=show_buy_auction&item_id="+item_id, false);
 			doc.send(null);
            var mainarraylist=doc.responseText.split("|**|");
			//alert(doc.responseText);
			if(mainarraylist[1]=="buy_auction")
			document.getElementById('show_buy_auction_'+parseInt(item_id)).innerHTML = mainarraylist[0];
		}
		
			Update_Buy_Detail(item_id);
		setTimeout('Show_buy_auction('+item_id+');',5000);	
}

function Update_Buy_Detail(pro_id) {
    ajax();
	  if (doc){
	       doc.open("GET", "./location.php?section=buy_detail&pro_id=" + pro_id, false);
 			doc.send(null);
			var mainarraylist=doc.responseText.split("|**|");
	//	alert(doc.responseText);
			if(mainarraylist[1]=="show_buy_bid")
		     document.getElementById('bid_rebate_price_div_'+pro_id).innerHTML = mainarraylist[0];
		  }
	//	setTimeout('Update_Buy_Detail('+pro_id+');',15000); 
	}	

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 = "Balance ["+mainarraylist[0]+" Credits]";;
			  
		  }
		setTimeout('Update_credits();',15000); 
	}



function hidezoomdisplay(item_id){

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

}

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


function Clear_autobid(autobid_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=clear_autobid&autobid_id=" + autobid_id, false);
		   	doc.send(null);
			//alert(doc.responseText);
			document.getElementById('clear_book').innerHTML = doc.responseText;
			}
}

 /*function validation(frm)
	{

	var error=0;
	var message="";
if(frm.login.value=="" || frm.login.value=="Username  ")
    {		
				
       if(error==0)
	     frm.login.focus();
       message=message+"User name is required field.\n";
	   error=1;
	}
if(frm.pass.value=="" || frm.pass.value=="Password ")
    {		
       if(error==0)
	     frm.pass.focus();
       message=message+"Password is required field.\n";
	   error=1;
	}
if(message)
	  {	  
	    alert(message);
		return false;
	   }
	   else
	   {	document.loginform.submit();
			return true;
	   }
	}


function validation_search(frm)
	{
	var error=0;
	var message="";
	
	if(frm.search.value=="" || frm.search.value=="Search")
		{		
		  frm.search.focus();
		   message="Please enter Search keyword \n";
		}

	   if(message)
 	  {	  
	    alert(message);
		return false;
	   }
	   else
	   {	
	   		document.search_form.submit();
			return true;
	   }
	}*/
	
function Show_advert()
	{ 
		ajax();
	   if (doc){ 
	       doc.open("GET", "./location.php?section=show_advert", false);    
	       doc.send(null);
		  
		  var mainarraylist=doc.responseText.split("|**|");
		 
		   if(mainarraylist[1]=="show_advert")
		     document.getElementById('advert_div').innerHTML = mainarraylist[0];
			}
		
	}
