

function hmenu_select(){

	 // get absolute path name from url
	//var abspath = window.location.href.replace("http://"+window.location.hostname, "").replace(/^\//, "").toLowerCase();
	//if (abspath.indexOf("#") !=-1) abspath = abspath.split('#')[0]; 	//get rid of any bookmarks
var host = "http://"+window.location.hostname.toLowerCase();
var path = window.location.href.toLowerCase().replace(host, ""); // clean host from url
if (path.indexOf("#") !=-1) path = path.split('#')[0]; 	//clean any bookmarks
	
	// select tab link that must match path 
	var menuitems = document.getElementById("hmenu").getElementsByTagName("a");	
	for (var i=0; i<menuitems.length; i++) {
			if (menuitems[i].getAttribute('href').toLowerCase().replace(host, "") == path) {
			// style applied to <li>
			menuitems[i].parentNode.className += " selected";
			break;
		}	
	}		
}

function addEvent(obj, evType, fn){ 
	if (obj.addEventListener){ 
		obj.addEventListener(evType, fn, false); 
		return true; 
	} else if (obj.attachEvent){ 
		var r = obj.attachEvent("on"+evType, fn); 
		return r; 
	} else return false; 
}
addEvent(window, 'load', hmenu_select);

