﻿function lastday(mon, yr)
     {
          var start_date= new Date(yr, mon, 1);
          var end_date= new Date(yr, mon+1, 1);
          lday =( end_date - start_date);
          lday = lday/(24*60*60000);
          return lday;
     }
     function idays(m,d,y)
     {
          lday=lastday(m.options[m.selectedIndex].value-1 ,
         y.options[y.selectedIndex].value);
          d.length=lday;
         for(i=0;i<lday;i++)
         {
               d.options[i].text=i+1;
               d.options[i].value=i+1;
         }
     }
     function fnToday()
     {
          var strDate = new Date();
          var str_out_Date = new Date();
          str_out_Date.setDate(str_out_Date.getDate()+1);
          var os_today="Win"
          var ie_today=false;
          var op_today=false;
          var bn_today=navigator.platform;
          var bw_today=navigator.userAgent;
          var checkInYear=strDate.getFullYear();
          var checkOutYear=str_out_Date.getFullYear();
          var checkInMonth=strDate.getMonth()+1;
          var checkInDay=strDate.getDate();
          var checkOutMonth=str_out_Date.getMonth()+1;
          var checkOutDay=str_out_Date.getDate();
          window.document.quicksearch.checkInDate1.value=checkInMonth+"/"+checkInDay+"/"+checkInYear
          window.document.quicksearch.checkOutFullDate.value=checkOutMonth+"/"+checkOutDay+"/"+checkOutYear
          if(bn_today.indexOf("Win32")==-1)
          {
           os_today="Mac";
           if(bw_today.indexOf("MSIE")!=-1){ie_today=true;} 
           if(bw_today.indexOf("Opera")!=-1){op_today=true;}
          }
          if(op_today)
          {
          var checkInMonth=strDate.getMonth()+parseInt(1);
          var checkInDay=strDate.getDate();
          var checkOutMonth=str_out_Date.getMonth()+parseInt(1);
          var checkOutDay=str_out_Date.getDate();
          
          window.document.quicksearch.checkInDate1.value=checkInMonth+"/"+checkInDay+"/"+checkInYear
          window.document.quicksearch.checkOutFullDate.value=checkOutMonth+"/"+checkOutDay+"/"+checkOutYear
          }
          else if(ie_today)
          {
          var checkInMonth=strDate.getMonth();
          var checkInDay=strDate.getDate()-parseInt(1);
          var checkOutMonth=str_out_Date.getMonth();
          var checkOutDay=str_out_Date.getDate()-parseInt(1);
          window.document.quicksearch.checkInDate1.value=checkInMonth+"/"+checkInDay+"/"+checkInYear
          window.document.quicksearch.checkOutFullDate.value=checkOutMonth+"/"+checkOutDay+"/"+checkOutYear
          }
          else
          {
          var checkInMonth=strDate.getMonth()+parseInt(1);
          var checkInDay=strDate.getDate();
          var checkOutMonth=str_out_Date.getMonth()+parseInt(1);
          var checkOutDay=str_out_Date.getDate();
          
          window.document.quicksearch.checkInDate1.value=checkInMonth+"/"+checkInDay+"/"+checkInYear
          window.document.quicksearch.checkOutFullDate.value=checkOutMonth+"/"+checkOutDay+"/"+checkOutYear
          }
     
     }

     function fnSubmit()
     {
          var strCurrentDate = new Date('12/30/2008');
          var check_In=new Date(window.document.quicksearch.checkInDate1.value);
               if(check_In<strCurrentDate)

               {
                    alert("Check-IN Date can not be passed date.");
                    window.document.quicksearch.checkInDate1.focus();
                    return false;
               }
          var ckin=window.document.quicksearch.checkInDate1.value;    
          var ckout=window.document.quicksearch.checkOutFullDate.value;
          var date=ckin.split("/");
          var date1=ckout.split("/");
          window.document.quicksearch.checkInDate.value = date[1];
          var monthIn=parseInt(date[0])-parseInt(1);
          var monthOut=parseInt(date1[0])-parseInt(1);
          window.document.quicksearch.checkInMonthYear.value = monthIn + ""+date[2];
          //window.document.quicksearch.checkInMonth.value=monthIn;
          window.document.quicksearch.checkOutDate.value = date[1];
          window.document.quicksearch.checkOutMonthYear.value =monthOut + ""+date1[2];
          //window.document.quicksearch.checkInYear.value=date[2]
          if(new Date(ckout)<new Date(check_In))
               {
                    alert("Check-Out Date should not be less than Check-In Date");
                    window.document.quicksearch.checkOutFullDate.focus();
                    return false;
               }
          var s=s_gi('thaycpmelbourne'); s.linkTrackVars='prop1,eVar1,events'; s.events='event1'; s.prop1='Reservation Widget - Accommodations'; s.eVar1='Reservation Widget - Accommodations'; s.tl(this,'o','Reservation Widget - Accommodations');
     }
     
     
     
     
     // ===================================================================
