<?php
// utility functions 
//date_default_timezone_set('America/New_York') ;

//** debug
	//include './scripts/lib/phpConsole/ChromePhp.php';
/* 	include './scripts/lib/phpConsole.php';
	ChromePhp::log('hello world');
	ChromePhp::log($_SERVER);
	
	foreach ($_SERVER as $key => $value) {
		ChromePhp::log($key, $value);
	} */
//** /debug

if (!function_exists("dateDiff")) {
function dateDiff($dformat, $endDate, $beginDate) {

	if ( ($beginDate=='') || ($endDate=='') ) return false ;
	
	$date_parts1=explode($dformat, $beginDate);
	$date_parts2=explode($dformat, $endDate);
	$start_date=gregoriantojd($date_parts1[0], $date_parts1[1], $date_parts1[2]);
	$end_date=gregoriantojd($date_parts2[0], $date_parts2[1], $date_parts2[2]);
	return $end_date - $start_date;
}
} // define dateDiff fn

include_once('./scripts/validation_functions.php') ; 
//foreach ( $_POST as $k => $v ) echo "post $k => $v<br>" ;
 
  // form error array and messages
  $FormError = array(
  	  'contactNameErr' => 'Please enter a valid contact name.' ,	
	  'emailErr' => 'Please enter a valid email address.' ,
	  'sourceErr' => 'Please specify the source of your referral.' ,
	  'addErr' => 'Please specify an address.' ,
	  'cityErr' => 'Please specify a city.' ,
	  'zipErr' => 'Please specify a zipcode.' ,
	  'phoneErr' => 'Please  specify a phone number.' ,
	  'fromDateErr' => 'Please enter valid "From" dates for your trip.' ,
	  'toDateErr' => 'Please enter valid "To" dates for your trip.' ,
	  'dateErr' => 'The from and to dates specified are invalid.' ,
	  'logErr' => 'Error logging form information on server.'
  ) ;
  // init and build indeces for each form POST validity check
  $thisFormError = array() ;
  foreach ( $FormError as $errName => $errString ) {
  	${$errName} = $errName ; 
  }
  $onSubmit = false ;
  $errEMail = '' ;
   
