function checkLinks (ids) {

expx = ids.split(",")

	if (expx.length>20) {
	x = confirm("Do you really want to check over 20 links? this may take some time...")
	} else {
	x = true
	}
	
	if (x) {
	tt = expx.length-1
	k = 0
	
		for(i=0;i<=tt;i++) {
		idd = expx[i]
			if (idd) {
			htmlId = "linkz"+idd+""
			$(htmlId).innerHTML = 'Please Wait...'
			lol = new Ajax.Updater("linkz"+idd+"", '/check.php', { method: 'post', parameters: { id: idd } });
			}
		
		
		}
		
	}

}

function checkDead (key,qstr) {
var http = false;

	if(navigator.appName == "Microsoft Internet Explorer") {
	http = new ActiveXObject("Microsoft.XMLHTTP");
	} else {
	http = new XMLHttpRequest();
	}

var url = "/check.php";
var params = "checkDead=1&key="+key+"";
http.open("POST", url, true);

http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http.setRequestHeader("Content-length", params.length);
http.setRequestHeader("Connection", "close");

http.onreadystatechange=function() {
		
		if(http.readyState == 4) {
			
			if (http.responseText == "true") {
			x = confirm("This download appears to be dead, return to search results for more downloads?")
				
				if (x) window.top.location='http://www.pirateaccess.com/search/'+qstr+''
				
			}
			
		}
		
}

http.send(params);
}

function rate (op,id) {
var http = false;

	if(navigator.appName == "Microsoft Internet Explorer") {
	http = new ActiveXObject("Microsoft.XMLHTTP");
	} else {
	http = new XMLHttpRequest();
	}

var url = "/rate.php";
var params = "id="+id+"&op="+op+"";
http.open("POST", url, true);

http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http.setRequestHeader("Content-length", params.length);
http.setRequestHeader("Connection", "close");

http.onreadystatechange=function() {
		
		if(http.readyState == 4) {
		document.getElementById("actRating").innerHTML = http.responseText;
		document.getElementById("rbox").innerHTML = "<b>Thanks!</b>"
		}
		
}

http.send(params);
}

function rhover (op) {
x = document.getElementById('rhover')
	
	switch (op) {
		
		case "yes":
			x.innerHTML = "<b style=\"color:green;\">This download is good</b>"
			break;
			
		case "no":
		x.innerHTML = "<b style=\"color:red;\">This download is bad</b>"
			break;
			
		case "none":
			x.innerHTML = ""
			break;
			
	}

}

function searchUpdateOn () {
document.getElementById('suggestBox').style.visibility='visible'
}

function searchUpdateOff () {
document.getElementById('suggestBox').style.visibility='hidden'
document.getElementById('suggestBox').style.border='0'
}

function searchUpdate () {
q = document.getElementById('q').value
var curleft = curtop = 0;
	var obj = document.getElementById('q');
	if (obj.offsetParent)
	{
		do
		{
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
		}
		while (obj = obj.offsetParent);
		curtop = curtop + document.getElementById('q').offsetHeight;
		document.getElementById('suggestBox').style.top = curtop + 'px';
		document.getElementById('suggestBox').style.left = curleft + 'px';	
	}


	if (!q) {
	searchUpdateOff()
	} else {
	var http = new XMLHttpRequest();
	var url = "/searchUpdate.php?q="+q+"";
	http.open("GET", url, true);
	http.onreadystatechange = function() {
		if(http.readyState == 4 && http.status == 200) {
			
			if (!http.responseText) {
			searchUpdateOff()
			} else {
			searchUpdateOn()
			document.getElementById('suggestBox').innerHTML=http.responseText;
			}
			
		}
	
	}
	http.send(null);
}


}

function searchBoxFade () {
setTimeout("searchUpdateOff()",500)
}

function replaceQ (ss) {
document.getElementById('q').value=ss	
}


function showContact () {
document.getElementById('msg').style.display='block'	
}
