function redirectToBooking() {

	//Datumseingabe aus Schnellreservierung ohne Punkt Trennung
	var arrive = (document.getElementById('inputArrive').value).replace(/[.]/g,"");
	var depart = (document.getElementById('inputDepart').value).replace(/[.]/g,"");	
	
	var arriveDIRS = (document.getElementById('inputArrive').value);		//DIRS
	var departDIRS = (document.getElementById('inputDepart').value);		//DIRS		

	//Check dates - for numbered dates only: 22072010
	var a_day = arrive.substring(0,2);
	var a_month = arrive.substring(2,4);
	var a_year = arrive.substring(4,8);
	
	var d_day = depart.substring(0,2);
	var d_month = depart.substring(2,4);
	var d_year = depart.substring(4,8);
	
	var arriveDate = new Date(a_year,a_month-1,a_day); 	
	var departDate = new Date(d_year,d_month-1,d_day); 
	var diff = Math.ceil((departDate-arriveDate)/1000/60/60/24);
	
	
	if (diff < 1){
		window.alert ("Falsche Datumseingabe! \nBitte korrigieren Sie das Anreise- und/oder Abreisedatum!");
	}
	else if (diff >= 1 ){
		var hotelName = checkHotel();
		redirect(hotelName,arriveDIRS,departDIRS);	
	}
}

function checkHotel(){

	var tempURL = window.location.toString();
	
	var hotelBeginDE = tempURL.search(/\/de\//);
	var hotelBeginEN = tempURL.search(/\/en\//);
	var hotelBeginHU = tempURL.search(/\/hu\//);
		
	if(hotelBeginDE != -1){
		var hotelLang = "/de/";
		var hotelBegin = hotelBeginDE;
	} else if(hotelBeginEN != -1){
		var hotelLang = "/en/";
		var hotelBegin = hotelBeginEN;
	} else if(hotelBeginHU != -1){
		var hotelLang = "/hu/";
		var hotelBegin = hotelBeginHU;
	}
	
	
	var cutBegin = tempURL.slice(hotelBegin+4);
	var hotelEnd = cutBegin.search(/\//);
	var hotelSlice = cutBegin.slice(0,hotelEnd);	
	var hotelName = hotelLang + hotelSlice;
	
	return hotelName;
}

function redirect (hotelNameLong,arriveDIRS,departDIRS){

	//arriveDIRS & departDIRS = DIRS21
	
	var lang = hotelNameLong.slice(1,3);
	var hotelName = hotelNameLong.slice(4);
	var sprache;
	
	if (lang == "hu"){
		langOpt = "en";	
	} else if (lang != "hu"){
		langOpt = lang;
	}

	if (hotelName == "salzburg-center"){
		url = 'https://www.dirs21.de/dirs21_book/starinnhotelscom_salzburg-zentrum/default.aspx?Anreise='+arriveDIRS+'&Abreise='+departDIRS+'&sprache='+langOpt;
		window.open(url, "Reservation");
	}
	if (hotelName == "salzburg-airport"){
		//url = 'https://www.dirs21.de/dirs21_book/starinnhotelscom/default.aspx?knr=62331&Anreise='+arriveDIRS+'&Abreise='+departDIRS+'&sprache='+langOpt;
		url = 'https://ibe.dirs21.de/Channels/starinnhotelscom_2/Default.aspx?knr=62331&Anreise='+arriveDIRS+'&Abreise='+departDIRS+'&sprache='+langOpt;
		window.open(url, "Reservation");
	}
	if (hotelName == "salzburg-gablerbraeu"){
		url = 'https://www.dirs21.de/dirs21_book/starinnhotelscom_2/default.aspx?knr=62886&Anreise='+arriveDIRS+'&Abreise='+departDIRS+'&sprache='+langOpt;
		window.open(url, "Reservation");
	}
	if (hotelName == "frankfurt-center"){
		url = 'https://www.dirs21.de/dirs21_book/starinnhotelscom/default.aspx?knr=62301&Anreise='+arriveDIRS+'&Abreise='+departDIRS+'&sprache='+langOpt;
		window.open(url, "Reservation");
	}
	if (hotelName == "bremen-columbus"){
		url = 'https://www.dirs21.de/dirs21_book/starinnhotelscom/default.aspx?knr=62326&Anreise='+arriveDIRS+'&Abreise='+departDIRS+'&sprache='+langOpt;
		window.open(url, "Reservation");
	}
	if (hotelName == "karlsruhe-siemensallee"){
		url = 'https://ibe.dirs21.de/Channels/starinnhotelscom_2/default.aspx?knr=62327&Anreise='+arriveDIRS+'&Abreise='+departDIRS+'&sprache='+langOpt;
		window.open(url, "Reservation");
	}
	if (hotelName == "munich-north"){
		//url = 'https://www.dirs21.de/dirs21_book/starinnhotelscom/default.aspx?knr=62328&Anreise='+arriveDIRS+'&Abreise='+departDIRS+'&sprache='+langOpt;
		url = 'https://ibe.dirs21.de/Channels/starinnhotelscom_munich-north/Default.aspx?Anreise='+arriveDIRS+'&Abreise='+departDIRS+'&sprache='+langOpt;
		window.open(url, "Reservation");
	}
	if (hotelName == "munich-schwabing"){
		//url = 'https://www.dirs21.de/dirs21_book/starinnhotelscom/default.aspx?knr=62329&Anreise='+arriveDIRS+'&Abreise='+departDIRS+'&sprache='+langOpt;
		url = 'https://ibe.dirs21.de/Channels/starinnhotelscom_2/Default.aspx?knr=62329&Anreise='+arriveDIRS+'&Abreise='+departDIRS+'&sprache='+langOpt;
		window.open(url, "Reservation");
	}
	if (hotelName == "regensburg-center"){
		url = 'https://www.dirs21.de/dirs21_book/starinnhotelscom/default.aspx?knr=62330&Anreise='+arriveDIRS+'&Abreise='+departDIRS+'&sprache='+langOpt;
		window.open(url, "Reservation");
	}
	if (hotelName == "budapest-center"){
		url = 'https://www.dirs21.de/dirs21_book/starinnhotelscom/default.aspx?knr=62332&Anreise='+arriveDIRS+'&Abreise='+departDIRS+'&sprache='+langOpt;
		window.open(url, "Reservation");
	}

}		
