//checks that the user has entered something in all the fields that 
//have been signaled as requireing input. sends an alert box for each
//field they have not inpout data for

function validate(form1)
{
	if(document.form1.firstname.value  =="")
	{
		alert("please enter your first name");
		document.form1.firstname.focus();
		return false;
	}
	if(document.form1.lastname.value =="")
	{
		alert("please enter your last name");
		document.form1.lastname.focus();
		return false;

	}
	if(document.form1.email.value =="")
	{
		alert("please enter your e-mail address ");
		document.form1.email.focus();
		return false;
	}


	if(document.form1.twin.checked == false && document.form1.double.checked == false )
 	 {
 		alert("please choose the twin or the double room or both")
 		document.form1.double.focus();
 		return false;
 	}

	
	if(document.form1.numbers.selectedIndex == 0 )
	{
		alert("please enter the number of people");
		document.form1.numbers.focus();
		return false;
	}
	if(document.form1.arrivalday.selectedIndex == 0)
	{
		alert("please enter the day you wish to arrive");
		document.form1.arrivalday.focus();
		return false;
	}
	if(document.form1.arrivalmonth.selectedIndex == 0)
	{
		alert("please enter the month you wish to arrive");
		document.form1.arrivalmonth.focus();
		return false;
	}
	if(document.form1.departureday.selectedIndex == 0)
	{
		alert("please enter the day you wish to depart");
		document.form1.departureday.focus();
		return false;
	}
	if(document.form1.departuremonth.selectedIndex == 0)
	{
		alert("please enter the month you wish to depart");
		document.form1.departuremonth.focus();
		return false;
	}
	
	if(document.form1.nightnumber.selectedIndex == 0)
	{
		alert("please enter the number of nights you may stay");
		document.form1.nightnumber.focus();
		return false;
	}
	
	return true ;
}


//checks that the user does not exceed the limit set on the 
//additional info required at the bottom of the form. tells them if they
//have and removes the text back to the limit 
function chklimit(addinfo, limit)
{
	if (addinfo.value.length > limit)
	{
		alert("field limited to "+limit+" characters");

		var revertfield = addinfo.value.slice(0,limit-1);
		addinfo.value = revertfield;
		addinfo.focus();
	}
}