// Author: Matt Kruse <matt@mattkruse.com>
// WWW: http://www.mattkruse.com/
//
// NOTICE: You may use this code for any purpose, commercial or
// private, without any further permission from the author. You may
// remove this notice from your final code if you wish, however it is
// appreciated by the author if at least my web site address is kept.
//
// You may *NOT* re-distribute this code in any way except through its
// use. That means, you can include it in your product, or your web
// site, or any other form where the code is actually being used. You
// may not put the plain javascript up on your site for download or
// include it in your javascript libraries for download. Instead,
// please just point to my URL to ensure the most up-to-date versions
// of the files. Thanks.
// ===================================================================
/* 
AnchorPosition.js
Author: Matt Kruse
Last modified: 5/31/01

DESCRIPTION: These functions find the position of an <A> tag in a document,
so other elements can be positioned relative to it.

COMPATABILITY: Works with Netscape 4.x, 6.x, IE 5.x on Windows. Some small
positioning errors - usually with Window positioning - occur on the 
Macintosh platform.

FUNCTIONS:
getAnchorPosition(anchorname)
  Returns an Object() having .x and .y properties of the pixel coordinates
  of the upper-left corner of the anchor. Position is relative to the PAGE.

getAnchorWindowPosition(anchorname)
  Returns an Object() having .x and .y properties of the pixel coordinates
  of the upper-left corner of the anchor, relative to the WHOLE SCREEN.

NOTES:

1) For popping up separate browser windows, use getAnchorWindowPosition. 
   Otherwise, use getAnchorPosition

2) Your anchor tag MUST contain both NAME and ID attributes which are the 
   same. For example:
   <A NAME="test" ID="test"> </A>

3) There must be at least a space between <A> </A> for IE5.5 to see the 
   anchor tag correctly. Do not do <A></A> with no space.
*/ 
// getAnchorPosition(anchorname)
//   This function returns an object having .x and .y properties which are the coordinates
//   of the named anchor, relative to the page.
function getAnchorPosition(anchorname) {
     // This function will return an Object with x and y properties
     var coordinates = new Object();
     var x=0;
     var y=0;
     // Browser capability sniffing
     var use_gebi = false;
     var use_css = false;
     var use_layers = false;
     if (document.getElementById) { use_gebi = true; }
     else if (document.all) { use_css = true; }
     else if (document.layers) { use_layers = true; }
     // Logic to find position
     if (use_gebi && document.all) {
          x = AnchorPosition_getPageOffsetLeft(document.all[anchorname]);
          y = AnchorPosition_getPageOffsetTop(document.all[anchorname]);
          }
     else if (use_gebi) {
          var o = document.getElementById(anchorname);
          x = o.offsetLeft;
          y = o.offsetTop;
          }
     else if (use_css) {
          x = AnchorPosition_getPageOffsetLeft(document.all[anchorname]);
          y = AnchorPosition_getPageOffsetTop(document.all[anchorname]);
          }
     else if (use_layers) {
          var found=0;
          for (var i=0; i<document.anchors.length; i++) {
               if (document.anchors[i].name == anchorname) {
                    found=1;
                    break;
                    }
               }
          if (found == 0) {
               coordinates.x=0; coordinates.y=0; return coordinates;
               }
          x = document.anchors[i].x;
          y = document.anchors[i].y;
          }
     else {
          coordinates.x=0; coordinates.y=0; return coordinates;
          }
     coordinates.x = x;
     coordinates.y = y;
     return coordinates;
     }

// getAnchorWindowPosition(anchorname)
//   This function returns an object having .x and .y properties which are the coordinates
//   of the named anchor, relative to the window
function getAnchorWindowPosition(anchorname) {
     var coordinates = getAnchorPosition(anchorname);
     var x=0;
     var y=0;
     if (document.getElementById) {
          if (isNaN(window.screenX)) {
               x = coordinates.x + window.screenLeft;
               y = coordinates.y + window.screenTop;
               }
          else {
               x = coordinates.x + window.screenX + (window.outerWidth-window.innerWidth) - window.pageXOffset;
               y = coordinates.y + window.screenY + (window.outerHeight-24-window.innerHeight) - window.pageYOffset;
               }
          }
     else if (document.all) {
          x = coordinates.x + window.screenLeft;
          y = coordinates.y + window.screenTop;
          }
     else if (document.layers) {
          x = coordinates.x + window.screenX + (window.outerWidth-window.innerWidth) - window.pageXOffset;
          y = coordinates.y + window.screenY + (window.outerHeight-24-window.innerHeight) - window.pageYOffset;
          }
     coordinates.x = x;
     coordinates.y = y;
     return coordinates;
     }

// Functions for IE to get position of an object
function AnchorPosition_getPageOffsetLeft (el) {
     var ol = el.offsetLeft;
     while ((el = el.offsetParent) != null) { 
          ol += el.offsetLeft; 
          }
     return ol;
     }
function AnchorPosition_getWindowOffsetLeft (el) {
     var scrollamount = document.body.scrollLeft;
     return AnchorPosition_getPageOffsetLeft(el)-scrollamount;
     }    
function AnchorPosition_getPageOffsetTop (el) {
     var ot = el.offsetTop;
     while((el = el.offsetParent) != null) { 
          ot += el.offsetTop; 
          }
     return ot;
     }
function AnchorPosition_getWindowOffsetTop (el) {
     var scrollamount = document.body.scrollTop;
     return AnchorPosition_getPageOffsetTop(el)-scrollamount;
     }




