<?php
	include $_SERVER['DOCUMENT_ROOT']."/server/secureProtocol.php";
	include $_SERVER['DOCUMENT_ROOT']."/server/common.php";
	validateOrCreateSession();
	include $_SERVER['DOCUMENT_ROOT']."/elements/portalInfoEngine.php";
	
	$error = false;
	$errorCode = NULL;
	$errorMessage = NULL;
	$errorCode = $_GET['errorCode'] ?? null;

	if ($errorCode == 1) {
		$error = true;
		$errorMessage = "Your browser session has expired. Please refresh your browser and try again.";
	} else if ($errorCode == 2) {
		$error = true;
		$errorMessage = "Unfortunately we cannot accept a reservation more than 180-days in advance. Please try again later.";
	} else if ($errorCode == 3) {
		$error = true;
		$errorMessage = "There appears to be an issue with your payment method. If you continue to have problems please contact your financial institution.";
	} else if ($errorCode == 4) {
		$error = true;
		$errorMessage = "Please check the formatting of your input and avoid using any symbols, special characters, or invalid input. Please try again.";
	} else if ($errorCode == 5) {
		$error = true;
		$errorMessage = "In order to book a reservation you must be 21-years or older. Thank you for your interest.";
	} else if ($errorCode == 6) {
		$error = true;
		$errorMessage = "In order to book a reservation you must be 25-years or older. Thank you for your interest.";
	} else if ($errorCode == 7) {
		$error = true;
		$errorMessage = "Please check the dates that you have entered and try again.";
	} else if ($errorCode == 8) {
		$error = true;
		$errorMessage = "Our system appears to be having technical difficulties. Please contact us to manually book your reservation.";
	} else if ($errorCode == 9) {
		$error = true;
		$errorMessage = "Unfortunately we cannot accept a rental from your account at this time. Thank you for your interest.";
	} else if ($errorCode == 10) {
		$error = true;
		$errorMessage = "In order to book a reservation that is longer than 4-weeks you must contact us to manually book your reservation.";
	} else if ($errorCode == 11) {
		$error = true;
		$errorMessage = "In order to book a reservation you must rent for 2-days or longer. Please change your rental dates or contact us to manually book your reservation.";
	} else if ($errorCode == 12) {
		$error = true;
		if($_SESSION['error'])
			$errorMessage = $_SESSION['error'];
		else
			$errorMessage = "Unfortunately we cannot accept same-day reservations using our online booking system. Please contact us to manually book your reservation.";
	}
?>
<!DOCTYPE html>
<html class="no-js" lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Book Reservation | Roadmoto Big Trailer Rentals</title>
	<meta name="keywords" content="book trailer reservation, roadmoto book reservation, roadmoto booking, roadmoto availability, roadmoto reservations, roadmoto rentals" />
	<meta name="description" content="Book a rental from Southern California's leading big trailer rental company." />
	<meta name="revised" content="Roadmoto, 12/14/2022" />
	<meta name="copyright" content="Roadmoto Holdings, Inc" />
	<link rel="shortcut icon" href="img/favicon.ico" />
	<link href="/style/fonts/poppins.css" rel="stylesheet" type="text/css">
	<link href="/style/fonts/abril.css" rel="stylesheet">
	<link href="/style/fonts/merriweather.css" rel="stylesheet">
	<link rel="stylesheet" href="/style/css/foundation.css">
	<link rel="stylesheet" href="/style/css/foundation-motion.css">
	<link rel="stylesheet" href="/style/css/icons.css">
	<link rel="stylesheet" href="/style/css/iconic-font.css">
	<link rel="stylesheet" href="/style/css/plugins.css">
	<link rel="stylesheet" href="/style/css/style.css">
</head>

<body>
	<div>
		<div class="off-canvas position-right" id="js-main-off-canvas-right" data-off-canvas data-content-scroll="false" data-auto-focus="false">
			<?php include "../elements/HEADER-WITHTOP.php"; ?>
		</div>

		<div class="off-canvas-content" data-off-canvas-content>
			<section class="section-boxed page-header bg-secondary-shade">
				<div class="row">
					<div class="column small-12">
						<header class="s-header align-center">
							<h1 class="headline">Reservations</h1>
						</header>
					</div>
				</div>
			</section>

			<div class="callout bg-secondary-shade">
				<div class="row">
					<div class="column small-12">
						<nav class="text-center" aria-label="You are here:">
							<ul class="breadcrumbs mb0">
								<li><a href="/">Home</a></li>
								<li><span class="show-for-sr">Current:</span>Reservations</li>
							</ul>
						</nav>
					</div>
				</div>
			</div>

			<?php if ($error) { ?>
				<span class="card-divider" id="errorCustomerDetails" style="text-align: center; display: block; background-color: red;">
					<h2>Error</h2>
					<?php echo $errorMessage; ?>&nbsp;
					<b>CODE<?php echo $errorCode; ?></b>
				</span>
			<?php } ?>
			<span class="card-divider" id="errorSpan" name="errorSpan" style="text-align: center; display: none; background-color: red;">
			</span>

			<main class="mb0">
				<div class="section">
					<div class="row align-center" style="margin-top: -50px">
						<div class="column small-12 large-10">
							<?php include "../elements/searchAvailability.php"; ?>
						</div>
					</div>
				</div>
			</main>

			<div class="mobile-bottom-bar bg-secondary-shade flex-container align-justify hide-for-large" id="js-bottom-bar" data-magellan>
				<div class="buuton-group">
					<a class="button hollow secondary-white small" name="supportPhone" href="tel:+1 818-740-4006"><i class="zmdi fa zmdi-phone fa-phone" aria-hidden="true"></i></a>
					<a class="button hollow secondary-white small" href="mailto:support@roadmoto.com"><i class="zmdi fa zmdi-email fa-mail" aria-hidden="true"></i></a>
				</div>
				<div class="buuton-group">
					<a class="button hollow secondary-white small" href="#js-top-bar"><i class="zmdi zmdi-long-arrow-up fa fa-arrow-up" aria-hidden="true"></i></a>
				</div>
			</div>

			<div class="scroll-up show-for-large" id="js-scroll-up" data-magellan>
				<a class="flex-container align-center align-bottom" href="#js-top-bar">
					<span class="show-for-sr">Scroll up</span>
				</a>
			</div>

		</div>
	</div>

	<?php include "../elements/FOOTER.php"; ?>
	<?php include "../components/liveChat.php"; ?>
	<?php include "../components/tracker.php"; ?>

	<script src="/style/js/jquery.min.js"></script>
	<script src='/style/js/searchValidation.js?v5'></script>
	<script src="/style/js/plugins.js"></script>
	<script src="/style/js/functions.js?v1"></script>
	<script src="/style/js/request/common.js?v5"></script>
	<script src="/style/js/request/infoEngine.js?v4"></script>
	<script src="/style/js/request/locationEngine.js?v4"></script>
	<script>
		function init() {
			loadInfo(
				'<?php echo $baseURL; ?>',
				'<?php echo $authorizationToken; ?>',
				'<?php echo session_id(); ?>',
				'<?php echo get_client_ip(); ?>',
				'<?php echo $_SERVER["REQUEST_URI"]; ?>');
			loadLocationHour(
				'<?php echo $baseURL; ?>',
				'<?php echo $authorizationToken; ?>',
				'<?php echo session_id(); ?>',
				'<?php echo get_client_ip(); ?>');
			loadReservation();
			
		};
		
		window.onload = init;
	</script>
</body>
</html>