// ----- Bin ich Netscape?  -------------------
var ns   = (navigator.appName.indexOf("Netscape")!=-1);

// ----- Bin ich Winzigweich? -------------------
var msie = (navigator.appName.indexOf("Microsoft")!=-1);
var ie4 = (document.all && document.getElementById) ? 1 : 0;

// ----- Bin ich Opera? -------------------
var opera = (navigator.appName.indexOf("Opera")!=-1);

function makeArray() { // für slide.js und gaestebuchliste.js
  this.length = makeArray.arguments.length;
  for (var i = 0; i < this.length; i++)
    this[i + 1] = makeArray.arguments[i];
}

function goback(url) { // geht zurück oder zur angegebenen URL
  if (history.length>1) {
	  history.back;
  } else {
	  window.location=url;
  }
}

function getEventImage(imgPath)
{
 d = new Date();
 t = d.getDate();
 y = d.getYear();
 m = d.getMonth();
 if (m==11) {
	 if (t >= 2 && t <  6) return "<img src=\"" + imgPath + "/kerze_an.jpg\" alt=\"\" border=\"0\" />";
	 if (t >= 6 && t < 13) return "<img src=\"" + imgPath + "/kerze_an.jpg\" alt=\"\" border=\"0\" /><img src=\"" + imgPath + "/kerze_an.jpg\" alt=\"\" border=\"0\" />";
	 if (t >=13 && t < 20) return "<img src=\"" + imgPath + "/kerze_an.jpg\" alt=\"\" border=\"0\" /><img src=\"" + imgPath + "/kerze_an.jpg\" alt=\"\" border=\"0\" /><img src=\"" + imgPath + "/kerze_an.jpg\" alt=\"\" border=\"0\" />";
	 if (t >=20          ) return "<img src=\"" + imgPath + "/kerze_an.jpg\" alt=\"\" border=\"0\" /><img src=\"" + imgPath + "/kerze_an.jpg\" alt=\"\" border=\"0\" /><img src=\"" + imgPath + "/kerze_an.jpg\" alt=\"\" border=\"0\" /><img src=\"" + imgPath + "/kerze_an.jpg\" alt=\"\" border=\"0\" />";
	 //if (t >=31)           return "<img src=\"" + imgPath + "/2007.jpg\" alt=\"\" border=\"0\" />";
 }
 if (m==0) {
	 ;//if (t <= 2)           return "<img src=\"" + imgPath + "/2008.jpg\" alt=\"\" border=\"0\" />";
 }
 return "&nbsp;";
}

// ----- disable all standard navigation:  -------------------
/*

if(ns) {
 self.menubar.visible=false;
 self.toolbar.visible=false;
 self.locationbar.visible=false;
 self.personalbar.visible=false;
 self.statusbar.visible=false;
}
*/

//window.open("",window.name,'hotkeys=no,personalbar=no,menubar=no,toolbar=no,statusbar=no,locationbar=yes');


// ----- open new window w/o navigation buttons -----------------------------------------------
var windex=0;


function opennew(who,name) {
 opennew(who,name,'610',(screen.availHeight/4*3));
}
function opennew(who,name,w,h) {
if (msie || ie4)
{
 document.location=who;
 return;
}
 mywindow=window.open(who,name+windex, 'hotkeys=no,personalbar=no,menubar=no,toolbar=no,statusbar=no,locationbar=no,resizable=yes,scrollbars=yes,width='+w+',height='+h);
 if(mywindow.focus){mywindow.focus();}
 //windex++;	// disabled: immer ins selbe Fenster öffnen
}

function opennewWindow(who,name) {
 mywindow=window.open(who,name+windex,'hotkeys=no,personalbar=no,menubar=no,toolbar=no,statusbar=no,locationbar=no,resizable=yes,scrollbars=yes,width='+(screen.availWidth-200)+',height='+(screen.availHeight-120));
 //windex++;	// disabled: immer ins selbe Fenster öffnen
}

