
function menuover(e) {
	e.className = "menucellover";
}

function menuout(e) {
	e.className = "menucell";
	menuShowSelected();
}

function menuclick(e) {
	var obj = e.getElementsByTagName("a");
	
	document.location = obj[0].href;
}

function menuShowSelected() {
	var myURL = document.URL;
	myURL = myURL.replace(/^http.*rivan\.net/i,"");
	
	if ((myURL.indexOf("/index.html") == 0) || (myURL == "/")) {
		document.getElementById("navbtn-home").className = "menucellsel";
	} else 	if (myURL.indexOf("/projects/") == 0) {
		document.getElementById("navbtn-proj").className = "menucellsel";
	} else 	if (myURL.indexOf("/humor/") == 0) {
		document.getElementById("navbtn-humr").className = "menucellsel";
	} else 	if (myURL.indexOf("/beer/") == 0) {
		document.getElementById("navbtn-beer").className = "menucellsel";
	} else 	if (myURL.indexOf("/tivo/") == 0) {
		document.getElementById("navbtn-tivo").className = "menucellsel";
	} else 	if (myURL.indexOf("/misc/") == 0) {
		document.getElementById("navbtn-ppri").className = "menucellsel";
	} else 	if (myURL.indexOf("/downloads/") == 0) {
		document.getElementById("navbtn-dlds").className = "menucellsel";
	} else 	if (myURL.indexOf("/utils/search.html") == 0) {
		document.getElementById("navbtn-srch").className = "menucellsel";
	}

}

function setContentBackground() {
	var myURL = document.URL;
	myURL = myURL.replace(/^http.*rivan\.net/i,"");
	
	if (myURL.indexOf("/tivo/") == 0) {	
		document.getElementById("tdcontent").style.backgroundImage = "url('http://www.rivan.net/images/tivo/svr2000_bg.jpg')";
	} else if (myURL.indexOf("/misc/winternyet/") == 0) {
		document.getElementById("tdcontent").style.backgroundImage = "none";
	} else {
		document.getElementById("tdcontent").style.backgroundImage = "url('http://www.rivan.net/images/cow_bg2.jpg')";
	}
}

function hideValidXhtml() {
	alert(1)
	var myURL = document.URL;
	
	for (obj in document.doctype.entities) {
		alert(obj.nodeName);
	} 
	
	if (myURL) {
		
		myURL = myURL.replace(/^http.*rivan\.net/i,"");
		
		if (myDocType) {
			if (myDocType.indexOf("DTD XHTML 1.0") >= 0) {
				document.getElementById('valXHTML10').style.display = 'inline';
			} else if (myDocType.indexOf("DTD XHTML 1.1") >= 0) {
				document.getElementById('valXHTML11').style.display = 'inline';
			}
		}
	}
}


function feedbackValidate(theForm) {
	var missingData = "";
	var emailFilter=/^.+@.+\..{2,3}$/;
	
	if (theForm.name.value == "") {
		missingData += "    - Your Name\n";	
		theForm.name.className = "formerror";
	}
	
	if (theForm.email.value == "") {
		missingData += "    - Your Email Address\n";	
		theForm.email.className = "formerror";
	} else 	if (!(emailFilter.test(theForm.email.value))) { 
		missingData += "    - A valid email address\n";	
		theForm.email.className = "formerror";
	}
 
	if (theForm.comments.value == "") {
		missingData += "    - Comments\n";	
		theForm.comments.className = "formerror";
	}

	if (missingData != "") {
		alert("Please complete the following field(s) before\nsubmitting the form:\n\n" + missingData);
		
		theForm.name.className = "forminput";
		theForm.email.className = "forminput";
		theForm.comments.className = "forminput";
		
		return false;
	} else {
		return true;
	}
}
