function freeSelect(sel,dflt){
  for(var i=0;sel.options.length>0;i++){
    sel.options[0]=null;
  }
  sel.options[0]=new Option(dflt,'XXX');
}

function getSel(cb){
  return (cb.selectedIndex==-1?'XXX':cb.options[cb.selectedIndex].value);
}

function openCal(desc){
  var my=eval('document.frmPost.frm'+desc+'my.value');
  document.calForm.year.value=my.substr(0,4);
  document.calForm.month.value=new Number(my.substr(4,2) -1);
  document.calForm.day.value=eval ('document.frmPost.frm'+desc+'day.value');
  document.calForm.cb.value =desc;
  window.open("include/calendar.html","calendar","width=250,height=250,toolbar=0,status=0,location=0,menubar=0,scrollbars=0,resizable=0");
}


function monyearChanged(sel,month_sel,is_return)
{
	var opt=sel.options;
	var day_sel=sel.value;
	for(var i=0;sel.options.length>0;i++){
		sel.options[0]=null;
	}
	if(is_return)
	{
		sel.options[0]=new Option("--",'00');
	}
	var year=month_sel.value.substr(0,4);
	var month=month_sel.value.substr(4,2);
	var days=_DatesArr[month_sel.value];
	for(i=1;i<=_DatesArr[month_sel.value];i++)
	{
		var s = "" + i;
		if( s.length == 1)
		{
			s='0'+s;
		}
		if(month_sel.value > _CurMY || i>=_CurDay)
		{
			var opt=new Option(s,s);
			if(s == day_sel)
			{
				opt.selected=1;
			}
			sel.options[sel.options.length]=opt;
		}
	}
}

var oldRETday,oldRETmonth,oldRETyear;

function setTravelType(form,type)
{
	if(type=='oneway')
	{
		oldRETday=form.frmRETday.value;
		form.frmRETday.value='00';
		oldRETmy=form.frmRETmy.value;
		form.frmRETmy.value='000000';
	}
	else
	{
		form.frmRETday.value=oldRETday;
		form.frmRETmy.value=oldRETmy;
	}
}
function rChanged(form)
{
	if (form.trip[0].checked)
	{
		if(confirm("Oh! Did you want to fly round trip?"))
		{
			form.trip[1].checked=true;
			if(form.frmRETday.value == '00')
			{
				form.frmRETday.value=oldRETday;
			}
			if(form.frmRETmy.value == '000000')
			{
				form.frmRETmy.value=oldRETmy;
			}
		}
		else
		{
		form.frmRETday.value='00';
		form.frmRETmy.value='000000';
		}
	}
}

