//==============================Quick Reservation=====================================

 /******************************
  * Editable section -- Start --
  ******************************/
  // DATE SETTINGS - EDIT AS REQUIRED
  var daysinAdvance = 1; // Sets default days in advance from current date
  var numberNights = 2;  // Sets default number of nights
  var numberYears = 4; // Sets default number of years to display in year select list
  var numberNightsMin = 1; // Sets minimum number of nights accepted
  var imgDir = "images/"; // Directory for the dynamic calendar script and images. Trailing slash must be included.

  // FLAG SETTINGS ON/OFF - SET TO 1 FOR ON & 0 FOR OFF
  var wdDisplay = 0; //weekday display
  var numberNightsDisplay = 1; //number of nights display
  var departDateDisplay = 0; //departure dates display
  var departDateUpdate = 1; //auto update departure date

  // WEEK DAY AND NUMBER NIGHTS TEXT - EDIT TEXT AS REQUIRED
  var wdArray = new Array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat");
  var nightTxt = " Night";
  var nightsTxt = " Nights";

  // ERROR MESSAGE TEXT - EDIT TEXT AS REQUIRED
  var invalidDateTxt = "Invalid Arrival Date. Please check number of days selected";
  var invalidDatePriorTxt = "Arrival Date selected is prior Today's date. Please change...";
  var invalidDepartTxt = "Departure Date is prior to Arrival Date selected. Please change...";
  var invalidNightsTxt = "Sorry, reservations under 1 nights are not accepted.";
  /******************************
  * Editable section -- End --
  ******************************/

  /**************************************************
  * DO NOT CHANGE JAVASCRIPT SETTINGS BELOW THIS LINE
  **************************************************/
  //Days in each month Array
  var aNumDays = new Array (31,0,31,30,31,30,31,31,30,31,30,31);

  //Cancel out if no departure date display
  if(departDateDisplay == 0) {
    numberNightsDisplay = 0;
    departDateUpdate = 0;
  }

  //Sets dates selected from dyncalendar
  function calendarCallback(day, month, year, objName, formName) {
    if(objName == "calendarArrive"){
      document.forms[formName].fd.selectedIndex = day-1;
      document.forms[formName].fm.selectedIndex = month-1;
      document.forms[formName].fy.selectedIndex = year - document.forms[formName].fy.options[0].text;
      updateDates(document.forms[formName]);
      if(wdDisplay == 1 && departDateDisplay == 1) setWkd(formName, 1);
    }else{  //objName == calendarDepart
      document.forms[formName].td.selectedIndex = day-1;
      document.forms[formName].tm.selectedIndex = month-1;
      document.forms[formName].ty.selectedIndex = year - document.forms[formName].ty.options[0].text;
      if(wdDisplay == 1 && departDateDisplay == 1) setWkd(formName, 1);
    }
  }

  //Update form with selected dates
  function updateDates(form, loadDates) {
    //check Leap Year
    if(form.fm.selectedIndex==1)  {
      var leapYear  = new Date (form.fy.options[form.fy.selectedIndex].text,form.fm.selectedIndex+1,1);
      var leapYear  = new Date (leapYear  - (24*60*60*1000));
      var numDaysInMonth = leapYear.getDate();
    }else{
      var numDaysInMonth = aNumDays[form.fm.selectedIndex];
    }
    // Update departure date only when loading the form and/or departDateUpdate is set to 1
    if(loadDates == 1 || departDateUpdate == 1) {
      var selectDate = new Date(form.fy.options[form.fy.selectedIndex].text, form.fm.selectedIndex, form.fd.selectedIndex);
      var setDate = new Date(selectDate.getTime() + ((numberNights+1) * 86400000));
      var setDay = setDate.getDate();
      var setMonth = setDate.getMonth();
      var setYear = setDate.getFullYear() - form.fy.options[0].text;
      var checkinDate = new Date(form.fy.options[form.fy.selectedIndex].text,form.fm.selectedIndex,form.fd.selectedIndex+1);
      var checkoutDate = new Date(form.ty.options[form.ty.selectedIndex].text,form.tm.selectedIndex,form.td.selectedIndex+1);
      if(checkinDate > checkoutDate) {
        if(setYear == form.ty.length) {
          form.td.options[30].selected=1;
          form.tm.options[11].selected=1;
          form.ty.options[form.ty.length-1].selected=1;
        } else {
          form.td.options[setDay-1].selected=1;
          form.tm.options[setMonth].selected=1;
          form.ty.options[setYear].selected=1;
        }
      }
    }
    if(form.fd.selectedIndex+1 > numDaysInMonth) {
      alert(invalidDateTxt);
      form.fd.selectedIndex = numDaysInMonth-1;
    }
  }

  function setWkd(form, calendar) {
    // change form object if returned from calendar
    if(calendar) form = document.forms[form];
    for (var i = 0; i < form.fy.length; i++) {
      if (form.fy.options[i].selected) var fyear = form.fy.options[i].text;
      if (departDateDisplay == 1 && form.ty.options[i].selected) var tyear = form.ty.options[i].text;
    }
    var checkinDate = new Date(fyear,form.fm.selectedIndex,form.fd.selectedIndex+1);
    if (departDateDisplay == 1) var checkoutDate = new Date(tyear,form.tm.selectedIndex,form.td.selectedIndex+1);
    var numNights = Math.round((checkoutDate - checkinDate) / 86400000);
    if (numNights == 1) numNights += nightTxt;
    else numNights += nightsTxt;
    //Set Days of the week display
    if(wdDisplay == 1 && document.getElementById) {
      document.getElementById('inWd').firstChild.nodeValue = '(' + wdArray[checkinDate.getDay()] + ')';
      if (departDateDisplay == 1) document.getElementById('outWd').firstChild.nodeValue = '(' + wdArray[checkoutDate.getDay()] + ')';
    }
    //Set number of nights display
    if(numberNightsDisplay == 1 && document.getElementById) document.getElementById('lengthStay').firstChild.nodeValue = numNights;
  }

  //Load current dates on form load
  function LoadDates(form) {
    var curDate = new Date();
    var setDate = new Date(curDate.getTime() + (daysinAdvance * 86400000));
    var setDay = setDate.getDate();
    var setMonth = setDate.getMonth();
    var setYear = setDate.getFullYear() - form.fy.options[0].text;
    // Set Arrival Dates
    form.fd.selectedIndex = setDay-1;
    form.fm.selectedIndex = setMonth;
    form.fy.selectedIndex = setYear;
    // Set the Departure Dates
    updateDates(form, departDateDisplay);
    if(wdDisplay == 1 || numberNightsDisplay == 1) setWkd(form);
  }

  //Load current dates on form load
  function checkDates(form) {
    var curDate = new Date();
    for (var i = 0; i < form.fy.length; i++) {
      if (form.fy.options[i].selected) var fyear = form.fy.options[i].text;
      if (departDateDisplay == 1 && form.ty.options[i].selected) var tyear = form.ty.options[i].text;
    }
    var checkinDate = new Date(fyear,form.fm.selectedIndex,form.fd.selectedIndex+2);
    if (departDateDisplay == 1) {
      var checkoutDate = new Date(tyear,form.tm.selectedIndex,form.td.selectedIndex+2);
      var numNights = Math.round((checkoutDate - checkinDate) / 86400000);
    } else {
      var numNights = form.numnights.selectedIndex+1;
    }
    if(checkinDate.getTime() < curDate.getTime()) {
      alert(invalidDatePriorTxt);
      return false;
    }
    if(numNights < 1) {
      alert(invalidDepartTxt );
      return false;
    }
    if(numNights < numberNightsMin) {
      alert(invalidNightsTxt);
      return false;
    }
  }

  //Generate years options for year select list
  function year_option(form){
    curDate = new Date();
	var str = "";
    curYear = curDate.getFullYear();
    for(i = curYear ; i <= curYear+(numberYears-1) ; i++ ){
      //document.write('<option value="' + i + '">' + i + '</option>');
	  str += '<option value="' + i + '">' + i + '</option>';
    }
	return str;
  }


