
function SelectNavigation()
{
	try
	{
		ActualizeNavi(GetNavPos());
	}
	catch (x)
	{
	}
}

function ActualizeNavi(navpos)
{
	// get navi area
	var navi = document.getElementById('naviset');
	
	// get all div-tags in this area
	var divs = navi.getElementsByTagName("div");


	// loop throught all div-tags
	for (i = 0; i < divs.length; i++)
	{ 
		if (divs[i] != null)
		{
			// select register
			if (i == navpos)
				divs[i].className = 'navi_active';
		
			// de-select register (if selected)
			else if (divs[i].className == 'navi_active')
				divs[i].className = 'navi_inactive';
		}
	} 
}

function GetNavPos()
{
	// get url
	var url = window.top.location.pathname.toLowerCase();
	
	// get parameter list
	var qs = unescape(window.top.location.search.substring(1).toLowerCase());

	// home
	if (url.indexOf("home.aspx") > -1)
	{
		return 0;
	}
	// cars
	else if (url.indexOf("ride") > -1 || url.indexOf("hotcar") > -1)
	{	
		return 1;
	}
	// events
	else if (url.indexOf("event") > -1)
	{	
		return 2;
	}
	// forum
	else if (url.indexOf("forums.aspx") > -1)
	{	
		return 3;
	}
	// iframesite + iframesitefull
	else if (url.indexOf("iframesite") > -1)
	{
		// marktplatz (as24)
		if (qs.indexOf("www.autoscout24.ch") > -1)
			return 4;

		// atvsl
		else if (qs.indexOf("atvsl") > -1)
			return 6;

			
		// default: reportage
		return 5;
	}
	// contentsite
	else if (url.indexOf("contentsite") > -1)
	{
		// default: home
		return 0;
	}

	
	// default: hotcars
	return null;
	
}
