// floating.copyright //
var logo;
var xOff = 4;
var yOff = 4;
function init() {
  logo = getLayer("logo");
  showLayer(logo);
  setInterval('updateLogo()', 20);
}
function updateLogo() {
  var x, y;
  x = getPageScrollX() + xOff;
  y = getPageScrollY() + getWindowHeight() - getHeight(logo) - yOff;
  moveLayerTo(logo, x, y);
}

// window.openers //
function openFischFamiliePopup(url, name) {
	win=window.open(url,name,"width=400,height=400,resizeable=0,toolbar=no,scrollbars=1,status=0");
}

function openAdressePopup(url, name) {
	win=window.open(url,name,"width=400,height=400,resizeable=0,toolbar=no,scrollbars=1,status=0");
}

function openTauchplatzPopup(url, name) {
	win=window.open(url,name,"width=640,height=480,resizeable=0,toolbar=no,scrollbars=1,status=0");
}

function openHeftPopup(url, name) {
	win=window.open(url,name,"width=400,height=400,resizeable=0,toolbar=no,scrollbars=1,status=0");
}

function openHaiopei(url, name) {
	win=window.open(url,name,"width=770,height=480,resizeable=0,toolbar=no,scrollbars=1,status=0");
}

function openPrintPreview(url, name) {
	win=window.open(url,name,"width=600,height=600,menubar=1,resizeable=1,toolbar=no,scrollbars=1,status=0");
}

function openVideoPopup(url, name) {
	win=window.open(url,name,"width=575,height=480,resizeable=0,toolbar=no,scrollbars=1,status=0");
}function openXLVideoPopup(url, name) {
	win=window.open(url,name,"width=900,height=660,resizeable=0,toolbar=no,scrollbars=1,status=0");
}

function openQuizPopup (url, name) {
	win=window.open(url,name,"menubar=no,toolbar=no,scrollbars=yes,status=0,resizable=0,height=495,width=660");
   return;
}


function openEcardPopup(flag, url, themaID, catID, card) {

	var full_url, name;
	
	if (flag > 0)
	{
		name = 'unterwasserEcards'+ themaID;
		full_url = url + '&thema=' + themaID;
		
		if (card != '')
		{
			full_url = full_url + '&card=' + card;
		}
		else
		{
			full_url = full_url + '&cat=' + catID;
		}
		
		//alert('url: ' + full_url + '   name: ' + name);
	
		win=window.open(full_url,name,"width=950,height=600,resizeable=0,toolbar=no,scrollbars=0,status=0");
	}	
}


function newWindow(url, name) {
	win=window.open(url,name,"");
}

//special.opener.for.imageflyouts
Protokoll = self.location.protocol;
Pfad = self.location.pathname;
Basis = Protokoll + '//' + Pfad.substring(1,Pfad.length-11)
neues_Fenster = null;

function OpenFlyoutImage(url0)
{
   url=url0	
   zu1();
   setTimeout("sichtbar1()",1000);
}

function sichtbar1()
{  
   Optionen = 'width=640,height=480,resizeable=0,toolbar=no,scrollbars=1,status=0';
   neues_Fenster = window.open('','',Optionen)
   with (neues_Fenster) 
   {
      document.writeln('<html><head><title>unterwasser.de</title></head>');
      document.writeln('<body bgcolor="#ffffff" text="#000000" link="#262626" vlink="#262626" alink="#bd0000"><table border=0 cellspacing=0 cellpadding=0 valign="middle"><tr><td>');
      document.writeln('<img src="'+url+'" BORDER=0>');
      document.writeln('</td></tr></table></body></html>');
   }
}

function zu1()
{
   if (neues_Fenster != null)
     if (!neues_Fenster.closed)
       neues_Fenster.close();
}


//special.opener.for.fotogalery
Protokoll = self.location.protocol;
Pfad = self.location.pathname;
Basis = Protokoll + '//' + Pfad.substring(1,Pfad.length-11)
neues_Fenster = null;

function OpenGalleryImage(url0)
{
   url=url0	
   zu2();
   setTimeout("sichtbar2()",1000);
}

function sichtbar2()
{  
   Optionen = 'width=440,height=440,resizeable=0,toolbar=no,scrollbars=1,status=0';
   neues_Fenster = window.open('','',Optionen)
   with (neues_Fenster) 
   {
      document.writeln('<html><head><title>unterwasser.de</title></head>');
      document.writeln('<body bgcolor="#ffffff" text="#000000" link="#262626" vlink="#262626" alink="#bd0000"><table width=100% border=0 cellspacing=0 cellpadding=0><tr><td align=center>');
      document.writeln('<img src="'+url+'" BORDER=0>');
      document.writeln('</td></tr><tr><td><img src="http://unterwas.ivwbox.de/cgi-bin/ivw/CP/bildaufruf/" width="1" height="1" border="0"></td></tr></table></body></html>');
   }
}