if (array_key_exists('submit', $_POST)) { 
  $onSubmit = true  ;
  
  // remove escape characters from POST array
  if (get_magic_quotes_gpc()) {
    function stripslashes_deep($value) {
      $value = is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value);
      return $value;
      }
    $_POST = array_map('stripslashes_deep', $_POST);
    }
   
  // list expected fields
  $expected = array("source", "sourceTxt", "contactName", "eMail", "Add1", "Add2", "City" , "State", "Zip", "phone", "ephone", "fromMonth", "fromDay", "fromYear", "toMonth", "toDay", "toYear", "nAdults", "nKids");      
  // set required fields
  $required = array( "source", "contactName", "eMail", "Add1", "City" , "State", "Zip", "phone", "fromDate", "toDate");
  // create empty array for any missing fields
  $missing = array();

  // assume that there is nothing suspect
  $suspect = false;
  // create a pattern to locate suspect phrases
  $pattern = '/Content-Type:|Bcc:|Cc:/i';
  
  // function to check for suspect phrases
  function isSuspect($val, $pattern, &$suspect) {
    // if the variable is an array, loop through each element
	// and pass it recursively back to the same function
	if (is_array($val)) {
      foreach ($val as $item) {
	    isSuspect($item, $pattern, $suspect);
	    }
	  }
    else {
      // if one of the suspect phrases is found, set Boolean to true
	  if (preg_match($pattern, $val)) {
        $suspect = true;
	    }
	  }
    }

  // check the $_POST array and any subarrays for suspect content
  isSuspect($_POST, $pattern, $suspect);
  
  if ($suspect) {
    //debug echo "<br>is suspect is true: $suspect<br>";
    $mailSent = false;
	unset($missing);
	}
  else {
    // process the $_POST variables
    foreach ($_POST as $key => $value) {
      // assign to temporary variable and strip whitespace if not an array
      $temp = is_array($value) ? $value : trim($value);

      // assign to a variable of the same name as $key
      if (in_array($key, $expected)) {
        ${$key} = $temp;
		//debug echo "<br /> $key => $value" ;
        } // elseif
	  // if empty and required, add to $missing array
      if (empty($temp) && in_array($key, $required)) {
        array_push($missing, $key);
        }
      }  // foreach
    } // else

  // validate the email address
  if (!empty($email)) {
  	if ( !verifyEmail($email) ) {
	  $mailSent = false;
	  // unset($missing); could reset onSubmit, then malicious attemp is assumed and no sticky form
	  $thisFormError[$emailErr] = $FormError['emailErr'] ;
	  }
  } // if email not empty

  // validate dates.  Year not checked.
  if (($fromMonth == 'none' ) || ($fromDay == 'none' )) $thisFormError [$fromDateErr] = $FormError['fromDateErr'] ;  
  if (($toMonth == 'none' ) || ($toDay == 'none' )) $thisFormError [$toDateErr] = $FormError['toDateErr'] ;
 	
  if ( !(isset($thisFormError[$fromDateErr])) && !(isset($thisFormError[$toDateErr]))) { // assemble date (leave time to implement db load later  . '- 00:00:00'
  	$fromDate = $fromMonth . '/' . $fromDay . '/' . $fromYear ;
	$toDate = $toMonth . '/' . $toDay . '/' . $toYear ;	
	//echo 'From date = ' . $fromDate . ' To date = ' . $toDate ;
/* 	if ( dateDiff('/', $toDate, $fromDate ) < 0 ) {
		$thisFormError[$dateErr] = $FormError['dateErr'] ;
		$datesSpecified = false ;
	}
	else {
		$datesSpecified = true ;
	} */
	$datesSpecified = true ;
  }

  // go ahead only if not suspsect and all required fields OK
  if ( empty($thisFormError) && empty($missing) ) { // !$suspect
  
	$message = '';
	$html_message = '';  

    $to_ = 'seawitchsailing@aol.com' ;
	$to_admin = 'lizmcmahon@comcast.net' ; //'info@thequarrygroup.com' ;
	$to_alt = 'susan@abedandbreakfastafloat.com' ;
    $subject = 'AbnbA Reservation Request ' . $_SERVER['PHP_SELF'];
	
        // build the message
	$message = "\nA reservation request from AbnbA Server: " .  $_SERVER['PHP_SELF'] . "\n\n" ;
	
    $message .= "\nName: $contactName\n";
    $message .= "Email: $eMail\n\n";
	$message .= "Source of referral: $source \n\n";
	if ( trim($sourceTxt) != '' ) $message .= "Additional source information:  $sourceTxt \n";
	$message .= "Address 1:  $Add1\n";
	if ( trim($Add2) != '' ) $message .= "Address 2:  $Add2 \n";
	$message .= "City:  $City \n";
	$message .= "State: $State \n";
	$message .= "Zip/Postal:  $Zip \n\n";
	$message .= "Daytime Phone:  $phone \n";
	if ( isset($ephone) ) $message .= "Evening Phone:  $ephone \n\n";
	$message .= "Arrival Date:  $fromDate \n";
	$message .= "Departure Date: $toDate\n\n";
 
	if ( isset($nAdults) ) $message .= "# of Adults:  $nAdults \n"; 
	if ( isset($nKids) ) $message .= "# of Children: $nKids \n";
	$message .= "\nEnd of message.\n" ;
    $message = wordwrap($message, 70);

        // build the html message
	$html_message = "<br />A reservation request from AbnbA Server: " .  $_SERVER['PHP_SELF'] . "<br />" ;
	
	  $html_message .= "<br />Name: $contactName<br />";
	  $html_message .= "Email: $eMail<br />";
	  $html_message .= "Source of referral: $source<br />";
	  if ( trim($sourceTxt) != '' ) $html_message .= "Additional source information:  $sourceTxt <br />";
	  $html_message .= "Address 1:  $Add1<br />";
	  if ( trim($Add2) != '' ) $html_message .= "Address 2:  $Add2 <br />";
	  $html_message .= "City:  $City <br />";
	  $html_message .= "State: $State <br />";
	  $html_message .= "Zip/Postal:  $Zip <br /><br />";
	  $html_message .= "Daytime Phone:  $phone <br />";
	  if ( isset($ephone) ) $html_message .= "Evening Phone:  $ephone <br /><br />";
	  $html_message .= "Arrival Date:  $fromDate <br />";
	  $html_message .= "Departure Date: $toDate<br /><br />";
	  
	  if ( isset($nAdults) ) $html_message .= "# of Adults:  $nAdults <br />"; 
	  if ( isset($nKids) ) $html_message .= "# of Children: $nKids <br />";
	  $html_message .= "<br />End of message.<br />" ;

	  require("./scripts/phpmailer.php");
	  $mail = new PHPMailer();
	 // $mail->Host = "alpha.specvest.com";	// 11.07.28 New mail server
	  $mail->Host = "abedandbreakfastafloat.com";	// 11.07.28 New mail server
	  $mail->From     = "susan@abedandbreakfastafloat.com";
	  $mail->FromName = "ABnB Contact Form";
	  
	  //$mail->AddAddress($to_admin,"AbnbAfloat Contact Form");
	  $mail->AddAddress($to_alt,"AbnbAfloath Recipient");
	  $mail->AddAddress($to,"AbnbAfloat Contact Form");
	  
	  $mail->WordWrap = 70;
	  $mail->IsHTML(true);
	  
	  $mail->Subject  =  $subject ;
	  $mail->Body     =  $html_message;
	  $mail->AltBody  =  $message;
	  $mail->IsSendmail(); 
	  
	  if(!$mail->Send()) {
		 echo "Mailer Error: " . $mail->ErrorInfo;
	  } else {
		 echo "Message sent sendmail/";
	  }	
		/*
          $recipient = $to_admin ;
          $subject = ' AbnbAfloat@aol.com Contact Form Mail.';	
          mail($recipient, $subject, $message, "From: AbnbAfloat@aol.com\r\nReply-To: 'AbnbAfloat@aol.com\r\nX-Mailer: DT_formmail");
		  $recipient = $to;
		  mail($recipient, $subject, $message, "From: AbnbAfloat@aol.com\r\nReply-To: 'AbnbAfloat@aol.com\r\nX-Mailer: DT_formmail");
		  $recipient = $to_alt ;
		  mail($recipient, $subject, $message, "From: AbnbAfloat@aol.com\r\nReply-To: 'AbnbAfloat@aol.com\r\nX-Mailer: DT_formmail");
		  
          //$recipient = $to;
          $subject = 'Error on mail send:  AbnbAfloat@aol.com Form';
          $content = $message;
	
              //mail($recipient, $subject, $message, "From: contact@seawitchsailingcharters.com\r\nReply-To: 'Sea Witch Admin\r\nX-Mailer: DT_formmail");
        //} 
        //else {
            //$thisFormError[$logErr] = "Message was sent sucessfully. We will be contacting you as soon as possible.";
			//document.getElementById('mainFormQuote').reset();
        //}
        //$thisFormError[$logErr] = "There was an error on the server processing your request.  Please send your information to <b>AbnbAfloat@aol.com</b> and we'll be happy to assist you!" ;

        // log file for each submit
        /* $fp = fopen("abnb_reservationsFormSubmit.txt", "a");
        if ($fp) {
              fwrite($fp, date("F j, Y, g:i a"));
              fwrite($fp, $message);
              fclose($fp);
        }
        else {
              $thisFormError[$logErr] = $FormError['logErr'] ;
        } 
        } */ // if no errors, attempt mail 
	}
	header($_SERVER['PHP_SELF'] + '#mainFormQuote');
	
  } // if POST
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Expires" content="1 Jan 2015 12:12:01 GMT" />
<title>Martha's Vineyard's A bed and breakfast Afloat</title>
<meta name="keywords" content="bed,breakfast,afloat,oak bluffs,marthas vineyards,aboard,dock,unique,bed &amp; breakfast,bed and breakfast,hotel on water,inn on water,b&amp;b,bed,breakfast,afloat,oak bluffs,marthas vineyard,marthas vineyards" />
<meta name="description" content="Come Stay aboard Martha's Vineyard's Only Bed and Breakfast Afloat!" />
<link rel="shortcut icon" href="favicon.ico" />
<link rel="icon" href="animated_favicon1.gif" type="image/gif" />
<meta name="abstract" content="Experience a boating adventure in Martha's Vineyard  without leaving the dock." />
<meta http-equiv="Content-Language" content="EN" />
<meta name="author" content="The Quarry Group, info@TheQuarryGroup.com" />
<meta name="copyright" content="copyright 2007-2011, All rights reserved." />
<meta name="robots" content="follow,index" />
<style type="text/css" media="screen,print">
<!--
@import url("css/screen.css");
@import url("css/menu.css");
-->
</style>
<script type="text/javascript">AC_FL_RunContent = 0;</script>
<script type="text/javascript" src="scripts/AC_RunActiveContent.js"></script>
<!--[if lte IE 6]>
<style type="text/css">
img { behavior: url(./scripts/iepngfix/iepngfix.htc); }
</style>
<![endif]-->
<link rel="stylesheet" type="text/css" href="css/form.css" />
<link rel="stylesheet" type="text/css" media="all" href="css/datechooser.css" />
<script type="text/javascript" src="scripts/datechooser.js"></script>
<script type="text/javascript">
function init() {
	CalendarLoad();	
}
window.onload = init ; <!-- make init routine per page as necessary -->
</script>
<style type="text/css">
ol.info ,
ol.info li {
	text-align: left ;
	list-style: decimal ;
	font-size: 1.1em;
}
</style>
</head>
<body id="res">
<div id="container">
<div id="header"><h1>A bed &amp; breakfast Afloat</h1></div>

