var Extend_timer = new Array(); 
var Extend_status = new Array();
var Old_Bidcounter = new Array();
var Auction_ids=0;
var Product_id=0;


 
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_penny.php?section=update_bid&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 arraylist1=arraylist[l].split("**");
						var pro_id =(parseInt(arraylist1[0]));
					
						if(Extend_status[pro_id]!=arraylist1[2])
							Update_status(pro_id);
		
						if(Old_Bidcounter[pro_id]!=parseInt(arraylist1[1]))
							{
								
							Old_Bidcounter[pro_id]=parseInt(arraylist1[1]);	
							
						
							Update_Auction_Detail(pro_id);
							Update_Auto_Bid();
							if(Product_id!=0)
								Update_bid_table();
								
							setTimeout('document.getElementById("price_index_div_'+pro_id+'").style.backgroundColor = "#ff0000"', 10);
							setTimeout('document.getElementById("price_index_div_'+pro_id+'").style.backgroundColor = "#fd1313"', 70);
							setTimeout('document.getElementById("price_index_div_'+pro_id+'").style.backgroundColor = "#fb2222"', 130);
							setTimeout('document.getElementById("price_index_div_'+pro_id+'").style.backgroundColor = "#fb3434"', 200);
							setTimeout('document.getElementById("price_index_div_'+pro_id+'").style.backgroundColor = "#fb4848"', 270);
							setTimeout('document.getElementById("price_index_div_'+pro_id+'").style.backgroundColor = "#fc5a5a"', 330);
							setTimeout('document.getElementById("price_index_div_'+pro_id+'").style.backgroundColor = "#fc7e7e"', 400);
							setTimeout('document.getElementById("price_index_div_'+pro_id+'").style.backgroundColor = "#fcacac"', 470);
							setTimeout('document.getElementById("price_index_div_'+pro_id+'").style.backgroundColor = ""', 530);	
							}
							
							
						}
					}
				}  
			}
	  };
		
	setTimeout('Update_Bid_Detail()', 2000); 
	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]=='N')	
						document.getElementById('counter_index_div_'+pro_id).innerHTML = '' + calc_counter_from_time(Extend_timer[pro_id]);
					else 
						document.getElementById('counter_index_div_'+pro_id).innerHTML = '-- : -- : --';
					}
				else
					{
						document.getElementById('counter_index_div_'+pro_id).innerHTML = '-- : -- : --';
					}
					Extend_timer[pro_id]=(Extend_timer[pro_id]-1);	
			}
		}
		setTimeout('Run_timer();', 900); 
}

function Run_timer1()
{
	
	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]=='N')	
						document.getElementById('counter_index_div_'+pro_id).innerHTML = '' + calc_counter_from_time1(Extend_timer[pro_id]);
					else 
						document.getElementById('counter_index_div_'+pro_id).innerHTML = '-- : -- : --';
					}
				else
					{
						document.getElementById('counter_index_div_'+pro_id).innerHTML = '-- : -- : --';
					}
					Extend_timer[pro_id]=(Extend_timer[pro_id]-1);	
			}
		}
		setTimeout('Run_timer1();', 900); 
}

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_penny.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_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_penny.php?section=update_status&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)
				{
				if(doc.responseText!=0)
					{
						var Main_array=doc.responseText.split("**");	
						document.getElementById('bid_btn_'+Pro_id).innerHTML = Main_array[0];	
						Extend_timer[Pro_id] = parseInt(Main_array[1]);	
						Extend_status[Pro_id]=Main_array[2];
					}
				}
			}
	    };
	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_penny.php?section=update_bid_deatils&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)
				{
				if(doc.responseText!=0)
					{
					var Main_array=doc.responseText.split("**");
					document.getElementById('price_index_div_'+Pro_id).innerHTML = Main_array[0];	
					document.getElementById('winner_index_div_'+Pro_id).innerHTML = Main_array[1];
					Extend_timer[Pro_id] = parseInt(Main_array[2]);	
					}
					}
				}  
	    };
		doc.send(null);
	}
	
	
	
	
//ami code

function Update_Auto_Bid()
{	
	
	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_penny.php?section=update_auto_bid&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)
				{
					
					document.getElementById('remain_index_div').innerHTML = doc.responseText;
					
					}
				}  
	    };
		doc.send(null);
		
		 
	}





function Update_Add_Bid1()
{	
	
	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_penny.php?section=update_add_bid1&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)
				{
					//alert(doc.responsetext);
					document.getElementById('place_index_div').innerHTML = doc.responseText;
					
					}
				}  
	    };
		doc.send(null);
	}




function Update_status1(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_penny.php?section=update_status1&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)
				{
				if(doc.responseText!=0)
					{
						var Main_array=doc.responseText.split("**");	
						document.getElementById('autobid_btn12_'+Pro_id).innerHTML = Main_array[0];	
						Extend_timer[Pro_id] = parseInt(Main_array[1]);	
						Extend_status[Pro_id]=Main_array[2];
					}
				}
			}
	    };
	doc.send(null);
}




function Update_status_prod(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_penny.php?section=update_status_prod&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)
				{
				if(doc.responseText!=0)
					{
						var Main_array=doc.responseText.split("**");	
						document.getElementById('prod_bid_btn_'+Pro_id).innerHTML = Main_array[0];	
						Extend_timer[Pro_id] = parseInt(Main_array[1]);	
						Extend_status[Pro_id]=Main_array[2];
					}
				}
			}
	    };
	doc.send(null);
}






