function joinLE () {
x = $('siteName').value
y = $('siteURL').value
req = new Request ({
	method:'post',
	url:'http://www.unlimitedserials.com/join.php',
	data: { siteName:x, siteURL:y },
	onComplete: function(response) { $('msg').innerHTML=response }
	}).send()
}

function sendMsg () {
x = $('name').value
y = $('subject').value
z = $('message').value
a = $('email').value

req = new Request ({
	method:'post',
	url:'http://www.unlimitedserials.com/contact.php',
	data: { name:x, email:a, subject:y, message:z },
	onComplete: function(response) {
			
			if (response == "msgsent") {
			$('sendButton').disabled=true
			$('sendButton').value="Message sent"
			$('msg').innerHTML="Your message has been sent, please allow 24 hours for a reply!"
			} else {
			$('msg').innerHTML=response
			}
		
		}
	}).send()
}

function checkSubject (subject) {
	
	switch (subject) {
		
		case "Link exchange":
		alert("Please place a link back to our site before requesting a link exchange")
		break;
		
		case "List my site":
		alert("Please please a link back to our site first on your homepage, also ensure you have either an XML feed or a sitemap otherwise you will not be listed. Please provide as much information as possible!")
		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	
}