function yearOptions() {
         var i=0;
         var datum = new Date();
	var jahr = datum.getFullYear();
	while (i<6){
         	document.write("<option value="+jahr+">"+jahr+"</option>");
                 i++;
                 jahr++;
         }
}

function yearOptions1() {
         var i=0;
         var datum = new Date();
	var jahr = datum.getFullYear();
         var month = datum.getMonth() + 1;
         var tag = datum.getDate();
	while (i<6){
         	if(month==12 && tag==31){
                    document.write("<option value="+(jahr+1)+">"+(jahr+1)+"</option>");
                 }
                 else{
         		document.write("<option value="+jahr+">"+jahr+"</option>");
                 }
                 i++;
                 jahr++;
         }
}

function dayOptions() {
         var i=1;
         var datum = new Date();
         var tag = datum.getDate();
	while (i<32){
                 if(i==tag){
                      document.write("<option value="+i+" selected>"+i+"</option>");
                 }
                 else{
                 	document.write("<option value="+i+">"+i+"</option>");
                 }
                 i++;
         }
}

function dayOptions1() {
         var i=1;
         var datum = new Date();
         var month = datum.getMonth() + 1;
         var tag = datum.getDate();
	while (i<32){
                 if((month==1||month==3||month==5||month==7||month==8||month==10||month==12)&&tag==31&&i==1){
                      document.write("<option value="+i+" selected>"+i+"</option>");
                 }
                 else if((month==2||month==4||month==6||month==9||month==11)&&tag==30&&i==1){
                      document.write("<option value="+i+" selected>"+i+"</option>");
                 }
                 else if((month==1||month==3||month==5||month==7||month==8||month==10||month==12)&&tag!=31&&i==(tag+1)){
                      document.write("<option value="+i+" selected>"+i+"</option>");
                 }
                 else if((month==2||month==4||month==6||month==9||month==11)&&tag!=30&&i==(tag+1)){
                      document.write("<option value="+i+" selected>"+i+"</option>");
                 }
                 else{
                 	document.write("<option value="+i+">"+i+"</option>");
                 }
                 i++;
         }
}

function monthOptions() {
         var i=1;
         var monatsname = new Array("Januar", "Februar", "M&auml;rz", "April", "Mai", "Juni", "Juli",
                          "August", "September", "Oktober", "November", "Dezember");
         var datum = new Date();
         var month = datum.getMonth() + 1;
	while (i<13){
                 if(i==month){
                 	document.write('<option value="'+i+'/" selected>'+monatsname[i-1]+'</option>');
                 }
                 else{
                     	document.write('<option value="'+i+'/">'+monatsname[i-1]+'</option>');
                 }
                 i++;
         }
}

function monthOptions1() {
         var i=1;
         var monatsname = new Array("Januar", "Februar", "M&auml;rz", "April", "Mai", "Juni", "Juli",
                          "August", "September", "Oktober", "November", "Dezember");
         var datum = new Date();
         var month = datum.getMonth() + 1;
         var tag = datum.getDate();
	while (i<13){
                 if((month==12)&&tag==31&&i==1){
                      document.write('<option value="'+i+'/" selected>'+monatsname[i-1]+'</option>');
                 }
                 else if((month==1||month==3||month==5||month==7||month==8||month==10||month==12)&&tag==31&&i==(month+1)){
                      document.write('<option value="'+i+'/" selected>'+monatsname[i-1]+'</option>');
                 }
                 else if((month==2||month==4||month==6||month==9||month==11)&&tag==30&&i==(month+1)){
                      document.write('<option value="'+i+'/" selected>'+monatsname[i-1]+'</option>');
                 }
                 else if((month==1||month==3||month==5||month==7||month==8||month==10||month==12)&&tag!=31&&i==month){
                      document.write('<option value="'+i+'/" selected>'+monatsname[i-1]+'</option>');
                 }
                 else if((month==2||month==4||month==6||month==9||month==11)&&tag!=30&&i==month){
                      document.write('<option value="'+i+'/" selected>'+monatsname[i-1]+'</option>');
                 }
                 else{
                     	document.write('<option value="'+i+'/">'+monatsname[i-1]+'</option>');
                 }
                 i++;
         }
}

function monthOptions2() {
         var i=1;
         var monatsname = new Array("January", "February", "March", "April", "May", "June", "July",
                          "August", "September", "October", "November", "December");
         var datum = new Date();
         var month = datum.getMonth() + 1;
	while (i<13){
                 if(i==month){
                 	document.write('<option value="'+i+'/" selected>'+monatsname[i-1]+'</option>');
                 }
                 else{
                     	document.write('<option value="'+i+'/">'+monatsname[i-1]+'</option>');
                 }
                 i++;
         }
}

