<? 
require_once "include/application.php"; 
require_once "include/function.php";
require_once "include/parameter.php";

if($btnDelete){
	$sql="delete from `ivc_reservation` where irs_id='$id' and irs_stamp='$stamp'";	
	@mysql_query($sql) or die(mysql_error());

	print("<script type='text/javascript'>alert('Record is deleted.')</script>");
	print("<script type='text/javascript'>location.href='reservConfirm.php'</script>");

}
if($btnSave || $btnPrint || $btnEmail){
		$sql="
			update `ivc_reservation` set `irs_for` ='$reserv',
			`irs_guestname` =\"$gname\" ,
			`irs_guestic` ='$gic',
			`irs_checkin1`  = '".system_date($cin1)."',
			`irs_checkout1` = '".system_date($cout1)."',
			`irs_bookingno` ='$bookingno',
			`irs_room1` ='$rooms',
			`irs_adult1`='$adult1' ,
			`irs_child1` ='$child1' ,
			`irs_checkin2` = '".system_date($cin2)."',
			`irs_checkout2` ='".system_date($cout2)."',
			`irs_checkin3` = '".system_date($cin3)."',
			`irs_checkout3` = '".system_date($cout3)."',
			`irs_remark` = \"$remark\", 
			`irs_ivcremark` = \"$ivcremark\"  
			 where irs_id='$id'
		";
		@mysql_query($sql) or die(mysql_error());
		
	
		if($btnPrint)print("<script type='text/javascript'>window.open('reservPrint.php?id=$id')</script>");
		else if($btnEmail){
			$to      = "rachel@sepanggoldcoast.com";
			$subject = 'Room Request';
		   
			$message = '
<table width="1000" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td colspan="2"><U>ROOM REQUEST FORM</U> </td>
    <td colspan="2">&nbsp;</td>
    <td width="288" rowspan="3" align="right" valign="top">&nbsp;</td>
  </tr>
  <tr>
    <td>Owner\'s Free Stay </td>
    <td>[ &nbsp; ]</td>
    <td width="209">House Use</td>
    <td width="209">[ &nbsp; ]</td>
  </tr>
  <tr>
    <td width="200">IVC Member </td>
    <td width="94">[X]</td>
    <td width="209">Complimentary Use</td>
    <td width="209">[ &nbsp; ]</td>
  </tr>
  <tr>
    <td colspan="2">&nbsp;</td>
    <td colspan="2">&nbsp;</td>
    <td align="right">&nbsp;</td>
  </tr>
  <tr>
    <td colspan="5"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td valign="top"><table border="0" cellpadding="2" width="100%" cellspacing="1" class="small">
          <tr>
            <td width="151" >Card No. :</td>
            <td width="255" >'.$cardno.'</td>
          </tr>
          <tr>
            <td >Principal Name  :</td>
            <td >'.$no.'</td>
          </tr>
          <tr>
            <td >Nationality     :</td>
            <td >'.$nationality.'</td>
          </tr>
          <tr>
            <td >NRIC/Passport  :</td>
            <td >'.$ic.'</td>
          </tr>
          <tr >
            <td height="23" ><div align="left">Home Contact No. : </div></td>
            <td >'.$home.'</td>
          </tr>
          <tr >
            <td height="23" ><div align="left">Mobile No. :</div></td>
            <td >'.$mobile.'</td>
          </tr>
          <tr >
            <td height="23" ><div align="left">Email : </div></td>
            <td >'.$email.'</td>
          </tr>
          <tr>
            <td class="TextH1">Type of Product    :</td>
            <td class="TextH1">'.$scheme.'</td>
          </tr>
          <tr>
            <td class="TextH1">Rooms    :</td>
            <td class="TextH1">'.$roomtype.'</td>
          </tr>
          <tr>
            <td class="TextH1">No. of Villas :              </td>
            <td class="TextH1">'.$rooms.'
</td>
          </tr>
          <tr>
            <td class="TextH1">No. of Adults :
              &nbsp;</td>
            <td class="TextH1">'.$adult1.'
</td>
          </tr>
          <tr >
            <td height="23" ><span class="TextH1">No. of Childrens :</span></td>
            <td >'.$child1.'

</td>
          </tr>
          <tr>
            <td colspan="2" class="TextH1">Special Request :</td>
          </tr>
          <tr>
            <td height="50" colspan="2" valign="top" class="TextH1">'.str_replace("\r\n","<br>",$remark).'</td>
          </tr>
          <tr>
            <td colspan="2" >IVC Remarks :</td>
          </tr>
          <tr>
            <td colspan="2" valign="top" ><span class="TextH1">'.str_replace("\r\n","<br>",$ivcremark).'</span></td>
          </tr>
          <tr >
            <td height="23" colspan="2" >&nbsp;</td>
          </tr>
        </table></td>
        <td><table width="100%" border="0" cellspacing="1" cellpadding="2">
          <tr class="small" >
            <td height="23" align="left" >Booking No :</td>
            <td height="23" align="left" >&nbsp;</td>
          </tr>
          <tr>
            <td colspan="2" class="TextH1">Reservation Request</td>
          </tr>
          <tr>
            <td colspan="2" class="TextH1">For personal use [';

            if($reserv=="Personal")$message.= 'X';
			$message.= '] &nbsp;  For guest use [';
            if($reserv=="Guest")$message.= 'X';

   $message.= ']
               </td>
          </tr>
          <tr>
            <td colspan="2" class="TextH1">If for guest use, please indicate the following:</td>
          </tr>
          <tr>
            <td colspan="2" class="TextH1">Guest\'s Full Name:
              '.$gname.'</td>
          </tr>
          <tr>
            <td colspan="2" class="TextH1">Guest\'s IC / Passport No : '.$gic.'</td>
          </tr>
          <tr>
            <td colspan="2" class="TextH1">Guest\'s Contact No : '.$gcontact.'</td>
          </tr>
          <tr>
            <td colspan="2" class="TextH1">Guest\'s Email : '.$gemail.'</td>
          </tr>
          <tr>
            <td colspan="2" class="TextH1">&nbsp;</td>
          </tr>
          <tr>
            <td colspan="2" class="TextH1">[ &nbsp; ] 
              Confirm 1st Choice </td>
          </tr>
          <tr>
            <td width="41%" class="TextH1">Check In Date :</td>
            <td width="59%" class="TextH1">'.$cin1.'
            </td>
          </tr>
          <tr>
            <td class="TextH1">Check Out Date :</td>
            <td class="TextH1">'.$cout1.'</td>
          </tr>
          <tr>
            <td class="TextH1">&nbsp;</td>
            <td class="TextH1">&nbsp;</td>
          </tr>
          <tr>
            <td colspan="2" class="TextH1">[ &nbsp; ]
              Confirm 2nd Choice </td>
          </tr>
          <tr>
            <td class="TextH1">Check In Date :</td>
            <td class="TextH1">'.$cin2.'
</td>
          </tr>
          <tr>
            <td class="TextH1">Check Out Date :</td>
            <td class="TextH1">'.$cout2.'
            </td>
          </tr>
          <tr>
            <td class="TextH1">&nbsp;</td>
            <td class="TextH1">&nbsp;</td>
          </tr>
          <tr>
            <td colspan="2" class="TextH1">[ &nbsp; ]
              Confirm 3rd Choice </td>
          </tr>
          <tr>
            <td class="TextH1">Check In Date :</td>
            <td class="TextH1">'.$cin3.'
             </td>
          </tr>
          <tr>
            <td class="TextH1">Check Out Date :</td>
            <td class="TextH1">'.$cout3.'
              </td>
          </tr>
          </table></td>
      </tr>
    </table></td>
  </tr>
  </table>';
  
 // echo $message;
			  
			$headers= 'MIME-Version: 1.0' . "\r\n";
			$headers.= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
			$headers.= "From: ".Email."\r\n" .
				'Reply-To: '.Email."\r\n";
			
		//	mail($to, $subject, $message, $headers);
			

			print("<script type='text/javascript'>alert('Email send.')</script>");
		}
		
		print("<script type='text/javascript'>location.href='reservConfirm.php'</script>");

}

if($btnAdd){
	$err=false;

	$adv=book_adv();


	$ye=yearly_expired($no);

	if(date("Y-m-d") > system_date($expiry)){
		$action_msg="Membership program tenure is expired.<br>";
		$err=true;
	}

		
/*	if(system_date($cin1) < $adv){
		$action_msg="Invalid check in date(1)! Must book before 2 weeks in advance.<br>";
		$err=true;
	}

	if($cin2 && system_date($cin2) < $adv){
		$action_msg.="Invalid check in date(2)! Must book before 2 weeks in advance.<br>";
		$err=true;
	}

	if($cin3 && system_date($cin3) < $adv){
		$action_msg.="Invalid check in date(3)! Must book before 2 weeks in advance.<br>";
		$err=true;
	}

	if(system_date($cout1) > $ye){
		$action_msg.="Invalid Check out date(1)! Annual entitlement date is expiry.<br>";
		$err=true;
	}

	if($cout2 && system_date($cout2) > $ye){
		$action_msg.="Invalid Check out date(2)! Annual entitlement date is expiry.<br>";
		$err=true;
	}

	if($cout3 && system_date($cout3) > $ye){
		$action_msg.="Invalid Check out date(3)! Annual entitlement date is expiry.<br>";
		$err=true;
	}
*/
		
	if(!$confirmchoice){
		$action_msg="Please select the confirm choice !";
		$err=true;
	}else{
		if($confirmchoice=="1")$nonight=get_days(system_date($cin1),system_date($cout1));
		else if($confirmchoice=="2")$nonight=get_days(system_date($cin2),system_date($cout2));		
		else if($confirmchoice=="3")$nonight=get_days(system_date($cin3),system_date($cout3));		
		
		$tot=$nonight * $rooms;
		
		if($tot > $bal){
			$action_msg="Balance of night is no enought to make reservation !";
			$err=true;
		}
	}
	
	if($err==false){
		if($confirmchoice=="1"){
			$cin=system_date($cin1);
			$cout=system_date($cout1);
		}else if($confirmchoice=="2"){
			$cin=system_date($cin2);
			$cout=system_date($cout2);
		}else if($confirmchoice=="3"){
			$cin=system_date($cin3);
			$cout=system_date($cout3);
		}			
		$newstamp=nextid('n_stamp');
		$sql="
			update `ivc_reservation` set `irs_for` ='$reserv',
			`irs_guestname` =\"$gname\" ,
			`irs_guestic` ='$gic',
			`irs_checkin1`  = '".system_date($cin1)."',
			`irs_checkout1` = '".system_date($cout1)."',
			`irs_bookingno` ='$bookingno',			
			`irs_room1` ='$rooms',
			`irs_adult1`='$adult1' ,
			`irs_child1` ='$child1' ,
			`irs_checkin2` = '".system_date($cin2)."',
			`irs_checkout2` ='".system_date($cout2)."',
			`irs_checkin3` = '".system_date($cin3)."',
			`irs_checkout3` = '".system_date($cout3)."',
			`irs_remark` = \"$remark\" ,
			`irs_ivcremark` = \"$ivcremark\" ,
			`irs_confirm_date`=now(),
			`irs_confirm_choice`='$confirmchoice',
			`irs_confirm_cin`='$cin',
			`irs_confirm_cout`='$cout',			
			 irs_confirm_night='$tot',irs_status='Y',irs_stamp='$newstamp' where irs_id='$id' and irs_stamp='$stamp' 
		";
		@mysql_query($sql) or die(mysql_error());
		
		if($email){
				
			
			if($reserv=="Personal")$egname=$name;
			else if($reserv=="Guest")$egname=$gname;
			
			$message="
			<p><img src=\"images/ivc-logo.png\" width=\"150\" height=\"75\"></p>
			<p>&nbsp;</p>
			<p>Dear $name,</p>
			<p>&nbsp;</p>
			<p>As requested, we pleased to confirm your reservation at Golden Palm Tree as detailed below:</p>
			<p>Guest Name : $egname</p>
			<p>Confirmation Number : $bookingno</p>
			<p>Arrival Date : $cin</p>
			<p>Depature Date : $cout</p>
			<p>No of Villas Required : $rooms</p>
			<p>&nbsp;</p>
			<p>Kindly be informed that the Resort's check-in time at 3:00p.m. and the check-out time at 12:00 noon.</p>
			<p>The Management will not guarantee early check in and is subjected strictly to abvailability of the rooma.</p>
			<p>&nbsp;</p>
			<p>We would be most delighted to assist you if you require further assistance or inquiries. Thanks you for your reservation and we look forward to the pleaseure of welcoming you and / or you guest(s) to Golden Palm Tree.</p>
			<p>&nbsp;</p>
			<p>Thanks you!</p>
			<p>&nbsp;</p>
			<p>&nbsp;</p>
			<p>Warnest regards,</p>
			<p>Head, Customer Service Department</p>
			<p>&nbsp;</p>
			";
	
			$headers= 'MIME-Version: 1.0' . "\r\n";
				$headers.= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
				$headers.= "From: noreply@iconicvacationclub.com \r\n" .
					"Reply-To: noreply@iconicvacationclub.com \r\n";
			$subject=" Confirmation of Golden Palm Tree ";
				
			//	mail($email, $subject, $message, $headers);		
			//	mail(Email, $subject, $message, $headers);		
		}
		print("<script type='text/javascript'>alert('Booking is confirm.')</script>");			
		print("<script type='text/javascript'>location.href='reservConfirm.php'</script>");
	}
}else{
	$sql="select * from ivc_reservation left join ivc_members on irs_memberno=im_formno left join 
	ivc_products on im_scheme=ip_id left join ivc_rooms on ip_room = ir_id 	where irs_id='$id' and irs_confirm_night='0' ";
	$result=mysql_query($sql);	
	while($myrow=MySQL_fetch_array($result,MYSQL_ASSOC))
	{
		$reserv=$myrow["irs_for"];
		$gname=$myrow["irs_guestname"];
		$gic=$myrow["irs_guestic"];
		$gcontact=$myrow["irs_guestcontact"];
		$gemail=$myrow["irs_guestemail"];
		$cin1=window_date($myrow["irs_checkin1"]);
		$cout1=window_date($myrow["irs_checkout1"]);
		$adult1=$myrow["irs_adult1"];
		$child1=$myrow["irs_child1"];
		$cin2=window_date($myrow["irs_checkin2"]);
		$cout2=window_date($myrow["irs_checkout2"]);
		$cin3=window_date($myrow["irs_checkin3"]);
		$cout3=window_date($myrow["irs_checkout3"]);
		$remark=$myrow["irs_remark"];
		$ivcremark=$myrow["irs_ivcremark"];
		$rooms=$myrow["irs_room1"];
		$bookingno=$myrow["irs_bookingno"];
        		
		$cardno=$myrow["im_cardno"];
		$no=$myrow["irs_memberno"];
		$name=$myrow["im_name"];
		$scheme=$myrow["ip_code"]." - ".$myrow["ip_name"];
		$roomtype=$myrow["ir_type"]." - ".$myrow["ir_descr"];
		$ic=$myrow["im_ic"];
		$email=$myrow["im_email"];
		$home=$myrow["im_phome"];
		$mobile=$myrow["im_mobile"];
		$fax=$myrow["im_fax"];

		$freemaint=$myrow["im_freemaint"];
		$expiry=window_date($myrow["im_expired"]);
		$program=$myrow["im_program"];
		$nationality=$myrow["im_nationality"];        
		$stamp=$myrow["irs_stamp"];
		$adult_list=$myrow["ip_adult"];
		$child_list=$myrow["ip_child"];
	}


	$sql="select * from ivc_yearly_ent where ye_memberno='$no' and ye_expiry >= '".date("Y-m-d")."' order by ye_expiry limit 1";
	$result=mysql_query($sql) or die(mysql_error());
	while($myrow=MySQL_fetch_array($result,MYSQL_ASSOC))
	{
		$ye=$myrow["ye_expiry"];
		$st=$myrow["ye_start"];
		$entnights=$myrow["ye_night"];
	}
	$bal=$entnights -reserv_num($no,$st,$ye);
	$yrexp=window_date($ye);
}

?>

<!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" />
<link rel="stylesheet" type="text/css" href="sddm.css" >
<script src="include/validation.js" type="text/javascript"></script>

  <link rel="stylesheet" href="datepicker/themes/winter.css" />
<!-- Loading Calendar JavaScript files -->
    <script type="text/javascript" src="datepicker/zapatec.js"></script>
    <script type="text/javascript" src="datepicker/calendar.js"></script>
<!-- Loading language definition file -->
    <script type="text/javascript" src="datepicker/calendar-en.js"></script>
<script language="javascript">
function guestinfo(val)
{
	if(val=="Personal"){
		document.form.gname.value="";
		document.form.gic.value="";
		document.form.gcontact.value="";
		document.form.gemail.value="";
	}
}
</script>

<title><? echo TITLE?></title></head>
<body>

<table width="1024" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#f1efd8">
  <tr>
    <td  colspan="2" align="center"><? require_once "include/header.php"; ?></td>
  </tr>
  <tr>
    <td colspan="2" align="center">&nbsp;</td>
  </tr>
  <tr>
    <td width="185" valign="top" bgcolor="e6f3f9">
	
<? require_once "include/columnLeft.php";
if(array_search("Rooms",$menulist)==false)
		print("<script type='text/javascript'>location.href='index.php'</script>");

 ?>	</td>
    <td width="834" valign="top">
	<form name="form" method="post" action="<?=$PHP_SELF ?>"  ONSUBMIT="return ValidateEditReservation(this)">
	  <table width="800" height="250" border="0" align="center" cellpadding="0" cellspacing="0">


	  <tr>
        
        <td valign="top"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td width="100%" height="30" class="TitleH3">Confirm Reservation <strong><strong><strong><strong><strong><strong><strong><strong><strong>
              <input name="id" type="hidden" id="id" value="<? echo $id ?>" />
              <strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong>
              <input name="stamp" type="hidden" id="stamp" value="<? echo $stamp ?>" />
              <strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong>
              <input name="adult_list" type="hidden" id="adult_list" value="<? echo $adult_list ?>" />
              <strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong>
              <input name="child_list" type="hidden" id="child_list" value="<? echo $child_list ?>" />
              </strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></td>
          </tr>
          <tr>
            <td height="1" bgcolor="#B8ED83"></td>
          </tr>
          <tr>
            <td ><? echo "<div class='Msg'>$action_msg</div>" ?>&nbsp;</td>
          </tr>

        </table>
          <table width="100%" border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td width="53%" valign="top"><table border="0" cellpadding="2" width="100%" cellspacing="1" class="small">
                <tr>
                  <td class="TextH1">Card No. :</td>
                  <td class="TextH1"><input name="cardno" type="text" class="info" id="cardno" onfocus="if(document.images){blur()}" value="<? echo $cardno ?>" size="30" /></td>
                </tr>
                <tr>
                  <td width="151" class="TextH1">Membership No. :</td>
                  <td width="255" class="TextH1"><input name="no" type="text" class="info" id="no" onfocus="if(document.images){blur()}" value="<? echo $no ?>" size="30" /></td>
                </tr>
                <tr>
                  <td class="TextH1">Principal's Name  :</td>
                  <td class="TextH1"><input name="name" type="text" class="info" id="name" onfocus="if(document.images){blur()}" value="<? echo $name ?>" size="30" /></td>
                </tr>
                <tr>
                  <td class="TextH1">Type of Product    :</td>
                  <td class="TextH1"><input name="scheme" type="text" class="info"  onfocus="if(document.images){blur()}" value="<? echo $scheme ?>" size="30" /></td>
                </tr>
                <tr>
                  <td class="TextH1">Rooms    :</td>
                  <td class="TextH1"><input name="roomtype" type="text" class="info" id="roomtype"  onfocus="if(document.images){blur()}" value="<? echo $roomtype ?>" size="30" /></td>
                </tr>
                <tr>
                  <td class="TextH1">NRIC/Passport  :</td>
                  <td class="TextH1"><input name="ic" type="text" class="info"  onfocus="if(document.images){blur()}" value="<? echo $ic ?>" size="30" /></td>
                </tr>
                <tr>
                  <td class="TextH1" >Nationality     :</td>
                  <td ><span class="TextH1">
                    <input name="nationality" type="text" class="info" id="nationality"  onfocus="if(document.images){blur()}" value="<? echo $nationality; ?>" size="30" />
                  </span></td>
                </tr>
                <tr class="editTbl">
                  <th height="23" class="TextH1"><div align="left">Home Contact No. : </div></th>
                  <td class="TextH1"><input name="home" type="text" class="info" id="home"  onfocus="if(document.images){blur()}" value="<? echo $home ?>" size="30" /></td>
                </tr>
                <tr class="editTbl">
                  <th height="23" class="TextH1"><div align="left">Mobile No. :</div></th>
                  <td class="TextH1"><input name="mobile" type="text" class="info"  onfocus="if(document.images){blur()}" value="<? echo $mobile ?>" size="30" /></td>
                  </tr>
                <tr class="editTbl">
                  <th height="11" class="TextH1"><div align="left">Fax No. :</div></th>
                  <td class="TextH1"><input name="fax" type="text" class="info"  onfocus="if(document.images){blur()}" value="<? echo $fax ?>" size="30" /></td>
                  </tr>

                <tr class="editTbl">
                  <th height="23" class="TextH1"><div align="left">Email : </div></th>
                  <td class="TextH1"><input name="email" type="text" class="info"  onfocus="if(document.images){blur()}" value="<? echo $email ?>" size="30" /></td>
                  </tr>
                <tr class="editTbl">
                  <th height="23" class="TextH1"><div align="left"> Program Tenure : </div></th>
                  <td class="TextH1"><input name="program" type="text" class="info"  onfocus="if(document.images){blur()}" value="<? echo $program ?>" size="10" />
                    Year(s ) </td>
                </tr>
                <tr class="editTbl">
                  <th height="23" class="TextH1"><div align="left">Membership Expired : </div></th>
                  <td class="TextH1"><input name="expiry" type="text" class="info" id="expiry"  onfocus="if(document.images){blur()}" value="<? echo $expiry ?>" size="10" /></td>
                </tr>
                <tr class="editTbl">
                  <th height="23" class="TextH1"><div align="left"> Annual Entitlement : </div></th>
                  <td class="TextH1"><span id="txtEntNights">
                    <input name="entnights" type="text" class="info"  onfocus="if(document.images){blur()}" value="<? echo $entnights ?>" size="10" /> 
                    Night(s) </span></td>
                </tr>
                <tr class="editTbl">
                  <th height="23" class="TextH1"><div align="left">Annual Entitlement<br />
                    Expired : </div></th>
                  <td class="TextH1"><input name="yrexp" type="text" class="info" id="yrexp"  onfocus="if(document.images){blur()}" value="<? echo $yrexp ?>" size="10" /></td>
                </tr>
                <tr>
                  <td class="TextH1">Free Maintenance Fees :</td>
                  <td class="TextH1"><span id="txtFreeMaint"></span>
                    <input name="freemaint" type="text" class="info"  onfocus="if(document.images){blur()}" value="<? echo $freemaint ?>" size="10" />                    &nbsp; Year(s ) </td>
                </tr>
                <tr class="editTbl">
                  <th height="23" class="TextH1"><div align="left"> Balance of Nights : </div></th>
                  <td class="TextH1"><input name="bal" type="text" class="info" id="bal"  onfocus="if(document.images){blur()}" value="<? echo $bal ?>" size="4" /> 
                    end of 
                      <input name="yrexp" type="text" class="info"  onfocus="if(document.images){blur()}" value="<? echo $yrexp ?>" size="12" /></td>
                </tr>
                <tr class="editTbl">
                  <th height="23" class="TextH1">&nbsp;</th>
                  <td class="TextH1">&nbsp;</td>
                </tr>
                <tr>
                  <td colspan="2" class="TextH1">IVC Remarks :</td>
                </tr>
                <tr>
                  <td colspan="2" class="TextH1"><textarea name="ivcremark" cols="50" rows="4" id="ivcremark" ><? echo $ivcremark ?></textarea></td>
                </tr>
                <tr class="editTbl">
                  <th height="23" align="left" class="TextH1">Booking No :</th>
                  <th height="23" align="left" class="TextH1"><input name="bookingno" type="text" class="small" id="bookingno" value="<? echo $bookingno ?>" size="11" maxlength="10" /></th>
                </tr>
                <tr class="editTbl">
                  <th height="23" colspan="2" class="TextH1">&nbsp;</th>
                </tr>

              </table></td>
              <td width="47%" valign="top"><table width="100%" border="0" cellspacing="1" cellpadding="2">
                <tr>
                  <td colspan="2" class="TextH1">Reservation Request <span class="require">*</span></td>
                </tr>
                <tr>
                  <td colspan="2" bgcolor="#333333" class="TextH1"><span class="white14">Please choose </span><br />
                    <input name="reserv" type="radio" value="Personal" <?=($reserv=="Personal" ? "CHECKED" : " ")?>/>
                    <span class="white14">For personal
                      use</span>
                    <input name="reserv" type="radio" value="Guest" <?=($reserv=="Guest" ? "CHECKED" : " ")?>/>
                    <span class="white14"> For guest use </span></td>
                </tr>
                <tr>
                  <td colspan="2" bgcolor="#3DC3CE" class="TextH1">If for guest use, please indicate the following:</td>
                </tr>
                <tr>
                  <td colspan="2" bgcolor="#3DC3CE" class="TextH1">Guest's Full Name: 
                    <span class="require">*</span>
                    <input name="gname" type="text" class="small" id="gname" value="<? echo $gname ?>" maxlength="50" /></td>
                </tr>
                <tr>
                  <td colspan="2" bgcolor="#3DC3CE" class="TextH1">Guest's IC / Passport No : 
                    <span class="require">*</span>
                    <input 
      name="gic" id="gic" style="WIDTH: 180px" value="<? echo $gic ?>" size="20" maxlength="20" /></td>
                </tr>
                <tr>
                  <td colspan="2" bgcolor="#3DC3CE" class="TextH1">Guest's Contact No : <span class="require">*</span>
                      <input 
      name="gcontact" id="gcontact" style="WIDTH: 180px" value="<? echo $gcontact ?>" size="20" maxlength="20" /></td>
                </tr>
                <tr>
                  <td colspan="2" bgcolor="#3DC3CE" class="TextH1">Guest's Email :
                    <input 
      name="gemail" id="gemail" style="WIDTH: 180px" value="<? echo $gemail ?>" size="20" maxlength="20" /></td>
                </tr>
                <tr>
                  <td colspan="2" class="TextH1">&nbsp;</td>
                  </tr>
                <tr>
                  <td colspan="2" bgcolor="#FF9900" class="TextH1">
                    <input name="confirmchoice" type="radio" value="1" <?=($confirmchoice=="1" ? "CHECKED" : " ")?>/>

                    Confirm 1st Choice </td>
                  </tr>
                <tr>
                  <td width="38%" class="TextH1">Check In Date : <span class="require">*</span></td>
                  <td width="62%" class="TextH1"><input name="cin1" type="text" class="small" id="cin1"   value="<? echo $cin1 ?>" size="15" maxlength="10" />
                    <button id="trigger_cin1">...</button>
                    <script type="text/javascript">//<![CDATA[
      Zapatec.Calendar.setup({
        weekNumbers       : false,
        electric          : false,
        inputField        : "cin1",
        button            : "trigger_cin1",
        ifFormat          : "%d/%m/%Y",
        daFormat          : "%Y/%m/%d"
      });
    //]]></script>
                    <span class="subItem"> dd/mm/yyyy</span></td>
                </tr>
                <tr>
                  <td class="TextH1">Check Out Date : <span class="require">*</span></td>
                  <td class="TextH1"><input name="cout1" type="text" class="small" id="cout1"   value="<? echo $cout1 ?>" size="15" maxlength="10" />
                    <button id="trigger_cout1">...</button>
                    <script type="text/javascript">//<![CDATA[
      Zapatec.Calendar.setup({
        weekNumbers       : false,
        electric          : false,
        inputField        : "cout1",
        button            : "trigger_cout1",
        ifFormat          : "%d/%m/%Y",
        daFormat          : "%Y/%m/%d"
      });
    //]]></script>
                    <span class="subItem"> dd/mm/yyyy</span></td>
                </tr>
                <tr>
                  <td class="TextH1">&nbsp;</td>
                  <td class="TextH1">&nbsp;</td>
                </tr>
                <tr>
                  <td colspan="2" bgcolor="#FF9966" class="TextH1">
                    <input name="confirmchoice" type="radio" value="2" <?=($confirmchoice=="2" ? "CHECKED" : " ")?>/>
                    Confirm 2nd Choice </td>
                </tr>
                <tr>
                  <td class="TextH1">Check In Date :</td>
                  <td class="TextH1"><input name="cin2" type="text" class="small" id="cin2"   value="<? echo $cin2 ?>" size="15" maxlength="10" />
                      <button id="trigger_cin2">...</button>
                    <script type="text/javascript">//<![CDATA[
      Zapatec.Calendar.setup({
        weekNumbers       : false,
        electric          : false,
        inputField        : "cin2",
        button            : "trigger_cin2",
        ifFormat          : "%d/%m/%Y",
        daFormat          : "%Y/%m/%d"
      });
    //]]></script>
                      <span class="subItem"> dd/mm/yyyy</span></td>
                </tr>
                <tr>
                  <td class="TextH1">Check Out Date :</td>
                  <td class="TextH1"><input name="cout2" type="text" class="small" id="cout2"   value="<? echo $cout2 ?>" size="15" maxlength="10" />
                      <button id="trigger_cout2">...</button>
                    <script type="text/javascript">//<![CDATA[
      Zapatec.Calendar.setup({
        weekNumbers       : false,
        electric          : false,
        inputField        : "cout2",
        button            : "trigger_cout2",
        ifFormat          : "%d/%m/%Y",
        daFormat          : "%Y/%m/%d"
      });
    //]]></script>
                      <span class="subItem"> dd/mm/yyyy</span></td>
                </tr>
                <tr>
                  <td class="TextH1">&nbsp;</td>
                  <td class="TextH1">&nbsp;</td>
                </tr>
                <tr>
                  <td colspan="2" bgcolor="#FF9999" class="TextH1">
                    <input name="confirmchoice" type="radio" value="3" <?=($confirmchoice=="3" ? "CHECKED" : " ")?>/>
                    Confirm 3rd Choice </td>
                </tr>
                <tr>
                  <td class="TextH1">Check In Date :</td>
                  <td class="TextH1"><input name="cin3" type="text" class="small" id="cin3"   value="<? echo $cin3 ?>" size="15" maxlength="10" />
                      <button id="trigger_cin3">...</button>
                    <script type="text/javascript">//<![CDATA[
      Zapatec.Calendar.setup({
        weekNumbers       : false,
        electric          : false,
        inputField        : "cin3",
        button            : "trigger_cin3",
        ifFormat          : "%d/%m/%Y",
        daFormat          : "%Y/%m/%d"
      });
    //]]></script>
                      <span class="subItem"> dd/mm/yyyy</span></td>
                </tr>
                <tr>
                  <td class="TextH1">Check Out Date :</td>
                  <td class="TextH1"><input name="cout3" type="text" class="small" id="cout3"   value="<? echo $cout3 ?>" size="15" maxlength="10" />
                      <button id="trigger_cout3">...</button>
                    <script type="text/javascript">//<![CDATA[
      Zapatec.Calendar.setup({
        weekNumbers       : false,
        electric          : false,
        inputField        : "cout3",
        button            : "trigger_cout3",
        ifFormat          : "%d/%m/%Y",
        daFormat          : "%Y/%m/%d"
      });
    //]]></script>
                      <span class="subItem"> dd/mm/yyyy</span></td>
                </tr>
                <tr>
                  <td colspan="2" class="TextH1">&nbsp;</td>
                </tr>
                <tr>
                  <td colspan="2" class="TextH1">Confirm No of Villas : <span class="require">*</span>
                    <?
echo "<select name='rooms'>";

for($i=1;$i<=$adult_list * $entnights;$i++){
	echo '<option value="'.$i.'"';
	if($rooms==$i)echo ' selected';
	echo '>'.$i.'</option>\n';
} echo '</select> ';

?></td>
                  </tr>
                <tr>
                  <td colspan="2" class="TextH1">No of Adults :
                    <?
echo "<select name='adult1'>";

for($i=1;$i<=$adult_list;$i++){
	echo '<option value="'.$i.'"';
	if($adult1==$i)echo ' selected';
	echo '>'.$i.'</option>\n';
} echo '</select> ';

?>
&nbsp; No of Childrens : <span class="require">
<?
echo "<select name='child1'>";

for($i=0;$i<=$child_list;$i++){
	echo '<option value="'.$i.'"';
	if($child1==$i)echo ' selected';
	echo '>'.$i.'</option>\n';
} echo '</select> ';

?>
</span></td>
                </tr>
                <tr>
                  <td colspan="2" class="TextH1">&nbsp;</td>
                </tr>
                <tr>
                  <td colspan="2" class="TextH1">Remarks (if any):</td>
                </tr>
                <tr>
                  <td colspan="2" class="TextH1"><textarea name="remark" cols="50" rows="4" id="remark" ><? echo $remark ?></textarea></td>
                </tr>
              </table></td>
            </tr>
          </table>
          <table border="0" cellpadding="2" width="100%" cellspacing="1" class="small">
            <tr>
              <td height="30" class="text12"><p class="TextH1">Disclaimer:</p>
                <p class="TextH1">Your reservation is accepted / rejected. Kindly keep your  Booking No. as a reference upon your checking in the resort. Last minutes  cancellation (3 days before check-in date) or no turn ups will constitute to  usage of your entitlement. No replacement will be entertained. The Management  decision is final. </p>
<p class="TextH1">&nbsp;</p>
                <p class="TextH1">&nbsp;</p></td>
            </tr>
            <tr>
              <td height="1" bgcolor="#999999"></td>
            </tr>
            <tr>
              <td height="30" class="TextH1"><span class="require">* Denotes a require_onced field</span></td>
            </tr>
            <tr>
              <td class="text12"><input name="btnAdd" type="submit" class="btn150" id="btnAdd" value="CONFIRM BOOKING" onclick="return confirm('Are you sure ?')"/>
  &nbsp;
  <? if($_SESSION["egoBlock"]<>"Yes"){ ?>
  <input name="btnDelete" type="submit" class="btn150" id="btnDelete" value="DELETE BOOKING" onclick="return confirm('Are you sure to delete?')"/>
  &nbsp;
  <? } ?>
  <input name="btnBack" type="button" class="btn" id="btnBack" onclick="location.href='reservConfirm.php'" value="BACK" /></td>
            </tr>
            <tr>
              <td class="text12"><input name="btnSave" type="submit" class="btn" id="btnSave" value="SAVE" onclick="return confirm('Are you sure?')"/>
&nbsp;
<input name="btnPrint" type="submit" class="btn" id="btnPrint" value="PRINT" onclick="return confirm('Are you sure?')"/>
&nbsp;
<input name="btnEmail" type="submit" class="btn" id="btnEmail" onclick="return confirm('Are you sure?')" value="EMAIL" /></td>
            </tr>
          </table></td>

      </tr>
 
    </table><br />
	</form>	</td>
  </tr>
  <tr>
    <td colspan="2" bgcolor="#333333" class="Footer" align="center"><br />
    <? require_once "footer.php"; ?></td>
  </tr>
</table>
</body>
</html>
