  <?php 
    $strRes = "RES_Static";
//include 'externalScripts/DimVar.php';
//include 'externalScripts/XMLConnection.php'; 

ini_set(
    "include_path", (
        "D:/hshome/bdcpdn/megasys.brooksdigital.com/PHP/lib" .
        PATH_SEPERATOR .
        ini_get("include_path")
        )
    );
include('D:/hshome/bdcpdn/megasys.brooksdigital.com/PHP/lib/HTTP/Request2.php');


  


  //echo $XMLString;
  //echo $url
  
//$req =& new HTTP_Request('http://alpha.lodgepro.com:8088/megaweb');
//$req->addHeader("Content-Type", "text/xml");
//$req->addHeader("Content-Length", strlen($XMLString));
//$req->setMethod(HTTP_REQUEST_METHOD_POST);
//$req->addRawPostData($XMLString, true);
//$req->sendRequest();
//echo $req->getResponseBody();



 //$doc = new DOMDocument();
 //$doc->load( $XMLString );
  
  //$roomType = $doc->getElementsByTagName( "roomType" );
 // foreach( $roomType as $roomType )
 // {
  //$typeDesc = $roomType->getElementsByTagName( "typeDesc" );
  //$typeDesc = $typeDesc->item(0)->nodeValue;
  
  //$typeAment = $roomType->getElementsByTagName( "typeAment" );
  //$typeAment = $typeAment->item(0)->nodeValue;
  
  //$titles = $roomType->getElementsByTagName( "title" );
  //$title = $titles->item(0)->nodeValue;
  
  //echo "$title - $typeDesc - $typeAment\n";
  //}
  ?>
  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Extended Template Step 1</title>

<script language="JavaScript" type="text/javascript">
<!--
function checkform ( form )
{
  // ** Check Form Values **
  if (form.arrive.value == "") {
    alert( "Please enter a Check-In date." );
    form.arrive.focus();
    return false ;
  }

  if (form.depart.value == "") {
    alert( "Please enter a Check-Out date." );
    form.depart.focus();
    return false ;
  }

  if (form.child.value == "") {
    alert( "Please enter a number for the amount of children." );
    form.child.focus();
    return false ;
  }
  
  if (form.adults.value == "") {
    alert( "Please enter a number for the amount of adult(s)." );
    form.adults.focus();
    return false ;
  }
  
  return true ;
}

function check_date(field){
var checkstr = "0123456789";
var DateField = field;
var Datevalue = "";
var DateTemp = "";
var seperator = "/";
var day;
var month;
var year;
var leap = 0;
var err = 0;
var i;
   err = 0;
   DateValue = DateField.value;
   /* Delete all chars except 0..9 */
   for (i = 0; i < DateValue.length; i++) {
	  if (checkstr.indexOf(DateValue.substr(i,1)) >= 0) {
	     DateTemp = DateTemp + DateValue.substr(i,1);
	  }
   }
   DateValue = DateTemp;
   /* Always change date to 8 digits - string*/
   /* if year is entered as 2-digit / always assume 20xx */
   if (DateValue.length == 6) {
      DateValue = DateValue.substr(0,4) + '20' + DateValue.substr(4,2); }
   if (DateValue.length != 8) {
      err = 19;}
   /* year is wrong if year = 0000 */
   year = DateValue.substr(4,4);
   if (year == 0) {
      err = 20;
   }
   /* Validation of month*/
   month = DateValue.substr(0,2);
   if ((month < 1) || (month > 12)) {
      err = 21;
   }
   /* Validation of day*/
   day = DateValue.substr(2,2);
   if (day < 1) {
     err = 22;
   }
   /* Validation leap-year / february / day */
   if ((year % 4 == 0) || (year % 100 == 0) || (year % 400 == 0)) {
      leap = 1;
   }
   if ((month == 2) && (leap == 1) && (day > 29)) {
      err = 23;
   }
   if ((month == 2) && (leap != 1) && (day > 28)) {
      err = 24;
   }
   /* Validation of other months */
   if ((day > 31) && ((month == "01") || (month == "03") || (month == "05") || (month == "07") || (month == "08") || (month == "10") || (month == "12"))) {
      err = 25;
   }
   if ((day > 30) && ((month == "04") || (month == "06") || (month == "09") || (month == "11"))) {
      err = 26;
   }
   /* if 00 ist entered, no error, deleting the entry */
   if ((day == 0) && (month == 0) && (year == 00)) {
      err = 0; day = ""; month = ""; year = ""; seperator = "";
   }
   /* if no error, write the completed date to Input-Field (e.g. 13.12.2001) */
   if (err == 0) {
      DateField.value = month + seperator + day + seperator + year;
   }
   /* Error-message if err != 0 */
   else {
      alert("Date you have input is in an unsuported fromat! Please enter dd/mm/yyyy.");
      DateField.select();
	  DateField.focus();
   }
}

