function checkMac()
{
	if (navigator.appVersion.indexOf("Mac") != -1)
	{
		document.enquiry_form.enquiry_mac.checked = true;
	}

	return true;
}

function checkForm(thisForm)
{

	if (thisForm.client_title.value == "")
	{
		alert("Please enter your title");
		thisForm.client_title.focus();

		return false;
	}

	if (thisForm.client_first_name.value == "")
	{
		alert("Please enter your first name");
		thisForm.client_first_name.focus();

		return false;
	}

	if (thisForm.client_last_name.value == "")
	{
		alert("Please enter your last name");
		thisForm.client_last_name.focus();

		return false;
	}


	if (thisForm.client_tel_no.value == "")
	{
		alert("Please enter your telephone number");
		thisForm.client_tel_no.focus();

		return false;
	}

	if (thisForm.client_email.value == "" || isEmail(thisForm.client_email.value) == false)
	{
		alert("Please enter a valid e-mail address");
		thisForm.client_email.focus();

		return false;
	}

	if (thisForm.client_email.value != thisForm.client_email_val.value)
	{
		alert("The email addresses entered don't match. Please enter the same address in both fields");
		thisForm.client_email_val.focus();

		return false;
	}

	var budget = new String();

	budget = thisForm.enquiry_budget_upper.value;
	budget = budget.replace(/,/, "");
	budget = budget.replace(/ /, "");
	budget = budget.replace(/\$/, "");
	budget = budget.replace(/£/, "");
	budget = budget.replace(/€/, "");

	thisForm.enquiry_budget_upper.value = budget;

	if (thisForm.enquiry_budget_upper.value == "" || isNaN(thisForm.enquiry_budget_upper.value) || parseFloat(thisForm.enquiry_budget_upper.value) <= 0)
	{
		alert("Please enter your approximate budget in euros and omit any currency symbols");
		thisForm.enquiry_budget_upper.focus();

		return false;
	}

	if ((thisForm.enquiry_start_date.value == "" && thisForm.enquiry_end_date.value == "") && (thisForm.enquiry_no_weeks.value == "0" && thisForm.enquiry_month.value == "0"))
	{
		alert("Please provide us with your preferred dates");
		thisForm.enquiry_start_date.focus();

		return false;
	}

	if ((thisForm.enquiry_start_date.value != "" && thisForm.enquiry_end_date.value == "") || (thisForm.enquiry_start_date.value == "" && thisForm.enquiry_end_date.value != ""))
	{
		alert("Please enter a 'From' and a 'To' date");
		thisForm.enquiry_start_date.focus();

		return false;
	}

	if (thisForm.enquiry_start_date.value != "" && checkDate(thisForm.enquiry_start_date.value) == false)
	{
		alert("Please enter a 'From' date");
		thisForm.enquiry_start_date.focus();

		return false;
	}

	if (thisForm.enquiry_end_date.value != "" && checkDate(thisForm.enquiry_end_date.value) == false)
	{
		alert("Please enter a 'To' date");
		thisForm.enquiry_end_date.focus();

		return false;
	}

	if (thisForm.enquiry_start_date.value == "" && thisForm.enquiry_end_date.value == "" && (thisForm.enquiry_no_weeks.value == "0" || thisForm.enquiry_month.value == "0"))
	{
		alert("Please enter the approximate no. of weeks and month");
		thisForm.enquiry_no_weeks.focus();

		return false;
	}

	if (thisForm.enquiry_start_date.value != "" && thisForm.enquiry_end_date.value != "" && thisForm.enquiry_no_weeks.value != "0" && thisForm.enquiry_month.value != "0")
	{
		alert("Please either provide us with specific preferred arrival\n and departure dates, or with an approximate no. of weeks and month");
		thisForm.enquiry_start_date.focus();

		return false;
	}

	if (thisForm.enquiry_total_no_guests.value == "" || isNaN(thisForm.enquiry_total_no_guests.value) || parseInt(thisForm.enquiry_total_no_guests.value) <= 0)
	{
		alert("Please enter the total no. of guests (including children)");
		thisForm.enquiry_total_no_guests.focus();

		return false;
	}

	return true;
}

function check_option(option_selected)
{
	if (option_selected == 'Other' || option_selected == 'Magazine Ad' || option_selected == 'Article')
	{
		document.getElementById("hear_other").style.display = "inline";
	}
	else
	{
		document.getElementById("hear_other").style.display = "none";
	}
}

function calendar_departure(event)
{
	g_Calendar.show(event, 'enquiry_start_date', 'dd-mmm-yyyy', null, null, null, null, new Date(2011, 5, 1));
}

function calendar_return(event)
{
	g_Calendar.show(event, 'enquiry_end_date', 'dd-mmm-yyyy', null, null, null, null, new Date(2011, 5, 1));
}
