//------------------------------------------------------------------------------------------------
function setMenu(URL)
{
	toframe();
	if(!setMenuFrame(parent, URL))
	{
		setMenuFrame(parent.parent, 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('.'));
//		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(fdir);alert(fname);alert(fname.indexOf('/'));
			relocation = base+"index.php?fname="+encodeURIComponent(fname);
			//relocation = base+"index.php?fdir="+fdir+"&fname="+fname;
			//alert(relocation);return;
			//relocation = "../index.html";
		}
		top.location.href = relocation;
	}
}
//------------------------------------------------------------------------------------------------
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();
}

//---------------------------------------------------------------------------------------------- 
function ShowPicture(anc, PicTitle)
{
	pic=anc.childNodes[0].src;
	pic=pic.substr(0,pic.length-6) + '.jpg'; // Vorschau auf _s.jpg
	parent.Select.document.CacheImage.src = pic;
	//alert(document.CacheImage.height);
	htm = base+"image.html";
	h = 20;
	w = 400;
	var opts = "scrollbars=no,toolbar=no,status=no,menubar=no,location=no,rezisable=yes,width="+w+",height="+h;
	Imag = window.open(htm,"Img",opts);
	var x = (screen.availWidth - 800);
	var y = (screen.availHeight - 600);
	if(x < 0) x=0;
	if(y < 0) y=0;
	Imag.moveTo(x,y);
	return;
}
//---------------------------------------------------------------------------------------------- 
function loadImage()
{
	pic = document.ShowImage;
	pic.src = opener.parent.Select.document.CacheImage.src;
	setTimeout('resizeToImage()',60);
}
//---------------------------------------------------------------------------------------------- 
function resizeToImage()
{
	pic = document.ShowImage;
//	pic.style.visibility = "hidden";
	h = pic.height;
	w = pic.width;
	if(w < 100)
	{
		setTimeout('resizeToImage()',600);
	}
	else
	{
		pic.style.visibility = "visible";
		self.resizeTo(w,h);
		if(window.innerHeight)
		{
			nh = h;
			nw = w;
			if(self.innerHeight < h) nh = nh + 50;
			if(self.innerWidth < w) nw = nw + 30;
			self.resizeTo(nw,nh);
			self.innerHeight = h+5;
			self.innerWidth = w+5;
//		alert(self.innerHeight);
		}
		else
		{
			h += 30;
			w += 12;
			self.resizeTo(w,h);
		}
		var x = (screen.availWidth - w - 150) / 3;
		var y = (screen.availHeight - h - 30) / 3;
		if(x < 0) x=0;
		if(y < 0) y=0;
		self.moveTo(x,y);
		self.focus();
	}
}
//---------------------------------------------------------------------------------------------- 


