// JavaScript Document
/* Functions that swaps images. */
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

window.name = "mainwindow";


function openIconWindow()
{
	var mainwindow = self;
	var url = "guestbook_icons.cfm";
	var iconwindow = window.open(url,'iconwindow','width=520,height=600,toolbar=no,location=no,scrolling=yes,menubar=no,scrollbars=yes,resizable=yes');
	iconwindow.focus();
}

function openSmilyWindow()
{
	var url = "guestbook_smilies.cfm";
	var smilywindow = window.open(url,'smilywindow','width=380,height=230,toolbar=no,location=no,scrolling=yes,menubar=no,scrollbars=yes,resizable=yes');
	smilywindow.focus();
}

function openChickenWindow(theID, theWidth, theHeight)
{
	var url = "../data/chicken_detail.cfm?id=" +theID;
	var chickenwindow = window.open(url,'chickenwindow','width=' + theWidth + ',height=' + theHeight + ',toolbar=no,location=no,scrolling=yes,menubar=no,scrollbars=no,resizable=yes');
	chickenwindow.focus();
}

function openGalleryWindow(theID, theWidth, theHeight)
{
	var url = "../data/gallery_detail.cfm?id=" +theID;
	var gallerywindow = window.open(url,'gallerywindow','width=' + theWidth + ',height=' + theHeight + ',toolbar=no,location=no,scrolling=yes,menubar=no,scrollbars=no,resizable=yes');
	gallerywindow.focus();
}

function openGalleryWindow2(theID, theWidth, theHeight)
{
	var url = "../data/gallery_detail2.cfm?id=" +theID;
	var gallerywindow = window.open(url,'gallerywindow','width=' + theWidth + ',height=' + theHeight + ',toolbar=no,location=no,scrolling=yes,menubar=no,scrollbars=no,resizable=yes');
	gallerywindow.focus();
}

function openGalleryWindow3(theID, theWidth, theHeight)
{
	var url = "../data/images.cfm?id=" +theID;
	var gallerywindow = window.open(url,'gallerywindow','width=' + theWidth + ',height=' + theHeight + ',toolbar=no,location=no,scrolling=yes,menubar=no,scrollbars=yes,resizable=yes');
	gallerywindow.focus();
}

function openGalleryWindowExtern(theID, theWidth, theHeight)
{
	var url = "../data/images_extern.cfm?id=" +theID;
	var gallerywindow = window.open(url,'gallerywindow','width=' + theWidth + ',height=' + theHeight + ',toolbar=no,location=no,scrolling=yes,menubar=no,scrollbars=yes,resizable=yes');
	gallerywindow.focus();
}

function openKalenderWindow(tag, monat, jahr)
{
	var url = "../data/kalender_detail.cfm?tag=" +tag + "&monat=" + monat + "&jahr=" + jahr;
	var kalenderwindow = window.open(url,'kalenderwindow','width=' + 480 + ',height=' + 350 + ',toolbar=no,location=no,scrolling=yes,menubar=no,scrollbars=yes,resizable=yes');
	kalenderwindow.focus();
}

function openKalenderWindowID(id)
{
	var url = "../data/kalender_detail.cfm?id=" +id;
	var kalenderwindow = window.open(url,'kalenderwindow','width=' + 480 + ',height=' + 350 + ',toolbar=no,location=no,scrolling=yes,menubar=no,scrollbars=yes,resizable=yes');
	kalenderwindow.focus();
}

function openLageplanWindow()
{
	var url = "../data/lageplan.htm";
	var lageplanwindow = window.open(url,'lageplanwindow','width=' + 420 + ',height=' + 600 + ',toolbar=no,location=no,scrolling=yes,menubar=no,scrollbars=yes,resizable=yes');
	lageplanwindow.focus();
}

function openFlyerWindow(theURL)
{
	var url = "../data/" + theURL;
	var flyerwindow = window.open(url,'flyerwindow','width=' + 400 + ',height=' + 600 + ',toolbar=no,location=no,scrolling=no,menubar=no,scrollbars=no,resizable=yes');
	flyerwindow.focus();
}

function openUstrinketeWindow()
{
	var url = "../data/flyer_ustrinkete.htm"; //"../data/lageplan.htm";
	var ustrinketewindow = window.open(url,'ustrinketewindow','width=' + 420 + ',height=' + 550 + ',toolbar=no,location=no,scrolling=no,menubar=no,scrollbars=no,resizable=yes');
	ustrinketewindow.focus();
}

