//------------------------------------------------------------------------------------------------
function setMenu(URL)
{
	toframe();
	if(parent.frames.length > 0)
	{
		if(parent.frames[0].name == 'Select')
		{
			parent.Select.setMenu(URL);
		}
		else if(parent.parent.Select)
		{
	//	alert(parent.parent.frames[0].name);
			parent.parent.Select.setMenu(URL);
		}
	}
	self.focus();
}
//------------------------------------------------------------------------------------------------
function toframe()
{
	if (this.location.href.indexOf(base+'index.php') == 0 ) return;
	if (parent.length > 1) return;
	if (!parent.name)
	{
		fname = this.location.href;
		//fname = fname.substr(0, fname.lastIndexOf('.'));
		if (fname.indexOf(base) >= 0) fname = fname.substr(base.length);
		if (fname.indexOf('/') == 0) fname = fname.substr(1);
//		alert(fname);alert(fname.indexOf('htmdocs'));return;
		if (fname.indexOf('htmdocs') >= 0)
		{
			fdir = fname.substr(0,fname.indexOf('htmdocs')+7);
			fname = fname.substr(fdir.length + 1);
			fdir = 'htmdocs';
			lang = fname.substr(0,fname.indexOf('/'));
			fname = fname.substr(lang.length+1);
//			alert(fname);alert(fname.indexOf('/'));return;
			if (fname.indexOf('/') > 0)
			{
				subdir = fname.substr(0,fname.indexOf('/'));
				fname = fname.substr(subdir.length+1);
				relocation = base+"index.php?fdir="+fdir+"&lang="+lang+"&subdir="+subdir+"&fname="+fname;
//			alert(subdir);alert(fname);return;
			}
			else
			{
//				alert(base+"index.html"); return;
				relocation = base+"index.php?fdir="+fdir+"&lang="+lang+"&fname="+fname;
			}
//			alert(relocation);return;
		}
		else
		{
			fdir = fname.substr(0,fname.indexOf('php')+3);
			fname = fname.substr(fdir.length + 1);
			alert(fname);alert(fname.indexOf('/'));return;
			relocation = base+"index.php?fname="+fname;
			//relocation = "../index.html";
		}
		top.location.href = relocation;
	}
}
//------------------------------------------------------------------------------------------------
function openPopUp(URL,LANG,WIN,WIDTH,HEIGHT,SB,ACTION)
{
	if (!SB) SB="yes";
	if (!HEIGHT) HEIGHT=400;
	if (!WIDTH) WIDTH=600;
	OPT="height="+HEIGHT+", width="+WIDTH+", scrollbars=no";

win_popup = window.open("about:blank", WIN, OPT);
win_popup.document.open("text/html");
win_popup.document.write("<html><head><title>" + gl_title + "</title></head>"
+ '<frameset rows="*,1,30" frameborder="0" framespacing="0" border="0" onload="' + ACTION + '">'
+ '<frame name="Content" src="' + URL + '" marginwidth="1" marginheight="1" scrolling="' + SB + '" frameborder="0">'
+ '<frame src="'+ base +'emptyborder.html" marginwidth="0" marginheight="1" scrolling="no" frameborder="0" noresize>'
+ '<frame src="'+ base +'htmdocs/'+ LANG +'/popup_close.html" marginwidth="0" marginheight="0" scrolling="no" frameborder="0" noresize>'
+ '</frameset><body></body></html>');
win_popup.document.close;

	win_popup.focus();
	return;


	popupURL = 'popup_frame.php?URL=' + URL + '&SB=' + SB;
	win_popup = window.open(popupURL, "Popup", OPT);
//	alert(URL);
	win_popup.frames[0].location.href=URL;
	win_popup.focus();
	return;
}
//------------------------------------------------------------------------------------------------
function NewWin(URL)
{
var width=screen.availWidth*0.9;
if(width > 750) width=750;
var height=screen.availHeight*0.9;
if(height > 750) height=750;
	if(height<screen.availHeight && width<screen.availWidth)
	{
		options="status=no,location=no,menubar=no,directories=no,scrollbars=no,height="+height+",width="+width;
	}else{
		options="status=no,location=no,menubar=no,directories=no,scrollbars=yes,height="+height+",width="+width;
	}
	window.open(URL,'Fensterl',options);
	return;
}

//------------------------------------------------------------------------------------------------
vis = new Array("hidden","visible");
function show(which,mod)
{
	itm = document.getElementById(which);
	itm.style.visibility = vis[mod];
	return;
}
//------------------------------------------------------------------------------------------------
function activate(btn)
{
	ShowButton(btn,1)
}

function deactivate(btn)
{
	ShowButton(btn,0)
}
function ShowButton(btn,evt)
{
	if(InitFlag)
	{
		if(evt==0)
		{
			for(i=0; i < bCount; i++)
			if (btn==ButtonNames[i])
			{
				if(ButtonStatus==i)
				{
					document.images[Buttons[i]].src=ButtonOn.src;
				}
				else
				{
					document.images[Buttons[i]].src=ButtonOff.src;
				}
			}
		}
		else
		{
			for(i=0;i<bCount;i++)
			if (btn==ButtonNames[i])
			{
				document.images[Buttons[i]].src=ButtonOn.src;
			}
		}
	}
}

function ChangeButton(btn)
{
	if(InitFlag)
	{
		for(i=0;i<bCount;i++)
		if(btn==ButtonNames[i])
		{
			document.images[Buttons[i]].src=ButtonOn.src;
			ButtonStatus=i;
		}else{
			document.images[Buttons[i]].src=ButtonOff.src;
		}
	}
}
//----------------------------------------------------------------------------------------------
function print_doc(doc)
{
	//doc.blur();
	//alert(doc.frames.length);
	doc.print();
	doc.focus();
}

//----------------------------------------------------------------------------------------------
