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
	
		for(i=0;i<=tt;i++) {
		idd = expx[i]
			if (idd) {
			htmlId = "linkz"+idd+""
			$(htmlId).innerHTML = '<i>Please wait...</i>'
			new Ajax.Updater("linkz"+idd+"", '/check.php', { method: 'post', parameters: { id: idd } });
			}
		
		
		}
	
	xx = "checkLinkBox"
	document.getElementById(xx).innerHTML = "<b>Links updating...</b>"
	}

}

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) {
		w = "rbox"
		x = document.getElementById(w).innerHTML = http.responseText;
		}
		
}

http.send(params);
}

function rhover (op) {
x = document.getElementById('rhover')
	
	switch (op) {
		
		case "yes":
			x.innerHTML = "<b style=\"color:green;\">Working</b>"
			break;
			
		case "no":
		x.innerHTML = "<b style=\"color:red;\">Not working</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	
}
