<?php
/**
 * Fires after the main content, before the footer is output.
 *
 * @since ??
 */
do_action( 'et_after_main_content' );

if ( 'on' == et_get_option( 'divi_back_to_top', 'false' ) ) : ?>

	<span class="et_pb_scroll_top et-pb-icon"></span>

<?php endif;

if ( ! is_page_template( 'page-template-blank.php' ) ) : ?>

			<footer id="main-footer">
            	
                <div class="container clearfix upper-foo">
               
               
               
               
					</div>
            
				<?php get_sidebar( 'footer' ); ?>


		<?php
			if ( has_nav_menu( 'footer-menu' ) ) : ?>

				<div id="et-footer-nav">
					<div class="container">
						<?php
							wp_nav_menu( array(
								'theme_location' => 'footer-menu',
								'depth'          => '1',
								'menu_class'     => 'bottom-nav',
								'container'      => '',
								'fallback_cb'    => '',
							) );
						?>
					</div>
				</div> <!-- #et-footer-nav -->

			<?php endif; ?>

				<div id="footer-bottom">
					<div class="container clearfix">
				<?php
					if ( false !== et_get_option( 'show_footer_social_icons', true ) ) {
						get_template_part( 'includes/social_icons', 'footer' );
					}

					echo et_get_footer_credits();
				?>
					</div>	<!-- .container -->
				</div>
			</footer> <!-- #main-footer -->
		</div> <!-- #et-main-area -->

<?php endif; // ! is_page_template( 'page-template-blank.php' ) ?>

	</div> <!-- #page-container -->
	<script src="<?php bloginfo('template_url');?>/js/jquery.bxslider.js"></script>
    
	<script>

jQuery('.bxslider').bxSlider({

  slideWidth: 310,
    minSlides: 1,
    maxSlides: 3,
    slideMargin: 30,
	 pager: false,
	 pause: 5000,
	auto: true

});

</script>	

<script>
	jQuery('.t2 select').on('change', function() {
	$place = this.value;
	//$pdm = jQuery('input[name=delivery_method]:checked').val();
	var x = location.href;
  	window.location.href = window.location.href.split('?')[0] + "?place=" +$place
})

jQuery( document ).ready(function() {
	<?php if(is_page(218)){?>
    var param1 = window.location.href.split('=')[1];
	if(param1){
		var param = param1.replace("%20", " ");
	}
	jQuery(".t2 select option").each(function(){
  if (jQuery(this).text() == param){
    jQuery(this).attr("selected","selected");
	}
});
<?php }?>
<?php if(is_page(267)){?>
<?php $p_id = $_GET["id"]; 
		$dm =  $_GET["dm"];
	$product = wc_get_product( $p_id );
?>
	var p_name = '<?php echo $product->get_name();?>';	
	var p_price = '<?php echo "R".$product->get_price();?>';	
	var p_date = '<?php echo get_post_meta( $p_id, 'class_date', true);?>';	
	var p_place = '<?php echo get_post_meta( $p_id, 'place', true);?>';	
	var pdm =  '<?php echo $dm;?>';
	jQuery('.p_name').val(p_name);
	jQuery('.p_price').val(p_price);
	jQuery('.p_date').val(p_date);
	jQuery('.p_place').val(p_place);
	jQuery('.pdm').val(pdm);
<?php }?>
});


jQuery('body').on("click",".book", function(){
	var n_id = jQuery(this).closest('td').find('.n_id').val();
	var flag = jQuery(this).closest('td').find('.flag').val();
	var pdm = jQuery('input[name=delivery_method]:checked').val();
	jQuery(this).closest('td').find('.lod').show(); 
	//var pdm ='Classroom';
	// var ajaxurl = "<?php /*echo admin_url('admin-ajax.php');*/ ?>";	
	 
	  /*var data = {
   'action': 'myownproduct',
   'id': n_id,
   'type': pdm
  };*/
  
  
  jQuery.ajax({
		type: "POST",
		url: '<?php  echo admin_url('admin-ajax.php');?>',
		//data : jQuery("#addToWishListFormId :input[value!=''][value!=0]").serialize(),
		data: ({
                action: 'myownproduct',
				id: n_id,
                type: pdm,
				flag: flag
            }),
		beforeSend:function()
		 {
			//jQuery(this).closest('td').find('.lod').show(); 
		 },
		success: function (msg) {
			window.location.href = '<?php echo get_permalink(110);?>';
			//jQuery(this).closest('td').find('.lod').hide(); 
		}
	});
  
	
  // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
  <?php /*?>jQuery.post(ajaxurl, data, function(response) {
   	//alert('Got this from the server: ' + response);
	
  });<?php */?>
  
  
})


</script>

	<?php wp_footer(); ?>
</body>
</html>
