// popuplate date select boxes and set to today's date
function createStartDateOptionsList()   {
    var dtToday = new Date();
	doc=document.sbform;

	// create days
	daySelect=doc.startday;
	for (x=1;x<=31;x++)   { 
		daySelect.options[x-1] =  new Option(x, x); 
		}
	daySelect.selectedIndex =  dtToday.getDate()-1;

	// create months
	monthSelect=doc.startmonth;
	for (x=1;x<=12;x++)   {  
		monthSelect.options[x-1] =  new Option(monthName[x-1], monthName[x-1]); 
		}
	monthSelect.selectedIndex =  dtToday.getMonth();

	// create years
    var currentYear = dtToday.getFullYear();
	c=0;
	yearSelect=doc.startyear;
	for (x=currentYear;x<=currentYear+2;x++)   { yearSelect.options[c] =  new Option(x, x); c++;  }
	}
	

// short breaks search form needs outputs reformatting for compatibility with search results page
function sanitise_outputs()   {
	
	theform=document.sbform;

	startday=theform.startday.options[theform.startday.selectedIndex].value;
	if (startday<10)  {   fstartday="0"+String(startday);   }
	else  {   fstartday=startday;   }

	startmonth=theform.startmonth.options[theform.startmonth.selectedIndex].value;
	switch (startmonth) {
		case "Jan" : startmonthnum = 1;
			break;
		case "Feb" : startmonthnum = 2;
			break;
		case "Mar": startmonthnum = 3;
			break;
		case "Apr" : startmonthnum = 4;
			break;
		case "May" : startmonthnum = 5;
			break;
		case "Jun" : startmonthnum = 6;
			break;
		case "Jul" : startmonthnum = 7;
			break;
		case "Aug" : startmonthnum = 8
			break;
		case "Sep" : startmonthnum = 9;
			break;
		case "Oct" : startmonthnum = 10;
			break;
		case "Nov" : startmonthnum = 11;
			break;
		case "Dec" : startmonthnum = 12;
			break;
		}

	if (startmonthnum<10)  {   fstartmonthnum="0"+String(startmonthnum);   }
	else  {   fstartmonthnum=startmonthnum;   }
	startyear=theform.startyear.options[theform.startyear.selectedIndex].value;
	theweek=startyear+"-"+fstartmonthnum+"-"+fstartday;
	duration=theform.duration.options[theform.duration.selectedIndex].value;
	area=theform.area.options[theform.area.selectedIndex].value;
	if (area=="")  area=theform.area.options[theform.area.selectedIndex].text;
	partysize=theform.partysize.options[theform.partysize.selectedIndex].value;
	shortbreaksearch=theform.shortbreaksearch.value;
	window.location="search-results.aspx?area="+area+"&partysize="+partysize+"&duration="+duration+"&week="+theweek+"&shortbreaksearch="+shortbreaksearch;
	return false;
	}