var QRVar='<form name="form1" action="http://www.globekey.com/reserve.php" method="POST">';


QRVar += '<table width="250" border="0" cellspacing="0" cellpadding="0" align="center">';
QRVar += '<tr>';
QRVar += '<td align="left" style="font-size:13px; color:#462b0a; padding-top:13px; padding-bottom:6px; background-image: url(images/dots.gif); background-repeat:no-repeat; background-position:left bottom;"><b>MAKE ROOM RESERVATIONS</b> ';
QRVar += '<tr>';
QRVar += '<td align="left" style="font-size:11px; color:#000; padding-top:3px; padding-bottom:3px;">Arrival Date';
QRVar += '<table width="100%" border="0" cellspacing="0" cellpadding="3">';
QRVar += ' <tr> ';
QRVar += '<td align="left" height="30" valign="top">';

QRVar += '<select name="fd" id="fd" size="1" onChange="updateDates(this.form);setWkd(this.form)" style="font-size:11px; background:#FFF; width:40px; border:none; height:18px;">';
QRVar += '<option value="1" selected>01</option>';
QRVar += '<option value="2">02</option>';
QRVar += '<option value="3">03</option>';
QRVar += '<option value="4">04</option>';
QRVar += '<option value="5">05</option>';
QRVar += '<option value="6">06</option>';
QRVar += '<option value="7">07</option>';
QRVar += '<option value="8">08</option>';
QRVar += '<option value="9">09</option>';
QRVar += '<option value="10">10</option>';
QRVar += '<option value="11">11</option>';
QRVar += '<option value="12">12</option>';
QRVar += '<option value="13">13</option>';
QRVar += '<option value="14">14</option>';
QRVar += '<option value="15">15</option>';
QRVar += '<option value="16">16</option>';
QRVar += '<option value="17">17</option>';
QRVar += '<option value="18">18</option>';
QRVar += '<option value="19">19</option>';
QRVar += '<option value="20">20</option>';
QRVar += '<option value="21">21</option>';
QRVar += '<option value="22">22</option>';
QRVar += '<option value="23">23</option>';
QRVar += '<option value="24">24</option>';
QRVar += '<option value="25">25</option>';
QRVar += '<option value="26">26</option>';
QRVar += '<option value="27">27</option>';
QRVar += '<option value="28">28</option>';
QRVar += '<option value="29">29</option>';
QRVar += '<option value="30">30</option>';
QRVar += '<option value="31">31</option>';
QRVar += '</select>';