// ===================================================================
// Author: Matt Kruse <matt@mattkruse.com>
// WWW: http://www.mattkruse.com/
//
// NOTICE: You may use this code for any purpose, commercial or
// private, without any further permission from the author. You may
// remove this notice from your final code if you wish, however it is
// appreciated by the author if at least my web site address is kept.
//
// You may *NOT* re-distribute this code in any way except through its
// use. That means, you can include it in your product, or your web
// site, or any other form where the code is actually being used. You
// may not put the plain javascript up on your site for download or
// include it in your javascript libraries for download. Instead,
// please just point to my URL to ensure the most up-to-date versions
// of the files. Thanks.
// ===================================================================
/* 
CalendarPopup.js
Author: Matt Kruse
Last modified: 5/31/01

DESCRIPTION: This object implements a popup calendar to allow the user to
select a date. 

COMPATABILITY: Works with Netscape 4.x, 6.x, IE 5.x on Windows. Some small
positioning errors - usually with Window positioning - occur on the 
Macintosh platform.
The calendar can be modified to work for any location in the world by 
changing which weekday is displayed as the first column, changing the month
names, and changing the column headers for each day.

USAGE:
// Create a new CalendarPopup object of type WINDOW
var cal = new CalendarPopup(); 

// Create a new CalendarPopup object of type DIV using the DIV named 'mydiv'
var cal = new CalendarPopup('mydiv'); 

// Set the name of the function to be called when the user clicks on a date.
// This function should accept year,month,date as arguments. It is then the
// responsibility of the function to populate a text box with the date or
// do whetever else is necessary
cal.setReturnFunction(functionname);

// Show the calendar relative to a given anchor
cal.showCalendar(anchorname);

// Hide the calendar. The calendar is set to autoHide automatically
cal.hideCalendar();

// Set the month names to be used. Default are English month names
cal.setMonthNames("Jan","Feb","Mar",...);

// Set the text to be used above each day column. The days start with 
// sunday regardless of the value of WeekStartDay
cal.setDayHeaders("S","M","T",...);

// Set the day for the first column in the calendar grid. By default this
// is Sunday (0) but it may be changed to fit the conventions of other
// countries.
cal.setWeekStartDay(1); // week is Monday - Saturday

// Set the calendar offset to be different than the default. By default it
// will appear just below and to the right of the anchorname. So if you have
// a text box where the date will go and and anchor immediately after the
// text box, the calendar will display immediately under the text box.
cal.offsetX = 20;
cal.offsetY = 20;

NOTES:
1) Requires the functions in AnchorPosition.js and PopupWindow.js

2) Your anchor tag MUST contain both NAME and ID attributes which are the 
   same. For example:
   <A NAME="test" ID="test"> </A>

3) There must be at least a space between <A> </A> for IE5.5 to see the 
   anchor tag correctly. Do not do <A></A> with no space.

4) When a CalendarPopup object is created, a handler for 'onmouseup' is
   attached to any event handler you may have already defined. Do NOT define
   an event handler for 'onmouseup' after you define a CalendarPopup object 
   or the autoHide() will not work correctly.
   
5) The calendar display uses "graypixel.gif" which is a 1x1 gray pixel of
   color #C0C0C0. If this file is not present, the calendar display should 
   still be fine but will not show the gray lines.
   
6) The calendar popup display uses style sheets to make it look nice.

*/ 

// CONSTRUCTOR for the CalendarPopup Object
function CalendarPopup() {
     var newCalendar;
     if (arguments.length>0) {
          newCalendar = new PopupWindow(arguments[0]);
          }
     else {
          newCalendar = new PopupWindow();
          newCalendar.setSize(150,175);
          }
     newCalendar.offsetX = 20;
     newCalendar.offsetY = 25;
     newCalendar.autoHide();
     // Calendar-specific properties
     newCalendar.monthNames = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
     newCalendar.dayHeaders = new Array("S","M","T","W","T","F","S");
     newCalendar.returnFunction = "tmpReturnFunction";
     newCalendar.weekStartDay = 0;
     // Method mappings
     newCalendar.setReturnFunction = CalendarPopup_setReturnFunction;
     newCalendar.setMonthNames = CalendarPopup_setMonthNames;
     newCalendar.setDayHeaders = CalendarPopup_setDayHeaders;
     newCalendar.setWeekStartDay = CalendarPopup_setWeekStartDay;
     newCalendar.showCalendar = CalendarPopup_showCalendar;
     newCalendar.hideCalendar = CalendarPopup_hideCalendar;
     newCalendar.getStyles = CalendarPopup_getStyles;
     newCalendar.refreshCalendar = CalendarPopup_refreshCalendar;
     newCalendar.getCalendar = CalendarPopup_getCalendar;
     // Return the object
     return newCalendar;
     }

// Temporary default function to be called when a date is clicked, so no error is thrown
function CalendarPopup_tmpReturnFunction(y,m,d) {
     alert('Use setReturnFunction() to define which function will get the clicked results!');
     }

// Set the name of the function to call to get the clicked date
function CalendarPopup_setReturnFunction(name) {
     this.returnFunction = name;
     }

// Over-ride the built-in month names
function CalendarPopup_setMonthNames() {
     for (var i=0; i<arguments.length; i++) {
          this.monthNames[i] = arguments[i];
          }
     }

// Over-ride the built-in column headers for each day
function CalendarPopup_setDayHeaders() {
     for (var i=0; i<arguments.length; i++) {
          this.dayHeaders[i] = arguments[i];
          }
     }

// Set the day of the week (0-7) that the calendar display starts on
// This is for countries other than the US whose calendar displays start on Monday(1), for example
function CalendarPopup_setWeekStartDay(day) {
     this.weekStartDay = day;
     }

// Hide a calendar object
function CalendarPopup_hideCalendar() {
     if (arguments.length > 0) {
          window.popupWindowObjects[arguments[0]].hidePopup();
          }
     else {
          this.hidePopup();
          }
     }

// Refresh the contents of the calendar display
function CalendarPopup_refreshCalendar(index) {
     var calObject = window.popupWindowObjects[index];
     if (arguments.length>1) { 
          calObject.populate(calObject.getCalendar(arguments[1],arguments[2]));
          }
     else {
          calObject.populate(calObject.getCalendar());
          }
     calObject.refresh();
     }

// Populate the calendar and display it
function CalendarPopup_showCalendar(anchorname) {
     this.populate(this.getCalendar());
     this.showPopup(anchorname);
     }

