function displayDirectSearch(strBookingURL,strAffiliateID, strProviderID, strPremisesCode, strChildren, strInfants, strBackgroundImage,strBackgroundColor) { //document.write('
') //hidden controls to hold parameters passed in for button click event below document.write(''); document.write(''); document.write(''); document.write(''); var strGullSurroundStyle; strGullSurroundStyle = ""; if(strBackgroundColor!="") { strGullSurroundStyle = 'style="background-color:' + strBackgroundColor + '"'; } if(strBackgroundImage!="") { strGullSurroundStyle = 'style="background:transparent url(' + strBackgroundImage + ') no-repeat 0 0"'; } document.write('
'); document.write('
Adults
'); document.write('
'); if(strChildren =='yes') { document.write('
Children
'); document.write('
'); } if(strInfants =='yes') { document.write('
Infants
'); document.write('
') } document.write('
'); document.write('
Night(s)
'); document.write(''); document.write('
'); document.write(''); document.write('
Arrival
'); document.write('') var m_names = new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"); for (var yearCounter = todaysDate.getFullYear(); yearCounter<2013; yearCounter++ ) { if(yearCounter == todaysDate.getFullYear()) { for (var monthCounter = todaysDate.getMonth()+1; monthCounter<=12;monthCounter++) { document.write(''); } } else { for (var monthCounter = 1; monthCounter<=12;monthCounter++) { document.write(''); } } } document.write(' '); document.write(''); document.write('
'); document.write(''); document.write('
'); //document.write('') } //declare variable to hold URL - build URL from controls on page - redirect page to this URL function Search() { //var GullFormStore = document.forms['GullDirectPremSearchfrm']; var gullYear = document.getElementById('date_sel'); var myStr = document.getElementById('date_sel_mm').value.split("|"); var gullYear = myStr[0]; var gullMonth = myStr[1]; var gullChild; if(document.getElementById('selNumChildren') == undefined) {gullChild = 0;} else{gullChild = document.getElementById('selNumChildren').value;} var gullInfants; if(document.getElementById('selNumInfants') == undefined) {gullInfants = 0;} else {gullInfants = document.getElementById('selNumInfants').value;} //if(isValidDate(gullForm.selDays.value,gullForm.hdnSelectedMonth.value-1,gullForm.hdnSelectedYear.value)) if(isValidDate(document.getElementById('date_sel_dd').value,gullMonth-1,gullYear)) { //variable to hold our deepLink var deepLink; //build the URL for deepLinking deepLink = document.getElementById('hdnBookingURL').value; deepLink = deepLink + "?affiliateid=" + document.getElementById('hdnAffiliateID').value; deepLink = deepLink + "&ProvID=" + document.getElementById('hdnProviderID').value;; deepLink = deepLink + "&PremisesCode=" + document.getElementById('hdnPremisesCode').value; deepLink = deepLink + "&AffiliatevisitID=" + "1"; deepLink = deepLink + "&selNumAdults=" + document.getElementById('selNumAdults').value; deepLink = deepLink + "&selNumChildren=" + gullChild; deepLink = deepLink + "&selNumInfants=" + gullInfants; deepLink = deepLink + "&selArriveMonth=" + gullMonth; deepLink = deepLink + "&selArriveYear=" + gullYear; deepLink = deepLink + "&selArriveDay=" + document.getElementById('date_sel_dd').value; deepLink = deepLink + "&selNumNights=" + document.getElementById('selNumNights').value; deepLink = deepLink + "&isAdvanced=" + "1"; deepLink = deepLink + "&hdnAction=" + "search"; deepLink = deepLink + "&SelCurrency=" + "978"; //redirect page to our deepLink URL self.parent.location = deepLink; // document.write(deepLink); } } function isValidDate(day,month,year) { /* Purpose: return true if the date is valid, false otherwise Arguments: day integer representing day of month month integer representing month of year year integer representing year Variables: dteDate - date object */ var dteDate; var todaysDateTime; todaysDateTime = new Date(); //set up a Date object based on the day, month and year arguments //javascript months start at 0 (0-11 instead of 1-12) dteDate=new Date(year,month,day,"23","59","59"); if (dteDate>=todaysDateTime) { /* Javascript Dates are a little too forgiving and will change the date to a reasonable guess if it's invalid. We'll use this to our advantage by creating the date object and then comparing it to the details we put it. If the Date object is different, then it must have been an invalid date to start with... */ return ((day==dteDate.getDate()) && (month==dteDate.getMonth()) && (year==dteDate.getFullYear())); } else { return false; } }