QRVar += '</td>';
QRVar += '<td align="left" height="30" valign="top">';
QRVar += '<select name="fm" id="fm" size="1" onChange="updateDates(this.form);setWkd(this.form)" style="font-size:11px; background:#fff; width:50px; border:none; height:18px;">';
QRVar += '<option value="1" selected>Jan</option>';
QRVar += '<option value="2">Feb</option>';
QRVar += '<option value="3">March</option>';
QRVar += '<option value="4">April</option>';
QRVar += '<option value="5">May</option>';
QRVar += '<option value="6">June</option>';
QRVar += '<option value="7">July</option>';
QRVar += '<option value="8">Aug</option>';
QRVar += '<option value="9">Sep</option>';
QRVar += '<option value="10">Oct</option>';
QRVar += '<option value="11">Nov</option>';
QRVar += '<option value="12">Dec</option>';
QRVar += '</select>';
QRVar += '</td>';
QRVar += '<td align="left" height="30" valign="top">';
QRVar += '<select name="fy" id="fy" size="1" onChange="updateDates(this.form);setWkd(this.form)" style="font-size:11px; background:#fff; width:55px; border:none; height:18px;">';
QRVar += year_option();
//QRVar += '<option value="2005" selected>2005</option>';
//QRVar += '<option value="2006">2006</option>';
//QRVar += '<option value="2007">2007</option>';
//QRVar += '<option value="2008">2008</option>';
QRVar += '</select>';
QRVar += '</td>';
QRVar += '</tr>';
QRVar += '</table>';
QRVar += '</td>';
QRVar += '</tr>';
QRVar += '<tr>';
QRVar += '<td align="left">';
QRVar += '<table width="100%" border="0" cellspacing="0" cellpadding="3">';
QRVar += '<tr>';
QRVar += '<td style="font-size:11px; color:#000;">Nights</td>';
QRVar += '<td style="font-size:11px; color:#000;">Adults</td>';
QRVar += '<td style="font-size:11px; color:#000;">+Children</td>';
QRVar += '<td style="font-size:11px; color:#000;">Rooms</td>';
QRVar += '</tr>';
QRVar += '<tr>';
QRVar += '<td height="30" valign="top">';
QRVar += '<SELECT name="numnights" size="1" style="font-size:11px; background:#fff; width:43px; border:none; height:18px;">';
QRVar += '<option value="1" selected>1</option>';
QRVar += '<option value="2">2</option>';
QRVar += '<option value="3">3</option>';
QRVar += '<option value="4">4</option>';
QRVar += '<option value="5">5</option>';
QRVar += '<option value="6">6</option>';
QRVar += '<option value="7">7</option>';
QRVar += '<option value="8">8</option>';
QRVar += '<option value="9">9</option>';
QRVar += '<option value="10">10</option>';
QRVar += '<option value="11">11</option>';
QRVar += '<option value="12">12</option>';
QRVar += '<option value="13">13</option>';
QRVar += '<option value="14">14</option>';
QRVar += '<option value="15">15</option>';
QRVar += '<option value="16">16</option>';
QRVar += '<option value="17">17</option>';
QRVar += '<option value="18">18</option>';
QRVar += '<option value="19">19</option>';
QRVar += '<option value="20">20</option>';
QRVar += '<option value="21">22</option>';
QRVar += '<option value="21">23</option>';
QRVar += '<option value="21">24</option>';
QRVar += '<option value="21">25</option>';
QRVar += '<option value="21">26</option>';
QRVar += '<option value="21">27</option>';
QRVar += '<option value="21">28</option>';
QRVar += '<option value="21">29</option>';
QRVar += '<option value="21">30</option>';
QRVar += '<option value="21">31</option>';
QRVar += '<option value="21">32</option>';
QRVar += '<option value="21">33</option>';
QRVar += '<option value="21">34</option>';
QRVar += '<option value="21">35</option>';
QRVar += '<option value="21">36</option>';
QRVar += '<option value="21">37</option>';
QRVar += '<option value="21">38</option>';
QRVar += '<option value="21">39</option>';
QRVar += '<option value="21">40</option>';
QRVar += '<option value="21">41</option>';
QRVar += '<option value="21">42</option>';
QRVar += '<option value="21">43</option>';
QRVar += '<option value="21">44</option>';
QRVar += '<option value="21">45</option>';
QRVar += '<option value="21">46</option>';
QRVar += '<option value="21">47</option>';
QRVar += '<option value="21">48</option>';
QRVar += '<option value="21">49</option>';
QRVar += '<option value="21">50</option>';
QRVar += '<option value="21">51</option>';
QRVar += '<option value="21">52</option>';
QRVar += '<option value="21">53</option>';
QRVar += '<option value="21">54</option>';
QRVar += '<option value="21">55</option>';
QRVar += '<option value="21">56</option>';
QRVar += '<option value="21">57</option>';
QRVar += '<option value="21">58</option>';
QRVar += '<option value="21">59</option>';
QRVar += '<option value="21">60</option>';
QRVar += '</select>';
QRVar += '</td>';
QRVar += '<td height="30" valign="top">';
QRVar += ' <select  name="adults" id="adults" size="1" style="font-size:11px; background:#fff; width:43px; border:none; height:18px;">';
QRVar += '<option value="1" selected>1</option>';
QRVar += '<option value="2">2</option>';
QRVar += '<option value="3">3</option>';
QRVar += '<option value="4">4</option>';
QRVar += '<option value="5">5</option>';
QRVar += '<option value="6">6</option>';
QRVar += '</select>';
QRVar += '</td>';
QRVar += '<td height="30" valign="top">';
QRVar += '<select  name="child" id="child" size="1" style="font-size:11px; background:#fff; width:43px; border:none; height:18px;">';
QRVar += '<option value="0" selected>0</option>';
QRVar += '<option value="1">1</option>';
QRVar += '<option value="2">2</option>';
QRVar += '<option value="3">3</option>';
QRVar += '<option value="4">4</option>';
QRVar += '<option value="5">5</option>';
QRVar += '<option value="6">6</option>';
QRVar += '</select>';
QRVar += '</td>';
QRVar += '<td height="30" valign="top">';
QRVar += '<select name="numrooms" id="numrooms" size="1" style="font-size:11px; background:#fff; width:43px; border:none; height:18px;">';
QRVar += '<option value="1" selected>1</option>';
QRVar += '<option value="2">2</option>';
QRVar += '<option value="3">3</option>';
QRVar += '<option value="4">4</option>';
QRVar += '<option value="5">5</option>';
QRVar += '<option value="6">6</option>';
QRVar += '</select>';
QRVar += '</td>';
QRVar += '</tr>';
QRVar += '</table>';
QRVar += '</td>';
QRVar += '</tr>';
QRVar += '<tr>';
QRVar += '<td align="left" class="booking"><input type="hidden" name="settings1" value="daysinAdvance=1;numberNights=2;numberYears=4;numberNightsMin=1;"><input type="hidden" name="settings2" value="wdDisplay=1;numberNightsDisplay=1;departDateDisplay=0;"><input type="hidden" name="sh" value="yes"><input type="hidden" name="lang" value="en"><input type="hidden" name="hid" value="BOH10626"> <span style="font-family:Arial, Helvetica, sans-serif; color:#000;font-size:11px;">Promotion code:</span> <input type="text" name="agc" value="" style="font-size:11px; background:#fff; width:113px; border:none; height:18px;"></td></tr><tr><td height="0" align="center"valign="top">&nbsp;</td></tr><tr><td height="0" align="center" valign="top"><input type="image" src="images/submit.jpg" name="availcheck" value="GO" onClick="return checkDates(this.form)"></td>';
QRVar += '</tr>';
QRVar += '</table>';
QRVar += '</form>';

//writing form===========================================================================

document.write (QRVar);


//himakshi
 LoadDates(document.form1);
 //himakshi

//end write===========================================
//end QR==============================================
// current date Selected
/*var a;
a=new Date();
day=a.getDate();day=((day<10)?'0':'')+day;
month=a.getMonth()+1;month=((month<10)?'0':'')+month;
year=a.getYear();year=((year<1000)?((year<70)?2000:1900):0)+year;



document.form1.Qday.selectedIndex =day-1;
document.form1.Qmonth.selectedIndex = month-1;
//document.form1.Qyear.selectedIndex = (year.charAt(parseInt(year.length-1))-1);

for(i=0;i<document.form1.Qyear.options.length;i++)
  {
   if (document.form1.Qyear.options[i].value == year)
   {
    document.form1.Qyear.options[i].selected = true;
   }
  }



	*/




