function onclickbuttons(e) {
	var sourceelement = e.target;
	if (!sourceelement) {
		sourceelement = window.event.srcElement;
	}
	var htmllink = stripwhitespace(sourceelement.innerHTML.toLowerCase()) + ".html";
	var match = parent.contentframe.location.href.match(/.*\/(.*\.html)/);
	if (match && match[1] == htmllink) {
		return;
	}
	var row = sourceelement.parentNode;
	UnSelectAll();
	
	sourceelement.style.backgroundColor = '#477E45';
	sourceelement.style.borderBottom = 'none';
	sourceelement.selected = 1;
	sourceelement.className = 'homebar selected';
	
	parent.contentframe.location.href = htmllink;
}

function mousebuttons(e) {
	var sourceelement = e.target;
	var eventtype = e.type;
	if (!sourceelement) {
		sourceelement = window.event.srcElement;
		eventtype = window.event.type;
	}

	if ((sourceelement.className == 'homebar selected') || sourceelement.tagName != 'TD') {
		return;
	}

	if (eventtype == 'mouseover') {
		sourceelement.style.backgroundColor = '#006400';
	}
	else if (eventtype == 'mouseout') {
		sourceelement.style.backgroundColor = '#477E45';
	}
}

function stripwhitespace(str) {
	var newstring = "";
  	if (str.indexOf(' ') != -1) {
    	var string = str.split(' ');
    	for (var i=0; i < string.length; i++) {
      		newstring += string[i];
    	}
    	return newstring;
  	} 
	else { 
		return str; 
	}
}

function UnSelectAll() {
	var navbar = parent.document.getElementById("navbarrow");
	
	for (i = 0; i < navbar.childNodes.length; i++) {
		if (navbar.childNodes[i].tagName == 'TD') {
			navbar.childNodes[i].style.borderBottom = '1px solid';
			navbar.childNodes[i].className = 'homebar';
		}
	}
}
