<?php \Laravel\Section::start('container'); ?>
<h3>Compare Prices</h3>
<!-- the tabs -->
<ul class="tabs">
	<li><a id="monday" class='day-tab'>Monday</a></li>
	<li><a id="tuesday" class='day-tab'>Tuesday</a></li>
	<li><a id="wednesday" class='day-tab'>Wednesday</a></li>
    <li><a id="thursday" class='day-tab'>Thursday</a></li>
	<li><a id="friday" class='day-tab'>Friday</a></li>
	<li><a id="saturday" class='day-tab'>Saturday</a></li>
    <li><a id="sunday" class='day-tab'>Sunday</a></li>
</ul>

<div id="monday-table" class='day-table' style='display:none'>
<?php echo render('partials.drinks_table', array('drinkPrices' => $drinkPricesDays['Monday'])); ?>
</div>

<div id="tuesday-table" class='day-table' style='display:none'>
<?php echo render('partials.drinks_table', array('drinkPrices' => $drinkPricesDays['Tuesday'])); ?>
</div>

<div id="wednesday-table" class='day-table' style='display:none'>
<?php echo render('partials.drinks_table', array('drinkPrices' => $drinkPricesDays['Wednesday'])); ?>
</div>
<div id="thursday-table" class='day-table' style='display:none'>
<?php echo render('partials.drinks_table', array('drinkPrices' => $drinkPricesDays['Thursday'])); ?>
</div>
<div id="friday-table" class='day-table' style='display:none'>
<?php echo render('partials.drinks_table', array('drinkPrices' => $drinkPricesDays['Friday'])); ?>
</div>
<div id="saturday-table" class='day-table' style='display:none'>
<?php echo render('partials.drinks_table', array('drinkPrices' => $drinkPricesDays['Saturday'])); ?>
</div>
<div id="sunday-table" class='day-table' style='display:none'>
<?php echo render('partials.drinks_table', array('drinkPrices' => $drinkPricesDays['Sunday'])); ?>
</div>

<div id="test" style="display: none; width: 300px; height:455px;">
  <form id="ContactForm" accept-charset="UTF-8" action='processemail'  method="post">
    <div>
    <label id="name" for="name">*Name:</label>
    <input id="name"  class ="input textbox" type="text" name="name">
    <div id='name' class='error-msg'></div>
    </div>
    <div>
      <label id="email" for="email">*Email:</label>
      <input id="email" class ="input textbox" type="text" name="email">
      <div id='email' class='error-msg'></div>
    </div>
    
    <div>
      <label id='number_of_guests' for="number_of_guests" class="Heading">*Number of Guests:</label>
      <input id="number_of_guests" class ="input textbox" type="text" name="number_of_guests">
      <div id='number_of_guests' class='error-msg' ></div>
    </div>

    <div>
      <label id="terms_and_conditions" for="terms_and_conditions">*Accept Terms and Conditions</label>
      <input id="terms_and_conditions" type="checkbox" value='yes' name="terms_and_conditions">
      <div id='terms_and_conditions' class='error-msg'></div>
    </div>

    <input type="hidden" id="club" name="club" value="">
    <input type="hidden" id="day" name="day" value="">
    
  </form>
  <input id="submit-form" class="button" type="submit" name="submit" value="Submit">
  <div id="main-error-msg"></div>
</div>
<?php \Laravel\Section::stop(); ?>

<?php \Laravel\Section::start('scripts'); ?>
<script type="text/javascript"> 
Cufon.now();
$(document).ready(function(){
	$('a#monday').on('click', function(){
		$('div.day-table').hide();
		$('a.day-tab').removeClass('highlight-day-tab');
		$('a#monday').addClass('highlight-day-tab');
		$('div#monday-table').show();
	});
	
	$('a#tuesday').on('click', function(){
		$('div.day-table').hide();
		$('a.day-tab').removeClass('highlight-day-tab');
		$('a#tuesday').addClass('highlight-day-tab');
		$('div#tuesday-table').show();
	});
	
	$('a#wednesday').on('click', function(){
		$('div.day-table').hide();
		$('a.day-tab').removeClass('highlight-day-tab');
		$('a#wednesday').addClass('highlight-day-tab');
		$('div#wednesday-table').show();
	});
	
	$('a#thursday').on('click', function(){
		$('div.day-table').hide();
		$('a.day-tab').removeClass('highlight-day-tab');
		$('a#thursday').addClass('highlight-day-tab');
		$('div#thursday-table').show();
	});
	
	$('a#friday').on('click', function(){
		$('div.day-table').hide();
		$('a.day-tab').removeClass('highlight-day-tab');
		$('a#friday').addClass('highlight-day-tab');
		$('div#friday-table').show();
	});
	
	$('a#saturday').on('click', function(){
		$('div.day-table').hide();
		$('a.day-tab').removeClass('highlight-day-tab');
		$('a#saturday').addClass('highlight-day-tab');
		$('div#saturday-table').show();
	});
	
	$('a#sunday').on('click', function(){
		$('div.day-table').hide();
		$('a.day-tab').removeClass('highlight-day-tab');
		$('a#sunday').addClass('highlight-day-tab');
		$('div#sunday-table').show();
	});
	
	var weekday=new Array(7);
	weekday[0]="sunday";
	weekday[1]="monday";
	weekday[2]="tuesday";
	weekday[3]="wednesday";
	weekday[4]="thursday";
	weekday[5]="friday";
	weekday[6]="saturday";
	weekday[0]="sunday";

	var date = new Date();
	dayIndex = date.getDay();
	$('div#'+weekday[dayIndex]+'-table').show();
	$('#'+weekday[dayIndex]).addClass('highlight-day-tab');

	$('a.nyroModal').nyroModal();
	$('#ContactForm').ajaxForm({
        type: "POST",
        success: processData ,
    });

  $('input#submit-form').on('click', function(e){
    e.preventDefault();
    $('#ContactForm').submit();
  });
});

function processData(json)
{
	console.log($('terms_and_conditions').val());
	$('div.error-msg').text('');
	$('label').css('color', 'white');
	if (json.messages) {
		//alert a failure message
		console.log(json.messages);
		for (message in json.messages)
		{
			
			$('div#main-error-msg').text('Highlighted fields are incorrect');

			$('label#'+message).css({'color': 'yellow'});
			
		}
	} else {
		//alert a success message 
		$.nmTop().close();
	}	
}

function loadGuestListForm(club, day)
{
  $('input#club').val(club);
  $('input#day').val(day);
  // Remove error messages and formvalues
  $('div.error-msg').text('');
  $('label').css('color', 'white');
  $('form#ContactForm input.textbox').val('');

}

</script>
<?php \Laravel\Section::stop(); ?>