var fenster=null;
	 
function animation_start ()
	{
	document.query.module.value = 3;

	 fenster = open ("","Anzeige", "width=410,height=300,top=218,left=200");
	 fenster.document.open ();
	 fenster.outerHeight = 300;
	 fenster.outerWidth = 410;
	 fenster.innerHeight = 300;
	 fenster.innerWidth = 410;
	 fenster.screenX = 200;
	 fenster.screenY = 218;
	 
	 fenster.document.open ();
	 
	 with (fenster.document)
	 {
	  write ("<html>");
	  write ("<title>Anfrage in Bearbeitung .....</title>");
	  write ('<body onblur="window.close()">');
	 
	  write ('<img border="0" width="385" height="282" src="http://flight1.travel.ch/flightnewgif/ssr/2d_avail.gif"/>'); 
	  write ("</body>");
	  write ("</html>");
	 }
	 fenster.document.close ();
}
	 
function animation_ende ()
{
	if (fenster != null) fenster.close ();
}
function start_program(theForm)
{
	if (theForm.adult.value == 0 && theForm.youth.value == 0 && theForm.student.value == 0) 
	{
		alert("Achtung! Du musst mindestens einen Erwachsenen\noder einen Jugendlichen bzw. Student unter\n'Anzahl Reisende' wählen!");
		theForm.adult.focus();	
		return (false);
	}

	datum = 0;
	
	if (navigator.appName == 'Microsoft Internet Explorer') 
	{
		adult_zahl = parseInt (theForm.adult.value);
		youth_zahl = parseInt (theForm.youth.value);
		student_zahl = parseInt (theForm.student.value);
		if (theForm.pday) datum =  parseInt (theForm.pyear.value)*10000 + parseInt (theForm.pmonth.value)*100 + parseInt (theForm.pday.value);
	}
	else
	{
		adult_zahl = parseInt (theForm.adult.options[theForm.adult.selectedIndex].value);
		youth_zahl = parseInt (theForm.youth.options[theForm.youth.selectedIndex].value);
		student_zahl = parseInt (theForm.student.options[theForm.student.selectedIndex].value);
		if (theForm.pday) datum = parseInt (theForm.pyear.options[theForm.pyear.selectedIndex].value)*10000 + parseInt (theForm.pmonth.options[theForm.pmonth.selectedIndex].value)*100 + parseInt (theForm.pday.options[theForm.pday.selectedIndex].value);
	}
	
	if (adult_zahl != 0 && (youth_zahl != 0 || student_zahl != 0)) 
	{
		alert("Achtung !  Du darfst nicht Erwachsene und Jugendliche oder Studenten zusammen buchen!");
		theForm.adult.focus();	
		return (false);
	}
	if (youth_zahl != 0 && student_zahl != 0) 
	{
		alert("Achtung !  Du darfst nicht Jugendliche und Studenten zusammen buchen!");
		theForm.youth.focus();	
		return (false);
	}

	if ((student_zahl || youth_zahl) && datum < 19700000)
	{
		alert("Bitte gib ein Geburtsdatum ein !");
		theForm.pday.focus();	
		return (false);
	}

	theForm.module.value = 0;
	return (true);
}
function start_program2(theForm)
{
	theForm.mode.value = 0;
	return (true);
}