function openMovieWindow(theMovie, theWidth, theHeight)
{
	var url = "../data/movies.cfm?movie=" +theMovie;
	var moviewindow = window.open(url,'moviewindow','width=' + theWidth + ',height=' + theHeight + ',toolbar=no,location=no,scrolling=no,menubar=no,scrollbars=no,resizable=no');
	moviewindow.focus();
}

function openFileWindow(theFile, theWidth, theHeight)
{
	var url = "../data/" + theFile;
	var filewindow = window.open(url,'filewindow','width=' + theWidth + ',height=' + theHeight + ',toolbar=no,location=no,scrolling=no,menubar=no,scrollbars=no,resizable=no');
	filewindow.focus();
}


var is_major = parseInt(navigator.appVersion);
var is_minor = parseFloat(navigator.appVersion);
var ie4    = ( (navigator.userAgent.toLowerCase().indexOf("msie 4")!=-1) );
    
var ie = document.all ? true : false;
var ns = document.layers ? true : false;
var mac= (navigator.userAgent.toLowerCase().indexOf("mac")!=-1);



function closeAll()
{
	MM_showHideLayers('topLayer','','hide');
	MM_showHideLayers('printLayer','','hide');
	MM_showHideLayers('homeLayer','','hide');
}


function getLeft(l)
{
  if (l.offsetParent) return (l.offsetLeft + getLeft(l.offsetParent));
  else return (l.offsetLeft);
}
function getTop(l)
{
  if (l.offsetParent) return (l.offsetTop + getTop(l.offsetParent));
  else return (l.offsetTop);
}

function Write(theID, theLeft)
{
	closeAll();
	if (ns)
	{
		var layer = document.ns;
		posX = layer.pageX;
		posY = layer.pageY;
		document.layers[theID].left = posX+theLeft;
		document.layers[theID].top = posY-30;
	}
	else if (ie)
	{
		if (mac)
		{
			var topPlus = -30; var leftPlus = 3;
		}
		else
		{
			var topPlus = -30; var leftPlus = 3;
		}
	    document.all(theID).style.left = getLeft(document.all('ie')) + leftPlus + theLeft;
		document.all(theID).style.top = getTop(document.all('ie')) + topPlus;
		//
		//document.all(theID).style.height = 98;
	}
	else if (document.getElementById('ns')) //Internet Explorer 5+ or Netscape 6
    {
    	var layer = document.getElementById('ns');
		
		posX = document.getElementById('ns').offsetLeft;
		posY = document.getElementById('ns').offsetTop;
		document.getElementById(theID).style.position = "absolute";
		document.getElementById(theID).style.left = posX+3+theLeft +"px";
		document.getElementById(theID).style.top = posY-30 +"px";
		//alert( document.getElementById('ns') );
		//alert( document.getElementById('ns').left );
		//alert( document.getElementById('ns').offsetLeft );
		//alert( document.getElementById('ns').style.position );
		//alert( document.getElementById('ns').style.left );
		//alert( posX );
    }

	MM_showHideLayers(theID,'','show');
}

function Description(theID)
{
	closeAll();
	if (ns)
	{
		var layer = document.partyNS;
		posX = layer.pageX;
		posY = layer.pageY;
		document.layers[theID].left = posX;
		document.layers[theID].top = posY;
	}
	else if (ie)
	{
		if (mac)
		{
			var topPlus = 0; var leftPlus = 0;
		}
		else
		{
			var topPlus = 0; var leftPlus = 0;
		}
	    document.all(theID).style.left = getLeft(document.all('partyIE')) + leftPlus;
		document.all(theID).style.top = getTop(document.all('partyIE')) + topPlus;
	}
	else if (document.getElementById('partyNS')) //Internet Explorer 5+ or Netscape 6
    {
    	var layer = document.getElementById('partyNS');
		
		posX = document.getElementById('partyNS').offsetLeft;
		posY = document.getElementById('partyNS').offsetTop;
		document.getElementById(theID).style.position = "absolute";
		document.getElementById(theID).style.left = posX+"px";
		document.getElementById(theID).style.top = posY+"px";
    }

	MM_showHideLayers(theID,'','show');
}

function debug(variable)
{
	alert(variable);
}
