<?php if ($effects){
    $cr_effect = ' cr-animate-gen"  data-gen="'.$effects.'" data-gen-offset="bottom-in-view';
} else {
    $cr_effect ='';
} ?>

<div class="clients_module module row <?php echo $css ?> <?php echo $cr_effect; ?>">

    <?php if (!empty($r_items)): ?>

        <div class="clients-list twelve columns">
            <div class="row">
                <div class="clients-list-wrap ten columns centered" id="<?php echo $unique_id ?>">
                    <ul class="clients-list-slider">

                        <?php

                        foreach ($r_items as $item):

                            if ($item['image'] != '') :

                                $img_url = wp_get_attachment_url($item['image']);

                                $article_image = aq_resize($img_url, 180, 130); //resize & crop img
                                ?>

                                <li class="clients-item">

                                    <?php if ($item['client_url'] != '') : // Display chosen img ?>
                                        <a href="<?php echo $item['client_url'] ?>" target="_blank"><img src="<?php echo $article_image ?>" alt="<?php echo $item['main_title'] ?>" title="<?php echo $item['main_title'] ?>"/></a>
                                    <?php else : ?>
                                        <img src="<?php echo $article_image ?>" alt="<?php echo $item['main_title'] ?>" title="<?php echo $item['main_title'] ?>"/>
                                    <?php endif; ?>

                                </li>

                            <?php endif;   endforeach; ?>

                    </ul>
                </div>
            </div>
        </div>

        <?php if ($main_title != '') { ?>

            <div class="description">
                <div class="custom-three columns">
                <h3 class="widget-title">
                    <?php echo $main_title; ?>
                </h3>
                </div>

                <div class="custom-ten columns">
                    <?php echo mvb_parse_content($description) ?>
                </div>
            </div>

        <?php } else { ?>

            <div class="description">
                <div class="twelve columns">
                    <?php echo mvb_parse_content($description) ?>
                </div>
            </div>

        <?php } ?>

    <?php endif; ?>


    <?php if (count($r_items) > 4): ?>

        <script type="text/javascript">


            jQuery(document).ready(function () {
                jQuery('#<?php echo $unique_id ?>').flexslider({
                    selector: ".clients-list-slider > li",
                    namespace: "clients-",          //{NEW} String: Prefix string attached to the class of every element generated by the plugin
                    animation: "slide",
                    animationLoop: true,
                    direction: "horizontal",
                    itemWidth: 180,                   //{NEW} Integer: Box-model width of individual carousel items, including horizontal borders and padding.
                    itemMargin: 20,                  //{NEW} Integer: Margin between carousel items.
                    minItems: 2,                    //{NEW} Integer: Minimum number of carousel items that should be visible. Items will resize fluidly when below this.
                    maxItems: 5,
                     <?php if ($slideshow == '1'){echo 'slideshow:true';}else{echo 'slideshow:false';}?>,
					pauseOnAction: true,
                    controlsContainer: ".clients-list",
                    controlNav: false,               //Boolean: Create navigation for paging control of each clide? Note: Leave true for manualControls usage
                    directionNav: true,           //Boolean: Create navigation for previous/next navigation? (true/false)
                    prevText: "",                 //String: Set the text for the "previous" directionNav item
                    nextText: ""
                });
            });
        </script>
    <?php endif; ?>
</div>