<div id="menu">
  <div class="rope">&nbsp;</div> <!-- rope -->
            <div id="nav">
              <ul>
            	<li><a title="A bed and breakfast Afloat - Martha's Vineyard's ONLY floating B&B!" href="index.htm">Home</a></li>
            	<li><a title="Accomodations at A bed and breakfast Afloat - Martha's Vineyard's ONLY floating B&B!" href="abnbAccomodations.htm">Accommodations</a></li>
            	<li class="current"><a title="Reservations for A bed and breakfast Afloat - Martha's Vineyard's ONLY floating B&B!" href="abnbReservations.php">Calendar &amp; Reservations</a></li>	
            	<li><a title="Directions to A bed and breakfast Afloat - Martha's Vineyard's ONLY floating B&B!" href="abnbDirections.htm">Directions &amp; Maps</a></li>
            	<li><a title="Rates for A bed and breakfast Afloat - Martha's Vineyard's ONLY floating B&B!" href="abnbRates.htm">Rates &amp; Policies</a></li>
              </ul>
            </div> <!-- chrome menu -->
  <div class="rope">&nbsp;</div> <!-- rope -->
</div> <!-- div spacing -->

<div id="wrapper">
<div id="content">

<div class="bump">
<p><em><strong>Our season is June 14<sup>th</sup> to Oct 12<sup>th</sup>.  We are available by phone Monday - Friday from 9am to 4pm EST at 508-650-0466 or email (<a href='&#109;&#97;&#105;&#108;&#116;&#111;&#58;&#115;&#117;&#115;&#97;&#110;&#64;&#97;&#98;&#101;&#100;&#97;&#110;&#100;&#98;&#114;&#101;&#97;&#107;&#102;&#97;&#115;&#116;&#97;&#102;&#108;&#111;&#97;&#116;&#46;&#99;&#111;&#109;'>&#115;&#117;&#115;&#97;&#110;&#64;&#97;&#98;&#101;&#100;&#97;&#110;&#100;&#98;&#114;&#101;&#97;&#107;&#102;&#97;&#115;&#116;&#97;&#102;&#108;&#111;&#97;&#116;&#46;&#99;&#111;&#109;</a>) all winter long.</strong></em></p>
<p>It's easy to request/confirm a reservation!</p>
<ol class="info"><li>Check out our Calendar and <strong>select your dates</strong></li>
	<li>Complete the reservation <strong>request form</strong> below</li>
    <li>To <strong>confirm your dates by credit card</strong>, please go to the <a href="abnbRates.htm" title="A B&B Afloat Rates and Payment page.">Rates page</a> and process your credit card for 50% of your stay.</li>
</ol>
    
<p>We look forward to having you aboard A Bed and Breakfast Afloat!</p>   
</div>
<div id="rentalo-pricing-schedule"> 

<style type="text/css">
.calendar_container ,
iframe { background-color: #f00 ; }
</style>
<iframe src="http://rentalo.com/web/client/plugins/Calendar.cgi?PropertyID=348223&c=blue&months=9" scrolling="no" width="615" height="410" frameborder="0" bgcolor="#f8faea" style="background:#f8faea"></iframe>
<div class="rentalo-text">Calendar powered by: <a href="http://rentalo.com">rentalo.com | vacation rentals</a></div>
</div>
<div id="formRes" style="margin-bottom:2.5em; margin-left:.5em;margin-top:1em;zoom:1;">
	
<form id="mainFormQuote" name="mainFormQuote" action="<?php $_SERVER['PHP_SELF'] ?>" method="post">
<fieldset><legend>Your contact information</legend>

    <?php if ($_POST && isset($onSubmit) && (!empty($thisFormError) || !empty($missing)) ) { 
			echo '<p class="errorBG"> Please complete the required fields indicated with an <strong>*</strong>.</p>' ;
				echo '<ul class="errorBG">' ;
				foreach ( $thisFormError as $e ) echo "<li>$e</li>" ;
				if ( !empty($missing) ) foreach ( $missing as $m ) echo "<li>Required field <strong>$m</strong> need to be specified.</li>" ;
				echo '</ul>' ;
			echo '</p>' ;
		   } 
	?>
    
<span class="instructions"><br />Please complete the information requested below so that we may contact you regarding your vacation planning.</span>
<span class="instructions">We will never sell or disclose your contact information to a third party.  Your information is protected by our Privacy Policy.</span>
<span class="instructions">Entries marked with a <span class="cfb">*</span> are required.</span>
<div class="pair">
<label class="horizRange" for="source">* How did you hear about us? </label>
<span class="info"><select class="freeSize" id="source" name="source" >
        <option value="none">Select One --</option> 
        <option value="mvol" <?php if ( $onSubmit && ($source == 'mvol') ) echo 'select="selected"' ; ?>>http://www.mvol.com</option> 
        <option value="mvy" <?php if ( $onSubmit && ($source == 'mvy') ) echo 'selected="selected"' ; ?>>http://www.mvy.com</option> 
        <option value="google" <?php if ( $onSubmit && ($source == 'google') ) echo 'select="selected"' ; ?>>http://www.google.com</option> 
        <option value="destinationinsider" <?php if ( $onSubmit && ($source == 'destinationinsider') ) echo 'select="selected"' ; ?>>http://www.destinationinsider.com</option> 
        <option value="masstraveljournal" <?php if ( $onSubmit && ($source == 'masstraveljournal') ) echo 'select="selected"' ; ?>>http://www.masstraveljournal.com</option> 
        <option value="msn" <?php if ( $onSubmit && ($source == 'msn') ) echo 'select="selected"' ; ?>>http://www.msn.com</option>  
        <option value="marthasvineyardhotelmotels" <?php if ( $onSubmit && ($source == 'marthasvineyardhotelmotels') ) echo 'select="selected"' ; ?>>http://www.mathasvineyardhotelsmotels.com</option> 
        <option value="frommers" <?php if ( $onSubmit && ($source == 'frommers') ) echo 'select="selected"' ; ?>>http://www.frommers.com</option> 
        <option value="aol" <?php if ( $onSubmit && ($source == 'aol') ) echo 'select="selected"' ; ?>>http://www.aol.com</option> 
        <option value="vineyardfastferry" <?php if ( $onSubmit && ($source == 'vineyardfastferry') ) echo 'select="selected"' ; ?>>http://www.vineyardfastferry.com</option> 
        <option value="oakbluffsmv" <?php if ( $onSubmit && ($source == 'oakbluffsmv') ) echo 'select="selected"' ; ?>>http://www.oakbluffsmv.com</option> 
        <option value="mvgazette" <?php if ( $onSubmit && ($source == 'mvgazette') ) echo 'select="selected"' ; ?>>http://www.mvgazette.com</option> 
        <option value="yahoo" <?php if ( $onSubmit && ($source == 'yahoo') ) echo 'select="selected"' ; ?>>http://travel.yahoo.com</option> 
        <option value="bbgfc" <?php if ( $onSubmit && ($source == 'bbgfc') ) echo 'select="selected"' ; ?>>http://www.bbgfc.com</option> 
        <option value="Former Guest" <?php if ( $onSubmit && ($source == 'Former Guest') ) echo 'select="selected"' ; ?>>Former Guest</option> 
        <option value="Group" <?php if ( $onSubmit && ($source == 'Group') ) echo 'select="selected"' ; ?>>Group</option> 
        <option value="Wedding" <?php if ( $onSubmit && ($source == 'Wedding') ) echo 'select="selected"' ; ?>>Wedding</option>
        <option value="Word of Mouth" <?php if ( $onSubmit && ($source == 'Word of Mouth') ) echo 'select="selected"' ; ?>>Word of Mouth</option> 
        <option value="Harbor Mailing" <?php if ( $onSubmit && ($source == 'Harbor Mailing') ) echo 'select="selected"' ; ?>>Harbor Mailing</option> 
        <option value="Chamber of Commerce" <?php if ( $onSubmit && ($source == 'Chamber of Commerce') ) echo 'select="selected"' ; ?>>Chamber of Commerce</option> 
        <option value="Island Referral" <?php if ( $onSubmit && ($source == 'Island Referral') ) echo 'select="selected"' ; ?>>Island Referral</option> 
        <option value="Hyline Ferry" <?php if ( $onSubmit && ($source == 'Hyline Ferry') ) echo 'select="selected"' ; ?>>Hyline Ferry</option> 
        <option value="RSVP Martha's Vineyard" <?php if ( $onSubmit && ($source == "RSVP Martha's Vineyard") ) echo 'select="selected"' ; ?>>RSVP Martha's Vineyard</option> 
        <option value="Vineyard  Travel Services" <?php if ( $onSubmit && ($source == 'Vineyard  Travel Services') ) echo 'select="selected"' ; ?>>Vineyard  Travel Services</option> 
        <option value="Other Travel Service" <?php if ( $onSubmit && ($source == 'Other Travel Service') ) echo 'select="selected"' ; ?>>Other Travel Service</option> 
        <option value="Rough Guide to New England" <?php if ( $onSubmit && ($source == 'Rough Guide to New England') ) echo 'select="selected"' ; ?>>Rough Guide to New England</option> 
        <option value="Cape Cod Travel Guide" <?php if ( $onSubmit && ($source == 'Cape Cod Travel Guide') ) echo 'select="selected"' ; ?>>Cape Cod Travel Guide</option> 
        <option value="Yankee Magazine" <?php if ( $onSubmit && ($source == 'Yankee Magazine') ) echo 'select="selected"' ; ?>>Yankee Magazine</option> 
        <option value="Getaway Guide &quot;Mass Travel &amp; Tour&quot;" <?php if ( $onSubmit && ($source == 'Getaway Guide &quot;Mass Travel &amp; Tour&quot;') ) echo 'select="selected"' ; ?>>Getaway Guide &quot;Mass Travel &amp; Tour&quot;</option> 
        <option value="Visitors Guide" <?php if ( $onSubmit && ($source == 'Visitors Guide') ) echo 'select="selected"' ; ?>>Visitors Guide</option> 
        <option value="Fodor's Guide" <?php if ( $onSubmit && ($source == "Fodor's Guide") ) echo 'select="selected"' ; ?>>Fodor's Guide</option> 
        <option value="Past Guest" <?php if ( $onSubmit && ($source == 'Past Guest') ) echo 'select="selected"' ; ?>>Past Guest</option> 
        <option value="Fommers Guide" <?php if ( $onSubmit && ($source == 'Fommers Guide') ) echo 'select="selected"' ; ?>>Fommers Guide</option> 
        <option value="Other" <?php if ( $onSubmit && ($source == 'Other') ) echo 'select="selected"' ; ?>>Other (Please specify in additional comments)</option>
 </select>
</span> <!-- info -->
<div class="clearfix"></div>
</div> <!-- pair -->

<div class="pair">
<label for="sourceTxt">Other source: </label>
<span class="info"><input type="text" name="sourceTxt" id="sourceTxt" size="40" maxlength="256" value="<?php if ( $onSubmit ) echo $sourceTxt ?>" /></span>
</div> <!-- pair -->

<div <?php if ($onSubmit && array_key_exists($contactNameErr,$thisFormError)) echo 'class="pair bgE"'; else echo 'class="pair"' ; ?>><br />
<label for="contactName">
<span <?php if ($onSubmit && array_key_exists($contactNameErr,$thisFormError)) echo 'class="cRust"'; ?>>*</span> Name: </label>
<span class="info"><input type="text" name="contactName" id="contactName" size="40" maxlength="256" value="<?php if ( $onSubmit ) echo $contactName ?>" /></span>
</div>

<div <?php if ($onSubmit && array_key_exists($emailErr,$thisFormError)) echo 'class="pair bgE"'; else echo 'class="pair"' ; ?>>
<label for="eMail">
<span <?php if ($onSubmit && array_key_exists($emailErr,$thisFormError)) echo 'class="cRust"'; ?>>*</span> eMail: </label>
<span class="info"><input type="text" id="eMail" name="eMail" size="40" maxlength="256" value="<?php if ( $onSubmit ) echo $eMail ?>" /></span>
</div>

<div class="pair">
<label for="Add1">* Address Line 1: </label>
<span class="info"><input type="text" id="Add1" name="Add1" size="40" maxlength="256" value="<?php if ( $onSubmit ) echo $Add1 ?>" /></span>
</div>

<div class="pair" >
<label for="Add2"> Address Line 2: </label>
<span class="info"><input type="text" id="Add2" name="Add2" size="40" maxlength="256" value="<?php if ( $onSubmit ) echo $Add2 ?>" /></span>
</div>

<div class="pair">
<label for="city">* City: </label>
<span class="info"><input type="text" id="City" name="City" size="40" maxlength="256" value="<?php if ( $onSubmit ) echo $City ?>" /></span>
</div>

<div class="pair">
<label for="state">* State/Province: </label>
<span class="info"><input type="text" id="State" name="State" size="40" maxlength="256" value="<?php if ( $onSubmit ) echo $State ?>" /></span>
</div>

<div class="pair">
<label for="zip">* Zip/Postal Code: </label>
<span class="info"><input type="text" id="Zip" name="Zip" size="40" maxlength="256" value="<?php if ( $onSubmit ) echo $Zip ?>" /></span>
</div>

<div class="pair">
<label for="phone">* Day Phone: </label>
<span class="info"><input type="text" id="phone" name="phone" size="40" maxlength="256" value="<?php if ( $onSubmit ) echo $phone ?>" /></span>
</div>

<div class="pair">
<label for="ephone">Evening Phone: </label>
<span class="info"><input type="text" id="ephone" name="ephone" size="40" maxlength="256" value="<?php if ( $onSubmit ) echo $ephone ?>" /></span>
</div>

<div class="pair"><br />
<label class="horizRange" for="from">* Date of Arrival:</label>

<span id="fromDate">
<span class="info"><select name="fromMonth" id="fromMonth">
                          <option value="none" select="selected">Month  </option>
                          <option value="1">January </option>
                          <option value="2">February </option>
                          <option value="3">March </option>
                          <option value="4">April </option>
                          <option value="5">May </option>
                          <option value="6">June </option>
                          <option value="7">July </option>
                          <option value="8">August </option>
                          <option value="9">September </option>
                          <option value="10">October </option>
                          <option value="11">November </option>
                          <option value="12">December</option></select></span>                       
<span class="info"><select name="fromDay" id="fromDay">  
                          <option value="none" selected="selected">Day </option>
                          <option value="1">1</option> 
                          <option value="2">2 </option>
                          <option value="3">3 </option>
                          <option value="4">4 </option>
                          <option value="5">5 </option>
                          <option value="6">6 </option>
                          <option value="7">7 </option>
                          <option value="8">8 </option>
                          <option value="9">9 </option>
                          <option value="10">10 </option>
                          <option value="11">11</option>
                          <option value="12">12 </option>
                          <option value="13">13 </option>
                          <option value="14">14 </option>
                          <option value="15">15 </option>
                          <option value="16">16</option>
                          <option value="17">17 </option>
                          <option value="18">18 </option>
                          <option value="19">19 </option>
                          <option value="20">20 </option>
                          <option value="21">21 </option>
                          <option value="22">22 </option>
                          <option value="23">23 </option>
                          <option value="24">24 </option>
                          <option value="25">25 </option>
                          <option value="26">26 </option>
                          <option value="27">27 </option>
                          <option value="28">28 </option>
                          <option value="29">29 </option>
                          <option value="30">30 </option>
                          <option value="31">31</option></select>
</span>
<span class="info"><select name="fromYear" id="fromYear">
                          <option value="none" selected="selected">Year </option>
                                <option value="2015">2015</option>
                                <option value="2016">2016</option>
                                <option value="2017">2017</option>
                                <option value="2018">2018</option>
                                <option value="2019">2019</option>
                                <option value="2020">2020</option></select></span>
</span> <!-- fromDate -->
</div> <!-- pair from -->
                                
<div class="pair">
<label class="horizRange" for="to">* Date of Departure:</label>

<span id="toDate">
<span class="info"><select id="toMonth" name="toMonth" class="day">
                          <option value="none" selected="selected">Month</option>
                          <option value="1">January</option> 
                          <option value="2">February</option> 
                          <option value="3">March</option> 
                          <option value="4">April </option>
                          <option value="5">May </option>
                          <option value="6">June </option>
                          <option value="7">July </option>
                          <option value="8">August </option>
                          <option value="9">September </option>
                          <option value="10">October </option>
                          <option value="11">November </option>
                          <option value="12">December </option></select></span>     <!-- info -->     
<span class="info"><select id="toDay" name="toDay" class="day" width="8">  
                          <option value="none" selected="selected">Day</option>
                          <option value="1">1 </option>
                          <option value="2">2 </option>
                          <option value="3">3 </option>
                          <option value="4">4 </option>
                          <option value="5">5 </option>
                          <option value="6">6 </option>
                          <option value="7">7 </option>
                          <option value="8">8 </option>
                          <option value="9">9 </option>
                          <option value="10">10 </option>
                          <option value="11">11 </option>
                          <option value="12">12 </option>
                          <option value="13">13 </option>
                          <option value="14">14 </option>
                          <option value="15">15 </option>
                          <option value="16">16 </option>
                          <option value="17">17 </option>
                          <option value="18">18 </option>
                          <option value="19">19 </option>
                          <option value="20">20 </option>
                          <option value="21">21 </option>
                          <option value="22">22 </option>
                          <option value="23">23 </option>
                          <option value="24">24 </option>
                          <option value="25">25 </option>
                          <option value="26">26 </option>
                          <option value="27">27 </option>
                          <option value="28">28 </option>
                          <option value="29">29 </option>
                          <option value="30">30 </option>
                          <option value="31">31</option></select></span>
<span class="info"><select id="toYear" name="toYear" class="day" width="8"> 
                          <option value="none" selected="selected">Year</option> 
                          <option value="2015">2015 </option>
                          <option value="2016">2016 </option>
                          <option value="2017">2017 </option>
                          <option value="2018">2018 </option>
                          <option value="2019">2019 </option>
			  <option value="2020">2020 </option>
                          <option value="2021">2021 </option></select></span>
</span> <!-- toDate -->
</div> <!-- pair to -->

<div class="pair">
<label for="nAdults" class="widerLabel">Number of Adults: </label>
<span class="info"><input type="text" id="nAdults" name="nAdults" size="20" maxlength="40" value="<?php if ( $onSubmit ) echo $nAdults ?>" /></span>
</div>

<div class="pair">
<label for="nKids" class="widerLabel">Number of Children <em>(10 years or older)</em>: </label>
<span class="info"><input type="text" id="nKids" name="nKids" size="20" maxlength="40" value="<?php if ( $onSubmit ) echo $nKids ?>" /></span>
<div class="clearfix"></div>
</div>

<div id="buttonRow">
<span class="info"><input type="submit" id="submit" name="submit" value=" Send Information " /></span>
<span class="info last"><input type="reset" value=" Clear Information " /></span>
      <p id="loading">Forwarding your information to A Bed and Breakfast Afloat...</p>
      <div id="message">
        <p class="content"></p>
    </div>
<br /><br /></div>
</fieldset> <!-- contact info -->
</form><br />
</div> <!--formres -->

</div>
</div>
<div id="right">
<!--<img src="i/res/crafted_interior_msr13.jpg" alt="Come and stay with us!  A bed and breakfast Afloat." width="330" height="305" /> -->
<img src="i/res/harborview330.jpg" alt="Oak Bluffs Harbor ~ A bed and breakfast Afloat." width="330" height="294" />
<img src="i/res/rotated_P7160074.jpg" alt="Martha's Vineyard's only!   A bed and breakfast Afloat." width="330" height="353" />
<img src="i/res/harborviewLogo330.jpg" alt="Come stay with us at A bed and breakfast Afloat!" width="330" height="294" longdesc="http://www.AbedandbreakfastAfloat.com" />
<img src="i/rates/outside_330_P8100218.jpg" alt="Martha's Vineyard's only bed and breakfast Afloat!" width="330" height="228" />
</div> <!-- right -->

<!--<div>
<p>Looking for more to do in Martha's Vineyard?  The Sea Witch offers --> 
<div id="footer"><p>A bed and breakfast Afloat&nbsp;&nbsp;&copy; 2012</p></div> <!-- footer -->
</div> <!-- container -->
<script type="text/javascript" src="scripts/jquery.js"></script> <!-- 1.2.6 packed -->
<script type="text/javascript">
$(document).ready(function() {
    $("select#source").select().focus();
	$("#submit").click( function() {
		$("p#loading").show("fast");
		$("#mainFormQuote").submit();
	});
});

function clearLoading() {
	$("p#loading").hide("fast");
	$("div#message > p.content").html('Your contact information was sent to &#115;&#117;&#115;&#97;&#110;&#64;&#97;&#98;&#101;&#100;&#97;&#110;&#100;&#98;&#114;&#101;&#97;&#107;&#102;&#97;&#115;&#116;&#97;&#102;&#108;&#111;&#97;&#116;&#46;&#99;&#111;&#109;.  Please call (508-650-0466) or email us directly if you do not hear from us within 24 hours. Thank you for inquiring!').show();
}
</script>
<script type="text/javascript">clearLoading();</script>
</body>
</html>