<script type="text/javascript">
function MM_validateForm() { //v4.0
  if (document.getElementById){
    var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
    for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
      if (val) { nm=val.name; if ((val=val.value)!="") {
        if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
          if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
        } else if (test!='R') { num = parseFloat(val);
          if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
          if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
            min=test.substring(8,p); max=test.substring(p+1);
            if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
      } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
    } if (errors) alert('The following error(s) occurred:\n'+errors);
    document.MM_returnValue = (errors == '');
} }
</script>
<table id="content" width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr> 
                      <td> 
<?php require_once 'fprotect.php'; ?>
           
<?php 
$name = mysql_real_escape_string(stripslashes($_REQUEST['name']));
$country = mysql_real_escape_string(stripslashes($_REQUEST['country']));
$telephone = mysql_real_escape_string(stripslashes($_REQUEST['telephone']));
$fax = mysql_real_escape_string(stripslashes($_REQUEST['fax']));
$email = mysql_real_escape_string(stripslashes($_REQUEST['email']));
$comments = mysql_real_escape_string(stripslashes($_REQUEST['comments']));
$room1 = mysql_real_escape_string(stripslashes($_REQUEST['room1']));
$arrivaldate = mysql_real_escape_string(stripslashes($_REQUEST['arrivaldate']));
$departuredate = mysql_real_escape_string(stripslashes($_REQUEST['departuredate']));
$adults = mysql_real_escape_string(stripslashes($_REQUEST['adults']));
$children = mysql_real_escape_string(stripslashes($_REQUEST['children']));
	
	if  (isset($_POST['submit'])) { 
    $name=safe($name); 
    $country=safe($country); 
    $telephone=safe($telephone); 
    $fax=safe($fax); 
    $email=safe($email); 
    $room1=safe($room1); 
    $arrivaldate=safe($arrivaldate); 
    $departuredate=safe($departuredate); 
    $adults=safe($adults); 
    $children=safe($children); 
    $comments=safe($comments); 
    $code1=safe($code1);  
	?>
    
   	<?php
if (preg_match("/a href/i", "$comments")) {
?> 
<?php } else { ?>

<?php if ($_REQUEST['data']==$_POST['code1']) { ?>

          <?php include 'holidayreservation.php';?> 

            <?php	
			$to="$sitemail";
			$from="$email";
			$reply="$email";
			$headers="MIME-Version: 1.0\r\n";
            $headers .="Content-type: text/plain; charset=utf-8\r\n";
			$headers .= "From: $email<$email>\r\n";
			$subject="New request from $domain";
			$message="New request from $domain

Reservation request form
			
Name: $name 
Country: $country
Tel: $telephone
Fax: $fax
E-mail: $email
Room type: $room1
Arrival date: $arrivaldate
Departure date: $departuredate
Number of adults: $adults
Number of children: $children
Comments: $comments

www.$domain Webserver 
";
mail ($to, $subject, $message, $headers);
?>
 </td>
                    </tr>
                    <tr> 
                     <td>
                      <?php echo $ftext1 ?>
                      </td>
                    </tr>
                    <tr> 
                      <td><hr></td>
                    </tr>
                    <tr> 
                      <td> 
                      <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr valign="top">
    <td width="150">
<?php echo $field1 ?><br>
<?php echo $field4 ?><br>
<?php echo $field5 ?><br>
Fax <br>
E-mail<br>
<?php echo $field7 ?><br>
<?php echo $field8 ?><br>
<?php echo $field11 ?><br>
<?php echo $field6 ?>

    </td>
    <td>
	  <?php echo $name ?><br>
      <?php echo $country ?><br>
      <?php echo $telephone ?><br>
      <?php echo $fax ?><br>
      <?php echo $email ?><br>
      <?php echo $room1?><br>
      <?php echo $arrivaldate ?> - <?php echo $departuredate?><br>
      <?php echo $adults?> + <?php echo $children?><br>
      <?php echo $comments ?>
      </td>
  </tr>
</table></td>
                    </tr>
                    <tr> 
                      <td>&nbsp;</td>
                    </tr>
                    <tr> 
                      <td> 
                        <?php } else { ?>
                      </td>
                    </tr>
                    <tr> 
                      <td><a href="reservation.php"><?php echo $ftext2 ?></a>  </td>
                    </tr>
                    <tr> 
                      <td> 
                        <?php } ?>
                        <?php } ?>
                        <?php } else { ?>
                      </td>
                    </tr>
                    <tr> 
                        <td> 
		<form name="forma" method="post" action="">	
           <table width="100%" border="0" cellpadding="0" cellspacing="2">
                            <tr> 
                              <td class="titles" colspan="2">
               <?php echo $field14 ?>                            
                              
                              </td>
                            </tr>
                            <tr valign="top"> 
                             <td>
               <?php echo $field1 ?>*
                              </td>
                              <td> 
                                <input type="text" name="name" id="name" class="forms" size="40" maxlength="50">
                              </td>
                              
                            </tr>
                            <tr valign="top"> 
                             <td>
               <?php echo $field4 ?>   
                              </td>
                              <td><input type="text" name="country" id="country" class="forms" size="40" maxlength="50"></td>
                            </tr>
                            <tr valign="top"> 
                              <td><?php echo $field5 ?>*</td>
                              <td><input type="text" name="telephone" id="telephone" class="forms" size="40" maxlength="50"></td>
                            </tr>
                            <tr valign="top"> 
                            <td>Fax</td>
                              <td><input type="text" name="fax" id="fax" class="forms" size="40" maxlength="50"></td>
                            </tr>
                            <tr valign="top">
                              <td>E-mail*</td>
                              <td><input type="text" name="email" id="email" class="forms" size="40" maxlength="60"></td>
                            </tr>
                            <tr valign="top">
                                    <td class="titles" colspan="2">
               <?php echo $textbutton1 ?>                              
                              </td>
                            </tr>
                            <tr valign="top">
                              <td>
               <?php echo $field7 ?>                              
                              </td>
                              <td> 
                                <select name="room1" id="room1" class="forms">
                                  <?php
			$sql10 = "SELECT * FROM rooms WHERE publish='yes' AND publisha='yes' ORDER BY priority";
			$result10 = mysql_query($sql10);
			while ($myrow=mysql_fetch_array($result10)) {
			$id1=$myrow['id'];
			$room1=$myrow['name_en'];
?>
<?php if ($id1 == $rid ) { ?>
                                  <option value="<?php echo $room1 ?>" selected> 
                                  <?php echo $room1 ?>
                                  <?php } else { ?>
                                  <option value="<?php echo $room1 ?>"> 
                                  <?php echo $room1 ?>
                                  </option>
                                  <?php } }?>
                                  <option value="Any available">Any available</option>
                                </select>
                              </td>
                            </tr>
                            <tr valign="top">
                              <td><?php echo $field8 ?>* </td>
                              <td><input name="arrivaldate" id="arrivaldate" type="text" value="<?php echo $field9 ?>" onfocus="if(this.value=='<?php echo $field9 ?>')this.value='';" class="forms" size="15" maxlength="10" />
                                <input name="departuredate" id="departuredate" type="text" value="<?php echo $field10 ?>" onfocus="if(this.value=='<?php echo $field10 ?>')this.value='';" class="forms" size="15" maxlength="10" /></td>
                            </tr>
                            <tr valign="top">
                              <td><?php echo $field11 ?>* </td>
                              <td><input name="adults" id="adults" type="text" value="<?php echo $field12 ?>" onfocus="if(this.value=='<?php echo $field12 ?>')this.value='';" class="forms" size="15" maxlength="10" />
                                <input name="children" id="children" type="text" value="<?php echo $field13 ?>" onfocus="if(this.value=='<?php echo $field13 ?>')this.value='';" class="forms" size="15" maxlength="10" /></td>
                            </tr>
                            <tr valign="top">
                              <td><?php echo $field6 ?></td>
                              <td><textarea name="comments" id="comments" class="forms" rows="2" cols="35">
                              </textarea></td>
                            </tr>
                            <tr valign="top">
                              <td><?php echo $ftext3 ?>
                                <?
global $data;
$data = mt_rand(100000,1000000);
?>
                                <input type="hidden" name="code1" value="<?php echo $code1 ?>" />
                                <input type="hidden" name="data" value="<?php echo $data ?>" /></td>
                              <td><img src="/includes/dynamicimage.php?dt=<? global $data; echo base64_encode($data);?>" alt="" />
                                <input type="text" name="code1" id="code1" size="20" class="forms" maxlength="6" /></td>
                            </tr>
                            <tr valign="top">
                              <td>&nbsp;</td>
                              <td><input name="submit" type="submit" class="button" onclick="MM_validateForm('name','','R','email','','RisEmail');return document.MM_returnValue" value="<?php echo $button1 ?>" /></td>
                            </tr>
                            <tr valign="top"> 
                                    <td>&nbsp;</td>
                              <td>&nbsp;</td>
                            </tr>
                            <tr valign="top"> 
                              <td colspan="2">
               * <?php echo $fieldr ?>
                              </td>
             </tr>
</table>
    </form>
						</td>
                    </tr>
                    <tr> 
                      <td> 
                    <?php }?>
                      </td>
                    </tr>
                  </table>