// Get style block needed to display the calendar correctly
function CalendarPopup_getStyles() {
     var result = "";
     result += "<STYLE>\n";
     result += "TD.cal { font-family:arial; font-size: 8pt; }\n";
     result += "TD.calmonth { font-family:arial; font-size: 8pt; text-align: right;}\n";
     result += "TD.caltoday { font-family:arial; font-size: 8pt; text-align: right; color: red; border-width:1; border-type:solid; border-color:#800000; }\n";
     result += "A.cancel { font-family:arial; font-size: 8pt; height: 20px; color: gray; }\n";
     result += "A.cal { text-decoration:none; color:#000000; }\n";
     result += "A.calthismonth { text-decoration:none; color:#000000; font-weight: bold;}\n";
     result += "A.calothermonth { text-decoration:none; color:#808080; }\n";
     result += "</STYLE>\n";
     return result;
     }

// Return a string containing all the calendar code to be displayed
function CalendarPopup_getCalendar() {
     var now = new Date();
     if (arguments.length > 0) { var month = arguments[0]; }
          else { var month = now.getMonth()+1; }
     if (arguments.length > 1) { var year = arguments[1]; }
          else { var year = now.getFullYear(); }
     var daysinmonth= new Array(0,31,28,31,30,31,30,31,31,30,31,30,31);
     if ( ( (year%4 == 0)&&(year%100 != 0) ) || (year%400 == 0) ) { // leap year
          daysinmonth[2] = 29;
          }
     var current_month = new Date(year,month-1,1);
     var display_year = year;
     var display_month = month;
     var display_date = 1;
     var weekday= current_month.getDay();
     var offset = 0;
     if (weekday >= this.weekStartDay) {
          offset = weekday - this.weekStartDay;
          }
     else {
          offset = 7-this.weekStartDay+weekday;
          }
     if (offset > 0) {
          display_month--;
          if (display_month < 1) { display_month = 12; display_year--; }
          display_date = daysinmonth[display_month]-offset+1;
          }
     var next_month = month+1;
     var next_month_year = year;
     if (next_month > 12) { next_month=1; next_month_year++; }
     var last_month = month-1;
     var last_month_year = year;
     if (last_month < 1) { last_month=12; last_month_year--; }
     var date_class;
     var result = "";
     if (this.type == "WINDOW") {
          var windowref = "window.opener.";
          }
     else {
          var windowref = "";
          }
     // If POPUP, write entire HTML document
     if (this.type == "WINDOW") {
          result += "<HTML><HEAD><TITLE>Calendar</TITLE>"+this.getStyles()+"</HEAD><BODY MARGINWIDTH=0 MARGINHEIGHT=0 TOPMARGIN=0 RIGHTMARGIN=0 LEFTMARGIN=0>\n";
          result += '<DIV style="position: absolute; z-index: 9999;" ID=calMove><CENTER><TABLE WIDTH=100% BORDER=0 BORDERWIDTH=0 CELLSPACING=0 CELLPADDING=0>\n';
          result += '<TR BGCOLOR="#99CCFF">\n';
          result += ' <TD BGCOLOR="#99CCFF" COLSPAN="3" VALIGN="MIDDLE"><A HREF="#" onClick="cal.hidePopup();return false;"><img src="http://vsites.vizergy.com/vsitefiles/templates/64/img/design/calclose-cpphiladelphia.gif" width="7" height="7" alt="" border="0"></a></TD>\n';
          result += '</TR>\n';
          }
     else {
          result += '<TABLE WIDTH=144 BORDER=1 BORDERWIDTH=1 BORDERCOLOR="#000000" CELLSPACING=0 CELLPADDING=2 BGCOLOR="#B67721">\n';
          // result += '<TR BGCOLOR="#99CCFF">\n';
          // result += ' <TD BGCOLOR="#99CCFF" COLSPAN="3" VALIGN="MIDDLE"><A HREF="#" onClick="cal.hidePopup();return false;"><img src="http://vsites.vizergy.com/vsitefiles/templates/64/img/design/calclose-cpphiladelphia.gif" alt="" border="0"></A></TD>\n';
          // result += '</TR>\n';
          result += '<TR><TD ALIGN=CENTER>\n';
          result += '<CENTER>\n';
          result += '<TABLE WIDTH=144 BORDER=0 BORDERWIDTH=0 CELLSPACING=0 CELLPADDING=0 BGCOLOR="#FFFFFF">\n';
          }
     result += '<TR BGCOLOR="#B67721" HEIGHT="15">\n';
     result += '    <TD BGCOLOR="#B67721" CLASS="cal" WIDTH=22 ALIGN=CENTER VALIGN=MIDDLE><B><A CLASS="cal" HREF="javascript:'+windowref+'CalendarPopup_refreshCalendar('+this.index+','+last_month+','+last_month_year+');"><img src="http://vsites.vizergy.com/vsitefiles/templates/64/img/design/prevmonth-cpphiladelphia.gif" width="13" height="11" alt="" border="0"></A></B></TD>\n';
     result += '    <TD BGCOLOR="#B67721" CLASS="cal" WIDTH=100 ALIGN=CENTER>'+this.monthNames[month-1]+' '+year+'</TD>\n';
     result += '    <TD BGCOLOR="#B67721" CLASS="cal" WIDTH=22 ALIGN=CENTER VALIGN=MIDDLE><B><A CLASS="cal" HREF="javascript:'+windowref+'CalendarPopup_refreshCalendar('+this.index+','+next_month+','+next_month_year+');"><img src="http://vsites.vizergy.com/vsitefiles/templates/64/img/design/nextmonth-cpphiladelphia.gif" width="13" height="11" alt="" border="0"></A></B></TD>\n';
     result += '</TR></TABLE>\n';
     result += '<TABLE WIDTH=120 BORDER=0 CELLSPACING=1 CELLPADDING=0 ALIGN=CENTER>\n';
     result += '<TR BGCOLOR="#B67721">\n';
     result += '    <TD CLASS="cal" ALIGN=CENTER WIDTH=14% BGCOLOR="#B67721">'+this.dayHeaders[(this.weekStartDay)%7]+'</TD>\n';
     result += '    <TD CLASS="cal" ALIGN=CENTER WIDTH=14% BGCOLOR="#B67721">'+this.dayHeaders[(this.weekStartDay+1)%7]+'</TD>\n';
     result += '    <TD CLASS="cal" ALIGN=CENTER WIDTH=14% BGCOLOR="#B67721">'+this.dayHeaders[(this.weekStartDay+2)%7]+'</TD>\n';
     result += '    <TD CLASS="cal" ALIGN=CENTER WIDTH=14% BGCOLOR="#B67721">'+this.dayHeaders[(this.weekStartDay+3)%7]+'</TD>\n';
     result += '    <TD CLASS="cal" ALIGN=CENTER WIDTH=14% BGCOLOR="#B67721">'+this.dayHeaders[(this.weekStartDay+4)%7]+'</TD>\n';
     result += '    <TD CLASS="cal" ALIGN=CENTER WIDTH=14% BGCOLOR="#B67721">'+this.dayHeaders[(this.weekStartDay+5)%7]+'</TD>\n';
     result += '    <TD CLASS="cal" ALIGN=CENTER WIDTH=14% BGCOLOR="#B67721">'+this.dayHeaders[(this.weekStartDay+6)%7]+'</TD>\n';
     result += '</TR>\n';
     result += '<TR><TD COLSPAN=7 ALIGN=CENTER><IMG SRC="images/graypixel.gif" WIDTH=120 HEIGHT=1></TD></TR>\n';
     for (var row=1; row<=6; row++) {
          result += '<TR>\n';
          for (var col=1; col<=7; col++) {
               if (display_month == month) {
                    date_class = "calthismonth";
                    }
               else {
                    date_class = "calothermonth";
                    }
               if ((display_month == now.getMonth()+1) && (display_date==now.getDate()) && (display_year==now.getFullYear())) {
                    td_class="caltoday";
                    }
               else {
                    td_class="calmonth";
                    }
               result += '    <TD CLASS="'+td_class+'" ALIGN="CENTER"><A HREF="javascript:'+windowref+this.returnFunction+'('+display_year+','+display_month+','+display_date+');'+windowref+'CalendarPopup_hideCalendar(\''+this.index+'\');" CLASS="'+date_class+'">'+display_date+'</A></TD>\n';
               display_date++;
               if (display_date > daysinmonth[display_month]) {
                    display_date=1;
                    display_month++;
                    }
               if (display_month > 12) {
                    display_month=1;
                    display_year++;
                    }
               }
          result += '</TR>';
          }
     result += '<TR><TD COLSPAN=7 ALIGN=CENTER><IMG SRC="images/graypixel.gif" WIDTH=120 HEIGHT=1></TD></TR>\n';
     result += '<TABLE WIDTH=144 BORDER=0 BORDERWIDTH=0 CELLSPACING=0 CELLPADDING=0 BGCOLOR="#FFFFFF">\n';
     result += '<TR BGCOLOR="#B67721" HEIGHT="15">\n';
     result += '    <TD BGCOLOR="#B67721" CLASS="cal" WIDTH=22 ALIGN=CENTER VALIGN=MIDDLE><B><A CLASS="cal" HREF="javascript:'+windowref+'CalendarPopup_refreshCalendar('+this.index+','+last_month+','+last_month_year+');"><img src="http://vsites.vizergy.com/vsitefiles/templates/64/img/design/prevmonth-cpphiladelphia.gif" width="13" height="11" alt="" border="0"></A></B></TD>\n';
     result += '    <TD BGCOLOR="#B67721" CLASS="cal" WIDTH=100 ALIGN=CENTER></TD>\n';
     result += '    <TD BGCOLOR="#B67721" CLASS="cal" WIDTH=22 ALIGN=CENTER VALIGN=MIDDLE><B><A CLASS="cal" HREF="javascript:'+windowref+'CalendarPopup_refreshCalendar('+this.index+','+next_month+','+next_month_year+');"><img src="http://vsites.vizergy.com/vsitefiles/templates/64/img/design/nextmonth-cpphiladelphia.gif" width="13" height="11" alt="" border="0"></A></B></TD>\n';
     result += '</TR></TABLE>\n';
     // result += '<TABLE WIDTH=120 BORDER=0 CELLSPACING=1 CELLPADDING=0 ALIGN=CENTER>\n';
     // result += '<TR>\n';
     // result += ' <TD COLSPAN=7 ALIGN=CENTER>\n';
     // result += '      <A HREF="#" class="cancel" onClick="cal.hidePopup();return false;">Cancel</A>\n';
     // result += '      <BR>\n';
     // result += ' </TD></TR></TABLE>';
     result += '    </CENTER></DIV></TD></TR></TABLE>\n';
     if (this.type == "WINDOW") {
          result += "</BODY></HTML>\n";
          }
     return result;
     }
     
     
     
          var calCheckIn= new CalendarPopup("calendarCheckIn");
     calCheckIn.setReturnFunction("showDateCheckIn");
     calCheckIn.setDayHeaders('Su','M','Tu','W','Th','F','Sa');
     var offsetX=0;
     var offsetY=0;
     var bn=navigator.platform
     var leftmargin=0
     var scrheight=0;scrwidth=0;
     var bw=navigator.userAgent;
     var os="Win"
     var ie=false;
     var ns=false;
     var sf=false;
     var fx=false
     var op=false;
     var mz=false;
     scrheight =(window.screen.height);
     scrwidth =(window.screen.width);
     //alert("scrheight:" +scrheight +" scrwidth:" +scrwidth);
     //alert(bw);
     if(bn.indexOf("Win32")==-1){os="Mac";}
     if(bw.indexOf("Opera")!=-1)
     {op=true;}
     else if(bw.indexOf("Safari")!=-1)
     {sf=true;}
     else if(bw.indexOf("Firefox")!=-1)
     {fx=true;}
     else if(bw.indexOf("MSIE")!=-1)
     {ie=true;}
     else if(bw.indexOf("Netscape")!=-1 && bw.indexOf("Mozilla")!=-1)
     {ns=true;}
     else if(bw.indexOf("Mozilla")!=-1)
     {mz=true;}
     else
     {op=true;}
