var imgPath = "images/";

function toframe(btn)
{
	if (this.document == top.document || parent.frames[0].name != 'Select')
	{
		top.location.href = "index.html";
	}else{
		setMenu(btn);
		self.focus();
	}
}

function NewWin(URL,NAME,h,w)
{
	if(h<screen.availHeight && w<screen.availWidth)
	{
		options="status=no,location=no,menubar=no,directories=no,scrollbars=no,height="+h+",width="+w;
	}else{
		options="status=no,location=no,menubar=no,directories=no,scrollbars=yes,height="+h+",width="+w;
	}
	window.open(URL,NAME,options);
}


function changeCell(cell)
{
	parent.Select.changeCell(cell);
}

function mClick(cell)
{
	parent.Select.mClick(cell);
}

function mOver(cell)
{
	parent.Select.mOver(cell);
}

function mOut(cell)
{
	parent.Select.mOut(cell);
}

function setMenu(mName)
{
		while(mName.indexOf("\\") > 0)
		{
			i = mName.indexOf("\\");
			mName = mName.substr(0,i) + '/' + mName.substr(i+1);
		}
	mName = mName.replace(/\\/, "/");
	action = "parent.Select.setMenu('" + mName + "')";
		//alert(action);
	setTimeout(action, 600);
}


var Imag=0;
var base;
var imgbase;

function ShowPicture(PicTitle,pic)
{
	base="../";
	imgbase="../images/";
	ShowPic (PicTitle, pic, base, imgbase);
}


function ShowPic(PicTitle, pic, base, imgbase)
{
	pic=pic+"_xl.jpg";
	pic_src = imgbase + pic;
	parent.Select.document.CacheImage.src = pic_src;
//	alert(parent.Select.document.CacheImage.height);
	htm = base+"image.html";
	h = 20;
	w = 500;
	var opts = "scrollbars=no,toolbar=no,status=no,menubar=no,location=no,rezisable=yes,width="+w+",height="+h;
	Imag = window.open(htm,"Img",opts);
Imag.document.open();
Imag.document.write(''
+'<html><head>'
+'<title>Jörg Chemnitz - ' + PicTitle + '</title>'
+'<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">'
+'<link href="../format.css" rel=stylesheet type=text/css>'
+'<script language="JavaScript" src="../script.js"></script>'
+'</head>'
+'<body class="ImgWindow" onload="loadImage()">'
+'<a href="JavaScript:window.close()"><img name="ShowImage" src="" border=1 style="visibility: hidden; margin: 0px" alt="close window"></a>'
+'</body></html>');
Imag.document.close();
	var x = (screen.availWidth - 800);
	var y = (screen.availHeight - 600);
	if(x < 0) x=0;
	if(y < 0) y=0;
	Imag.moveTo(x,y);
//	titel = Imag.document.getElementsByTagName("title")[0];
//	titel.text = titel.text + " - " + PicTitle;
	return;
}


function loadImage()
{
	titel = document.getElementsByTagName("title")[0];
//	titel.text = titel.text + " - " + opener.parent.Select.document.getElementById("CacheTitle").value;
	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();
	}
//	alert(document.getElementsByTagName("title")[0].text);
}
