/**
 * used to show the correct navigation within the truck area
 */
 
//used to save the active parts of the navigation
var activeLi1 = "";
var activeDiv = "";
var activeLi2 = "";

//shows the navigation with the correct highlighting of the path
//to the current page
function findCorrectTruckNavi(){
	var curLocation = location;
	var aTags = document.getElementById("ms-navi-main").getElementsByTagName("a");
	var counter = 0;
	for (var i = 0; i < aTags.length; i++) {
		var currentLocation = location.href;
		var curHref = aTags[i].href;
		var cutOff = curHref.indexOf(".htm");
		var shortHref = curHref.substring(0, cutOff); 
		if(currentLocation.indexOf(shortHref) > -1 && shortHref.length > 10){
			if(counter < 1){
				setClass(aTags[i], "ms-active");
				setClass(aTags[i].parentNode, "ms-active");
				aTags[i].parentNode.getElementsByTagName("div")[0].style.display = "block";
				activeLi1 = aTags[i].parentNode.getAttribute("id", 1);
				activeDiv = aTags[i].parentNode.getElementsByTagName("div")[0].getAttribute("id", 1)
				counter++;
			}
			else if(counter < 2){
				setClass(aTags[i], "ms-active");
				activeLi2 = i;
				counter++;
			}
		}
	}
}

function showCorrectTruckNavi(){
	if(activeLi1.length > 1){
		setClass(document.getElementById(activeLi1), "ms-active");
		setClass(document.getElementById(activeLi1).getElementsByTagName("a")[0], "ms-active");	
		if(activeDiv.length > 1){
			document.getElementById(activeDiv).style.display = "block";
			if(activeLi2.length > 0){
				setClass(document.getElementById("ms-navi-main").getElementsByTagName("a")[activeLi2], "ms-active");
			}
		}
	}
}

