// Function ViewImage ---------------------------------------------------------
// www.web-toolbox.net , W. Jansen
// Übergabeparameter: bildquelle,breite,höhe,bildtitel
// hand over parameters: imagesource,width,height,title

function ViewImage(bildurl,b,h,bildtitel)
{
var eigenschaften,sbreite,shoehe,fenster,b,h;

// stellt die Bildschirmabmessungen fest
var ns6 = (!document.all && document.getElementById);
var ie4 = (document.all);
var ns4 = (document.layers);

if(ns6||ns4) {
sbreite = innerWidth;
shoehe = innerHeight;
}
else if(ie4) {
sbreite = document.body.clientWidth;
shoehe = document.body.clientHeight;
}

x = (sbreite-b)/2;
y = (shoehe-h)/2;

// KZ: eingefügt für Firefox
if (navigator.userAgent.search(/Firefox/) != -1) {
	h = Number(h)+1;
}

eigenschaften="left="+x+",top="+y+",screenX="+x+",screenY="+y+",width="+b+",height="+h+",menubar=no,toolbar=no";

fenster=window.open("","",eigenschaften);
fenster.focus();
fenster.document.open();
with (fenster) {
  document.write('<html lang="de"><head>');
  // geändert 2004 für Mozilla
  document.write('<scr' + 'ipt type="text/javascr' + 'ipt" language="JavaScr' + 'ipt">');
  document.write("function click() { window.close(); } ");  // bei click  schliessen
  document.write("document.onmousedown=click ");
  // geändert 2004 für Mozilla
  document.write('</scr' + 'ipt>');
  document.write('<title>'+ bildtitel +'</title></head>');
  // Zeile geändert Aug 2003 (Dreamweaver machte Probleme)
  document.write('<' + 'body onblur="window.close();" ');// bei Focusverlust schliessen
  document.write('marginwidth="0" marginheight="0" leftmargin="0" topmargin="0">');
  document.write('<center>');
  document.write('<img src="'+ bildurl +'"border="0">');
  document.write('<center>');
  document.write('</body></html>');
  fenster.document.close();
}
}
// End of Function ViewImage ----------------------------



// Function TabOver -------------------------------------
// Usage: onMouseOver="TabOver(this, 0);" onMouseOut="TabOver(this, 1);"
function TabOver(td, mode)
{
	if (mode == 0)
	{
		sch0 = td.className;
		td.className = 'sch1';
	}
	else
	{
	td.className = sch0;
	}
}
// End of Function TabOver ------------------------------



// Function TextPop -------------------------------------
// <a href="javascript:TextPop('http://www.deinedomain.de/seite.html','textpopup','640','480','center','front');">LinkText</a>
function TextPop(mypage,myname,w,h,pos,infocus){
if(pos=="random"){myleft=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;mytop=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){myleft=(screen.width)?(screen.width-w)/2:100;mytop=(screen.height)?(screen.height-h)/2:100;}
else if((pos!='center' && pos!="random") || pos==null){myleft=0;mytop=20}
settings="width=" + w + ",height=" + h + ",top=" + mytop + ",left=" + myleft + ",scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes";win=window.open(mypage,myname,settings);
win.focus();}
// End of Function TextPop ------------------------------



// Image Popup - OK in Firefox ---------------------------
/******************************************************* 
IMAGEPOP 1.2
(c) 2003, Peter Bailey, http://www.peterbailey.net
Modified by Ryan Parman, http://www.skyzyx.com

- Works in IE/Win 5+, Gecko 0.94+, Opera 7+
- Downlevel for IE5/Mac and other non-DOM browsers.
- Fails miserably in Opera 6
- Not sure about KHTML browsers... 
*******************************************************/ 

// Quick Browser Sniffs
var opera=(navigator.userAgent.indexOf('Opera') != -1) ? true:false;
var operaVer=0;
if (navigator.userAgent.indexOf('Opera ') != -1)
{
	operaSplit=navigator.userAgent.split('Opera ');
	operaVer=parseInt(operaSplit[1]);
}
else if (navigator.userAgent.indexOf('Opera/') != -1)
{
	operaSplit=navigator.userAgent.split('Opera/');
	operaVer=parseInt(operaSplit[1]);
}
var opera7=(opera && operaVer >= 7) ? true:false;

var ie5mac=(navigator.platform.indexOf('Mac') != -1 && navigator.userAgent.indexOf('MSIE') != -1) ? true:false;
var dom=(document.getElementById && !opera) ? true:false;

// Positioning Differences Between Browsers
var vertShift=100; // Default for IE/Win and Gecko
if (opera7) vertShift=200; // For Opera 7

function imgPop(imageURL, imageTarget)
{
	// In case there is no target specified.
	imageTarget=(imageTarget) ? imageTarget:"_blank";

	if ((dom || opera7) && !ie5mac)
	{
		var imgWin = window.open('about:blank', imageTarget ,'width=200, height=200, left=0, top=0');

		with (imgWin.document)
		{ 
			writeln('<html lang="de"><head><title>Loading...</title>');
			writeln('<style type="text/css"><!-- body { margin:0px; padding:0px; } --></style></head>');
			writeln('<body onload="self.focus();"><img id="pic" style="display:none" /></body></html>');
			close();
		}

		var img = new Image();
		img.onload = function() { sizeImgWin(imgWin, img); };
		img.src = imageURL;
	}

	else window.open(imageURL, imageTarget);
}

