
var arr=new Array('dates_cat_1','dates_cat_2')
function subcat(loc){for(x in arr){ret=document.getElementById(arr[x])
ret.style.display='none';}
rem=document.getElementById(loc);rem.style.display='block';var sucat=loc.substr(-1);document.formual.sucat.value=sucat;}
function oc(self){var rem=document.getElementById(self)
if(document.formual.anyDates){document.formual.anyDates.checked=false;}}
function startDay(self){var fday=document.formual.dates_2_break.options[document.formual.dates_2_break.selectedIndex].value;if(fday>6){document.formual.dates_2_starts.selectedIndex=1;}else if(fday==4){document.formual.dates_2_starts.selectedIndex=3;}else if(fday==3){document.formual.dates_2_starts.selectedIndex=7;}
if(document.formual.anyDates){document.formual.anyDates.checked=false;}}
function nights(){var fday=document.formual.dates_1_ar_day.options[document.formual.dates_1_ar_day.selectedIndex].value;var monthyear=document.formual.dates_1_ar_my.options[document.formual.dates_1_ar_my.selectedIndex].value;var fmonth=monthyear.substring(4);var fyear=monthyear.substring(0,4);var eday=document.formual.dates_1_dep_day.options[document.formual.dates_1_dep_day.selectedIndex].value;var emonthyear=document.formual.dates_1_dep_my.options[document.formual.dates_1_dep_my.selectedIndex].value;var emonth=emonthyear.substring(4);var eyear=emonthyear.substring(0,4);fmonth=fmonth-1;emonth=emonth-1;var sDate=new Date()
var eDate=new Date()
sDate.setDate(fday);sDate.setMonth(fmonth);sDate.setFullYear(fyear);eDate.setDate(eday);eDate.setMonth(emonth);eDate.setFullYear(eyear);var dayz=Math.round((eDate-sDate)/86400000)-3;window.document.getElementById('fixed_dep').innerHTML="";if(dayz>25){window.document.getElementById('fixed_dep').innerHTML="The range of date selected is too large. If you update the results now your holiday  will be taken as being from the arrival date for 28 nights";dayz=25;}else if(dayz<0){window.document.getElementById('fixed_dep').innerHTML="The range of date selected is too small or negative.If you update the results now your holiday  will be taken as being from the arrival date for 3 nights";dayz=0;}
document.formual.dates_1_nights.selectedIndex=dayz;emonthyear=document.formual.dates_1_dep_my.options[document.formual.dates_1_dep_my.selectedIndex].value;var eyr=emonthyear.substring(0,4);var emnth=emonthyear.substring(4,6);loadMonth2(emnth,eyr);if(document.formual.anyDates){document.formual.anyDates.checked=false;}}
function dateTo(){var fday=document.formual.dates_1_ar_day.options[document.formual.dates_1_ar_day.selectedIndex].value;var monthyear=document.formual.dates_1_ar_my.options[document.formual.dates_1_ar_my.selectedIndex].value;var fmonth=monthyear.substring(4);var fyear=monthyear.substring(0,4);var sDate=new Date()
sDate.setDate(fday);sDate.setMonth(fmonth-1);sDate.setFullYear(fyear);var eDate=new Date();var nights=document.formual.dates_1_nights.selectedIndex;nights=nights+3;eDate=sDate;eDate.setDate(sDate.getDate()+nights);var eday=eDate.getDate();var emonth=eDate.getMonth();emonth+=1;if(emonth<10){emonth="0"+emonth;}
var emonthyear=""+eDate.getFullYear()+""+emonth;try{document.formual.dates_1_dep_day.selectedIndex=eday-1;}catch(err){}
if(false){window.document.getElementById('fixed_dep').innerHTML="";var txt="";index=0;for(x in document.formual.dates_1_dep_my.options){try{teste=document.formual.dates_1_dep_my.options[x].value;var b=(""+teste).length;if(b==5){teste=""+teste.substr(0,4)+"0"+teste.substr(4,5);}
txt+=teste;txt+="-"+b;txt+=",\r\n";if(teste==emonthyear){index=x;}}catch(err){}}
try{document.formual.dates_1_dep_my.selectedIndex=index;}catch(err){window.document.getElementById('fixed_dep').innerHTML="The arrival date and length of time you have selected is too far ahead to be booked.";}
emonthyear=document.formual.dates_1_dep_my.options[document.formual.dates_1_dep_my.selectedIndex].value;var eyr=emonthyear.substring(0,4);var emnth=emonthyear.substring(4,6);loadMonth2(emnth,eyr);}
var yr=monthyear.substring(0,4);var mnth=monthyear.substring(4,6);loadMonth(mnth,yr);if(document.formual.anyDates){document.formual.anyDates.checked=false;change(this);}}
function doDateStuff()
{var sd=document.formual.hiddenStartDate.value;var Jsd=sd.replace("/","");Jsd=Jsd.replace("/","");document.formual.Jstartdate.value=Jsd;var fday=sd.substring(8);var fmonthyear=sd.substring(0,7);var getIndex=eval('fday');var dayIndex=getIndex-1;document.formual.sday.selectedIndex=dayIndex;matchthis=fmonthyear.replace("/","");for(i=0;i<document.formual.smonthyear.length;i++)
{thisval=document.formual.smonthyear.options[i].value;if(thisval==matchthis)
{document.formual.smonthyear.selectedIndex=i;break;}}
if(document.formual.anyDates){document.formual.anyDates.checked=false;}}
function doDateField(){var fday=document.formual.sday.options[document.formual.sday.selectedIndex].text;var monthyear=document.formual.smonthyear.options[document.formual.smonthyear.selectedIndex].value;var fmonth=monthyear.substring(4);var fyear=monthyear.substring(0,4);var theDate=fyear+"/"+fmonth+"/"+fday+"";document.formual.hiddenStartDate.value=theDate;var Jsd=theDate.replace("/","");Jsd=Jsd.replace("/","");document.formual.Jstartdate.value=Jsd;if(document.formual.anyDates){document.formual.anyDates.checked=false;}}