$(document).ready(function()
{	

	$(".showDetails").css("display","block");
	$(".nojavascript").css("display","none");
	
	var pathname = window.location.toString();
	var found = pathname.indexOf("lng="); //returns the position of the language-string in the link
	var iPos; // number of language
	
	//$("#globalNav").css("margin-left", "-550px");
	
	iPos = 0;

	if (found != "-1")
		iPos = parseInt(pathname.substr(found + 4, 1));
	else
	{
		found = pathname.indexOf("lng/");
		
		if (found != "-1")
			iPos = parseInt(pathname.substr(found + 4, 1));
		else
			iPos = 0;
	}
	
	var countryName = new Array();
	
	countryName[0] = new Array(
		"Standorte",
		"Deutschland", 
		"UK", 
		"Benelux",
		"Skandinavien",
		"Frankreich",
		"Asien"
	);
	
	countryName[1] = new Array(
		"Locations",
		"Germany", 
		"UK",
		"Benelux",
		"Scandinavia",
		"France",
		"Asia"
	);

	countryName[2] = new Array(
		"Steder",
		"Tyskland", 
		"UK",
		"Benelux",
		"Scandinavia",
		"Frankrig",
		"Asien"
	);


	countryName[4] = new Array(
		"Emplacements",
		"Allemagne", 
		"UK",
		"Benelux",
		"Scandinavie",
		"France",
		"Asie"
	);
	
	countryName[3] = new Array(
		"Vestigingen",
		"Duitsland", 
		"UK",
		"Benelux",
		"Scandinavië",
		"Frankrijk",
		"Azië"
	);
	
	$("#wmd000257").css("padding","0px");	
	$("td#wmd000257.navi0").css("width", "115px");
	$("td#wmd000257.navi0").css("heigth", "50px");
	$("td#wmd000257.navi0").css("top", "0px");
	
	var lngBenelux = "1";
	
	if (iPos == "4" || iPos == "3")
		lngBenelux = iPos;
	
	$("#wmd000257").html('<div id="divListShow" style="position: relative; z-index: 11;">' +
		'<div id="ulListPos">' + 
		'<ul id="ulListShow">' +
			'<li>' +
				'<a href="#" class="navi0">' + countryName[iPos][0] + '</a>' +
				'<ul class="spNaviLevel2">' +
					'<li> <a href="/jsp/epctrl.jsp?lng=' + "0" + '&pri=wmd&cat=wmd000290" class="navi0 navrollover">' + countryName[iPos][1] + '</a> </li>' +
//					'<li> <a href="/jsp/epctrl.jsp?lng=' + iPos + '&pri=wmd&cat=wmd000209" class="navi0 navrollover">' + countryName[iPos][2] + '</a> </li>' +
					'<li> <a href="/jsp/epctrl.jsp?lng=' + lngBenelux + '&pri=wmd&cat=wmd000279" class="navi0 navrollover">' + countryName[iPos][3] + '</a> </li>' +
					'<li> <a href="/jsp/epctrl.jsp?lng=' + "2" + '&pri=wmd&cat=wmd000267" class="navi0 navrollover">' + countryName[iPos][4] + '</a> </li>' +
//					'<li> <a href="/jsp/epctrl.jsp?lng=' + iPos + '&pri=wmd&cat=wmd000209" class="navi0 navrollover">' + countryName[iPos][5] + '</a> </li>' +
					'<li class="lastcountry"> <a href="/jsp/epctrl.jsp?lng=' + "1" + '&pri=wmd&cat=wmd000320" class="navi0 navrollover">' + countryName[iPos][6] + '</a> </li>' +
				'</ul>' +
			'</li>' + 
		'</ul>' +
		'</div>'+
	'</div>');
	
	$("#ulListPos").css("width", "115px");
	$("#ulListPos").css("height", "50px");
	$("#ulListPos").css("position", "relative");
//	$("#ulListPos").css("top", "20px");
//	$("#ulListPos").css("left", "20px");
	
	$("#ulListPos ul li a").css("position", "relative");
//	$("#ulListPos ul li a").css("left", "-20px");
	$("#ulListPos ul li a").css("top", "23px");
	$("#ulListPos ul li").css("text-align", "center");
	$("#ulListPos ul li ul li").css("text-align", "left");
	
	$("#divListShow").css("width", "115px");
	$("#divListShow").css("height", "50px");
	$("#divListShow ul li > ul").css("display", "none");
	$("#divListShow ul li > ul").css("position", "absolute");
	
	$("#divListShow ul li > ul").css("top", "50px");
	$("#divListShow ul li ul > li").css("background-image", "url(/content/wmd/LaenderAuswahl_RollOver.jpg)");
	$("#divListShow ul li ul > li").css("background-repeat", "no-repeat");
	$("#divListShow ul li ul > li.lastcountry").css("background-image", "url(/content/wmd/LaenderAuswahl_RollOver_last.jpg)");
	
	$("#divListShow ul li ul > li").css("width", "156px");
	$("#divListShow ul li ul > li").css("height", "33px");
	$("#divListShow ul li ul > li").css("border", "0px"); 
	$("#divListShow ul li ul > li").css("border-style", "solid");
	$("#divListShow ul li ul > li").css("border-color", "#DFDEDA");
	$("#divListShow ul li ul > li").css("background-color", "#5d89bb");
	$("#divListShow ul li ul > li").css("border-collapse", "collapse");
	$("#divListShow ul li ul li > a").css("top", "6px");

	if (iPos == 0)
		$("#divListShow ul li ul li > a").css("left", "25px");
	else
		$("#divListShow ul li ul li > a").css("left", "25px");
	
	if (($.browser.msie))
	{
		if (iPos == 0)
			$("#divListShow ul li > ul").css("left", "0px");
		else
			$("#divListShow ul li > ul").css("left", "0px");

//		$("#divListShow ul li > ul").css("width", "220px");			
//		$("#divListShow ul li > ul").css("margin-top", "15px");
	}
	
	$("#wmd000257").mouseover(function()
	{
		$("#ulListShow li a:first").css("color", "#b2c8ff");
	});

	
	$("#wmd000257").hover(function()
	{
		$("#divListShow ul li > ul").stop(true, true).fadeIn();
		
		$("#ulListShow li a:first").css("color", "#b2c8ff");
	},
	function()
	{
		$("#divListShow ul li > ul").stop(true, true).fadeOut("slow");
		
		$("#ulListShow li a:first").css("color", "white");
	});
	
	
	
	$(".spNaviLevel2").hover(function()
	{
		$("#ulListShow li a:first").css("color", "#b2c8ff");
	},
	function()
	{
		$("#ulListShow li a:first").css("color", "white");
	});
	
	var str = $(".description").text();
	var des = jQuery.trim(str);

	if (des  == "")
	{
		$(".description").remove();
	}
	
	/* 
	For possible later usage
	var kundennetz = $("#wmd000055").css("visibility");
	
	if (kundennetz == "visible")
	{
		$("#wmd000055").css("display", "none");
		$("#costumernet").css("display", "inline");	
	}*/
	
/*	$(".topMenuLeft").html(' +
	'<img vspace="0" hspace="0" border="0" align="left" alt="" usemap="#topMenuLeft" src="/content/wmd/design/wmd000021/nav_links_landing.png">' +
	<map name="topMenuLeft"> 
	<area shape="rect" alt="" coords="15,20,34,34" href="<%L home_de_neu%>">
	<area shape="rect" alt="" coords="44,20,63,34" href="<%L home_en_neu%>">
	<area shape="rect" alt="" coords="73,20,92,34" href="<%L home_fr_neu%>">
	<area shape="rect" alt="" coords="102,20,121,34" href="<%L home_dk_neu%>">
	<area shape="rect" alt="" coords="131,20,150,34" href="<%L home_nl_neu%>">
		</map> 
	)
	*/
	
	/*
	$("div.navi:contains('Benutzername')").css("display", "none");
	$("select").css("visibility", "hidden");

	$('input[style="width: 160px;"]').css("display", "none");
	
	*/
	
	/*
	$("div.formlabel > b:contains('Sprache')").css("display", "none");
	$("select").css("visibility", "hidden"); */
});