function monthOptions3() {
         var i=1;
         var monatsname = new Array("January", "February", "March", "April", "May", "June", "July",
                          "August", "September", "October", "November", "December");
         var datum = new Date();
         var month = datum.getMonth() + 1;
         var tag = datum.getDate();
	while (i<13){
                 if((month==12)&&tag==31&&i==1){
                      document.write('<option value="'+i+'/" selected>'+monatsname[i-1]+'</option>');
                 }
                 else if((month==1||month==3||month==5||month==7||month==8||month==10||month==12)&&tag==31&&i==(month+1)){
                      document.write('<option value="'+i+'/" selected>'+monatsname[i-1]+'</option>');
                 }
                 else if((month==2||month==4||month==6||month==9||month==11)&&tag==30&&i==(month+1)){
                      document.write('<option value="'+i+'/" selected>'+monatsname[i-1]+'</option>');
                 }
                 else if((month==1||month==3||month==5||month==7||month==8||month==10||month==12)&&tag!=31&&i==month){
                      document.write('<option value="'+i+'/" selected>'+monatsname[i-1]+'</option>');
                 }
                 else if((month==2||month==4||month==6||month==9||month==11)&&tag!=30&&i==month){
                      document.write('<option value="'+i+'/" selected>'+monatsname[i-1]+'</option>');
                 }
                 else{
                     	document.write('<option value="'+i+'/">'+monatsname[i-1]+'</option>');
                 }
                 i++;
         }
}

function chkFormular() {
	error=0;
         if(document.quickbuchung.departureYear.selectedIndex<document.quickbuchung.arrivalYear.selectedIndex)
         {
         	error++;
         }
         else if(document.quickbuchung.departureYear.selectedIndex=document.quickbuchung.arrivalYear.selectedIndex)
         {
                 if(document.quickbuchung.departureMonth.selectedIndex<document.quickbuchung.arrivalMonth.selectedIndex)
         	{
         		error++;
         	}
                 else if(document.quickbuchung.departureMonth.selectedIndex=document.quickbuchung.arrivalMonth.selectedIndex)
                 {
                       if(document.quickbuchung.dD.selectedIndex<document.quickbuchung.aD.selectedIndex)
         		{
         			error++;
         		}
                 }
         }

         if (error == 0)
         {
         document.quickbuchung.aMY.value=document.quickbuchung.arrivalMonth.value+'-'+document.quickbuchung.arrivalYear.value;
		 document.quickbuchung.dMY.value=document.quickbuchung.departureMonth.value+'-'+document.quickbuchung.departureYear.value;
		 document.quickbuchung.action='http://www.themandala.de/booking/process/availability/language/de'
         document.quickbuchung.submit();
         }
         else
         {
         	alert("Ihr Abreisedatum liegt zeitlich vor dem Ankunftsdatum. Bitte überprüfen Sie Ihre Angaben.");
         }
}

function chkFormularSuites() {
	error=0;
         if(document.quickbuchung.departureYear.selectedIndex<document.quickbuchung.arrivalYear.selectedIndex)
         {
         	error++;
         }
         else if(document.quickbuchung.departureYear.selectedIndex=document.quickbuchung.arrivalYear.selectedIndex)
         {
                 if(document.quickbuchung.departureMonth.selectedIndex<document.quickbuchung.arrivalMonth.selectedIndex)
         	{
         		error++;
         	}
                 else if(document.quickbuchung.departureMonth.selectedIndex=document.quickbuchung.arrivalMonth.selectedIndex)
                 {
                       if(document.quickbuchung.dD.selectedIndex<document.quickbuchung.aD.selectedIndex)
         		{
         			error++;
         		}
                 }
         }

         if (error == 0)
         {
         //adults=document.quickbuchung.adults.value;
         //childs=document.quickbuchung.childs.value;
         //arrival=document.quickbuchung.aD.value+'/'+document.quickbuchung.arrivalMonth.value+document.quickbuchung.arrivalYear.value;
         //departure=document.quickbuchung.dD.value+'/'+document.quickbuchung.departureMonth.value+document.quickbuchung.departureYear.value;

         //document.quickbuchung.action='https://reservations.synxis.com/LBE/rez.aspx?hotel=12434&Chain=5154&Dest=mandala&locale=de-DE&src=mandalasuites&arrive='+arrival+'&depart='+departure+'&Adult='+adults+'&Child='+childs+'&step=2';
		 document.quickbuchung.aMY.value=document.quickbuchung.arrivalMonth.value+'-'+document.quickbuchung.arrivalYear.value;
		 document.quickbuchung.dMY.value=document.quickbuchung.departureMonth.value+'-'+document.quickbuchung.departureYear.value;
		 document.quickbuchung.action='http://www.themandala.de/booking/process/availability/language/de'
         document.quickbuchung.submit();
         }
         else
         {
         	alert("Ihr Abreisedatum liegt zeitlich vor Ihrem Ankunftsdatum. Bitte prüfen Sie Ihre Angaben.");
         }
}

