<?php
/**
 * The template for displaying the footer.
 *
 * Contains footer content and the closing of the
 * #main and #page div elements.
 *
 * @package Serpentsoft
 * @subpackage Adams_News
 * @since Adams News 1.0
 */
?>

<!-- Closing Span6 Main Content -->
</div>

<!-- Draw Side Bars if not Single and Page -->
<?php serpentsoft_footer_page_layout(); ?>

<!-- Closing Header Divs -->
</div>

<!-- Closing Row-Fluid Div -->
<!-- </div> -->

<!-- Footer Advertise -->
<div class="row-fluid">
    <div class="span12 footer-adv">
        <?php serpentsoft_footer_adv(); ?>
    </div>
</div>

<!-- Closing Main Container-Fluid Div -->
</div>

<!-- Twitter Ticker -->
<?php if (serpentsoft_get_data('serpentsoft_TwitterTickerFooter_switch')): ?>
    <section class="twitter-ticker-widget w-tweet">
        <div class="container-fluid">
            <div class="row-fluid widget-inner">
                <div class="span2 title visible-desktop">
                    <h4><?php echo serpentsoft_get_data('serpentsoft_TwitterTickerFooter_BoxTitle'); ?></h4>
                </div>

            <div id="divLatestTweets" class="span8">
                <ul class="tweet_list">
                    
                    <?php $consKey = serpentsoft_get_data('serpentsoft_twitterAPI_consumerkey');
                    $conSecret = serpentsoft_get_data('serpentsoft_twitterAPI_consumersecret');
                    $accToken = serpentsoft_get_data('serpentsoft_twitterAPI_accesstoken');
                    $accSecret = serpentsoft_get_data('serpentsoft_twitterAPI_accesstokensecret');
                    $scrName = serpentsoft_get_data('serpentsoft_twitterAPI_screenName');
                    $tweetsCount = serpentsoft_get_data('serpentsoft_TwitterTickerFooter_slider_TweetsNumber');
                    $tweets_avatar_size = serpentsoft_get_data('serpentsoft_TwitterTickerFooter_slider_AvatarSize');
                    
                    if( !empty($consKey) && !empty($conSecret) && !empty($accToken) && !empty($accSecret) && !empty($scrName) ){
                        serpentsoft_twitter_ticker($consKey, $conSecret, $accToken, $accSecret, $scrName, $tweetsCount, $tweets_avatar_size);
                    }
                    else{ echo '<li>It seems like you forget type any of your Twitter OAuth Data.</li>'; } ?>
                    
                </ul>
            </div>

                <div class="span2 visible-desktop visible-tablet follow">
                    <a href="http://twitter.com/<?php echo serpentsoft_get_data('serpentsoft_twitterAPI_screenName'); ?>" 
                       class="twitter-follow-button" data-show-count="true" data-lang="en">Follow @<?php echo serpentsoft_get_data('serpentsoft_twitterAPI_screenName'); ?></a>
                    <script>
                        //<![CDATA[
                        !function(d, s, id) {
                        "use strict";
                        var js, fjs = d.getElementsByTagName(s)[0];
                        if (!d.getElementById(id)) {
                            js = d.createElement(s);
                            js.id = id;
                            js.src = "//platform.twitter.com/widgets.js";
                            fjs.parentNode.insertBefore(js, fjs);
                        }
                    }(document, "script", "twitter-wjs");
                    //]]>
                    </script>
                </div>
                
            </div>
        </div>
    </section>

    <script type="text/javascript">
        //<![CDATA[
        jQuery(document).ready(function() {
            "use strict";
            var slideSpeed = <?php echo serpentsoft_get_data('serpentsoft_TwitterTickerFooter_slider_SlideSpeed'); ?>;
            var pauseInSeconds = <?php echo serpentsoft_get_data('serpentsoft_TwitterTickerFooter_slider_pauseInSeconds'); ?>;
            
            var ul = jQuery(this).find('.tweet_list');
            var ticker = function() {
                setTimeout(function() {
                    var top = ul.position().top;
                    var h = ul.height();
                    var incr = (h / ul.children().length);
                    var newTop = top - incr;
                    if (h + newTop <= 0)
                        newTop = 0;
                    ul.animate({top: newTop}, slideSpeed);
                    ticker();
                }, (pauseInSeconds * 1000) );
            };
            ticker();
        });
        //]]>
    </script>

<?php endif; ?>

<section class="modern-footer">
    <h2 class="hidden">Sub-Footer Section</h2>

<?php if (serpentsoft_get_data('serpentsoft_footerlayout') != 'f-none'): ?>
        <div class="container-fluid">
            <div class="row-fluid">
    <?php get_sidebar('footer'); ?>
            </div>
        </div>
<?php endif; ?>

    <!-- Copy Right Reserved Section & Social Icons -->
    <div class="footer-border-serpentsoft"></div>

    <footer class="f-copyright">
        <div class="container-fluid">
            <div class="row-fluid">

                <nav class="span6 footer-align-left">
<?php echo htmlspecialchars_decode(serpentsoft_get_data('serpentsoft_footer_left_text')); ?>
                </nav>

                <div class="span6 footer-align-right">
                    <p class="pull-right"><?php echo htmlspecialchars_decode(serpentsoft_get_data('serpentsoft_footer_right_text')); ?></p>
                </div>
            </div>
        </div>
    </footer>

</section>

<?php wp_footer(); ?>

</body>
</html>