//-->
</script>
	<script type="text/javascript" src="externalScripts/jquery.js"></script>
	<SCRIPT type="text/javascript" SRC="externalScripts/ui.datepicker.js"></SCRIPT>
	<script language="javascript" type="text/javascript" src="externalScripts/internal_request2.js"></script>

    <script type="text/javascript">
	 $(document).ready(function() {
	
	 $("#startDate").datepicker({ 
		dayNamesMin: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
		beforeShowDay: bookedDays,
	 	beforeShow: customRange,
		constrainInput: true,
		showAnim: "slideDown", 
    	duration: "slow", 
		mandatory: true, 
		showStatus: true, 
		changeMonth: false, 
    	changeYear: false, 
    	showOn: "both", 
    	buttonImage: "images/Cal.gif", 
    	buttonImageOnly: true 
	}).addClass("embed");

	 $("#endDate").datepicker({ 
		dayNamesMin: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
		beforeShowDay: bookedDays,
	 	beforeShow: customRange,
		constrainInput: true,
		showAnim: "slideDown", 
   		duration: "slow", 
		defaultDate: +1, 
		mandatory: true, 
		showStatus: true,  
		changeMonth: false, 
    	changeYear: false, 
    	showOn: "both", 
    	buttonImage: "images/Cal.gif", 
    	buttonImageOnly: true 
	}).addClass("embed");
			 
	$("#inline").datepicker({ 
		dayNamesMin: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
		beforeShowDay: bookedDays,
    	prevText: "<< Earlier Months", 
    	nextText: "Later Months >>", 
		onSelect: updateFields,
		currentText: "",
	 	changeMonth: false, 
    	changeYear: false,
    	rangeSelect: true, 
		showStatus: true,
	    minDate: 0, 
    	maxDate: 180,
		numberOfMonths: [2, 3], 
    	stepMonths: 3
	}).children("div").css("width", "555px");
	
	$('#startDate,#endDate').change(function(){
    	$('#inline').datepicker('setDate',
        	$.datepicker.parseDate('mm/dd/yy', $('#startDate').val()),
        	$.datepicker.parseDate('mm/dd/yy', $('#endDate').val()));
         });
    });	

    </script>


    <link href="externalScripts/Res_Styles.css" rel="stylesheet" type="text/css" />
<!--[if gte IE 5]>
<link rel="stylesheet" type="text/css" href="externalScripts/Res_Styles_IE.css" />
<![endif]-->
    <link href="externalScripts/ui.datepicker.css" rel="stylesheet" type="text/css" />
</head>

<body>
	
<table width="700" height="357" border="0" align="center" cellpadding="0" cellspacing="0" id="Table_01">
	<tr>
	  <td height="46" align="center" valign="top"><h1><img src="<?php echo $logoImg?>" alt="<?php echo $logoAltText?>" width="<?php echo $logoWidth?>" height="<?php echo $logohight?>" border="0" align="left" class="SPACER"> <?php echo $propName?></h1></td>
	</tr>
	<tr>
	  <td height="42" align="center" valign="middle"><span class="Button"><a href="Res1.php">Request Availability</a></span> <span class="ButtonNull">Rooms &amp; Rates</span> <span class="ButtonNull">Guest Information</span> <span class="ButtonNull">Confirmation</span> </td>
  </tr>
	<tr>
		<td align="left" valign="top">
			
