
//function PopUpCalender(DropDownName)

function PopUpCalender(DropDownName,DepartureName)
{
	var departure;
	var Origin_Id;
	var Destination_Id;
	
	if (DepartureName == "cboDeparture")
	{
		departure = document.frmSchedule.cboDeparture.options[document.frmSchedule.cboDeparture.selectedIndex].value;
		Origin_Id = departure.substr(0,2);
		Destination_Id = departure.substr(3,2);
	}
	else
	{
		departure = document.frmSchedule.cboReturnDeparture.options[document.frmSchedule.cboReturnDeparture.selectedIndex].value;
		Origin_Id = departure.substr(0,2);
		Destination_Id = departure.substr(3,2);
	}
	
	window.open("calender.aspx?h_DropDownName=" + DropDownName + "&h_OriginId=" + Origin_Id + "&h_DestinationID=" + Destination_Id,"_blank","left=200,top=200,height=240,width=240,status=no,toolbar=no,menubar=no,location=no,scrollbars=no");
	
}

function fInputDetails() 
		{ 
			document.frmSchedule.h_task.value = "select_schedule"; 
			document.frmSchedule.submit(); 
		} 		

function fSetDropDownValue(StrDropDownName, StrDropDownValue) 
		{ 
			var ObjDropDown; 
			ObjDropDown = eval('document.frmSchedule.' + StrDropDownName); 
			for (i=0; i<ObjDropDown.options.length; i++) 
			{ 
				if (ObjDropDown.options[i].value == StrDropDownValue) 
				{ 
					ObjDropDown.options[i].selected = true; 
					break; 
				} 
			} 
			eval("__doPostBack('" + StrDropDownName + "','');")
		} 
			

function OneWayTrip() 
{ 
	if (document.frmSchedule.chkRoundTrip.checked) 
	{
		//document.frmSchedule.cboReturnDeparture.disabled=true; 
		document.frmSchedule.cboReturnDate.disabled=true; 
		document.frmSchedule.cboReturnTime.disabled=true; 
		document.frmSchedule.img_return_date.disabled=true;
		document.frmSchedule.cboReturnMonth.disabled=true;
		//document.frmSchedule.chkClamBake.checked=false;
		//document.frmSchedule.chkClamBake.disabled=true;
	} 
	else 
	{ 
		//document.frmSchedule.cboReturnDeparture.disabled=false; 
		document.frmSchedule.cboReturnDate.disabled=false; 
		document.frmSchedule.cboReturnTime.disabled=false; 
		document.frmSchedule.img_return_date.disabled=false;
		document.frmSchedule.cboReturnMonth.disabled=false;
		//document.frmSchedule.chkClamBake.disabled=false;
	} 
}

function fValidateInput() 
		{ 
			var strAdult; 
			var strAdult; 
			var strChild;
			//var strBike;
			var strDeparture; 
			var strOutDate; 
			var strOutTime; 
			var strRoundTrip; 
			var strReturnDeparture; 
			var strReturnDate; 
			var strReturnTime; 
			var strError = ''; 
			var strErrorStdMsg = '';
			var dtOutBoundDateTime= new Date();
			var dtReturnDateTime= new Date();
			//alert('Hi'); 
			strAdult = document.frmSchedule.cboAdult.options[document.frmSchedule.cboAdult.selectedIndex].value; 
			strSenior = 0 //document.frmSchedule.cboSenior.options[document.frmSchedule.cboSenior.selectedIndex].value; 
			strChild = document.frmSchedule.cboChild.options[document.frmSchedule.cboChild.selectedIndex].value;
			strInfant = document.frmSchedule.cboInfant.options[document.frmSchedule.cboInfant.selectedIndex].value;
			//strBike =  document.frmSchedule.cboBike.options[document.frmSchedule.cboBike.selectedIndex].value;
			
			strErrorStdMsg = "Please correct the following errors. \n\n"
			//Check for no. of tickets selected
			//if (strAdult == '0' && strChild == '0' && strBike == '0') 
			if (strAdult == '0' && strSenior == '0' && strChild == '0') 
			{ 
				if (strError == '')
				{
					strError = strErrorStdMsg + "Please select Adult or Child ticket quantity\n"
				}
				else
				{
					strError = strError + "Please select Adult or Child ticket quantity\n"
				}
			} 
				
			//strDeparture = document.frmSchedule.cboDeparture.options[document.frmSchedule.cboDeparture.selectedIndex].value; 
			strOutDate = document.frmSchedule.cboOutDate.options[document.frmSchedule.cboOutDate.selectedIndex].value; 
			strOutTime = document.frmSchedule.cboOutTime.options[document.frmSchedule.cboOutTime.selectedIndex].value; 
				
			if (document.frmSchedule.chkRoundTrip.checked) 
				{ 
					strRoundTrip = "N"; 
				} 
			else 
				{ 
					strRoundTrip = "Y"; 
					//strReturnDeparture = document.frmSchedule.cboReturnDeparture.options[document.frmSchedule.cboReturnDeparture.selectedIndex].value; 
					strReturnDate = document.frmSchedule.cboReturnDate.options[document.frmSchedule.cboReturnDate.selectedIndex].value; 
					strReturnTime = document.frmSchedule.cboReturnTime.options[document.frmSchedule.cboReturnTime.selectedIndex].value; 
					 
					dtOutBoundDateTime = new Date(strOutDate + ' ' + strOutTime);
					dtReturnDateTime = new Date(strReturnDate + ' ' + strReturnTime);
					 
					//strDeparture = document.frmSchedule.cboDeparture.options[document.frmSchedule.cboDeparture.selectedIndex].value;
					var radioLength = cboDeparture.length;
					for(var i = 0; i < radioLength; i++) {
						if(cboDeparture[i].checked) {
							strDeparture = cboDeparture[i].value;
						}
					}
					
					//must be same return date for Mount Vernon
					if (strDeparture == 'AL-MV')
					{
						if (strOutDate == strReturnDate)
						{
						}
						else
						{
							if (strError == '')
							{
								strError = strErrorStdMsg + "In Bound date must be same as Out bound for Mount Vernon travel. \n"
							}
							else
							{
								strError = strError + "In Bound date must be same as Out bound for Mount Vernon travel. \n"
							}
						}
					}
								 
					if (dtReturnDateTime<dtOutBoundDateTime)
					{
						if (strError == '')
						{
							strError = strErrorStdMsg + "InBound date and time cannot be earlier than OutBound date and time. \n"
						}
						else
						{
							strError = strError + "InBound date and time cannot be earlier than OutBound date and time. \n"
						}
						
					}
				}
			if (strError=='')
				{
						document.frmSchedule.h_task.value = "select_schedule"; 
						document.frmSchedule.submit(); 
				}
			else
				{
					alert(strError);
				}
		}	
		
function openpopup(url) {
  var newUrl,displayHeight,displayWidth,newPropId
  nW= window.open(url,'Popup','left=300,top=10,width=450,height=300,location=no,resizable=no,status=no,toolbar=no,menubar=no,scrollbars=no');
  nW.focus()
  return;
}
