/**************************************************************************
 *                                                                        *
 *  JAVASCRIPT MENU HIGHLIGHTER v.1.5 (080929)                            *
 * --------------------------------------------                           *
 * ©2005 Media Division (www.MediaDivision.com)                           *
 *                                                                        *
 * Written by Marius Smarandoiu & Armand Niculescu                        *
 *                                                                        *
 * You are free to use, modify and distribute this file, but please keep  *
 * this header and credits                                                *
 *                                                                        *
 * Usage:                                                                 *
 * - the script will apply the .current class to the <a> and its parent   *
 *   <li> that is contained in the element with id="topnav" and points*
 *   to the current URL                                                   *
 * - works in IE6, Firefox and Opera                                      *
 **************************************************************************/
function extractPageName(hrefString)
{
	var arr = hrefString.split('/');
	return  (arr.length<2) ? hrefString : arr[arr.length-2].toLowerCase() + arr[arr.length-1].toLowerCase();               
}

function setActiveMenu(arr, crtPage)
{

/*var sPath = document.location.href;
alert(sPath.substring(sPath.lastIndexOf('/') + 1));
switch(document.location.href.substring(document.location.href.lastIndexOf('/') + 1))
{
	case "food.php":
			"http://test.augenblick-fotodesign.com/commercial.php".className = "current";
			"http://test.augenblick-fotodesign.com/commercial.php".parentNode.className = "current";
		break;
}

*/

		switch(document.location.href.substring(document.location.href.lastIndexOf('/') + 1))
		{
			case "food.php":
			case "product.php":
			case "portrait.php":
			case "design_com.php":
			case "project.php":
				var sPath = "commercial.php";
				break;
			case "familie.php":
			case "portrait_app.php":
			case "hochzeit.php":
			case "design.php":
			case "landfein.php":
			case "preise.php":
				var sPath = "privat.php";
				break;
		}

	for (var i=0; i<arr.length; i++)
	{
		if(extractPageName(arr[i].href) == crtPage || arr[i].href.substring(arr[i].href.lastIndexOf('/') + 1) == sPath)
		{
			if (arr[i].parentNode.tagName != "DIV")
			{
				arr[i].className = "current";
				arr[i].parentNode.className = "current";
			}
		}
	}
}

function setPageTop()
{
	hrefString = document.location.href ? document.location.href : document.location;

	if (document.getElementById("topnav")!=null)
		setActiveMenu(document.getElementById("topnav").getElementsByTagName("a"), extractPageName(hrefString));
}