
function CheckOK() {
	var strURL;
	var f = document.form1;
	var strTripType;
	var screenW = 800, screenH = 600;


	if (parseInt(navigator.appVersion)>3) {
		screenW = screen.width;
		screenH = screen.height;
	}
	else if (navigator.appName == "Netscape" 
		&& parseInt(navigator.appVersion)==3
		&& navigator.javaEnabled()
	   ) 
	{
		var jToolkit = java.awt.Toolkit.getDefaultToolkit();
		var jScreenSize = jToolkit.getScreenSize();
		screenW = jScreenSize.width;
		screenH = jScreenSize.height;
	}


	if (f.txtDepCity.value=="xxx") {
		alert("Bitte geben Sie den Abflugort ein.");
		return;
    }


	if (f.txtArrCity.value=="xxx") {
		alert("Bitte geben Sie den Ankunftsort ein.");
		return;
    }
	
	
	strTripType = getCheckedValue(f.TripType);

	strURL='http://wftc3.e-travel.com/plnext/tgpnext/TimeTable.action';
	strURL=strURL+'?LANGUAGE=GB&SITE=CATRCATR&EXTERNAL_ID=TG';
	
	strURL=strURL+'&TRIP_FLOW=YES&SESSION_ID=';
	
	if (strTripType=='O')
	{	
		f.txtDepDate.value=f.lstDepMonth.value+f.lstDepDay.value+'0000'

		
		strURL=strURL+'&B_DATE='+f.txtDepDate.value;
		strURL=strURL+'&B_LOCATION='+f.txtDepCity.value;
		strURL=strURL+'&E_LOCATION='+f.txtArrCity.value;
	}
	

	if (strTripType=='R')
	{	
		f.txtDepDate.value=f.lstDepMonth.value+f.lstDepDay.value+'0000'
		f.txtArrDate.value=f.lstArrMonth.value+f.lstArrDay.value+'0100'

		
		strURL=strURL+'&B_DATE='+f.txtDepDate.value;
		strURL=strURL+'&E_DATE='+f.txtArrDate.value;
		strURL=strURL+'&B_LOCATION='+f.txtDepCity.value;
		strURL=strURL+'&E_LOCATION='+f.txtArrCity.value;

		var NowDate=new Date();
		var NowYear=""+NowDate.getYear();
						
		
		var NowMonth=setTo2Digits(""+(NowDate.getMonth()+1));
		var NowDay=setTo2Digits(""+NowDate.getDate());
		var NowPLDate=NowYear+NowMonth+NowDay+"0000";
		
		if (f.txtDepDate.value>f.txtArrDate.value)
        {
            alert("Das Ankunftsdatum muss nach dem Abflugdatum liegen.");
            return;
        }
		

		if (f.txtDepDate.value<NowPLDate)
		{
			alert("Das Datum liegt in der Vergangenheit.");
			return;
		}
	}	
	

	
		var NowDate=new Date();
		var NowYear=""+NowDate.getYear();
						
		
		var NowMonth=setTo2Digits(""+(NowDate.getMonth()+1));
		var NowDay=setTo2Digits(""+NowDate.getDate());
		var NowPLDate=NowYear+NowMonth+NowDay+"0000";
	
 	 		
	strURL=strURL+'&TRIP_TYPE='+strTripType;
	strURL = strURL.replace(/LANGUAGE=GB/, g_Param_LANGUAGE);  //Kaew add code
	
	//alert(strURL);
	//window.navigate(strURL);
	
   	//	window.open(strURL,'1ARES','location,menubar,resizable,dependent,status,Width=800,Height=600,location,toolbar');
	screenW=screenW-10;
    screenH=screenH-160;

	//window.open(strURL,'1ARES',' menubar,resizable,status,location,scrollbars,toolbar,left=0,top=0,width=' +  screenW + ',height=' +  screenH + '');
	window.open(strURL,"1ARES","toolbar,status,resizable,scrollbars,top=0,left=0,width="+(screen.width*0.99)+",height="+(screen.height*0.88))

}


function changeTripType() {
	var f = document.form1;	
	var strTripType = getCheckedValue(f.TripType);

	var ID_ReturnDate_1 = document.getElementById('labelArr');
	var ID_ReturnDate_2 = f.lstArrDay;
	var ID_ReturnDate_3 = f.lstArrMonth;
	var ID_ReturnDate_4 = document.getElementById('iconArrCalendar');
	
	if(strTripType=='R') {
		ID_ReturnDate_1.style.visibility = "";
		ID_ReturnDate_2.style.visibility = "";
		ID_ReturnDate_3.style.visibility = "";
		ID_ReturnDate_4.style.visibility = "";
	} else {		
		ID_ReturnDate_1.style.visibility = "hidden";
		ID_ReturnDate_2.style.visibility = "hidden";
		ID_ReturnDate_3.style.visibility = "hidden";
		ID_ReturnDate_4.style.visibility = "hidden";		
	}
	return true;
}



window.onload = function() {
	var f = document.form1;
	setCityDropDown(f.txtDepCity, g_Inter_CityList['full']);
	setCityDropDown(f.txtArrCity, g_Inter_CityList['full']);
		
	setDateMonthDropDown(f.lstDepDay, f.lstDepMonth);
	setDateMonthDropDown(f.lstArrDay, f.lstArrMonth);
}