// ----- the current date:

function currentDate() {
 d = new Date();
 y = d.getYear();
 return dayOfWeek(d.getDay())+", "+d.getDate()+".&nbsp;"+monthName(d.getMonth())+"&nbsp;"+(y<1900?y+1900:y);
}
function currentDateShort() {
 d = new Date();
 y = d.getYear();
 return d.getDate()+".&nbsp;"+monthName(d.getMonth())+"&nbsp;"+(y<1900?y+1900:y);
}
function dayOfWeek(day) {
 switch (day) {
  case (0): return 'Sonntag';
  case (1): return 'Montag';
  case (2): return 'Dienstag';
  case (3): return 'Mittwoch';
  case (4): return 'Donnerstag';
  case (5): return 'Freitag';
  case (6): return 'Samstag';
  default:  return '?';
 }
}
function monthName(month) {
 switch (month) {
  case (0): return 'Januar';
  case (1): return 'Februar';
  case (2): return 'M&auml;rz';
  case (3): return 'April';
  case (4): return 'Mai';
  case (5): return 'Juni';
  case (6): return 'Juli';
  case (7): return 'August';
  case (8): return 'September';
  case (9): return 'Oktober';
  case (10): return 'November';
  case (11): return 'Dezember';
  default:  return '?';
 }
}

/*
function lastModified() {
 lastmod = document.lastModified
 lastmoddate = Date.parse(lastmod)
 if(lastmoddate == 0) return("28.6.2006")
 d = new Date(lastmoddate);
 y = d.getYear();
 return d.getDate()+"."+(d.getMonth()+1)+"."+(y<1900?y+1900:y);
}
*/

// --------------------------------------------------
function anrede() {
 d=(new Date()).getTime()/60000/60%24+""
 i=d.indexOf(".")
 if (i != -1) d=d.substring(0,i)
 switch(d)
 {
  case "23": case  "0": case  "1": case "2": case "3": return "Hallo Nachtschw&auml;rmer!";
  case  "4": case  "5": case  "6": return "Hallo Fr&uuml;haufsteher!";
  case  "7": case  "8": case  "9": return "Guten Morgen!";
  case "12": case "13": case "14": case "15": return "Guten Tag!";
  case "19": case "20": case "21": case "22": return "Guten Abend!";
  default: return "Hallo!"; // 10..11
 }
}

// --------------------------------------------------

var windowstatus='';

// vars für ticker():
var breite = 250;
var pos = 0;
var len = 0;
var text;

function ticker() {
 pos++;
 if (pos>=len+9) pos=0;
 window.status = text.substring(pos,breite);
 setTimeout("ticker()",250);
}

function initBody(txt) {
 initBody(txt,false,'',txt);
}


/*
function initBody(txt,running,spacer,ersatz) {
 if (txt.length == 0)
  initBody(ersatz,false,'');
 else
  initBody(txt,running,spacer);
}
*/
function initBody(txt,running,spacer,ersatz) {
  if (running==true && txt.length>0) {
   text=txt;
   while (text.length < breite) {
	text += "                     ";
	text += spacer;
	text += "                     ";
	text += txt;
   }
   text += txt;
   len = txt.length;
   ticker();
  }
  else {
	  if (txt.length==0) txt=ersatz;
   windowstatus=txt;
   window.status=txt;
  }
}


function resetStatus() {
 window.status=windowstatus;
}

function setStatus(txt) {
 windowstatus=txt;
 window.status=txt;
}

/*
function printme() {
 if (ns || msie) {
  window.print();
 } else {
  alert("Die Druckfunktion kann bisher leider nur mit Netscape/Mozilla und Microsoft Internet Explorer verwendet werden. "+
        "Wenn auch "+navigator.appName+" unterstuetzt werden soll, schick bitte eine entsprechende Anforderung an webmaster@bezirk-sifi.de,"+
        " wir werden dann ggf. sehen, was wir tun können.");
 }
}
*/