function chkFormularEn() {
	error=0;
         if(document.quickbuchung.departureYear.selectedIndex<document.quickbuchung.arrivalYear.selectedIndex)
         {
         	error++;
         }
         else if(document.quickbuchung.departureYear.selectedIndex=document.quickbuchung.arrivalYear.selectedIndex)
         {
                 if(document.quickbuchung.departureMonth.selectedIndex<document.quickbuchung.arrivalMonth.selectedIndex)
         	{
         		error++;
         	}
                 else if(document.quickbuchung.departureMonth.selectedIndex=document.quickbuchung.arrivalMonth.selectedIndex)
                 {
                       if(document.quickbuchung.dD.selectedIndex<document.quickbuchung.aD.selectedIndex)
         		{
         			error++;
         		}
                 }
         }

         if (error == 0)
         {
         document.quickbuchung.aMY.value=document.quickbuchung.arrivalMonth.value+'-'+document.quickbuchung.arrivalYear.value;
		 document.quickbuchung.dMY.value=document.quickbuchung.departureMonth.value+'-'+document.quickbuchung.departureYear.value;
		 document.quickbuchung.action='http://www.themandala.de/booking/process/availability/language/en'
         document.quickbuchung.submit();
         }
         else
         {
         	alert("Your departure is before your arrival. Please check your entries.");
         }
}

function chkFormularSuitesEn() {
	error=0;
         if(document.quickbuchung.departureYear.selectedIndex<document.quickbuchung.arrivalYear.selectedIndex)
         {
         	error++;
         }
         else if(document.quickbuchung.departureYear.selectedIndex=document.quickbuchung.arrivalYear.selectedIndex)
         {
                 if(document.quickbuchung.departureMonth.selectedIndex<document.quickbuchung.arrivalMonth.selectedIndex)
         	{
         		error++;
         	}
                 else if(document.quickbuchung.departureMonth.selectedIndex=document.quickbuchung.arrivalMonth.selectedIndex)
                 {
                       if(document.quickbuchung.dD.selectedIndex<document.quickbuchung.aD.selectedIndex)
         		{
         			error++;
         		}
                 }
         }

         if (error == 0)
         {
         document.quickbuchung.aMY.value=document.quickbuchung.arrivalMonth.value+'-'+document.quickbuchung.arrivalYear.value;
		 document.quickbuchung.dMY.value=document.quickbuchung.departureMonth.value+'-'+document.quickbuchung.departureYear.value;
		 document.quickbuchung.action='http://www.themandala.de/booking/process/availability/language/en'
         document.quickbuchung.submit();
         }
         else
         {
         	alert("Your departure is before your arrival. Please check your entries.");
         }
}

function selectDay() {
         if (document.quickbuchung.aD.selectedIndex != 30)
         {
    		document.quickbuchung.dD.selectedIndex = document.quickbuchung.aD.selectedIndex+1;
                 document.quickbuchung.departureMonth.selectedIndex = document.quickbuchung.arrivalMonth.selectedIndex;
                 document.quickbuchung.departureYear.selectedIndex = document.quickbuchung.arrivalYear.selectedIndex;
         }
         else
         {
         	document.quickbuchung.dD.selectedIndex = 0;
                 if (document.quickbuchung.arrivalMonth.selectedIndex != 11){
                 document.quickbuchung.departureMonth.selectedIndex = document.quickbuchung.arrivalMonth.selectedIndex+1;
                 }
                 else {document.quickbuchung.departureMonth.selectedIndex=0;}
         }
}

function selectMonth() {
         if (document.quickbuchung.arrivalMonth.selectedIndex != 11 && document.quickbuchung.aD.selectedIndex == 30)
         {
    		document.quickbuchung.departureMonth.selectedIndex = document.quickbuchung.arrivalMonth.selectedIndex+1;
                 document.quickbuchung.departureYear.selectedIndex = document.quickbuchung.arrivalYear.selectedIndex;
         }
         else if ((document.quickbuchung.arrivalMonth.selectedIndex != 11 || document.quickbuchung.arrivalMonth.selectedIndex == 11) && document.quickbuchung.aD.selectedIndex != 30)
         {
    		document.quickbuchung.departureMonth.selectedIndex = document.quickbuchung.arrivalMonth.selectedIndex;
                 document.quickbuchung.departureYear.selectedIndex = document.quickbuchung.arrivalYear.selectedIndex;
         }
         else if (document.quickbuchung.arrivalMonth.selectedIndex == 11 && document.quickbuchung.aD.selectedIndex == 30)
         {
         	document.quickbuchung.departureMonth.selectedIndex = 0;
                 if (document.quickbuchung.departureYear.options[document.quickbuchung.arrivalYear.selectedIndex+1])
	         {
	                 document.quickbuchung.departureYear.selectedIndex = document.quickbuchung.arrivalYear.selectedIndex+1;
	         }
         }
}

function selectYear() {
         if(document.quickbuchung.aD.selectedIndex == 30 && document.quickbuchung.arrivalMonth.selectedIndex == 11)
	{
	         if (document.quickbuchung.departureYear.options[document.quickbuchung.arrivalYear.selectedIndex+1])
	         {
	                 document.quickbuchung.departureYear.selectedIndex = document.quickbuchung.arrivalYear.selectedIndex+1;
	         }
         }
         else {
         	document.quickbuchung.departureYear.selectedIndex = document.quickbuchung.arrivalYear.selectedIndex;
         }
}