﻿/* -- ruethi2010.ch JavaScript Library */
/* -- Global Functions */

function countdown() 
	{
	var jahr=2010, monat=6, tag=19; // Ziel-Datum
	var zielDatum=new Date(jahr,monat-1,tag+1);
	
		startDatum=new Date(); // Aktuelles Datum

		// Countdown berechnen und anzeigen, bis Ziel-Datum erreicht ist
		if(startDatum<zielDatum)  {

			var jahre=0, monate=0, tage=0;

			// Jahre
			while(startDatum<zielDatum) {
				jahre++;
				startDatum.setFullYear(startDatum.getFullYear()+1);
			}
			startDatum.setFullYear(startDatum.getFullYear()-1);
			jahre--;

			// Monate
			while(startDatum<zielDatum) {
				monate++;
				startDatum.setMonth(startDatum.getMonth()+1);
			}
			startDatum.setMonth(startDatum.getMonth()-1);
			monate--;

			// Tage
			while(startDatum.getTime()+(24*60*60*1000)<zielDatum) {
				tage++;
				startDatum.setTime(startDatum.getTime()+(24*60*60*1000));
			}

			// Anzeige formatieren
			einleitung="Noch ";
			(jahre!=1)?jahre=jahre+" Jahre, ":jahre=jahre+" Jahr, ";
			(monate!=1)?monate=monate+" Monate und ":monate=monate+" Monat und ";
			(tage!=1)?tage=tage+" Tage bis zum Start.":tage=tage+" Tag bis zum Start.";
			
			document.countdownform.countdowninput.value=einleitung+jahre+monate+tage;

			setTimeout('countdown()',200);
		}
		// Anderenfalls alles auf Null setzen
		else document.countdownform.countdowninput.value="Das Rheintaler Turnfest hat begonnen!";
	}




function popup(bildname,fenstertitel,bildtitel)
{ var undefined;

  if (bildtitel==undefined)
  {bildtitel='Zum Schliessen auf das Bild klicken.';}

  if (fenstertitel==undefined)
  {fenstertitel='www.soumer.de';}

  popupwin = window.open('', 'xyz','resizable=1');

  with (popupwin)
  {
    	focus ();
    	document.open();
	document.write('<title>'+fenstertitel+'</title>');
	document.write('<meta http-equiv=\"imagetoolbar\" content=\"no\">');
	document.write('<body leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\" scroll=\"no\" onload=\"opener.popupresize(document.images[0].width,document.images[0].height)\">')
	document.write('<a href=\"javascript:self.close()\">');
	document.write('<img src=\"'+bildname+'\" border=\"0\" alt=\"'+bildtitel+'\">')
	document.close();
  }
}

function popupresize(x,y)
{
	popupwin.resizeTo(x+8,y+80);

	midx=(screen.availWidth/2)-(x/2);
	midy=(screen.availHeight/2)-(y/2);

	popupwin.moveTo(midx,midy);
}


function formmitte(formbreite,formhoehe,formurl,fenstername)
{
	abstandlinks	= (screen.availWidth/2)-(formbreite/2);
	abstandoben	= (screen.availHeight/2)-(formhoehe/2);
    win	= window.open(formurl,fenstername,"width="+formbreite+",height="+formhoehe+",left="+abstandlinks+",top="+abstandoben+"");
	win.focus();
}


/* EOF */
