
/* version updated 18/5/09 jwm to customise for sitefinder*/

var monthtext=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sept','Oct','Nov','Dec','Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sept','Oct','Nov','Dec','Jan'];
var monthnum=['01','02','03','04','05','06','07','08','09','10','11','12','01','02','03','04','05','06','07','08','09','10','11','12','01'];

function populatemonthyear(monthfield){

var today=new Date();
var monthfield=document.getElementById(monthfield);
var thisyear=today.getFullYear();
var nextyear = today.getFullYear() + 1;
for (var m=0; m<23; m++)
	if(m>11){
			thisyear = nextyear;
			monthfield.options[m]=new Option(monthtext[m]+ "  " + thisyear, thisyear + "-" + monthnum[m], true, true);
	}else{
			thisyear=today.getFullYear();
			monthfield.options[m]=new Option(monthtext[m]+ "  " + thisyear, thisyear + "-" + monthnum[m], true, true);
	}

	//document.write("<br>The current " +  m + " value is " + monthtext[m] + " " + thisyear );

//monthfield.options[today.getMonth()]=new Option(monthtext[today.getMonth()], monthtext[today.getMonth()] , true, true) //select today's month
}

/*
  var today=new Date();
document.write("The current month value is " + today.getMonth()+ "<br>");//The current month value is 4
document.write("The current year value is " + today.getYear()+ "<br>"); //The current year value is 2009
document.write("The current full year value is " + today.getFullYear()+ "<br>"); //The current year value is 2009
*/

function bb_set_date(){
	
	var today = new Date();
	var month = today.getMonth() + 1;
	var bb_dateFrom_day = document.getElementById("bb_dateFrom_day");
	var bb_dateFrom_month = document.getElementById("bb_dateFrom_month");
	
	if(today.getDate()<10){
		bb_dateFrom_day.value = '0' + today.getDate();
	}else{
		bb_dateFrom_day.value = today.getDate();
	}

	if(month<10){
		month = '0' + month;
	}
	
	var value = today.getFullYear() + "-" + month;
	bb_dateFrom_month.value = value;
	
}
//window.onload = bb_set_date;

function bb_check_availability()
{

	var bb_channelCode = 'BWGRTSTHRDDIRECT';
	var bb_dateFrom = document.getElementById('bb_dateFrom_month').value + "-" + document.getElementById('bb_dateFrom_day').value;
	var querywindow_width = '800';
	var querywindow_height = '600';
	var url = "https://www.thebookingbutton.com.au/public/reservation/PropertyOverview.do?channelCode=" + bb_channelCode + "&dateFrom=" + bb_dateFrom;

	window.open(url,"POPUP", "width=" + querywindow_width  + ",height=" + querywindow_height + ",scrollbars=yes,status=no,resizable=yes");

	//window.open( url + '&init=1', '',
	/*
	window.open( url, ' ',
            'toolbar=0,location=0,directories=0,status=1,menubar=0,' +
            'scrollbars=yes,resizable=yes,' +
            'width=' + querywindow_width + ',' +
            'height=' + querywindow_height )
			*/
	//window.location = "https://www.thebookingbutton.com.au/public/reservation/PropertyOverview.do?channelCode=" + bb_channelCode + "&dateFrom=" + bb_dateFrom;
 function popup(url) {
	window.open(url,"POPUP", "width=" + width + ",height=" + height + ",scrollbars=yes,status=no,resizable=yes");
} 
}
