var base="file://D:/Daten/WWW/dehoga-kiel/toleranz/";
if(location.href.substr(0,4) == 'http') base="http://www.dehoga-kiel.de/toleranz/";

//---------------------------------------------------------------------------------------------- 
function setMenu(url)
{
	toframe();
	parent.Select.ChangeButton(url);
}
//---------------------------------------------------------------------------------------------- 
function toframe()
{
	if (self.document == parent.document)
	{
		parent.location.href = "index.html";
	}
}
//---------------------------------------------------------------------------------------------- 
win_popup = new Array();
popup_counter = 0;
function openPopUp(URL,TITLE,WIDTH,HEIGHT,SB)
{
	if(win_popup[TITLE])
	{
		if(!win_popup[TITLE].closed)
		{
			win_popup[TITLE].focus();
			return;
		}
		win_popup[TITLE].close();
		popup_counter--;
	}
	popup_counter++;
	if (!SB) SB="yes";
	if (!HEIGHT) HEIGHT=400;
	if (!WIDTH) WIDTH=600;
	OPT="height="+HEIGHT+", width="+WIDTH+", scrollbars="+SB;
	win_popup[TITLE] = window.open("about:blank", TITLE, OPT);
	win_popup[TITLE].document.open("text/html");
	win_popup[TITLE].document.write("<html><head><title>Verein Kieler Köche</title></head>"
	+ '<frameset name="'+ TITLE +'" rows="*,1,30" frameborder="0" framespacing="0" border="0">'
	+ '<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 +'popup_close.html" marginwidth="0" marginheight="0" scrolling="no" frameborder="0" noresize>'
	+ '</frameset><body></body></html>');
	win_popup[TITLE].document.close();
	win_popup[TITLE].moveTo(popup_counter * 20, popup_counter * 10);
	win_popup[TITLE].focus();
}
//---------------------------------------------------------------------------------------------- 
var winopen = false;
function NewWin(URL, NAME, h, w, scrl)
{
	if(winopen) win.close();
	if(h>screen.availHeight && w>screen.availWidth) scrl = 'yes';
	options="status=no,location=no,menubar=no,directories=no,scrollbars="+scrl+",height="+h+",width="+w;
	win = window.open(URL,NAME,options);
	winopen = true;
//	alert(win.name);
//	return;
}

//---------------------------------------------------------------------------------------------- 
function printout()
{
	show("Printbutton",0);
	show("Closebutton",0);
	self.print();
	show("Printbutton",1);
	show("Closebutton",1);
	return;
}

//---------------------------------------------------------------------------------------------- 
vis = new Array("hidden","visible");
function show(which,mod)
{
	if (document.all)
	{
	eval("document.all."+which+".style.visibility='"+vis[mod]+"'");
	}else{
	eval("document."+which+".visibility='"+vis[mod]+"'");
	}
return;
}
//---------------------------------------------------------------------------------------------- 
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();
	}
}
//---------------------------------------------------------------------------------------------- 

