

// Function to create dynamic pop up window, currently set to center window on screen.
function newWindow(win, url, wid, hgt, scr, res, x, y) {
    if (screen) {
        widthOfScreen = screen.width
        heightOfScreen = screen.height
    }
    midX = widthOfScreen / 2
    midY = heightOfScreen / 2
    midWid = wid / 2
    midHgt = hgt / 2
    x = midX - midWid
    y = midY - midHgt
    win = window.open(url, 'popUp', 'width='+wid+',height='+hgt+',scrollbars='+scr+',resizable='+res+',left='+x+',top='+y+'')
}

function jfAddDays(pstrDate, pintDays){
	var strMonth, strDay, strYear;
	pstrDate = Date.parse(pstrDate);
	pstrDate = parseInt(pstrDate, 10);
	pstrDate = pstrDate + pintDays*(24*60*60*1000);

	pstrDate = new Date(pstrDate);
	
	strMonth = pstrDate.getMonth() + 1;
	strDay = pstrDate.getDate();
	strYear = pstrDate.getFullYear();

	return strMonth + '/' + strDay + '/' + strYear;
}

function jfBookNow(pfrmSource) {
	var strCheckInDate, strCheckOutDate;
	var strMonth, strDay, strYear, strNights, strAdults, strKids;
	var strAction, strURL;
	
	
	//modified to use the textbox instead of the drop downs
	/*
	if (document.all)
		frmSource = document.all('frmBookNow');
	else
		frmSource = document.layers['frmBookNow'];
		*/
 frmSource = document.all('frmBookNow');
	
	
	/*
	strMonth = frmSource.month.value;
	strDay = frmSource.day.value;
	strYear = frmSource.year.value;
	*/
	
	var dt = frmSource.DateIn.value;
	
	strNights = frmSource.nights.value;
	strAdults = frmSource.adults.value;
	strKids = frmSource.kids.value;

	//strCheckInDate = strMonth + '/' + strDay + '/' + strYear;
	
	strCheckInDate = frmSource.DateIn.value
	strCheckOutDate = jfAddDays(strCheckInDate, strNights);

	strAction = 'https://gc.synxis.com/rez.aspx?';
	

	strURL = strAction + 'chain=5173&hotel=11025&arrive=' + strCheckInDate + '&depart=' + strCheckOutDate + '&Adult=' + strAdults + '&Child=' + strKids + '';
		
	document.location.href = strURL;
}