function zu2()
{
   if (neues_Fenster != null)
     if (!neues_Fenster.closed)
       neues_Fenster.close();
}


// Sonderheftbestellung 
function checkChoice(whichbox, nummer, jahr) {
	if (whichbox.checked == false){		whichbox.form["heft_menge_" + nummer + "_" + jahr].value = "0";		whichbox.form["heft_check_" + nummer + "_" + jahr].value = "0";	}	else {		whichbox.form["heft_menge_" + nummer + "_" + jahr].value = "1";		whichbox.form["heft_check_" + nummer + "_" + jahr].value = "1";	}}function checkTotal(of) {
	var yearBegin = of.form["year_begin"].value;
	var yearEnd = of.form["year_end"].value;
	var somethingDone = false;
	
	for (var i=yearBegin; i<=yearEnd; i++) {
		for (var j=0; j<=12; j++) {
			if ((of.form["heft_check_" + j + "_" + i] != null) && (of.form["heft_menge_"+ j + "_" + i] != null) && (of.form["heft_check_" + j + "_" + i].value ==1) && (parseInt(of.form["heft_menge_"+ j + "_" + i].value)>0)) {
					somethingDone = true;
					break;
			}
		}
	}
	
	if (somethingDone) {of.form.submit();}
	else {alert(unescape("Sie m%FCssen mindestens ein Heft ausw%E4hlen!"));}
		
	return;
}


// Benutzerverwaltung
var ie=document.all?1:0;
var ns=document.layers?1:0;
var dom=document.getElementById?1:0;

var show=
ie?function(obj) {
 document.all[obj].style.visibility="visible";
}:
ns?function(obj) {
 document.layers[obj].visibility="show";
}:
function(obj) {
 document.getElementById(obj).style.visibility="visible";
};
var hide=
ie?function(obj) {
 document.all[obj].style.visibility="hidden";
}:
ns?function(obj) {
 document.layers[obj].visibility="hide";
}:
function(obj) {
 document.getElementById(obj).style.visibility="hidden"
};





function Statustext(Text)
{
	if (Text.length > 0)
	{
		window.defaultStatus = window.defaultStatus + ' - ' + Text;
	}
}


function SubmitForm (form)
{
	AppendFormParamsToActionString(form);
	
	window.location.href = form.action;
}

function AppendFormParamsToActionString(form)
{
	var name;
	var value;
	var nameParts;
	var strAction;
	var expr;
	var counter;
	
	strAction = new String(form.action);
	//alert (strAction);
	
	counter = 0;
	
	for (i=0; i<form.elements.length; i++)
	{
		name = form[i].name;
		value = form[i].value;
		
		if (value == null)
		{
			value = form[i].options[form[i].selectedIndex].value;
		}
		//alert (i + '  name: ' + name + '   value: ' + value);
		
		if (value.length > 0 && name.length > 0)
		{
			if (form[i].type != 'radio' || form[i].checked)
			{
				counter++;
				nameParts = name.split(':');
				name = nameParts[nameParts.length-1];
		
				if (counter == 1)
				{
					//alert(strAction.lastIndexOf('?'));
					if (strAction.lastIndexOf('?') > -1)
						{strAction += '&';}
					else {strAction += '?';}
				}
				else {strAction += '&';}
				
				strAction += name + '=' + value;
			}
		}
	}
	form.action = strAction;
}


function openEcardPopupHaiopei(url, categoryID, haiopeiUID) {

	var full_url, name;
	
	name = 'unterwasserEcards9';
	full_url = url + '&cat=' + categoryID;
	
	if (haiopeiUID != '')
	{
		full_url = full_url + '&haid=' + haiopeiUID;
	}
	
	//alert('url: ' + full_url + '   name: ' + name);

	win=window.open(full_url,name,"width=934,height=654,resizeable=0,toolbar=no,scrollbars=0,status=0");
}


function openFotowettbewerbPopup(flag, url, themaID, catID, card) {

	var full_url, name;
	
	if (flag > 0)
	{
		name = 'unterwasserEcards'+ themaID;
		full_url = url + '&thema=' + themaID;
		
		if (card != '')
		{
			full_url = full_url + '&card=' + card;
		}
		else
		{
			full_url = full_url + '&cat=' + catID;
		}
		
		//alert('url: ' + full_url + '   name: ' + name);
	
		win=window.open(full_url,name,"width=1100,height=700,resizeable=0,toolbar=no,scrollbars=0,status=0,top=20,left=20");
	}	
}