// JavaScript Document
var monthtext=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sept','Oct','Nov','Dec'];
var daytext = ['0','1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31']

function populatedropdown(dayfield, monthfield, yearfield){
var today=new Date()
var dayfield=document.getElementById(dayfield)
var monthfield=document.getElementById(monthfield)
var yearfield=document.getElementById(yearfield)
for (var i=1; i<32; i++)
dayfield.options[i]=new Option(daytext[i], daytext[i])
dayfield.options[today.getDate()]=new Option(daytext[today.getDate()], daytext[today.getDate()], true, true) //select today's month
//dayfield.options[i]=new Option(i+1, i+1)
//dayfield.options[today.getDate()]=new Option(today.getDate(), today.getDate(), true, true) //select today's day
for (var m=0; m<12; m++)
monthfield.options[m]=new Option(monthtext[m], monthtext[m])
monthfield.options[today.getMonth()]=new Option(monthtext[today.getMonth()], monthtext[today.getMonth()], true, true) //select today's month
var thisyear=today.getFullYear()
for (var y=0; y<20; y++){
yearfield.options[y]=new Option(thisyear, thisyear)
thisyear+=1
}
yearfield.options[0]=new Option(today.getFullYear(), today.getFullYear(), true, true) //select today's year
}


function checkForm(){
	
	var bValid = true, sAlert="";
	if(document.form1.stay.value==""){
	sAlert=sAlert + "Please entery your  lenth of stay\n";
	bValid=false;
	}

	if(document.form1.tel.value==""){
	sAlert=sAlert + "No telehpone number entered\n";
	bValid=false;
	}
	
	if(document.form1.email.value==""){
	sAlert=sAlert + "No email address entered\n";
	bValid=false;
	}
	
	if(document.form1.name.value==""){
	sAlert=sAlert + "No name entered\n";
	bValid=false;
	}


	if(document.form1.address.value==""){
	sAlert=sAlert + "No address entered\n";
	bValid=false;
	}


	document.form1.day.value = document.form1.daydropdown.value;
	document.form1.month.value = document.form1.monthdropdown.value;
	document.form1.year.value = document.form1.yeardropdown.value;

	document.form1.adult.value = document.form1.adultdropdown.value;
	document.form1.children.value = document.form1.childrendropdown.value;

	if(document.form1.terms.checked==false){
		sAlert=sAlert + "Please accept our terms & conditions before submitting\n";
		bValid=false;
	}

	if (bValid==true){
	    return true;
	}else{
		alert(sAlert+ "\n\nYou must add this information to continue");
		return false;
	}
}
