// gleich-lange spalten wegen wetterbox ----------------------------------//

function resizeColumns()
{
	// Get leftcolumn and rightcolumn elements
	var leftColumn = document.getElementById("navi");
	var rightColumn = document.getElementById("inhalt");

	// Get left-visualPadding and right-visualPadding elements
	var leftVisualPadding = document.getElementById("left-visualPadding");
	var rightVisualPadding = document.getElementById("right-visualPadding");

	// Reset the heights of these two padding divs to auto, in case 
	// resizeColumns has already been run (i.e. text resize scenario)
	leftVisualPadding.style.height = "auto";
	rightVisualPadding.style.height = "auto";

	// Calculate max height of leftcontent and rightcontent
	var maxHeight=Math.max(leftColumn.offsetHeight,rightColumn.offsetHeight);

	// Set IE Fudge -- For some reason, IE7 works just fine, but IE6 is 19px off
	
	var IE_left = 0;
	var IE_right = 0;

	if (msieversion() == 6)
	{
		IE_left = 19;
	}

	// Set both heights to the same (max) value.  Note that we have to append "px" to the value.
	leftVisualPadding.style.height = (maxHeight - leftColumn.offsetHeight + IE_left) + "px";
	rightVisualPadding.style.height = (maxHeight - rightColumn.offsetHeight + IE_right) + "px";
}

function msieversion()
{
	var ua = window.navigator.userAgent
	var msie = ua.indexOf ( "MSIE " )
	
	if ( msie > 0 )      // If Internet Explorer, return version number
		return parseInt (ua.substring (msie+5, ua.indexOf (".", msie )))
	else                 // If another browser, return 0
		return 0

}

function init()
{
	// Resize Columns
	resizeColumns();

	window.onresize = function() {
		resizeColumns();
	}
}

// Buchungsformular -----------------------------------------------//
//set todays date
Now = new Date();
NowDay = Now.getDate();
NowMonth = Now.getMonth();
NowYear = Now.getYear();
if (NowYear < 2000) NowYear += 1900; //for Netscape

//function for returning how many days there are in a month including leap years
function DaysInMonth(WhichMonth, WhichYear)
{
  var DaysInMonth = 31;
  if (WhichMonth == "April" || WhichMonth == "Juni" || WhichMonth == "September" || WhichMonth == "November") DaysInMonth = 30;
  if (WhichMonth == "Februar" && (WhichYear/4) != Math.floor(WhichYear/4))	DaysInMonth = 28;
  if (WhichMonth == "Februar" && (WhichYear/4) == Math.floor(WhichYear/4))	DaysInMonth = 29;
  return DaysInMonth;
}

//function to change the available days in a months
function ChangeOptionDays(Which)
{
  DaysObject = eval("document.FormZimmerAnfrage." + Which + "tag");
  MonthObject = eval("document.FormZimmerAnfrage." + Which + "monat");
  YearObject = eval("document.FormZimmerAnfrage." + Which + "jahr");

  Month = MonthObject[MonthObject.selectedIndex].text;
  Year = YearObject[YearObject.selectedIndex].text;

  DaysForThisSelection = DaysInMonth(Month, Year);
  CurrentDaysInSelection = DaysObject.length;
  if (CurrentDaysInSelection > DaysForThisSelection)
  {
    for (i=0; i<(CurrentDaysInSelection-DaysForThisSelection); i++)
    {
      DaysObject.options[DaysObject.options.length - 1] = null
    }
  }
  if (DaysForThisSelection > CurrentDaysInSelection)
  {
    for (i=CurrentDaysInSelection; i<(DaysForThisSelection); i++)
    {
      DaysObject.options[ i ] = new Option(i +1 + ".");
    }
  }
    if (DaysObject.selectedIndex < 0) DaysObject.selectedIndex == 0;
}


//function to set options to today
function SetToToday(Which)
{
  DaysObject = eval("document.FormZimmerAnfrage." + Which + "tag");
  MonthObject = eval("document.FormZimmerAnfrage." + Which + "monat");
  YearObject = eval("document.FormZimmerAnfrage." + Which + "jahr");

  YearObject[0].selected = true;
  MonthObject[NowMonth].selected = true;

  ChangeOptionDays(Which);

  DaysObject[NowDay-1].selected = true;
}

function SetToTomorrow(Which)
{
  if (NowDay == DaysForThisSelection)
  {
     NowMonth = NowMonth + 1;
     NowDay = 0;
  }

  DaysObject = eval("document.FormZimmerAnfrage." + Which + "tag");
  MonthObject = eval("document.FormZimmerAnfrage." + Which + "monat");
  YearObject = eval("document.FormZimmerAnfrage." + Which + "jahr");

  YearObject[0].selected = true;
  MonthObject[NowMonth].selected = true;

  ChangeOptionDays(Which);

  DaysObject[NowDay].selected = true;
}

//function to write option years plus x
function WriteYearOptions(YearsAhead)
{
  line = "";
  for (i=0; i<YearsAhead; i++)
  {
    line += "<OPTION>";
    line += NowYear + i;
  }
  return line;
}