function checkForm(theForm) {
	if (theForm.destt.value == "")
	{
		alert("\nBitte gib ein Reiseziel an !");
		theForm.destt.focus();
		return (false);
	}
		
	if (theForm.adult.value == 0 && theForm.youth.value == 0 && theForm.student.value == 0) 
	{
		alert("Achtung! Du musst mindestens einen Erwachsenen\noder einen Jugendlichen bzw. Student unter\n'Anzahl Reisende' wählen!");
		theForm.adult.focus();	
		return (false);
	}

	datum = 0;
	
	if (navigator.appName == 'Microsoft Internet Explorer') 
	{
		adult_zahl = parseInt (theForm.adult.value);
		youth_zahl = parseInt (theForm.youth.value);
		student_zahl = parseInt (theForm.student.value);
		if (theForm.pday) datum =  parseInt (theForm.pyear.value)*10000 + parseInt (theForm.pmonth.value)*100 + parseInt (theForm.pday.value);
	}
	else
	{
		adult_zahl = parseInt (theForm.adult.options[theForm.adult.selectedIndex].value);
		youth_zahl = parseInt (theForm.youth.options[theForm.youth.selectedIndex].value);
		student_zahl = parseInt (theForm.student.options[theForm.student.selectedIndex].value);
		if (theForm.pday) datum = parseInt (theForm.pyear.options[theForm.pyear.selectedIndex].value)*10000 + parseInt (theForm.pmonth.options[theForm.pmonth.selectedIndex].value)*100 + parseInt (theForm.pday.options[theForm.pday.selectedIndex].value);
	}
	
	if (adult_zahl != 0 && (youth_zahl != 0 || student_zahl != 0)) 
	{
		alert("Achtung !  Du darfst nicht Erwachsene und Jugendliche oder Studenten zusammen buchen!");
		theForm.adult.focus();	
		return (false);
	}
	if (youth_zahl != 0 && student_zahl != 0) 
	{
		alert("Achtung !  Du darfst nicht Jugendliche und Studenten zusammen buchen!");
		theForm.youth.focus();	
		return (false);
	}

	if ((student_zahl || youth_zahl) && datum < 19700000)
	{
		alert("Bitte gib ein Geburtsdatum ein !");
		theForm.pday.focus();	
		return (false);
	}
	animation_start ();
	
	return (true);
}

function setCurDate()
{	
	
	theMonths = new Array("Januar","Februar","M&auml;rz","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember")
	var theMonth;
		
	today = new Date ();
	var iHdate = today.getTime() + (1000 *60 * 60 *24) * 3;
	hdate = new Date (iHdate);
	
	jahr = today.getYear();
	if (jahr < 1000) jahr = jahr + 1900;
	
	s1 = hdate.getDate();
	s2 = hdate.getMonth() + 1;
	//s2 = theMonths[hdate.getMonth()]; 
	
	document.query.hdate1.value = new String(s1);
	document.query.hdate2.value = new String(s2);
	
	var iRdate = today.getTime() + (1000 *60 * 60 *24) * 33;
	rdate = new Date (iRdate);
	
	s1 = rdate.getDate();
	s2 = rdate.getMonth() + 1;
	
	document.query.rdate1.value = new String(s1);
	document.query.rdate2.value = new String(s2);
	
	document.query.pyear.length = 24;
	jahr = jahr - 34;

	for (i=0 ; i<23 ; i++)
	{
		document.query.pyear.options[i+1].value = jahr + i;
		document.query.pyear.options[i+1].text = jahr + i;
	}		
document.query.pyear.selectedIndex = 0;
	
}

function checkFormLM (theForm)
{
	theForm.from1.value = "" ;
	theForm.from2.value = "" ;
	theForm.from3.value = "" ;
	theForm.from4.value = "" ;
	theForm.from5.value = "" ;
	if (theForm.from.options[theForm.from.selectedIndex].value == "ZRH") theForm.from1.value = "ZRH" ;
	if (theForm.from.options[theForm.from.selectedIndex].value == "BSL") theForm.from2.value = "BSL"; 
	if (theForm.from.options[theForm.from.selectedIndex].value == "GVA") theForm.from3.value = "GVA";
	if (theForm.from.options[theForm.from.selectedIndex].value == "LUG") theForm.from4.value = "LUG";
	if (theForm.from.options[theForm.from.selectedIndex].value == "BRN") theForm.from5.value = "BRN";

	theForm.mode.value = 7;

	return (true);
}
function setCurDateLM()
{	
	
	theMonths = new Array("Januar","Februar","M&auml;rz","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember")
	var theMonth;
		
	today = new Date ();
	var iHdate = today.getTime() + (1000 *60 * 60 *24);
	hdate = new Date (iHdate);
	
	
	s1 = hdate.getDate();
	s2 = hdate.getMonth() + 1;
	s3 = hdate.getYear();
	
	document.query.hdate1.value = new String(s1);
	document.query.hdate2.value = new String(s2);
	document.query.hdate3.value = new String(s3);
	
	var iRdate = today.getTime() + (1000 *60 * 60 *24) * 31;
	rdate = new Date (iRdate);
	
	s1 = rdate.getDate();
	s2 = rdate.getMonth() + 1;
	s3 = hdate.getYear();
	
	document.query.rdate1.value = new String(s1);
	document.query.rdate2.value = new String(s2);
	document.query.rdate3.value = new String(s3);
}

