imgPath = "../images/tpl_navigation/";
imgNaviInactive = imgPath+"navioben_inactive.png"; 
imgNaviInactiveLeft = imgPath+"navioben_inactiveleft.png"; 
imgNaviInactiveRight = imgPath+"navioben_inactiveright.png"; 
imgNaviActive = imgPath+"navioben_active.png"; 
imgNaviActiveLeft = imgPath+"navioben_activeleft.png"; 
imgNaviActiveRight = imgPath+"navioben_activeright.png"; 
imgNaviInactiveInactive = imgPath+"navioben_inactiveleft_inactiveright.png"; 
imgNaviInactiveActive = imgPath+"navioben_inactiveleft_activeright.png"; 
imgNaviActiveInactive = imgPath+"navioben_activeleft_inactiveright.png"; 
imgNaviActiveActive = imgPath+"navioben_activeleft_activeright.png"; 

inactiveColor = '#f4790c';
activeColor = '#ffffff';

function loadImages() {
	var location = window.location.pathname;
	var currentPath = location.substring(0, location.lastIndexOf("GDMcom_Internet/"));
	imgPath = currentPath+"GDMcom_Internet/images/tpl_navigation/";
	imgNaviInactive = imgPath+"navioben_inactive.png"; 
	imgNaviInactiveLeft = imgPath+"navioben_inactiveleft.png"; 
	imgNaviInactiveRight = imgPath+"navioben_inactiveright.png"; 
	imgNaviActive = imgPath+"navioben_active.png"; 
	imgNaviActiveLeft = imgPath+"navioben_activeleft.png"; 
	imgNaviActiveRight = imgPath+"navioben_activeright.png"; 
	imgNaviInactiveInactive = imgPath+"navioben_inactiveleft_inactiveright.png"; 
	imgNaviInactiveActive = imgPath+"navioben_inactiveleft_activeright.png"; 
	imgNaviActiveInactive = imgPath+"navioben_activeleft_inactiveright.png"; 
	imgNaviActiveActive = imgPath+"navioben_activeleft_activeright.png"; 
}

function isActive(id) {
	var classValue = document.getElementById(id).className;
	if (classValue.indexOf("highlight") > 0) {
		return true;
	} else {
		return false;
	}
}

function isFirst(id) {
	if (id.indexOf('_0')>0) {
		return true;
	} else {
		return false;
	}
}

function isLast(id) {
	var classValue = document.getElementById(id).className;
	if (classValue.indexOf("last") > 0) {
		return true;
	} else {
		return false;
	}
}

function doOnMouseOver(leftOfId, imgId, rightOfId) {
	if (document.getElementById && document.getElementById(imgId) && !isActive(imgId)) {
		// my own bg image
		document.getElementById(imgId).style.background = "url("+imgNaviActive+") repeat-x center center";

		// left trenner-segment
		if (isFirst(leftOfId)) {
			// first entry
			document.getElementById(leftOfId).style.background = "url("+imgNaviActiveLeft+") no-repeat center center";
		} else if (isActive(leftOfId)) {
			// previous is active
			document.getElementById(leftOfId).style.background = "url("+imgNaviActiveActive+") no-repeat center center";
		} else {
			// previous is inactive
			document.getElementById(leftOfId).style.background = "url("+imgNaviInactiveActive+") no-repeat center center";
		}
	
		// right trenner-segment
		if (isLast(rightOfId)) {
			// last entry
			document.getElementById(rightOfId).style.background = "url("+imgNaviActiveRight+") no-repeat center center";
		} else if (isActive(rightOfId)) {
			// next is active
			document.getElementById(rightOfId).style.background = "url("+imgNaviActiveActive+") no-repeat center center";
		} else {
			// next is inactive
			document.getElementById(rightOfId).style.background = "url("+imgNaviActiveInactive+") no-repeat center center";
		}


		/* todo set the color */
	}
}

function doOnMouseOut(leftOfId, imgId, rightOfId) {
	if (document.getElementById && document.getElementById(imgId) && !isActive(imgId)) {
		// my own bg image
		document.getElementById(imgId).style.background = "url("+imgNaviInactive+") repeat-x center center";

		// left trenner-segment
		if (isFirst(leftOfId)) {
			// first entry
			document.getElementById(leftOfId).style.background = "url("+imgNaviInactiveLeft+") no-repeat center center";
		} else if (isActive(leftOfId)) {
			// previous is active
			document.getElementById(leftOfId).style.background = "url("+imgNaviActiveInactive+") no-repeat center center";
		} else {
			// previous is inactive
			document.getElementById(leftOfId).style.background = "url("+imgNaviInactiveInactive+") no-repeat center center";
		}
	
		// right trenner-segment
		if (isLast(rightOfId)) {
			// last entry
			document.getElementById(rightOfId).style.background = "url("+imgNaviInactiveRight+") no-repeat center center";
		} else if (isActive(rightOfId)) {
			// next is active
			document.getElementById(rightOfId).style.background = "url("+imgNaviInactiveActive+") no-repeat center center";
		} else {
			// next is inactive
			document.getElementById(rightOfId).style.background = "url("+imgNaviInactiveInactive+") no-repeat center center";
		}


		/* todo set the color */
	}
}
