
	/*----- Adding our search engine to browser's search engine list ---- */


function addOpenSearch(name,ext,cat,pid,meth)
{
  if ((typeof window.external == "object") && ((typeof window.external.AddSearchProvider == "unknown") || (typeof window.external.AddSearchProvider == "function"))) 
  {
    // See bugs 430058/430067/430070 for Camino
    if (((typeof window.external.AddSearchProvider == "unknown") || (window.navigator.vendor == 'Camino'))&& meth == "p") {
      alert("This plugin uses POST which is not currently supported by your browser's implementation of OpenSearch.");
    } else {
      window.external.AddSearchProvider(
        "http://tgpit.com/search_tgpit.xml");
    }
  } else {
    alert("You will need a browser which supports OpenSearch to install this plugin.");
  }
}

function stripspaces(input)
{
    input.value = input.value.replace(/\s/gi,"");
    return true;
}

function SearchBoxFix(inputId,imageClass){
  var str="Search BlogCatalog";
  var input=document.getElementById(inputId);
  input.value=str;
  input.onfocus=function(){input.value="";input.style.color="#000";}
} 

function print_search_ads(Query)
	{
		var tr1 =document.getElementById('r_table').insertRow(1);
		tr1.setAttribute("class", "ads_tr");
		var td1 = tr1.insertCell(0);
		var td2 = tr1.insertCell(1);
		
		var td3 = tr1.insertCell(2);
		td3.setAttribute("colspan", "3");
		

		
		td1.innerHTML='<a target="_blank" href="/out.php?q='+Query+'" rel="nofollow"><strong><span class="hightlight_download"> </span>'+Query+' [Full Download] from fileshare</strong></a>';
		td2.innerHTML="fileshare";
		
		td3.innerHTML="<strong>at&nbsp;1848&nbsp;Kb/s</strong>";
		

	}
	
function print_download_ads(Query)
{

 // create an empty element node
 // without an ID, any attributes, or any content
 var speed_block = document.createElement("div");

 // give it an id attribute called 'newSpan'
 speed_block.setAttribute("id", "download_ads");

 

 var div2 = document.getElementById("download_desc");
 var parentDiv = div2.parentNode;

 // insert the new element into the DOM before sp2
 parentDiv.insertBefore(speed_block, div2);


	document.getElementById('download_ads').innerHTML = '<a rel="nofollow" target="_blank"  href="/out.php?q='+Query+'">http://nowdownloadall.com/download/'+Query+'[Full Download]</a> ';	
	

}


$(function(){
$("a.vote_up").click(function(){
 //get the id
 the_id = $(this).attr('id');
 // show the spinner
 $(this).parent().html("<img src='images/spinner.gif'/>");
 
 //fadeout the vote-count 
 $("div#votes_count"+the_id).fadeOut("fast");
 
 //the main ajax request
  $.ajax({
   type: "POST",
   data: "action=vote_up&id="+$(this).attr("id"),
   url: "/votes.php",
   success: function(msg)
   {
    // alert(msg);
    $("div#votes_count"+the_id).html(msg);
    //fadein the vote count
    $("div#votes_count"+the_id).fadeIn();
    //remove the spinner
    $("div#vote_buttons"+the_id).remove();
   }
  });
 });
});


$(function(){
$("a.vote_down").click(function(){
 //get the id
 the_id = $(this).attr('id');
 // show the spinner
 $(this).parent().html("<img src='images/spinner.gif'/>");
 
 //the main ajax request
  $.ajax({
   type: "POST",
   data: "action=vote_down&id="+$(this).attr("id"),
   url: "/votes.php",
   success: function(msg)
   {
    $("div#votes_count"+the_id).fadeOut();
    $("div#votes_count"+the_id).html(msg);
    $("div#votes_count"+the_id).fadeIn();
    $("div#vote_buttons"+the_id).remove();
   }
  });
 });
});