//cal one
     var pos=new Array(-248,0,-248,0,-248,0,-200,-300,           // win-ie 800x600;1024x768;1152x864;1280x720 
                          -248,0,-248,0,-248,0,-248,0,                // win-op 800x600;1024x768;1152x864;1280x720
                          550,336,600,336,664,336,730,336,  // win-fx 800x600;1024x768;1152x864;1280x720 
                           550,336,600,336,664,336,730,336, // win-ns 800x600;1024x768;1152x864;1280x720
                           550,336,600,336,664,336,730,336, // win-mz 800x600;1024x768;1152x864;1280x720
                            
                         -250,-308,-296,-308,-364,-308,-426,-308,// mac-ie 800x600;1024x768;1152x864;1280x720 
                           -248,0,-248,0,-248,0,-248,0,                // mac-op 800x600;1024x768;1152x864;1280x720 
                          550,336,600,336,664,336,730,336,  // mac-fx 800x600;1024x768;1152x864;1280x720 
                           550,336,600,336,664,336,730,336, // mac-ns 800x600;1024x768;1152x864;1280x720
                           550,336,600,336,664,336,730,336,
                           730,730,730);   // mac-sf 800x600;1024x768;1152x864;1280x720             
     setPos(pos);

     function setPos(pos)
     {
          if(os=="Win")
          {
               if(ie)
               {
                    if(parseInt(scrwidth)=="800" && parseInt(scrheight)=="600") {offsetX=parseInt(pos[0]);offsetY=parseInt(pos[1]);}
                    if(parseInt(scrwidth)=="1024" && parseInt(scrheight)=="768"){offsetX=parseInt(pos[2]);offsetY=parseInt(pos[3]);}
                    if(parseInt(scrwidth)=="1152" && parseInt(scrheight)=="864"){offsetX=parseInt(pos[4]);offsetY=parseInt(pos[5]);}
                    if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="720"){offsetX=parseInt(pos[6]);offsetY=parseInt(pos[7]);}
                    if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="768"){offsetX=parseInt(pos[6]);offsetY=parseInt(pos[7]);}
                    if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="960"){offsetX=parseInt(pos[6]);offsetY=parseInt(pos[7]);}
                    if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="1024"){offsetX=parseInt(pos[6]);offsetY=parseInt(pos[7]);}
                    //alert("X:"+offsetX+"   Y:"+offsetY);
               }
               else if(op)
               {
                    if(parseInt(scrwidth)=="800"  && parseInt(scrheight)=="600"){offsetX=parseInt(pos[8]);offsetY=parseInt(pos[9]);}
                    if(parseInt(scrwidth)=="1024" && parseInt(scrheight)=="768"){offsetX=parseInt(pos[10]);offsetY=parseInt(pos[11]);}
                    if(parseInt(scrwidth)=="1152" && parseInt(scrheight)=="864"){offsetX=parseInt(pos[12]);offsetY=parseInt(pos[13]);}
                    if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="720"){offsetX=parseInt(pos[14]);offsetY=parseInt(pos[15]);}
                    if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="768"){offsetX=parseInt(pos[14]);offsetY=parseInt(pos[15]);}
                    if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="960"){offsetX=parseInt(pos[14]);offsetY=parseInt(pos[15]);}
                    if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="1024"){offsetX=parseInt(pos[14]);offsetY=parseInt(pos[15]);}
                    //alert("X:"+offsetX+"   Y:"+offsetY);

               }
               else if(fx)
               {
                    if(parseInt(scrwidth)=="800"  && parseInt(scrheight)=="600"){offsetX=parseInt(pos[16]);offsetY=parseInt(pos[17]);}
                    if(parseInt(scrwidth)=="1024" && parseInt(scrheight)=="768"){offsetX=parseInt(pos[18]);offsetY=parseInt(pos[19]);}
                    if(parseInt(scrwidth)=="1152" && parseInt(scrheight)=="864"){offsetX=parseInt(pos[20]);offsetY=parseInt(pos[21]);}
                    if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="720"){offsetX=parseInt(pos[22]);offsetY=parseInt(pos[23]);}
                    if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="768"){offsetX=parseInt(pos[80]);offsetY=parseInt(pos[23]);}
                    if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="960"){offsetX=parseInt(pos[81]);offsetY=parseInt(pos[23]);}
                    if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="1024"){offsetX=parseInt(pos[82]);offsetY=parseInt(pos[23]);}
                    //alert("offsetX:" +offsetX +"offsetY:"+offsetY );
               }
               else if(ns)
               {
                    if(parseInt(scrwidth)=="800"  && parseInt(scrheight)=="600"){offsetX=parseInt(pos[24]);offsetY=parseInt(pos[25]);}
                    if(parseInt(scrwidth)=="1024" && parseInt(scrheight)=="768"){offsetX=parseInt(pos[26]);offsetY=parseInt(pos[27]);}
                    if(parseInt(scrwidth)=="1152" && parseInt(scrheight)=="864"){offsetX=parseInt(pos[28]);offsetY=parseInt(pos[29]);}
                    if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="720"){offsetX=parseInt(pos[30]);offsetY=parseInt(pos[31]);}
                    if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="768"){offsetX=parseInt(pos[80]);offsetY=parseInt(pos[31]);}
                    if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="960"){offsetX=parseInt(pos[81]);offsetY=parseInt(pos[31]);}
                    if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="1024"){offsetX=parseInt(pos[82]);offsetY=parseInt(pos[31]);}
                    //alert("offsetX:" +offsetX +"offsetY:"+offsetY );
               }
               else if(mz)
               {
                    if(parseInt(scrwidth)=="800"  && parseInt(scrheight)=="600"){offsetX=parseInt(pos[32]);offsetY=parseInt(pos[33]);}
                    if(parseInt(scrwidth)=="1024" && parseInt(scrheight)=="768"){offsetX=parseInt(pos[34]);offsetY=parseInt(pos[35]);}
                    if(parseInt(scrwidth)=="1152" && parseInt(scrheight)=="864"){offsetX=parseInt(pos[36]);offsetY=parseInt(pos[37]);}
                    if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="720"){offsetX=parseInt(pos[38]);offsetY=parseInt(pos[39]);}
                    if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="768"){offsetX=parseInt(pos[80]);offsetY=parseInt(pos[39]);}
                    if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="960"){offsetX=parseInt(pos[81]);offsetY=parseInt(pos[39]);}
                    if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="1024"){offsetX=parseInt(pos[82]);offsetY=parseInt(pos[39]);}
                    //alert("offsetX:" +offsetX +"offsetY:"+offsetY );
               }
          }
          else if(os=="Mac")
          {
               if(ie)
               {
                    if(parseInt(scrwidth)=="800"  && parseInt(scrheight)=="600"){offsetX=parseInt(pos[40]);offsetY=parseInt(pos[41]);}
                    if(parseInt(scrwidth)=="1024" && parseInt(scrheight)=="768"){offsetX=parseInt(pos[42]);offsetY=parseInt(pos[43]);}
                    if(parseInt(scrwidth)=="1152" && parseInt(scrheight)=="864"){offsetX=parseInt(pos[44]);offsetY=parseInt(pos[45]);}
                    if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="960"){offsetX=parseInt(pos[46]);offsetY=parseInt(pos[47]);}
                    //alert("X:"+offsetX +"Y:" +offsetY);
               }
               else if(op)
               {
                    if(parseInt(scrwidth)=="800"  && parseInt(scrheight)=="600"){offsetX=parseInt(pos[48]);offsetY=parseInt(pos[49]);}
                    if(parseInt(scrwidth)=="1024" && parseInt(scrheight)=="768"){offsetX=parseInt(pos[50]);offsetY=parseInt(pos[51]);}
                    if(parseInt(scrwidth)=="1152" && parseInt(scrheight)=="864"){offsetX=parseInt(pos[52]);offsetY=parseInt(pos[53]);}
                    if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="960"){offsetX=parseInt(pos[54]);offsetY=parseInt(pos[55]);}
                    //alert("X:"+offsetX +"Y:" +offsetY);
               }
               else if(fx)
               {
                    if(parseInt(scrwidth)=="800"  && parseInt(scrheight)=="600"){offsetX=parseInt(pos[56]);offsetY=parseInt(pos[57]);}
                    if(parseInt(scrwidth)=="1024" && parseInt(scrheight)=="768"){offsetX=parseInt(pos[58]);offsetY=parseInt(pos[59]);}
                    if(parseInt(scrwidth)=="1152" && parseInt(scrheight)=="864"){offsetX=parseInt(pos[60]);offsetY=parseInt(pos[61]);}
                    if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="960"){offsetX=parseInt(pos[62]);offsetY=parseInt(pos[63]);}
                    //alert("X:"+offsetX +"Y:" +offsetY);
               }
               else if(ns)
               {
                    
                    if(parseInt(scrwidth)=="800"  && parseInt(scrheight)=="600"){offsetX=parseInt(pos[64]);offsetY=parseInt(pos[65]);}
                    if(parseInt(scrwidth)=="1024" && parseInt(scrheight)=="768"){offsetX=parseInt(pos[66]);offsetY=parseInt(pos[67]);}
                    if(parseInt(scrwidth)=="1152" && parseInt(scrheight)=="864"){offsetX=parseInt(pos[68]);offsetY=parseInt(pos[69]);}
                    if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="960"){offsetX=parseInt(pos[70]);offsetY=parseInt(pos[71]);}
                    //alert("X:"+offsetX +"Y:" +offsetY);
               }
               
               else if(sf)
               {
                    if(parseInt(scrwidth)=="800"  && parseInt(scrheight)=="600"){offsetX=parseInt(pos[72]);offsetY=parseInt(pos[73]);}
                    if(parseInt(scrwidth)=="1024" && parseInt(scrheight)=="768"){offsetX=parseInt(pos[74]);offsetY=parseInt(pos[75]);}
                    if(parseInt(scrwidth)=="1152" && parseInt(scrheight)=="864"){offsetX=parseInt(pos[76]);offsetY=parseInt(pos[77]);}
                    if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="960"){offsetX=parseInt(pos[78]);offsetY=parseInt(pos[79]);}
                    //alert("X:"+offsetX +"Y:" +offsetY);
               }
          }
     }    
     calCheckIn.offsetX = offsetX ;// 55;
     calCheckIn.offsetY = offsetY//15;
     
     //calCheckIn.offsetX = 0;
     //calCheckIn.offsetY = 35;
     function changeDate(varSelectedDate)
     {
          var takeDay = parseInt(varSelectedDate.value);
          var SelectedDate = new Date(window.document.quicksearch.checkInDate1.value);
          var dispDate=new Date(parseInt(SelectedDate.getMonth()+1,10) + "/" + (parseInt(SelectedDate.getDate()+takeDay)) + "/" + SelectedDate.getFullYear());
          var dispDay = dispDate.getDate();
          var dispMonth = parseInt(dispDate.getMonth()+1,10);
          var dispYear = dispDate.getFullYear();
          
          // display check out date
          window.document.quicksearch.checkOutFullDate.value=dispMonth+"/"+dispDay+"/"+dispYear;
     }
     
     function showDateCheckIn(y,m,d)
     {
          // display check in date
          window.document.quicksearch.checkInDate1.value=m+"/"+d+"/"+y ;
          var dispNights="";
          var dispDate="";
          var dispMonth ="";
          var dispYear ="";
          var iShowNights ;
          var SelectedDate = new Date(window.document.quicksearch.checkInDate1.value);
          var dtShowCheckOut =new Date(window.document.quicksearch.checkOutFullDate.value);
          if (dtShowCheckOut<SelectedDate)
          {
               iShowNights = 1;
          }
          else
          {
               iShowNights = Math.ceil((dtShowCheckOut.getTime() - SelectedDate.getTime())/(1000*60*60*24));
               if (iShowNights > 30) 
               {
                    iShowNights = 30;
               }
          }
          window.document.quicksearch.numberOfNights.value = iShowNights;
          dispNights=parseInt(window.document.quicksearch.numberOfNights.value);
          
          dispDate=new Date(parseInt(SelectedDate.getMonth()+1,10) + "/" + (SelectedDate.getDate()+dispNights) + "/" + SelectedDate.getFullYear());
          dispDay = dispDate.getDate();
          dispMonth = parseInt(dispDate.getMonth()+1,10);
          dispYear = dispDate.getFullYear();
          
          // display check out date
          
          window.document.quicksearch.checkOutFullDate.value=dispMonth+"/"+dispDay+"/"+dispYear;
     }
     document.write(calCheckIn.getStyles());
     
     //calendar 2
     
     var calCheckOut= new CalendarPopup("calendarCheckOut");
     calCheckOut.setReturnFunction("showDateCheckOut");
     calCheckOut.setDayHeaders('Su','M','Tu','W','Th','F','Sa');
     
     var pos=new Array(-248,0,-248,0,-248,0,-200,-300,           // win-ie 800x600;1024x768;1152x864;1280x720 
                          -248,0,-248,0,-248,0,-248,0,                // win-op 800x600;1024x768;1152x864;1280x720
                          550,366,600,366,664,366,730,366,  // win-fx 800x600;1024x768;1152x864;1280x720 
                           550,366,600,366,664,366,730,366,// win-ns 800x600;1024x768;1152x864;1280x720
                           550,366,600,366,664,366,730,366, // win-mz 800x600;1024x768;1152x864;1280x720
                            
                          -250,-304,-300,-304,-368,-304,-430,-304,// mac-ie 800x600;1024x768;1152x864;1280x720 
                           -248,0,-248,0,-248,0,-248,0,                // mac-op 800x600;1024x768;1152x864;1280x720 
                          550,366,600,366,664,366,730,366,// mac-fx 800x600;1024x768;1152x864;1280x720 
                           550,366,600,366,664,366,730,366,// mac-ns 800x600;1024x768;1152x864;1280x720
                           550,366,600,366,664,366,730,366,
                           730,730,730);   // mac-sf 800x600;1024x768;1152x864;1280x720             
     setPos(pos);
     
     calCheckOut.offsetX = offsetX;
     calCheckOut.offsetY = offsetY;

     function calDatesNights()
     {
          var dtCheckIn = new Date(window.document.quicksearch.checkInDate1.value);
          var dtCheckOut = new Date(window.document.quicksearch.checkOutFullDate.value);
          var iNights = Math.ceil((dtCheckOut.getTime() - dtCheckIn.getTime())/(1000*60*60*24));
          var displayNights = "";
          if ( dtCheckOut < dtCheckIn )
          {
               var showDate1=new Date(parseInt(dtCheckIn.getMonth()+1,10) + "/" + (dtCheckIn.getDate()+1) + "/" + dtCheckIn.getFullYear());
              window.document.quicksearch.checkOutFullDate.value=parseInt(showDate1.getMonth()+1,10)+"/"+showDate1.getDate()+"/"+showDate1.getFullYear();
               iNights = 1;
          }
          if (iNights > 30) 
          {
               displayNights = 30;
               var showDate=new Date(parseInt(dtCheckIn.getMonth()+1,10) + "/" + (dtCheckIn.getDate()+displayNights) + "/" + dtCheckIn.getFullYear());
              window.document.quicksearch.checkOutFullDate.value=parseInt(showDate.getMonth()+1,10)+"/"+showDate.getDate()+"/"+showDate.getFullYear();
          }
          else
          {
               displayNights = iNights
          }
          window.document.quicksearch.numberOfNights.value = displayNights;
     }
     function showDateCheckOut(y,m,d)
     {
          /*window.document.quicksearch.checkOutMonth.value = m;
          window.document.quicksearch.checkOutDay.value = d;
          window.document.quicksearch.checkOutYear.value = y;*/
          window.document.quicksearch.checkOutFullDate.value=m+"/"+d+"/"+y
          calDatesNights();
          
     }
     document.write(calCheckOut.getStyles());