var uselang = 1;
function good_code(field)
{
	return field.value.match(/\w{6}/);
}

function good_blank(field)
{
	return field.value != '';
}

function check_code(id)
{
	var field = fetch_object(id);

	if (!good_code(field))
	{
		alert(( uselang == 1 ? 'Your booking number must be six alphanumeric characters' : 'Le numéro de réservation doit comporter 6 chiffres.' ));
		field.focus();
	}
}

function check_blank(id)
{
	var field = fetch_object(id);

	if (!good_blank(field))
	{
		alert(( uselang == 1 ? 'Please enter your last name' : 'Le nom du passager champ doit être rempli' ));
		field.focus();
	}
}

function swap_country(theform)
{	
	if (theform.language.options[theform.language.selectedIndex].text == 'English (United States)')
	{
		theform.country.value = 'US';
	}
	else
	{
		theform.country.value = 'CA';
	}
}

function check_viewtrip()
{
	if (!good_code(fetch_object('code')) || !good_blank(fetch_object('name')))
	{
		alert(( uselang == 1 ? 'Please enter a valid booking number and last name' : 'Le numéro de réservation champ doit être rempli. Le nom du passager champ doit être rempli.' ));
		return false;
	}

	return true;
}