function sizeImgWin(win, img)
{
	var new_w = img.width;
	var new_h = img.height;
	var old_w = win.innerWidth || win.document.body.offsetWidth;
	var old_h = win.innerHeight || win.document.body.offsetHeight;

	if (!new_w) { new_w = old_w; }
	if (!new_h) { new_h = old_h; }

	new_w -= old_w; new_h -= old_h;
	win.resizeBy(new_w,new_h);
	win.document.title = img.src.substring(img.src.lastIndexOf("/")+1);
	var pic = win.document.getElementById('pic');
	pic.src = img.src;
	pic.style.display = 'block';

	sw=screen.width;
	sh=screen.height;

	var leftPos=((sw-new_w)/2)-100; // Exactly centered.
	var topPos=((sh-new_h)/2)-(vertShift+(((sh-new_h)/2))*0.1);
	win.moveTo(leftPos, topPos);
}


// http://www.alistapart.com/articles/tableruler/
/*
	tableruler()
	written by Chris Heilmann for alistapart.
	enables a rollover of rows for each table with the classname "hlrows"
*/

function tableruler()
{
	if (document.getElementById && document.createTextNode)
	{
		var tables=document.getElementsByTagName('table');
		for (var i=0;i<tables.length;i++)
		{
			if(tables[i].className=='ruler')
			{
				var trs=tables[i].getElementsByTagName('tr');
				for(var j=0;j<trs.length;j++)
				{
					if(trs[j].parentNode.nodeName=='TBODY')
					{
						trs[j].onmouseover=function(){this.className='ruled';return false}
						trs[j].onmouseout=function(){this.className='';return false}
					}
				}
			}
		}
	}
}


// --------------------------------------------------------------------------------------
// http://www.webmaster-resource.de/tricks/javascript/grafik-passend-in-einem-popup-fenster-oeffnen.php

function GrafikAnzeigen(GrafikURL, Breite, Hoehe)
{
	Fensteroptionen="toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0";

	Grafikfenster=window.open("", "", Fensteroptionen + ',width=' + Breite + ',height=' + Hoehe);
	Grafikfenster.focus();
	Grafikfenster.document.open();
	with(Grafikfenster)
	{
		document.write("<html><head>");
		document.write("<title>Grafikanzeige</title>");
		document.write("</head>");
		document.write("<body leftmargin=\"0\" marginheight=\"0\" marginwidth=\"0\" topmargin=\"0\">");
		document.write("<img border=\"0\" onclick=\"window.close();\" src=\""+ GrafikURL +"\" title=\"Zum Schließen auf das Foto klicken\">");
		document.write("</body></html>");
		Grafikfenster.document.close();
	}
}


// --------------------------------------------------------------------------------------
// http://www.webmaster-resource.de/tricks/javascript/grafik-passend-in-einem-popup-fenster-oeffnen.php
// ...S  mit Scrollbar und resizable
function GrafikAnzeigenS(GrafikURL, Breite, Hoehe)
{
	Fensteroptionen="toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1";

	Grafikfenster=window.open("", "", Fensteroptionen + ',width=' + Breite + ',height=' + Hoehe);
	Grafikfenster.focus();
	Grafikfenster.document.open();
	with(Grafikfenster)
	{
		document.write("<html><head>");
		document.write("<title>Grafikanzeige</title>");
		document.write("</head>");
		document.write("<body leftmargin=\"0\" marginheight=\"0\" marginwidth=\"0\" topmargin=\"0\">");
		document.write("<img border=\"0\" onclick=\"window.close();\" src=\""+ GrafikURL +"\" title=\"Zum Schließen auf das Foto klicken\">");
		document.write("</body></html>");
		Grafikfenster.document.close();
	}
}


// --------------------------------------------------------------------------------------
// Stadtplan mit Chalets anzeigen
function FewoPlan(fewoname, x, y)
{
	Fensteroptionen="toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1";

	Grafikfenster=window.open("", "", Fensteroptionen + ',width=663,height=1060');
	Grafikfenster.focus();
	Grafikfenster.document.open();
	with(Grafikfenster)
	{
		document.write("<html lang=\"de\"><head>");
		document.write("<title>" + fewoname + "</title>");
		document.write("</head>");
		document.write("<body style=\"margin:0; padding:0; background-color:#bfb;\">");
		document.write("<img src=\"mf-stadtplan.gif\" alt=\"\" width=\"640\" height=\"1060\" border=\"0\">");
		document.write("<div style=\"position:absolute; margin:-15px 0 0 -15px; left:"+ x +"px; top:"+ y + "px;\"><img src=\"fewokreis.gif\" width=\"30\" height=\"30\" alt=\"" + fewoname + "\"></div>");
		document.write("</body></html>");
		Grafikfenster.document.close();
	}
}
// End of Function FewoPlan ------------------------------
