function processLinks() {
	
	if (!document.getElementsByTagName) return;	
	
	var loc = getFileNameByUrl(window.location.href);
	if (loc == "") loc = "index.htm";
	
	var anchors = document.getElementsByTagName("a");
	
	for (var i=0; i < anchors.length; i++) {
		
		var anchor = anchors[i];
		var href = getFileNameByUrl(anchor.getAttribute("href"));
		
		if (href && anchor.getAttribute("rel") == "external") {
			anchor.target = "_blank";
		}
		if (href == loc) {
			anchor.setAttribute("class", "active");
			anchor.setAttribute("className", "active");
		}		
		
	}
	
}

function getFileNameByUrl(url) {
	return url.substr(url.lastIndexOf("/")+1, url.length);
}


function initMain() {
	
	processLinks();
	
}