// Skript zur Anzeige des aktuellen Datums im Formular (Bertram Grau, ATplanet, b.grau@atplanet.com)
//setzt das aktuelle Datum
Now = new Date();
NowDay = Now.getDate();
NowMonth = Now.getMonth();
NowYear = Now.getYear();
if (NowYear < 2000) NowYear += 1900; //für Netscape

//function liefert Anzahl der Tage des Monats(auch  Schaltjahr)
function DaysInMonth(WhichMonth, WhichYear)
{
  var DaysInMonth = 31;
  if (WhichMonth == "Apr" || WhichMonth == "Jun" || WhichMonth == "Sep" || WhichMonth == "Nov") DaysInMonth = 30;
  if (WhichMonth == "Feb" && (WhichYear/4) != Math.floor(WhichYear/4))        DaysInMonth = 28;
  if (WhichMonth == "Feb" && (WhichYear/4) == Math.floor(WhichYear/4))        DaysInMonth = 29;
  return DaysInMonth;
}

//function um die Anzahl der verfügbaren Tage des Monats zu ändern
function ChangeOptionDays()
{
	var fsd = document.getElementById('FirstSelectDay').options[document.getElementById('FirstSelectDay').selectedIndex].value;
	var fsm = document.getElementById('FirstSelectMonth').options[document.getElementById('FirstSelectMonth').selectedIndex].value;
	var fsy = document.getElementById('FirstSelectYear').options[document.getElementById('FirstSelectYear').selectedIndex].value;
	var ssd = document.getElementById('SecondSelectDay').options[document.getElementById('SecondSelectDay').selectedIndex].value;
	var ssm = document.getElementById('SecondSelectMonth').options[document.getElementById('SecondSelectMonth').selectedIndex].value;
	var ssy = document.getElementById('SecondSelectYear').options[document.getElementById('SecondSelectYear').selectedIndex].value;
	
	location.href = 'index.php?id=1&no_cache=1&tx_atmopro_pi1[X]=1&tx_atmopro_pi1[FirstSelectMonth]='+fsm+'&tx_atmopro_pi1[FirstSelectDay]='+fsd+'&tx_atmopro_pi1[FirstSelectYear]='+fsy+'&tx_atmopro_pi1[SecondSelectMonth]='+ssm+'&tx_atmopro_pi1[SecondSelectDay]='+ssd+'&tx_atmopro_pi1[SecondSelectYear]='+ssy+'&tx_atmopro_pi1[tpage]=suche_detail#searchAnchor';
}

//function für Tagesdatum
function SetToToday(Which)
{/*
  DaysObject = eval("document.getElementById('" + Which + "Day')");
  MonthObject = eval("document.getElementById('" + Which + "Month')");
  YearObject = eval("document.getElementById('" + Which + "Year')");

  YearObject[0].selected = true;
  MonthObject[NowMonth].selected = true;

  ChangeOptionDays(Which);

  DaysObject[NowDay-1].selected = true;*/
}
//function für Tagesdatum 2
function SetToToday2(Which)
{
/*
  DaysObject = eval("document.getElementById('" + Which + "Day')");
  MonthObject = eval("document.getElementById('" + Which + "Month')");
  YearObject = eval("document.getElementById('" + Which + "Year')");

  YearObject[0].selected = true;
  MonthObject[NowMonth].selected = true;

  ChangeOptionDays(Which);

  DaysObject[NowDay-1].selected = true;*/
}

//function zur Aufaddierung der Jahre
function WriteYearOptions(YearsAhead)
{
  line = "";
  for (i=0; i<YearsAhead; i++)
  {
    line += "<OPTION>";
    line += NowYear + i;
    line += "</OPTION>";
  }
  return line;
}