function manage_navigation()
{
	if(!document.getElementById("Navigation")) return false;
//	document.getElementById("Navigation").parentNode.onmouseout = clear_rollovers;
	var navigation_links = document.getElementById("Navigation").getElementsByTagName("li");
	for(var i = 0; i < navigation_links.length; i++)
	{
		if(navigation_links[i].getAttribute("class") != "Current") navigation_links[i].onmouseover = display_this;
	}
}
function clear_rollovers()
{
	var navigation_links = this.getElementsByTagName("li");
	for(var i = 0; i < navigation_links.length; i++)
	{
		if(navigation_links[i].getAttribute("class") == "jsHover") navigation_links[i].setAttribute("class", "");
	}
}
function display_this()
{
	var old = getElementsByClass("jsHover", this.parentNode, "li");
	if(old.length > 0) old[0].setAttribute("class", "");
	this.setAttribute("class", "jsHover");
}

/* -- Check Guestbook Form --*/

function check_form(guestbookAdd){
	var commSearch = /blog|porn|<a|www|http|viagra|sex|drug|loan|penis|sex|enlarge|online|casino|poker|rolex|dodge|car|cars|weight|phet|levit|pill|cheap|pharm|zune|strip|<|>|free|viagra|sex|drug|loan|penis|sex|enlarge|online|casino|poker|ringtone|rolex|dodge|car|weight|phet|levit|pill|cheap|google|cialispharm|.blogspot.com|zune|marketing|free|media|url4.net|.ru/;
	var string1 = document.guestbookAdd.comment.value;
	var matchPos1 = string1.search(commSearch);

	if(matchPos1 != -1){
		alert("Sorry, to cut down on spam, URLs or email address are not allowed in your comments!");
		document.guestbookAdd.comment.focus();
		return false;
	}

	var emailSearch = /blog|porn|<a|www|http|viagra|sex|drug|loan|penis|sex|enlarge|online|casino|poker|rolex|dodge|car|cars|weight|phet|levit|pill|cheap|pharm|zune|strip|<|>|free|viagra|sex|drug|loan|penis|sex|enlarge|online|casino|poker|ringtone|rolex|dodge|car|weight|phet|levit|pill|cheap|google|cialispharm|.blogspot.com|zune|marketing|free|media|url4.net|.ru|,/;
	var string1 = document.guestbookAdd.email_address.value;
	var matchPos1 = string1.search(emailSearch);

	if(matchPos1 != -1){
		alert("Sorry, to cut down on spam, URLs or email address are not allowed in your comments!");
		document.guestbookAdd.email_address.focus();
		return false;
	}

	if ( document.guestbookAdd.comment.value == "" || document.guestbookAdd.name.value == "") {
		alert("Please include both your name and a comment!");
		document.guestbookAdd.comment.focus();
		return false;
	}
}

/*##### Supporting Functions #####*/
function getElementsByClass(searchClass,node,tag)
{
	//Taken from http://www.dustindiaz.com/getelementsbyclass/
	var classElements = new Array();
	if ( node == null )
		node = document;
	if ( tag == null )
		tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
	for (i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].className) ) {
			classElements[j] = els[i];
			j++;
		}
	}
	return classElements;
}

function getPreviousSibling(n)
{
	//taken from http://www.w3schools.com/dom/prop_element_previoussibling.asp
	var x=n.previousSibling;
	while (x.nodeType!=1)
	{
		x=x.previousSibling;
	}
	return x;
}

function addLoadEvent(func)
{
	//Taken from Jeremy Keith's DOM Scripting.
	var oldonload = window.onload;
	if (typeof window.onload != 'function')
	{
		window.onload = func;
	}
	else
	{
		window.onload = function()
		{
			oldonload();
			func();
		}
	}
}

//addLoadEvent(manage_navigation);