var last_id;
var last_link = "";

function reload_menue()
{
	menue_link(last_id,last_link)
}

function menue_link(id,link)
{
	HidePopup();
	last_id = id;
	last_link = link;	
	
	ajax_class.send_request('../dyn/cMenue.php',
			new Array(
					  ['showmenue', '1'],
					  ['sel', id],
					  ['firma',firma]
					 ),
			ajax_class.post_request,'menue_link_result');

	if(link != "")	
	{	
		var marke = "";
		var ar = link.split("#");
		link = ar[0];
		if(ar.length > 1)
			marke = ar[1];
		
		
		var ar2 = link.split("?");
		if(ar2[0].substr(ar2[0].length-4) == ".pdf")
		{
			window.open(ar2[0],"pdf","");
			return;
		}
		
		
		if(link.indexOf("?")>=0)
			link = link+"&firma="+firma+"&id="+id;
		else
			link = link+"?firma="+firma+"&id="+id;
		
		if(marke != "")
			link = link+"#"+marke;
				
		if(top.main)
			top.main.document.location.href = link;
		else if(top.frames[0].main)
			top.frames[0].main.document.location.href = link;
	}
	
	if(top.main)
		top.main.focus();
	else if(top.frames[0].main)
		top.frames[0].main.focus();
}

function menue_link_career(id,link)
{
	HidePopup();
	last_id = id;
	last_link = link;	
	
	ajax_class.send_request('../dyn/cMenue.php',
			new Array(
					  ['showmenuecareer', '1'],
					  ['sel', id],
					  ['firma',firma]
					 ),
			ajax_class.post_request,'menue_link_result');

	if(link != "")	
	{	
		var marke = "";
		var ar = link.split("#");
		link = ar[0];
		if(ar.length > 1)
			marke = ar[1];
		
		
		var ar2 = link.split("?");
		if(ar2[0].substr(ar2[0].length-4) == ".pdf")
		{
			window.open(ar2[0],"pdf","");
			return;
		}
		
		if(link.indexOf("?")>=0)
			link = link+"&firma="+firma+"&id="+id;
		else
			link = link+"?firma="+firma+"&id="+id;
		
		if(marke != "")
			link = link+"#"+marke;
				
		if(top.main)
			top.main.document.location.href = link;
		else if(top.frames[0].main)
			top.frames[0].main.document.location.href = link;
	}
	
	if(top.main)
		top.main.focus();
	else if(top.frames[0].main)
		top.frames[0].main.focus();
}

function menue_mark(id,link)
{
	HidePopup();
	last_id = id;
	last_link = link;
	
	ajax_class.send_request('../dyn/cMenue.php?firma='+firma,
			new Array(
					  ['showmenue', '1'],
					  ['sel', id]
					 ),
			ajax_class.post_request,'menue_link_result');
	
	if(top.main)
		top.main.focus();
	else if(top.frames[0].main)
		top.frames[0].main.focus();
}
	
function menue_link_result(http_object)
{
	if(http_object.responseText)
		document.getElementById("menuenav").innerHTML = http_object.responseText;	
}
	
function Filter(id)
{
	ajax_class.send_request('../dyn/set_session.php?firma='+firma,
			new Array(
						['var', 'combo_masch'],
						['val', id]
					 ),
			ajax_class.post_request,"FilterResult");
}
	
function FilterResult(http_object)
{
	HidePopup();
	menue_link(last_id,"");
}
	
function ShowPopup(parent)
{
	if(!document.getElementById("combo_maschgrp"))	return;
	var popup = document.getElementById("combo_maschgrp");
	var width = popup.style.width.replace(/px/,"");
	var right = Math.abs(xPos)+Math.abs(width);

	popup.style.left = (right > xClientWidth())?xPos-(right-xClientWidth()):xPos;
	popup.style.top = yPos+10;
	popup.style.display = "block";	
	window.setTimeout("HidePopup()", 10000);
}
	
function HidePopup()
{
	if(document.getElementById("combo_maschgrp"))
		document.getElementById("combo_maschgrp").style.display = "none";
}
