DefExt = ".html"
showMeeting = 24 * 60 * 60 * 1000 * 5;

function shPop(MyUrl,MyWidth, MyHeight)
{
  if ( MyWidth == null )
  	MyWidth = 560;
  if  ( MyHeight == null )
  	MyHeight = 300;
  MyWindow ="popWindow";
  popup=window.open(MyUrl,MyWindow,
  "resizable=1,width="+MyWidth+",height="+MyHeight+",top=50,left=50,scrollbars");
}

function updateLeftFrame (pAbteilung)
{
	parent.leftFrame.location.href=
		pAbteilung + "/leftFrame.php?abteilung=" + pAbteilung;
}

function updateMainPages (pAbteilung)
{
	parent.topFrame.location.href=
		"topFrame.php?abteilung=" + pAbteilung;
	if ( pAbteilung == "Tennis" ) {
		parent.mainFrame.location.href=
		"Tennis/welcome.html"; }
	else {
		parent.mainFrame.location.href=
		"php/news.php?cmd=view&abteilung=" + pAbteilung; }
	parent.leftFrame.location.href=
		pAbteilung + "/leftFrame.php?abteilung=" + pAbteilung;
}

function shMain (Url) {
	parent.mainFrame.location.href=Url+DefExt;
}
function shBlank () {
	document.writeln('<a href="' + window.location +
		'" target="_blank">Diese Seite in neuen Fenster öffnen ?</a>');
}
function shTextIcon (MyUrl,MyText,altText)
{
	document.writeln('<a href="'+MyUrl+
		'" target="_blank" alt="'+altText+'">'+
		'<img border="0" src="images/icon_text.gif" width="17" height="22"></a>');
	document.writeln('<a href="'+MyUrl+'" target="_blank">'+MyText+'</a>');
}
function shOnce (MyUrl,MyText)
{
	document.writeln('<h3><a href="../once/'+MyUrl+'">'+MyText+'</a></h3>');
}
function shPdfIcon (MyUrl,MyText,altText)
{
	document.writeln('<a href="'+MyUrl+
		'" target="_blank" alt="'+altText+'">'+
		'<img border="0" src="images/icon_pdf.gif" width="39" height="40"></a>');
	document.writeln('<a href="'+MyUrl+'" target="_blank">'+MyText+'</a>');
}
function shPortrait(MyUrl)
{
  popup=window.open(MyUrl,"impWin",
  "resizable=1,width=560,height=600,top=50,left=0,scrollbars");
}

function impressum(MyUrl,MyWindow,MyTop)
{
  popup=window.open(MyUrl+"impressum.php","impWin",
  "resizable=1,width=560,height=600,top=50,left=0,scrollbars");
}

function DigitsOnly (n) {
	for (i=0;i<n.length;i++) {
		if ((n.substr(i,1) < "0") || (n.substr(i,1) > "9")) {
			return(n.substr(0,i));
        }
    }
    return(n)
}

function shGot (Url) {
	parent.frgot.location.href=Url;
}

function tObj (Obj,End) {
	Nr = Obj.value;
    if (Nr == "") {
		alert("Please enter a number !");
		Obj.focus();
		return(false);
	}
	if ((c=DigitsOnly(Nr)) != Nr) {
		alert("Please use only digits !");
		Obj.focus();
		return(false);
	}
	if ( ( Nr < 1 ) || ( End < Nr ) ) {
		alert('Please enter a number between 1 and ' + End + ' !!' );
		Obj.focus();
		return(false);
	}
}
function ValNr (Obj,End,MyLib,MyUrl,MyKindOfLib,MyExt) {
	if ( tObj(Obj,End) == false ){
 	return(false);
	}
	parent.frlib.location.href=MyLib + MyKindOfLib + "." + MyExt + "#" + "_" + Obj.value;
}
function ValNr2 (O1,O2,End,MyLib,MyUrl,MyKindOfLib,MyExt) {
	if ( (tObj(O1,End) == false) || (tObj(O2,End) == false) ){
 	return(false);
	}
	Nr = String((Number(O1.value)-1)*5 + Number(O2.value));
	parent.frlib.location.href=MyLib + MyKindOfLib + "." + MyExt + "#" + "_" + Nr;
}

function checkMeeting (todayGetTime,theDay, theMonth, theYear, theMeeting) {
	target = new Date(theYear,theMonth-1,theDay,20,0,0);
	diff = target.getTime () - todayGetTime;
	if ( diff < 0 ) return(false);
	if ( diff < showMeeting )
	{
		openMeetingWindow ( theMeeting );
	}
	else
	{
//	shPop("spendenaufruf");
 //		shPop("mitfahrgelegenheit",440);
	}

	return(true);
}

function checkAllMeetings () {
	today = new Date();
	todayGetTime = today.getTime();
	if ( checkMeeting (todayGetTime,18,12,2007,"Dienstag, 18. Dezember 2007") )  return(true);
}

function bsp_openMeetingWindow (nextMeeting) {
	meet=window.open("","meetingWindow",
		"width=400,height=400,top=100,left=100");
	meet.document.write ("<HEAD>");
	meet.document.write ("<TITLE>TSV Wartenberg</TITLE>");
	meet.document.write ('<link rel="stylesheet" type="text/css" href="util/tsv.css">');
	meet.document.write ("</HEAD>");
	meet.document.write ("<BODY>");
	meet.document.write ('<center><font size="+2">Unser nächster Stammtisch ist am');
	meet.document.write ("<P>" + nextMeeting + "</p>");
	meet.document.write ("im <b>Berglernen Sportler Heim</b>");
	meet.document.write ("<br>um 19:30 Uhr");
	meet.document.write ("<p>Zu Gast: Landtagskandidatin Dr. Hildegard Kronawitter");
	meet.document.write ("<P>herzlichst<br><br>Ihr SPD Ortsverein Wartenberg</font></center>");
	meet.document.write ("</body>");
}

function openMeetingWindow (nextMeeting) {
	meet=window.open("","meetingWindow",
		"width=400,height=300,top=100,left=100");
	meet.document.write ("<HEAD>");
	meet.document.write ("<TITLE>TSV Wartenberg</TITLE>");
	meet.document.write ('<link rel="stylesheet" type="text/css" href="util/ov.css">');
	meet.document.write ("</HEAD>");
	meet.document.write ("<BODY>");
	meet.document.write ('<center><font size="+2">Unser nächster Stammtisch ist am');
	meet.document.write ("<P>" + nextMeeting + "</p>");
	meet.document.write ("im Hotel Reiter");
	meet.document.write ("<br>um 20:00 Uhr");
	meet.document.write ("<P>herzlichst<br><br>Ihr TSV Wartenberg</font></center>");
	meet.document.write ("</body>");
}

function fotoGalerie (galerie) {
	window.open(galerie,"anzeige",
		"width=800,height=600,top=100,left=100");
}
