function popupcal_open()
{
	// OLD POPUP IN NEW WINDOW
	var newWindow;
	var urlstring = 'popupcal/popupcal.htm'
	newWindow = window.open(urlstring,'','height=200,width=280,toolbar=no,minimize=no,status=no,memubar=no,location=no,scrollbars=no')
}

function showpopUpCalendar()
{
	popUpCalendar(this, frmSearch.arriveDate, 'dd/mm/yyyy') ;
}

function CheckSrchForm(frm)
{
	var bOK = false ;
	if (CheckFieldWidths(frm))
	{
		if (frm.arriveDate.value.length > 0 && frm.arriveDate.value != "dd/mm/yyyy")
		{
			if (CheckMask(frm.arriveDate.value, "DD/MM/YYYY"))
			{
				if (CheckDate(frm.arriveDate.value) == false)
				{
					alert("Your arrival date is invalid, please correct") ;
					frm.arriveDate.focus() ;
				}
				else
				{
					bOK = true ;
				}
			}
			else
			{
				alert("Please enter date in correct UK format - DD/MM/YYYY") ;
				frm.arriveDate.focus() ;
			}
			if (bOK && frm.nights.value.length==0)
			{
				alert("If you are specifying an arrival date, you must also specify the number of nights.") ;
				frm.nights.focus() ;
				bOK = false ;
			}
			else if (bOK)
			{
				if (!CheckMaskToStrLen(frm.nights.value, "9999"))
				{
					alert("Please enter nights in numeric format, e.g. enter '7', not seven.") ;
					frm.nights.focus() ;
					bOK = false ;
				}
			}
		}
		else
		{
			bOK=true ;
		}
	}
	return bOK ;
}

function DateType_onclick(frm) 
{
	if (frm.DateType[0].checked)
	{
		frm.arriveDate.value = "" ;
		frm.nights.value = "" ;
	}
}

function arriveDate_onactivate(frm) {
	if (frm.arriveDate.value == "dd/mm/yyyy")
		frm.arriveDate.value = "" ;
}

function arriveDate_onchange(frm) 
{
	frm.DateType[1].checked = true ;
}

function nights_onchange(frm) 
{
	frm.DateType[1].checked = true ;
}