function Expire_extend_bid1(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_penny.php?section=expire_extend1&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='green'><b>END</b></font>" ;
							
							document.getElementById('autobid_btn12_'+pro_id).innerHTML='<div ><a href="index.php?show=product_penny&id='+pro_id+'&close=Y" class="WhiteLinks3">SOLD!</a></div>';
							Update_bid_auction();
							} 
						else
							{
							Extend_status[pro_id]='E';		
							Extend_timer[pro_id] = (parseInt(arraylist[2]));	
							}
					}
				}
        };
        doc.send(null);
	}
	

function Update_bid_table(){
		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_penny.php?section=update_bid_table&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)
			   	{
					
					var mainarraylist=doc.responseText.split("|**|");
				   if(mainarraylist[1]=="BidHistory")
       			      document.getElementById('bid_table_div1').innerHTML = mainarraylist[0];
				}
			}
        };
	       doc.send(null);
	}	
	
function Update_bid_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", "./location_penny.php?section=update_auction", false); 
	       doc.send(null);
		
			}
		//setTimeout('Update_bid_auction();',10000);		
	}


function Expire_home_bid(pro_id) {
    ajax();
	    if (doc){
	       doc.open("GET", "./location_penny.php?section=expire_bid&pro_id=" + pro_id, false);
 			doc.send(null);
			Extend_timer[pro_id] = parseInt(doc.responseText);	
			}
}	

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_penny.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='green'><b>END</b></font>" ;
							
							document.getElementById('bid_btn_'+pro_id).innerHTML='<div ><a href="index.php?show=product_penny&id='+pro_id+'&close=Y" >SOLD!</a></div>';
							Update_bid_auction();
							} 
						else
							{
							Extend_status[pro_id]='E';		
							Extend_timer[pro_id] = (parseInt(arraylist[2]));	
							}
					}
				}
        };
        doc.send(null);
	}	

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", "./location_penny.php?section=start_auction", false);
 			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 calc_counter_from_time(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 hours + ":" + minutes + ":" + seconds;
}*/

function calc_counter_from_time(diff) 
{

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

function calc_counter_from_time1(diff) 
{

  if (diff > 0) {
	days=Math.floor(diff / (3600*24))
		  
    hours=Math.floor((diff / 3600)-(days*24))
				
    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 + "days," + hours + "h:" + minutes + "m:" + seconds + "s";
else
  return hours + "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_bid(pro_id) {
		
		
		ajax();
		
	    if (doc){
	       doc.open("GET", "./location_penny.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 = "#ff0000"', 10);
					setTimeout('document.getElementById("price_index_div_'+pro_id+'").style.backgroundColor = "#fd1313"', 70);
					setTimeout('document.getElementById("price_index_div_'+pro_id+'").style.backgroundColor = "#fb2222"', 130);
					setTimeout('document.getElementById("price_index_div_'+pro_id+'").style.backgroundColor = "#fb3434"', 200);
					setTimeout('document.getElementById("price_index_div_'+pro_id+'").style.backgroundColor = "#fb4848"', 270);
					setTimeout('document.getElementById("price_index_div_'+pro_id+'").style.backgroundColor = "#fc5a5a"', 330);
					setTimeout('document.getElementById("price_index_div_'+pro_id+'").style.backgroundColor = "#fc7e7e"', 400);
					setTimeout('document.getElementById("price_index_div_'+pro_id+'").style.backgroundColor = "#fcacac"', 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 Valid_category(category_sub)
	{
		
		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)  {}
	        }
  		}
		if(doc)
		{
			
			doc.open("GET", "./location_penny.php?section=sub_catvalue&category_sub="+category_sub, false);
			doc.send(null);
			//alert(doc.responseText);
			//return  doc.responseText;
			if(doc.responseText==1)
			{
				alert("There is no sub category");
				//location.href = "admin.php?show=view_bid&action=Add";
			}
			else
			{
			  document.getElementById('sub_headding').innerHTML = doc.responseText;
			}
		}
		
	}

function Valid_categoryadv(category_sub)
	{
		
		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)  {}
	        }
  		}
		if(doc)
		{
			if(category_sub==61){
				document.getElementById('catpage').value = 'autocat';
		    }
			doc.open("GET", "./location_penny.php?section=sub_catvalueadv&category_sub="+category_sub, false);
			doc.send(null);
			//alert(doc.responseText);
			//return  doc.responseText;
			if(doc.responseText==1)
			{
				alert("There is no sub category");
				//location.href = "admin.php?show=view_bid&action=Add";
			}
			else
			{
			  document.getElementById('sub_headdingadv').innerHTML = doc.responseText;
			}
		}
		
	}


function Valid_categorysearch(category_sub)
	{
		
		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)  {}
	        }
  		}
		if(doc)
		{
			
			doc.open("GET", "./location_penny.php?section=sub_catvaluesearch&category_sub="+category_sub, false);
			doc.send(null);
			//alert(doc.responseText);
			//return  doc.responseText;
			if(doc.responseText==1)
			{
				alert("There is no sub category");
				//location.href = "admin.php?show=view_bid&action=Add";
			}
			else
			{
			  document.getElementById('sub_headding_search').innerHTML = doc.responseText;
			}
		}
		
	}