<h2>Online Reservations: Request Availability</h2>
		<form id="Request" name="datecheck" method="get" action="Res2.php" onsubmit="return checkform(this);">
  <table width="629" border="0" align="center" cellpadding="2">
    <tr>
      <td height="23" align="center" valign="middle" class="TBHeader">Check-In:</td>
      <td align="center" valign="middle" class="TBHeader">Check-Out</td>
      <td width="8" align="center" valign="middle">&nbsp;</td>
      <td width="323" rowspan="5" align="center" valign="top"><img src="<?php echo $propPhoto;?>" alt="<?php echo $photoAltText;?>" width="<?php echo $photoWidth;?>" height="<?php echo $photoHight;?>" /></td>
    </tr>
    <tr>
      <td width="136" align="center" valign="middle" class="Descript">
	  
        <input name="arrive" type="text" id="startDate" readonly="readonly" onblur="check_date(this)" value="" size="12" maxlength="10" border="0" />
		<style type="text/css">.embed + img { position: relative; left: -21px; top: -1px; }</style>
     	  </td>
      <td width="136" align="center" valign="middle">
	  
        <input name="depart" type="text" id="endDate" readonly="readonly" onblur="check_date(this)" value="" size="12" maxlength="10" border="0" />
		<style type="text/css">.embed + img { position: relative; left: -21px; top: -1px; }</style>

<script type="text/javascript"> 
function customRange(input) { 
    return {minDate: (input.id == "endDate" ? $("#startDate").datepicker("getDate") : null), 
        maxDate: (input.id == "startDate" ? $("#endDate").datepicker("getDate") : null)}; 
} 
function updateFields(range) {
               var dates = range.split(' - ');
               $('#startDate').val(dates[0]);
               $('#endDate').val(dates[1]);
           }
		   
fullDays = [
  [1, 26, 2009, 'ch'], [2, 6, 2009, 'nz'], [3, 17, 2009, 'ie'],
  [4, 27, 2009, 'za'], [5, 25, 2009, 'ar'], [6, 6, 2009, 'se'],
  [7, 4, 'us'], [8, 17, 'id'], [9, 7, 'br'],
  [10, 1, 2008, 'cn'], [11, 22, 2008, 'lb'], [12, 12, 2008, 'ch']
];

function bookedDays(date) {
    for (i = 0; i < fullDays.length; i++) {
      if (date.getMonth() == fullDays[i][0] - 1
          && date.getDate() == fullDays[i][1]) {
        return [false, fullDays[i][2] + '_day'];
      }
    }
  return [true, ''];
}
</script>
      	  </td>
	  


      <td valign="middle">&nbsp;</td>
      </tr>
    <tr>
      <td align="center" valign="middle">Number of Adults:</td>
      <td align="left" valign="middle"><span class="sidebar">
        <input name="adults" type="text" id="adults" value="1" size="3" maxlength="2" border="0" />
      </span></td>
      <td align="center" valign="middle">&nbsp;</td>
    </tr>
    
    <tr>
      <td align="right" valign="middle">Number of Children:</td>
      <td align="left" valign="middle"><span class="sidebar">
        <input name="child" type="text" id="child" value="0" size="3" maxlength="2" border="0" />
      </span></td>
      <td rowspan="2" valign="middle">&nbsp;</td>
      </tr>
    <tr>
      <td height="28" colspan="2" align="right" valign="top"><input name="resPage" type="hidden" value="" />
          <input type="submit" name="Submit" value="Request Availability" id="Submit" /></td>
      </tr>
    <tr>
      <td colspan="4" align="center">
	  <div id="inline"></div> 
<p style="clear: both;"><br />

	  </td>
    </tr>
  </table>

</form>
		
		</td>
	</tr>
</table>

<div id="footer"> 
<?php echo $propStreet1?>   <?php echo $propStreet2?>  <?php echo $propCity?>, <?php echo $propState?> <?php echo $propZip?> • <?php echo $propPhone?> • <?php echo $propEmail?>
</div>

</body>
</html>
