

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://avilib.com/search_avilib.xml");
    }
  } else {
    alert("You will need a browser which supports OpenSearch to install this plugin.");
  }
}


function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

function print_search_ads(Query)
	{
		/*if (readCookie("ads"))
		{*/
			
		
			 // 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", "speed_ads");
			
			
			 var div2 = document.getElementById("result_list");
			 var parentDiv = div2.parentNode;
			
			 // insert the new element into the DOM before sp2
			 parentDiv.insertBefore(speed_block, div2);
			
				document.getElementById('speed_ads').innerHTML = '<p><a href="/out.php?l=av_1&q='+Query+'" rel="nofollow"><strong>'+Query+'</strong>.full.rar </a> <span class="speed_value">472 Kb/s</span></p> <p><a href="/out.php?l=av_3&q='+Query+'" rel="nofollow"><strong>'+Query+'</strong> [HIGH SPEED] </a>  <span class="speed_value">1805 Kb/s</span></p>';

		/*}
		else
		{
			createCookie("ads",1,1);
		}*/

	
	}
	
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_item");
 var parentDiv = div2.parentNode;

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

	document.getElementById('download_ads').innerHTML = '<p><a href="/out.php?l=av_1&q='+Query+'" rel="nofollow">http://nowdownloadall.com/'+Query+'</strong>.rar </a> <span class="item_size">472 Kb/s</span></p> ';

	}