function weihnachten(){
window.open('weihnacht3.htm' , 'Weihnachten1', 'toolbar=no,scrollbars=no,resizable=no,width=450,height=315,top=170,left=90');
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_openBrWindow(theURL,winName,features) { 
window.open(theURL,winName,features);
}


function checkDatum(entry){
var val = entry.value + "";
if(val.length < 10 || val.lenght > 10){
	entry.focus();
     
      alert("Ungültiges Datum!");
      return false;}
if(val.substr(4,1) != "-" || val.substr(7,1) != "-"){
	entry.focus();
     
      alert("Ungültiges Datum!");
      return false;}
jj=val.substr(0,4);
mm=val.substr(5,2);
tt=val.substr(8,2);
 if (!validDate(tt, mm, jj)) {
	entry.focus();
     
      alert("Ungültiges Datum!");
      return false;}
return true;
}


function checkDatumAnreise(frm) {
  var day = parseInt(frm.Anreisetag.options[frm.Anreisetag.selectedIndex].value, 10);
  var mon = parseInt(frm.Anreisemonat.options[frm.Anreisemonat.selectedIndex].value, 10);
  var yea = parseInt(frm.Anreisejahr.options[frm.Anreisejahr.selectedIndex].value, 10);


  if (!validDate(day, mon, yea)) {
    frm.Anreisetag.focus();
    alert("Bitte wählen Sie ein gültiges Anreisedatum aus.");
    return false;
  }
  return true;
}



function validDate(day, mon, year)   {

 // mon = mon + "";
  //year = year + "";
  //mon = mon.toUpperCase();


 

 if ((day < "01")  || (day > "31") || (day == "NaN")) { return 0;  }
 if ((mon < "01")  || (mon > "12") || (mon == "NaN")) { return 0;  }
  if ((year < 0)  || (year > 9999) || (year == "NaN") || (year == "---")) { return 0;  }
  if ((mon != "01") && (mon != "02") && (mon != "03") && (mon != "04") && (mon != "05") && (mon != "06") && (mon != "07") && (mon != "08") && (mon != "09") && (mon != "10") && (mon != "11") && (mon != "12"))  { return 0; }
  if ((mon== "01") || (mon== "03") || (mon== "05") || (mon== "07") || (mon== "08") || (mon== "10") || (mon== "12")) { return 1;
  } else {
    if ((mon== "04") || (mon== "06") ||   (mon== "09") || (mon== "11")) {
      if (day <= 30)  {   return 1; }    }
    else {
      if (mon == "02")   {
        if (((year % 4) == 0) && ((year % 100) != 0))  {
          if (day <= 29) {  return 1;  }
        }
        if ((year % 400) == 0) {
          if (day <= 29)   {  return 1;    }
        }
        if (day <= 28) {  return 1;    }
      } else {
        return 0;
      }
    }
  }
  return 0;
}



function checkAnzahl(entry) {
  var val = entry.value + "";         
  var maxDecimalPlaces; 
  if (entry.form[entry.name+"_decimalPlaces"] == null) { 
    maxDecimalPlaces = 0; 
  } else { 
    maxDecimalPlaces = parseInt(eval(entry.form[entry.name+"_decimalPlaces"].value));
  }
  var newVal = ""; 
  var decimalPoint=false;
  var decimalPlaces=0;
  var thousandFoundIndex = -1;
  var dotFoundIndex = -1;
  var invalidNumber = false;
  if (val.length == 1 && val.substring(0,1) =="-") {      
    invalidNumber = true;
  }
  for (var i=0;i<val.length;i++)   {      
    letter=val.substring(i,i+1);          
    if ( ((letter<"0" || "9"<letter)&&(letter!=",")&&(letter!="-") && (letter!="."))
         || ((letter==",")&&(decimalPoint==true)) ) {
      entry.focus();
      entry.select();
      alert("Bitte nur Zahlen eingeben!");
      return false;
    }
    if ((decimalPoint==true)&&(letter!="-")) { decimalPlaces++; }
    if (decimalPlaces>maxDecimalPlaces && letter!="0") {
      entry.focus();
      entry.select();
      alert("Maximal erlaubte Dezimalstellen: " +maxDecimalPlaces);
      return false;
    }
    if ((letter=="-") && i!=0) {
      entry.focus();
      entry.select();
      alert("Ungültige Zahl");
      return false;
    }
    if (letter==",") { decimalPoint=true; }
    if (letter==".") {
      if (dotFoundIndex >= 0) {
        invalidNumber = true;
      } else {
        thousandFoundIndex = i;
      }
    }
    if (letter==",") {
      dotFoundIndex = i;
    }
    if (dotFoundIndex == i && i == (val.length - 1))  {
      invalidNumber = true;
    }
    if (thousandFoundIndex >= 0 && dotFoundIndex == i && ((dotFoundIndex - thousandFoundIndex) != 4))  {
      invalidNumber = true;
    }
    if (thousandFoundIndex >= 0 && dotFoundIndex < 0 && (i == val.length - 1) && (i - thousandFoundIndex != 3 )){
      invalidNumber = true;
    }
    newVal = newVal + letter;
  }
  entry.value = newVal;
  if (invalidNumber) {
    alert("Ungültige Zahl");
    entry.focus();
    entry.select();
    return false;
  }
  return true;
}

function checkText(entry) {
  var val = entry.value + "";
  val = val.replace(/ */, "");
  if (val.length > 0)  { return true; }
  entry.focus();
  entry.select();
  alert("Dieses Feld darf nicht leer sein.");
  return false;
}

function checkDatumAnreise(frm) {
  var day = parseInt(frm.Anreisetag.options[frm.Anreisetag.selectedIndex].value, 10);
  var mon = parseInt(frm.Anreisemonat.options[frm.Anreisemonat.selectedIndex].value, 10);
  var yea = parseInt(frm.Anreisejahr.options[frm.Anreisejahr.selectedIndex].value, 10);


  if (!validDate(day, mon, yea)) {
    frm.Anreisetag.focus();
    alert("Bitte wählen Sie ein gültiges Anreisedatum aus.");
    return false;
  }
  return true;
}

function checkDatumAbreise(frm) {
  var day = parseInt(frm.Abreisetag.options[frm.Abreisetag.selectedIndex].value, 10);
  var mon = parseInt(frm.Abreisemonat.options[frm.Abreisemonat.selectedIndex].value, 10);
  var yea = parseInt(frm.Abreisejahr.options[frm.Abreisejahr.selectedIndex].value, 10);

  if (!validDate(day, mon, yea)) {
    frm.Abreisetag.focus();
    alert("Bitte wählen Sie ein gültiges Abreisedatum aus.");
    return false;
  }
  return true;
}

function checkStartDatumAnreise(frm) {
  var day = parseInt(frm.Anreisetag.options[frm.Anreisetag.selectedIndex].value);
  var mon = frm.Anreisemonat.options[frm.Anreisemonat.selectedIndex].value;
  var yea = parseInt(frm.Anreisejahr.options[frm.Anreisejahr.selectedIndex].value);
  var daynow = parseInt(frm.sdac_DN.value);
  var monthnow = parseInt(frm.sdac_MN.value);
  var yearnow = parseInt(frm.sdac_YN.value);
  if (!compareDate(daynow, monthnow, yearnow, day, mon, yea, 1)) {
    frm.Anreisetag.focus();
    alert("Das angegebene Anreisedatum liegt in der Vergangenheit.");
    return false;
  }
  return true;
}

function checkStartDatumAbreise(frm) {
  var day = parseInt(frm.Abreisetag.options[frm.Abreisetag.selectedIndex].value);
  var mon = frm.Abreisemonat.options[frm.Abreisemonat.selectedIndex].value;
  var yea = parseInt(frm.Abreisejahr.options[frm.Abreisejahr.selectedIndex].value);
  var daynow = parseInt(frm.sdac_DN.value);
  var monthnow = parseInt(frm.sdac_MN.value);
  var yearnow = parseInt(frm.sdac_YN.value);
  if (!compareDate(daynow, monthnow, yearnow, day, mon, yea, 1)) {
    frm.Abreisetag.focus();
    alert("Das angegebene Abreisedatum liegt in der Vergangenheit.");
    return false;
  }
  return true;
}

function checkDatumAnreiseAbreise(frm) {
 var day = parseInt(frm.Anreisetag.options[frm.Anreisetag.selectedIndex].value);
  var mon = frm.Anreisemonat.options[frm.Anreisemonat.selectedIndex].value;
  var yea = parseInt(frm.Anreisejahr.options[frm.Anreisejahr.selectedIndex].value);
var anreise = yea;
if(mon<10){
	anreise=anreise+"0"+mon;}
else {
	anreise=anreise+mon;}
if(day<10){
	anreise=anreise+"0"+day;}
else {
	anreise=anreise+day;}

 var day = parseInt(frm.Abreisetag.options[frm.Abreisetag.selectedIndex].value);
  var mon = frm.Abreisemonat.options[frm.Abreisemonat.selectedIndex].value;
  var yea = parseInt(frm.Abreisejahr.options[frm.Abreisejahr.selectedIndex].value);
var abreise = yea;
if(mon<10){
	abreise=abreise+"0"+mon;}
else {
	abreise=abreise+mon;}
if(day<10){
	abreise=abreise+"0"+day;}
else {
	abreise=abreise+day;}


  if (abreise < anreise) {
    frm.Abreisetag.focus();
    alert("Das angegebene Abreisedatum liegt vor dem Anreisedatum.");
    return false;
  }
  return true;
}



function checkValueRange(entry, min, max, empty) {
  if (entry.value.length==0 && empty) { return true; }
  var value=parseFloat(convertLocaleSpecificNumberToFloat(entry.value));
  if (value>parseFloat(max)) {
    alert("Größte erlaubte Eingabe: " + max );
    entry.focus();
    return false;
  } else if (value<parseFloat(min)) {
    alert("Kleinste erlaubte Eingabe: " + min );
    entry.focus();
    return false;
  } else {
    return true;
  }
}

function compareDate(dayf, monthf, yearf, dayt, montht, yeart, equal) {
  if (parseInt(yeart) < parseInt(yearf)) {  return 0; }
  if (parseInt(yeart) > parseInt(yearf)) {  return 1; }
  if (parseInt(montht) < parseInt(monthf)) {  return 0; }
  if (parseInt(montht) > parseInt(monthf)) { return 1; }
  if (equal)   {
    if (parseInt(dayt) < parseInt(dayf))   {  return 0; }
	} else {
		if (parseInt(dayt) <= parseInt(dayf))   {  return 0; }
  }
  return 1;
}


function checkbuchung()        {

if(!checkDatumAnreise(document.f)) { return false; }
if(!checkStartDatumAnreise(document.f)) { return false; }
if(!checkDatumAbreise(document.f)) { return false; }
if(!checkStartDatumAbreise(document.f)) { return false; }
if(!checkDatumAnreiseAbreise(document.f)) { return false; }



 if (document.f.Einzelzimmer.value == 0 && document.f.Doppelzimmer.value == 0 && document.f.Dreibettzimmer.value == 0)            {
            		 alert ("Geben Sie bitte eine Zimmeranzahl ein!");
		document.f.Einzelzimmer.focus();
            		 return false;
             }
if(!checkText(document.f.Erwachsene)) { return false; }
if(!checkAnzahl(document.f.Erwachsene)) { return false; }
//if(!checkValueRange(document.f.Erwachsene, "-99.0", "99.0", "false")) { return false; }
if(!checkAnzahl(document.f.Kinder)) { return false; }
//if(!checkValueRange(document.f.Kinder, "-99.0", "99.0", "false")) { return false; }
if(!checkText(document.f.Nachname)) { return false; }

if(!checkText(document.f.Strasse)) { return false; }
if(!checkText(document.f.PLZ)) { return false; }
if(!checkText(document.f.Ort)) { return false; }
if(!checkText(document.f.Email)) { return false; }
if(document.f.Email.value.indexOf('@') == -1) {
   alert("Bitte geben Sie eine gültige Mailadresse ein!");
   document.f.Email.focus();
   return false;
  }

       return true;
}