function go_lastminute()
{

location.href ="/de/index.php?book=1"
}
function go_flugauto()
{
	location.href = "/de/index.php?book=2"
}
function go_hotelflug()
{
	location.href = "/de/index.php?book=3"
}
function go_flug()
{
	location.href = "/de/index.php?book=4"
}

function sendHotelFlightForm(myform, page, submit) {
	
	var date = new Date();
	var year = 0;
	var hd1, hd2, rd1, rd2;
	var r1 = document.query.Room1; 
	var r1a = document.query.Room1Adults; 
	var error_text = "";

	for(var i = 0; i < myform.hdate1.length; i++) {
		if(myform.hdate1[i].selected) {
			hd1 = myform.hdate1[i].value;
			break;
		}
	}
	
	for(var i = 0; i < myform.hdate2.length; i++) {
		if(myform.hdate2[i].selected) {
			hd2 = myform.hdate2[i].value;
			break;
		}
	}
	
	for(var i = 0; i < myform.rdate1.length; i++) {
		if(myform.rdate1[i].selected) {
			rd1 = myform.rdate1[i].value;
			break;
		}
	}
	
	for(var i = 0; i < myform.rdate2.length; i++) {
		if(myform.rdate2[i].selected) {
			rd2 = myform.rdate2[i].value;
			break;
		}
	}

	var sd = new Date(date.getFullYear(), hd2 - 1, hd1);
	var rd = new Date(date.getFullYear(), rd2 - 1, rd1);
	
	if(sd.getTime() < date.getTime() + (1000 * 60 * 60 * 24 * 2)) {
		sd.setFullYear(sd.getFullYear() + 1);
	}
	
	if(rd.getTime() < sd.getTime()) {
		rd.setFullYear(rd.getFullYear() + 1);
	}
	
	// alert(sd);
	// alert(rd);
	
	if(r1.value == '@SB' && r1a.value != 1) {
		error_text = 'Bei Einzelzimmer muss Anzahl Erwachsene 1 sein.';
	}
	else if(r1.value == '@DB' && r1a.value < 2) {
		error_text = 'Bei Doppelzimmer muss Anzahl Erwachsene 2 betragen.';
	}
	
	if(error_text.length == 0) {
		myform.StartDate.value = format_date(sd);
		myform.ReturnDate.value = format_date(rd);
		myform.Page.value = page;
		// return false;
		if(submit) {
			myform.submit();
		}
		
		return true;
	}
	else {
		alert(error_text);
		return false;
	}
}


function format_date(date) {
	
	var mon = '' + (date.getMonth() + 1);
	var day = '' + date.getDate();
	var year = '' + date.getFullYear();
	
	if(mon.length < 2) mon = '0' + mon;
	if(day.length < 2) day = '0' + day;
	
	var ret = day + '.' + mon + '.' + year;
	
	// alert(ret);  
	return(ret);
} 


function set_room_selection(room_selection_idx) {
	
	var room_selection = eval('document.query.Room' + room_selection_idx); 
	var room_adult_selection = eval('document.query.Room' + room_selection_idx + 'Adults'); 
	var i = 0;
	var num_adults = 0;
	
	if(room_selection.value == '@SB') {
		num_adults = 1;
	}
	if(room_selection.value == '@DB') {
		num_adults = 2;
	}
	
	for(i = 0; i < room_adult_selection.length; i++) {
		if(room_adult_selection[i].value == num_adults) {
			room_adult_selection[i].selected = true;
		}
		else {
			room_adult_selection[i].selected = false;
		}
	}
}