function perthel_homes_script_functions()
{
    ?>
	
    <?php 
    if (!perthel_homes_ltie9()) {
        ?>
    <script type="text/javascript">
    jQuery(document).ready(function($){
        $(document).foundation();
		
		// Navigation Call
		$('nav').easyPie();
		$('.menubtn').click(function() {
			$(".main-navigation > div > ul").slideToggle();
			$(".menubtn").toggleClass('open');
		});
		
		// Add 'has_children' class to menus
		if($('.menu-item').has('ul.sub-menu')) {
			$('ul.sub-menu').siblings('a').addClass('has-children');
			// $('ul.sub-menu').siblings('a.has-children').wrapInner('<span/>');
		}
		
		// Scroll Top
		$('.scroll-top').click(function(){
			$('html, body').animate({scrollTop : 0},800);
			return false;
		});
    });
	
	(function($){
		var $window_resize = $(window);
		$window_resize.on('resize', function(e){
			if($window_resize.width() > 623) {
				setTimeout(function(){
					$('#secondary').css({
					'height':$('#main').innerHeight()
					});
				}, 1000);
				
				setTimeout(function(){
					$('#secondary-footer').css({
					'height':$('.site-footer').innerHeight()-20
					});
				}, 1000);
				
				$('#secondary-inenr').css({
					'padding-bottom':$('#secondary .social-media-widget').height() + 20,
				});
				
				// Apply header height to coverings
				$('.site-header-coverings').css({
					'padding-bottom':$('.site-header').innerHeight(),
				});
				
			} else {
				$('#secondary, #secondary-footer').css({
					'height': 'auto'
				});
				
				// Apply header height to coverings
				$('.site-header-coverings').css({
					'padding-bottom':$('.site-header').innerHeight(),
				});
			}
		}).trigger('resize');
	})(jQuery);
	
	// Setting Visibility for scroll to top button
	jQuery(window).scroll(function() {
		if (jQuery(window).scrollTop() > jQuery(document).height()/2) {
			jQuery('.scroll-top').css('visibility','visible');
		} else {
			jQuery('.scroll-top').css('visibility','hidden');
		}
	});
	
	// Scroll Load effects
	wow = new WOW(
      {
        animateClass: 'animated',
        offset:       100
      }
    );
    wow.init();
    </script>
    <?php 
    } else {
        ?>
    <script type="text/javascript">
    jQuery(document).ready(function($){
        // Navigation Call
		$('nav').easyPie();
		$('.menubtn').click(function() {
			$(".main-navigation > div > ul").slideToggle();
			$(".menubtn").toggleClass('open');
		});
		
		// Add 'has_children' class to menus
		if($('.menu-item').has('ul.sub-menu')) {
			$('ul.sub-menu').siblings('a').addClass('has-children');
			// $('ul.sub-menu').siblings('a.has-children').wrapInner('<span/>');
		}
		
		// Scroll Top
		$('.scroll-top').click(function(){
			$('html, body').animate({scrollTop : 0},800);
			return false;
		});
    });
	
	(function($){
		var $window_resize = $(window);
		$window_resize.on('resize', function(e){
			if($window_resize.width() > 623) {
				setTimeout(function(){
					$('#secondary').css({
					'height':$('#main').innerHeight()
					});
				}, 1000);
				
				setTimeout(function(){
					$('#secondary-footer').css({
					'height':$('.site-footer').innerHeight() - 20
					});
				}, 1000);
				
				$('#secondary-inenr').css({
					'padding-bottom':$('#secondary .social-media-widget').height() + 20,
				});
				
				// Apply header height to coverings
				$('.site-header-coverings').css({
					'padding-bottom':$('.site-header').innerHeight(),
				});
			} else {
				$('#secondary, #secondary-footer').css({
					'height': 'auto'
				});
				
				// Apply header height to coverings
				$('.site-header-coverings').css({
					'padding-bottom':$('.site-header').innerHeight(),
				});
			}
		}).trigger('resize');
	})(jQuery);
	
	// Setting Visibility for scroll to top button
	jQuery(window).scroll(function() {
		if (jQuery(window).scrollTop() > jQuery(window).height()/2) {
			jQuery('.scroll-top').css('visibility','visible');
		} else {
			jQuery('.scroll-top').css('visibility','hidden');
		}
	});
	
	// Scroll Load effects
	wow = new WOW(
      {
        animateClass: 'animated',
        offset:       100
      }
    );
    wow.init();
    </script>
	<?php 
    }
    ?>

<?php 
}
    // If comments are open or we have at least one comment, load up the comment template
    if (comments_open() || '0' != get_comments_number()) {
        comments_template('', true);
    }
    ?>

			<?php 
}
// end of the loop.
?>

			</div><!-- #content .site-content -->
		</div><!-- #primary .content-area -->

		<?php 
if (!perthel_homes_ltie9()) {
    ?>
 
        	<?php 
    tha_sidebars_before();
    ?>
            <div id="secondary" class="widget-area left three large-3 medium-4 small-12 wow fadeIn animated" data-wow-delay="100ms" role="complementary">
                <div id="secondary-inenr" class="left columns twelve large-12 medium-12 small-12">
                    <div id="secondary-inenr-1" class="left twelve large-12 medium-12 small-12">
                    	<?php 
    tha_sidebar_top();
    ?>
						<?php 
    do_action('before_sidebar');
    ?>
                        	<aside>