public function display($params, $from_shortcode = 0, $bwg = 0)
    {
        global $wp;
        $current_url = $wp->query_string;
        global $WD_BWG_UPLOAD_DIR;
        require_once WD_BWG_DIR . '/framework/WDWLibrary.php';
        $options_row = $this->model->get_options_row_data();
        $play_icon = $options_row->play_icon;
        if (!isset($params['extended_album_image_title'])) {
            $params['extended_album_image_title'] = 'none';
        }
        if (!isset($params['extended_album_view_type'])) {
            $album_view_type = 'thumbnail';
        } else {
            $album_view_type = $params['extended_album_view_type'];
        }
        if (!isset($params['popup_fullscreen'])) {
            $params['popup_fullscreen'] = 0;
        }
        if (!isset($params['popup_autoplay'])) {
            $params['popup_autoplay'] = 0;
        }
        if (!isset($params['popup_enable_pinterest'])) {
            $params['popup_enable_pinterest'] = 0;
        }
        if (!isset($params['popup_enable_tumblr'])) {
            $params['popup_enable_tumblr'] = 0;
        }
        if (!isset($params['show_search_box'])) {
            $params['show_search_box'] = 0;
        }
        if (!isset($params['search_box_width'])) {
            $params['search_box_width'] = 180;
        }
        if (!isset($params['popup_enable_info'])) {
            $params['popup_enable_info'] = 1;
        }
        if (!isset($params['popup_info_always_show'])) {
            $params['popup_info_always_show'] = 0;
        }
        if (!isset($params['popup_info_full_width'])) {
            $params['popup_info_full_width'] = 0;
        }
        if (!isset($params['popup_enable_rate'])) {
            $params['popup_enable_rate'] = 0;
        }
        if (!isset($params['thumb_click_action']) || $params['thumb_click_action'] == 'undefined') {
            $params['thumb_click_action'] = 'open_lightbox';
        }
        if (!isset($params['thumb_link_target'])) {
            $params['thumb_link_target'] = 1;
        }
        if (!isset($params['popup_hit_counter'])) {
            $params['popup_hit_counter'] = 0;
        }
        if (!isset($params['order_by'])) {
            $params['order_by'] = ' ASC ';
        }
        if (!isset($params['show_sort_images'])) {
            $params['show_sort_images'] = 0;
        }
        if (!isset($params['show_tag_box'])) {
            $params['show_tag_box'] = 0;
        }
        if (!isset($params['extended_album_enable_page'])) {
            $params['extended_album_enable_page'] = 1;
        }
        $sort_direction = ' ' . $params['order_by'] . ' ';
        $theme_row = $this->model->get_theme_row_data($params['theme_id']);
        if (!$theme_row) {
            echo WDWLibrary::message(__('There is no theme selected or the theme was deleted.', 'bwg'), 'error');
            return;
        }
        $type = isset($_REQUEST['type_' . $bwg]) ? esc_html($_REQUEST['type_' . $bwg]) : 'album';
        $bwg_search = isset($_POST['bwg_search_' . $bwg]) && esc_html($_POST['bwg_search_' . $bwg]) != '' ? esc_html($_POST['bwg_search_' . $bwg]) : '';
        $album_gallery_id = isset($_REQUEST['album_gallery_id_' . $bwg]) ? esc_html($_REQUEST['album_gallery_id_' . $bwg]) : $params['album_id'];
        if (!$album_gallery_id || $type == 'album' && !$this->model->get_album_row_data($album_gallery_id)) {
            echo WDWLibrary::message(__('There is no album selected or the album was deleted.', 'bwg'), 'error');
            return;
        }
        if ($type == 'gallery') {
            $items_per_page = $params['extended_album_images_per_page'];
            $items_per_page_arr = array('images_per_page' => $params['extended_album_images_per_page'], 'load_more_image_count' => $params['extended_album_images_per_page']);
            $items_col_num = $params['extended_album_image_column_number'];
            if (isset($_POST['sortImagesByValue_' . $bwg])) {
                $sort_by = esc_html($_POST['sortImagesByValue_' . $bwg]);
                if ($sort_by == 'random') {
                    $params['sort_by'] = 'RAND()';
                } else {
                    if ($sort_by == 'default') {
                        $params['sort_by'] = $params['sort_by'];
                    } else {
                        $params['sort_by'] = $sort_by;
                    }
                }
            }
            $image_rows = $this->model->get_image_rows_data($album_gallery_id, $items_per_page, $params['sort_by'], $bwg, $sort_direction);
            $images_count = count($image_rows);
            if (!$image_rows) {
                echo WDWLibrary::message(__('There are no images in this gallery.', 'bwg'), 'error');
            }
            $page_nav = $this->model->gallery_page_nav($album_gallery_id, $bwg);
            $album_gallery_div_id = 'bwg_album_extended_' . $bwg;
            $album_gallery_div_class = 'bwg_standart_thumbnails_' . $bwg;
        } else {
            $items_per_page = $params['extended_albums_per_page'];
            $items_per_page_arr = array('images_per_page' => $params['extended_albums_per_page'], 'load_more_image_count' => $params['extended_albums_per_page']);
            $items_col_num = 1;
            $album_galleries_row = $this->model->get_alb_gals_row($album_gallery_id, $items_per_page, 'order', $bwg, ' asc ');
            if (!$album_galleries_row) {
                echo WDWLibrary::message(__('There is no album selected or the album was deleted.', 'bwg'), 'error');
                return;
            }
            $page_nav = $this->model->album_page_nav($album_gallery_id, $bwg);
            $album_gallery_div_id = 'bwg_album_extended_' . $bwg;
            $album_gallery_div_class = 'bwg_album_extended_thumbnails_' . $bwg;
        }
        if ($type == 'gallery') {
            if ($album_view_type == 'masonry') {
                $form_child_div_id = 'bwg_masonry_thumbnails_div_' . $bwg;
                $form_child_div_style = 'background-color:rgba(0, 0, 0, 0); position:relative; text-align:' . $theme_row->masonry_thumb_align . '; width:100%;';
                $album_gallery_div_id = 'bwg_masonry_thumbnails_' . $bwg;
                $album_gallery_div_class = 'bwg_masonry_thumbnails_' . $bwg;
            } else {
                $form_child_div_style = 'background-color:rgba(0, 0, 0, 0); position:relative; text-align:' . $theme_row->thumb_align . '; width:100%;';
                $form_child_div_id = '';
            }
        } else {
            $form_child_div_id = '';
            $form_child_div_style = 'background-color:rgba(0, 0, 0, 0); position:relative; text-align:' . $theme_row->album_extended_thumb_align . '; width:100%;';
        }
        $bwg_previous_album_id = isset($_REQUEST['bwg_previous_album_id_' . $bwg]) ? esc_html($_REQUEST['bwg_previous_album_id_' . $bwg]) : $params['album_id'];
        $bwg_previous_album_page_number = isset($_REQUEST['bwg_previous_album_page_number_' . $bwg]) ? esc_html($_REQUEST['bwg_previous_album_page_number_' . $bwg]) : 0;
        $rgb_page_nav_font_color = WDWLibrary::spider_hex2rgb($theme_row->page_nav_font_color);
        $rgb_album_extended_thumbs_bg_color = WDWLibrary::spider_hex2rgb($theme_row->album_extended_thumbs_bg_color);
        $rgb_album_extended_div_bg_color = WDWLibrary::spider_hex2rgb($theme_row->album_extended_div_bg_color);
        $rgb_thumbs_bg_color = WDWLibrary::spider_hex2rgb($theme_row->thumbs_bg_color);
        $params_array = array('action' => 'GalleryBox', 'current_view' => $bwg, 'theme_id' => $params['theme_id'], 'thumb_width' => $params['extended_album_image_thumb_width'], 'thumb_height' => $params['extended_album_image_thumb_height'], 'open_with_fullscreen' => $params['popup_fullscreen'], 'open_with_autoplay' => $params['popup_autoplay'], 'image_width' => $params['popup_width'], 'image_height' => $params['popup_height'], 'image_effect' => $params['popup_effect'], 'wd_sor' => $params['sort_by'], 'wd_ord' => $params['order_by'], 'enable_image_filmstrip' => $params['popup_enable_filmstrip'], 'image_filmstrip_height' => $params['popup_filmstrip_height'], 'enable_image_ctrl_btn' => $params['popup_enable_ctrl_btn'], 'enable_image_fullscreen' => $params['popup_enable_fullscreen'], 'popup_enable_info' => $params['popup_enable_info'], 'popup_info_always_show' => $params['popup_info_always_show'], 'popup_info_full_width' => $params['popup_info_full_width'], 'popup_hit_counter' => $params['popup_hit_counter'], 'popup_enable_rate' => $params['popup_enable_rate'], 'slideshow_interval' => $params['popup_interval'], 'enable_comment_social' => $params['popup_enable_comment'], 'enable_image_facebook' => $params['popup_enable_facebook'], 'enable_image_twitter' => $params['popup_enable_twitter'], 'enable_image_google' => $params['popup_enable_google'], 'enable_image_pinterest' => $params['popup_enable_pinterest'], 'enable_image_tumblr' => $params['popup_enable_tumblr'], 'watermark_type' => $params['watermark_type'], 'current_url' => $current_url);
        if ($params['watermark_type'] != 'none') {
            $params_array['watermark_link'] = urlencode($params['watermark_link']);
            $params_array['watermark_opacity'] = $params['watermark_opacity'];
            $params_array['watermark_position'] = $params['watermark_position'];
        }
        if ($params['watermark_type'] == 'text') {
            $params_array['watermark_text'] = $params['watermark_text'];
            $params_array['watermark_font_size'] = $params['watermark_font_size'];
            $params_array['watermark_font'] = $params['watermark_font'];
            $params_array['watermark_color'] = $params['watermark_color'];
        } elseif ($params['watermark_type'] == 'image') {
            $params_array['watermark_url'] = urlencode($params['watermark_url']);
            $params_array['watermark_width'] = $params['watermark_width'];
            $params_array['watermark_height'] = $params['watermark_height'];
        }
        $tags_rows = $this->model->get_tags_rows_data($album_gallery_id);
        ?>
    <style>
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_album_extended_thumbnails_<?php 
        echo $bwg;
        ?>
 * {
        -moz-box-sizing: border-box;
        box-sizing: border-box;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_album_extended_thumbnails_<?php 
        echo $bwg;
        ?>
 {
        display: block;
        -moz-box-sizing: border-box;
        box-sizing: border-box;
        background-color: rgba(<?php 
        echo $rgb_album_extended_thumbs_bg_color['red'];
        ?>
, <?php 
        echo $rgb_album_extended_thumbs_bg_color['green'];
        ?>
, <?php 
        echo $rgb_album_extended_thumbs_bg_color['blue'];
        ?>
, <?php 
        echo number_format($theme_row->album_extended_thumb_bg_transparent / 100, 2, ".", "");
        ?>
);
        font-size: 0;
        text-align: <?php 
        echo $theme_row->album_extended_thumb_align;
        ?>
;
        max-width: inherit;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_album_extended_div_<?php 
        echo $bwg;
        ?>
 {
        display: table;
        width: 100%;
        height: <?php 
        echo $params['extended_album_height'];
        ?>
px;
        border-spacing: <?php 
        echo $theme_row->album_extended_div_padding;
        ?>
px;
        border-bottom: <?php 
        echo $theme_row->album_extended_div_separator_width;
        ?>
px <?php 
        echo $theme_row->album_extended_div_separator_style;
        ?>
 #<?php 
        echo $theme_row->album_extended_div_separator_color;
        ?>
;
        background-color: rgba(<?php 
        echo $rgb_album_extended_div_bg_color['red'];
        ?>
, <?php 
        echo $rgb_album_extended_div_bg_color['green'];
        ?>
, <?php 
        echo $rgb_album_extended_div_bg_color['blue'];
        ?>
, <?php 
        echo number_format($theme_row->album_extended_div_bg_transparent / 100, 2, ".", "");
        ?>
);
        border-radius: <?php 
        echo $theme_row->album_extended_div_border_radius;
        ?>
;
        margin: <?php 
        echo $theme_row->album_extended_div_margin;
        ?>
;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_album_extended_thumb_div_<?php 
        echo $bwg;
        ?>
 {
        background-color: #<?php 
        echo $theme_row->album_extended_thumb_div_bg_color;
        ?>
;
        border-radius: <?php 
        echo $theme_row->album_extended_thumb_div_border_radius;
        ?>
;
        text-align: center;
        border: <?php 
        echo $theme_row->album_extended_thumb_div_border_width;
        ?>
px <?php 
        echo $theme_row->album_extended_thumb_div_border_style;
        ?>
 #<?php 
        echo $theme_row->album_extended_thumb_div_border_color;
        ?>
;
        display: table-cell;
        vertical-align: middle;
        padding: <?php 
        echo $theme_row->album_extended_thumb_div_padding;
        ?>
;
      }
      @media only screen and (max-width : 320px) {
        #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_album_extended_thumb_div_<?php 
        echo $bwg;
        ?>
 {
          display: table-row;
        }
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_album_extended_text_div_<?php 
        echo $bwg;
        ?>
 {
        background-color: #<?php 
        echo $theme_row->album_extended_text_div_bg_color;
        ?>
;
        border-radius: <?php 
        echo $theme_row->album_extended_text_div_border_radius;
        ?>
;
        border: <?php 
        echo $theme_row->album_extended_text_div_border_width;
        ?>
px <?php 
        echo $theme_row->album_extended_text_div_border_style;
        ?>
 #<?php 
        echo $theme_row->album_extended_text_div_border_color;
        ?>
;
        display: table-cell;
        width: 100%;
        border-collapse: collapse;
        vertical-align: middle;
        padding: <?php 
        echo $theme_row->album_extended_text_div_padding;
        ?>
;
      }
      @media only screen and (max-width : 320px) {
        #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_album_extended_text_div_<?php 
        echo $bwg;
        ?>
 {
          display: table-row;
        }
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_title_spun_<?php 
        echo $bwg;
        ?>
 {
        border: <?php 
        echo $theme_row->album_extended_title_span_border_width;
        ?>
px <?php 
        echo $theme_row->album_extended_title_span_border_style;
        ?>
 #<?php 
        echo $theme_row->album_extended_title_span_border_color;
        ?>
;
        color: #<?php 
        echo $theme_row->album_extended_title_font_color;
        ?>
;
        display: block;
        font-family: <?php 
        echo $theme_row->album_extended_title_font_style;
        ?>
;
        font-size: <?php 
        echo $theme_row->album_extended_title_font_size;
        ?>
px;
        font-weight: <?php 
        echo $theme_row->album_extended_title_font_weight;
        ?>
;
        height: inherit;
        margin-bottom: <?php 
        echo $theme_row->album_extended_title_margin_bottom;
        ?>
px;
        padding: <?php 
        echo $theme_row->album_extended_title_padding;
        ?>
;
        text-align: left;
        vertical-align: middle;
        width: inherit;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_description_spun1_<?php 
        echo $bwg;
        ?>
 a {
        color: #<?php 
        echo $theme_row->album_extended_desc_font_color;
        ?>
;
        font-size: <?php 
        echo $theme_row->album_extended_desc_font_size;
        ?>
px;
        font-weight: <?php 
        echo $theme_row->album_extended_desc_font_weight;
        ?>
;
        font-family: <?php 
        echo $theme_row->album_extended_desc_font_style;
        ?>
;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_description_spun1_<?php 
        echo $bwg;
        ?>
 {
        border: <?php 
        echo $theme_row->album_extended_desc_span_border_width;
        ?>
px <?php 
        echo $theme_row->album_extended_desc_span_border_style;
        ?>
 #<?php 
        echo $theme_row->album_extended_desc_span_border_color;
        ?>
;
        display: inline-block;
        color: #<?php 
        echo $theme_row->album_extended_desc_font_color;
        ?>
;
        font-size: <?php 
        echo $theme_row->album_extended_desc_font_size;
        ?>
px;
        font-weight: <?php 
        echo $theme_row->album_extended_desc_font_weight;
        ?>
;
        font-family: <?php 
        echo $theme_row->album_extended_desc_font_style;
        ?>
;
        height: inherit;
        padding: <?php 
        echo $theme_row->album_extended_desc_padding;
        ?>
;
        vertical-align: middle;
        width: inherit;
        word-wrap: break-word;
        word-break: break-word;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_description_spun1_<?php 
        echo $bwg;
        ?>
 * {
        margin: 0;
        text-align: left !important;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_description_spun2_<?php 
        echo $bwg;
        ?>
 {
        float: left;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_description_short_<?php 
        echo $bwg;
        ?>
 {
        display: inline;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_description_full_<?php 
        echo $bwg;
        ?>
 {
        display: none;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_description_more_<?php 
        echo $bwg;
        ?>
 {
        clear: both;
        color: #<?php 
        echo $theme_row->album_extended_desc_more_color;
        ?>
;
        cursor: pointer;
        float: right;
        font-size: <?php 
        echo $theme_row->album_extended_desc_more_size;
        ?>
px;
        font-weight: normal;
      }
      /*Album thumbs styles.*/
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_album_thumb_<?php 
        echo $bwg;
        ?>
 {
        display: inline-block;
        text-align: center;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_album_thumb_spun1_<?php 
        echo $bwg;
        ?>
 {
        background-color: #<?php 
        echo $theme_row->album_extended_thumb_bg_color;
        ?>
;
        border-radius: <?php 
        echo $theme_row->album_extended_thumb_border_radius;
        ?>
;
        border: <?php 
        echo $theme_row->album_extended_thumb_border_width;
        ?>
px <?php 
        echo $theme_row->album_extended_thumb_border_style;
        ?>
 #<?php 
        echo $theme_row->album_extended_thumb_border_color;
        ?>
;
        box-shadow: <?php 
        echo $theme_row->album_extended_thumb_box_shadow;
        ?>
;
        display: inline-block;
        height: <?php 
        echo $params['extended_album_thumb_height'];
        ?>
px;
        margin: <?php 
        echo $theme_row->album_extended_thumb_margin;
        ?>
px;
        opacity: <?php 
        echo number_format($theme_row->album_extended_thumb_transparent / 100, 2, ".", "");
        ?>
;
        filter: Alpha(opacity=<?php 
        echo $theme_row->album_extended_thumb_transparent;
        ?>
);
        <?php 
        echo $theme_row->album_extended_thumb_transition ? 'transition: all 0.3s ease 0s;-webkit-transition: all 0.3s ease 0s;' : '';
        ?>
        padding: <?php 
        echo $theme_row->album_extended_thumb_padding;
        ?>
px;
        text-align: center;
        vertical-align: middle;
        width: <?php 
        echo $params['extended_album_thumb_width'];
        ?>
px;
        z-index: 100;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_album_thumb_spun1_<?php 
        echo $bwg;
        ?>
:hover {
        opacity: 1;
        filter: Alpha(opacity=100);
        transform: <?php 
        echo $theme_row->album_extended_thumb_hover_effect;
        ?>
(<?php 
        echo $theme_row->album_extended_thumb_hover_effect_value;
        ?>
);
        -ms-transform: <?php 
        echo $theme_row->album_extended_thumb_hover_effect;
        ?>
(<?php 
        echo $theme_row->album_extended_thumb_hover_effect_value;
        ?>
);
        -webkit-transform: <?php 
        echo $theme_row->album_extended_thumb_hover_effect;
        ?>
(<?php 
        echo $theme_row->album_extended_thumb_hover_effect_value;
        ?>
);
        backface-visibility: hidden;
        -webkit-backface-visibility: hidden;
        -moz-backface-visibility: hidden;
        -ms-backface-visibility: hidden;
        z-index: 102;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_album_thumb_spun2_<?php 
        echo $bwg;
        ?>
 {
        display: inline-block;
        height: <?php 
        echo $params['extended_album_thumb_height'];
        ?>
px;
        overflow: hidden;
        width: <?php 
        echo $params['extended_album_thumb_width'];
        ?>
px;
      }
      /*Image thumbs styles.*/
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_standart_thumb_spun1_<?php 
        echo $bwg;
        ?>
 {
        background-color: #<?php 
        echo $theme_row->thumb_bg_color;
        ?>
;
        border-radius: <?php 
        echo $theme_row->thumb_border_radius;
        ?>
;
        border: <?php 
        echo $theme_row->thumb_border_width;
        ?>
px <?php 
        echo $theme_row->thumb_border_style;
        ?>
 #<?php 
        echo $theme_row->thumb_border_color;
        ?>
;
        box-shadow: <?php 
        echo $theme_row->thumb_box_shadow;
        ?>
;
        display: inline-block;
        height: <?php 
        echo $params['extended_album_image_thumb_height'];
        ?>
px;
        margin: <?php 
        echo $theme_row->thumb_margin;
        ?>
px;
        opacity: <?php 
        echo number_format($theme_row->thumb_transparent / 100, 2, ".", "");
        ?>
;
        filter: Alpha(opacity=<?php 
        echo $theme_row->thumb_transparent;
        ?>
);
        <?php 
        echo $theme_row->thumb_transition ? 'transition: all 0.3s ease 0s;-webkit-transition: all 0.3s ease 0s;' : '';
        ?>
        padding: <?php 
        echo $theme_row->thumb_padding;
        ?>
px;
        text-align: center;
        vertical-align: middle;
        width: <?php 
        echo $params['extended_album_image_thumb_width'];
        ?>
px;
        z-index: 100;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_standart_thumb_spun1_<?php 
        echo $bwg;
        ?>
:hover {
        -ms-transform: <?php 
        echo $theme_row->thumb_hover_effect;
        ?>
(<?php 
        echo $theme_row->thumb_hover_effect_value;
        ?>
);
        -webkit-transform: <?php 
        echo $theme_row->thumb_hover_effect;
        ?>
(<?php 
        echo $theme_row->thumb_hover_effect_value;
        ?>
);
        backface-visibility: hidden;
        -webkit-backface-visibility: hidden;
        -moz-backface-visibility: hidden;
        -ms-backface-visibility: hidden;
        opacity: 1;
        filter: Alpha(opacity=100);
        transform: <?php 
        echo $theme_row->thumb_hover_effect;
        ?>
(<?php 
        echo $theme_row->thumb_hover_effect_value;
        ?>
);
        z-index: 102;
        position: relative;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_standart_thumb_spun2_<?php 
        echo $bwg;
        ?>
 {
        display: inline-block;
        height: <?php 
        echo $params['extended_album_image_thumb_height'];
        ?>
px;
        overflow: hidden;
        width: <?php 
        echo $params['extended_album_image_thumb_width'];
        ?>
px;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_standart_thumbnails_<?php 
        echo $bwg;
        ?>
 {
        -moz-box-sizing: border-box;
        display: inline-block;
        background-color: rgba(<?php 
        echo $rgb_thumbs_bg_color['red'];
        ?>
, <?php 
        echo $rgb_thumbs_bg_color['green'];
        ?>
, <?php 
        echo $rgb_thumbs_bg_color['blue'];
        ?>
, <?php 
        echo number_format($theme_row->thumb_bg_transparent / 100, 2, ".", "");
        ?>
);
        box-sizing: border-box;
        font-size: 0;
        max-width: <?php 
        echo $params['extended_album_image_column_number'] * ($params['extended_album_image_thumb_width'] + 2 * (2 + $theme_row->thumb_margin + $theme_row->thumb_padding + $theme_row->thumb_border_width));
        ?>
px;
        text-align: <?php 
        echo $theme_row->thumb_align;
        ?>
;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_standart_thumb_<?php 
        echo $bwg;
        ?>
 {
        display: inline-block;
        text-align: center;
      }
      <?php 
        if ($params['extended_album_image_title'] == 'show') {
            /* Show image title at the bottom.*/
            ?>
        #bwg_container1_<?php 
            echo $bwg;
            ?>
 #bwg_container2_<?php 
            echo $bwg;
            ?>
 .bwg_image_title_spun1_<?php 
            echo $bwg;
            ?>
 {
          display: block;
          margin: 0 auto;
          opacity: 1;
          filter: Alpha(opacity=100);
          text-align: center;
          width: <?php 
            echo $params['extended_album_image_thumb_width'];
            ?>
px;
        }
        <?php 
        } elseif ($params['extended_album_image_title'] == 'hover') {
            /* Show image title on hover.*/
            ?>
        #bwg_container1_<?php 
            echo $bwg;
            ?>
 #bwg_container2_<?php 
            echo $bwg;
            ?>
 .bwg_image_title_spun1_<?php 
            echo $bwg;
            ?>
 {
          display: table;
          height: inherit;
          left: -3000px;
          opacity: 0;
          filter: Alpha(opacity=0);
          position: absolute;
          top: 0px;
          width: inherit;
        }
        <?php 
        }
        ?>
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_standart_thumb_spun1_<?php 
        echo $bwg;
        ?>
:hover .bwg_image_title_spun1_<?php 
        echo $bwg;
        ?>
 {
        left: <?php 
        echo $theme_row->thumb_padding;
        ?>
px;
        top: <?php 
        echo $theme_row->thumb_padding;
        ?>
px;
        opacity: 1;
        filter: Alpha(opacity=100);
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_image_title_spun2_<?php 
        echo $bwg;
        ?>
 {
        color: #<?php 
        echo $theme_row->thumb_title_font_color;
        ?>
;
        display: table-cell;
        font-family: <?php 
        echo $theme_row->thumb_title_font_style;
        ?>
;
        font-size: <?php 
        echo $theme_row->thumb_title_font_size;
        ?>
px;
        font-weight: <?php 
        echo $theme_row->thumb_title_font_weight;
        ?>
;
        height: inherit;
        margin: <?php 
        echo $theme_row->thumb_title_margin;
        ?>
;
        text-shadow: <?php 
        echo $theme_row->thumb_title_shadow;
        ?>
;
        vertical-align: middle;
        width: inherit;
        word-break: break-all;
        word-wrap: break-word;
      }
      /*Pagination styles.*/
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .tablenav-pages_<?php 
        echo $bwg;
        ?>
 {
        text-align: <?php 
        echo $theme_row->page_nav_align;
        ?>
;
        font-size: <?php 
        echo $theme_row->page_nav_font_size;
        ?>
px;
        font-family: <?php 
        echo $theme_row->page_nav_font_style;
        ?>
;
        font-weight: <?php 
        echo $theme_row->page_nav_font_weight;
        ?>
;
        color: #<?php 
        echo $theme_row->page_nav_font_color;
        ?>
;
        margin: 6px 0 4px;
        display: block;
        height: 30px;
        line-height: 30px;
      }
      @media only screen and (max-width : 320px) {
        #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .displaying-num_<?php 
        echo $bwg;
        ?>
 {
          display: none;
        }
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .displaying-num_<?php 
        echo $bwg;
        ?>
 {
        font-size: <?php 
        echo $theme_row->page_nav_font_size;
        ?>
px;
        font-family: <?php 
        echo $theme_row->page_nav_font_style;
        ?>
;
        font-weight: <?php 
        echo $theme_row->page_nav_font_weight;
        ?>
;
        color: #<?php 
        echo $theme_row->page_nav_font_color;
        ?>
;
        margin-right: 10px;
        vertical-align: middle;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .paging-input_<?php 
        echo $bwg;
        ?>
 {
        font-size: <?php 
        echo $theme_row->page_nav_font_size;
        ?>
px;
        font-family: <?php 
        echo $theme_row->page_nav_font_style;
        ?>
;
        font-weight: <?php 
        echo $theme_row->page_nav_font_weight;
        ?>
;
        color: #<?php 
        echo $theme_row->page_nav_font_color;
        ?>
;
        vertical-align: middle;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .tablenav-pages_<?php 
        echo $bwg;
        ?>
 a.disabled,
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .tablenav-pages_<?php 
        echo $bwg;
        ?>
 a.disabled:hover,
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .tablenav-pages_<?php 
        echo $bwg;
        ?>
 a.disabled:focus {
        cursor: default;
        color: rgba(<?php 
        echo $rgb_page_nav_font_color['red'];
        ?>
, <?php 
        echo $rgb_page_nav_font_color['green'];
        ?>
, <?php 
        echo $rgb_page_nav_font_color['blue'];
        ?>
, 0.5);
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .tablenav-pages_<?php 
        echo $bwg;
        ?>
 a {
        cursor: pointer;
        font-size: <?php 
        echo $theme_row->page_nav_font_size;
        ?>
px;
        font-family: <?php 
        echo $theme_row->page_nav_font_style;
        ?>
;
        font-weight: <?php 
        echo $theme_row->page_nav_font_weight;
        ?>
;
        color: #<?php 
        echo $theme_row->page_nav_font_color;
        ?>
;
        text-decoration: none;
        padding: <?php 
        echo $theme_row->page_nav_padding;
        ?>
;
        margin: <?php 
        echo $theme_row->page_nav_margin;
        ?>
;
        border-radius: <?php 
        echo $theme_row->page_nav_border_radius;
        ?>
;
        border-style: <?php 
        echo $theme_row->page_nav_border_style;
        ?>
;
        border-width: <?php 
        echo $theme_row->page_nav_border_width;
        ?>
px;
        border-color: #<?php 
        echo $theme_row->page_nav_border_color;
        ?>
;
        background-color: #<?php 
        echo $theme_row->page_nav_button_bg_color;
        ?>
;
        opacity: <?php 
        echo number_format($theme_row->page_nav_button_bg_transparent / 100, 2, ".", "");
        ?>
;
        filter: Alpha(opacity=<?php 
        echo $theme_row->page_nav_button_bg_transparent;
        ?>
);
        box-shadow: <?php 
        echo $theme_row->page_nav_box_shadow;
        ?>
;
        <?php 
        echo $theme_row->page_nav_button_transition ? 'transition: all 0.3s ease 0s;-webkit-transition: all 0.3s ease 0s;' : '';
        ?>
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_back_<?php 
        echo $bwg;
        ?>
 {
        background-color: rgba(0, 0, 0, 0);
        color: #<?php 
        echo $theme_row->album_extended_back_font_color;
        ?>
 !important;
        cursor: pointer;
        display: block;
        font-family: <?php 
        echo $theme_row->album_extended_back_font_style;
        ?>
;
        font-size: <?php 
        echo $theme_row->album_extended_back_font_size;
        ?>
px;
        font-weight: <?php 
        echo $theme_row->album_extended_back_font_weight;
        ?>
;
        text-decoration: none;
        padding: <?php 
        echo $theme_row->album_extended_back_padding;
        ?>
;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 #spider_popup_overlay_<?php 
        echo $bwg;
        ?>
 {
        background-color: #<?php 
        echo $theme_row->lightbox_overlay_bg_color;
        ?>
;
        opacity: <?php 
        echo number_format($theme_row->lightbox_overlay_bg_transparent / 100, 2, ".", "");
        ?>
;
        filter: Alpha(opacity=<?php 
        echo $theme_row->lightbox_overlay_bg_transparent;
        ?>
);
      }
      .bwg_play_icon_spun_<?php 
        echo $bwg;
        ?>
	 {
        width: inherit;
        height: inherit;
        display: table;
        position: absolute;
      }	 
     .bwg_play_icon_<?php 
        echo $bwg;
        ?>
 {
        color: #<?php 
        echo $theme_row->thumb_title_font_color;
        ?>
;
        font-size: <?php 
        echo 2 * $theme_row->thumb_title_font_size;
        ?>
px;
        vertical-align: middle;
        display: table-cell !important;
        z-index: 1;
        text-align: center;
        margin: 0 auto;
      }
    </style>
    <div id="bwg_container1_<?php 
        echo $bwg;
        ?>
">
      <div id="bwg_container2_<?php 
        echo $bwg;
        ?>
">
        <form id="gal_front_form_<?php 
        echo $bwg;
        ?>
" method="post" action="#">
          <?php 
        if ($params['show_search_box'] && $type == 'gallery') {
            WDWLibrary::ajax_html_frontend_search_box('gal_front_form_' . $bwg, $bwg, $album_gallery_div_id, $images_count, $params['search_box_width']);
        }
        if (isset($params['show_sort_images']) && $params['show_sort_images'] && $type == 'gallery') {
            WDWLibrary::ajax_html_frontend_sort_box('gal_front_form_' . $bwg, $bwg, $album_gallery_div_id, $params['sort_by'], $params['search_box_width']);
        }
        if (isset($params['show_tag_box']) && $params['show_tag_box'] && $type == 'gallery') {
            WDWLibrary::ajax_html_frontend_search_tags('gal_front_form_' . $bwg, $bwg, $album_gallery_div_id, $images_count, $tags_rows);
        }
        ?>
          <div id="<?php 
        echo $form_child_div_id;
        ?>
" style="<?php 
        echo $form_child_div_style;
        ?>
">
            <div id="ajax_loading_<?php 
        echo $bwg;
        ?>
" style="position:absolute;width: 100%; z-index: 115; text-align: center; height: 100%; vertical-align: middle; display: none;">
              <div style="display: table; vertical-align: middle; width: 100%; height: 100%; background-color:#FFFFFF; opacity:0.7; filter:Alpha(opacity=70);">
                <div style="display: table-cell; text-align: center; position: relative; vertical-align: middle;" >
                  <div id="loading_div_<?php 
        echo $bwg;
        ?>
" class="spider_ajax_loading" style="display: inline-block; text-align:center; position:relative; vertical-align:middle; background-image:url(<?php 
        echo WD_BWG_URL . '/images/ajax_loader.png';
        ?>
); float: none; width:50px;height:50px;background-size:50px 50px;">
                  </div>
                </div>
              </div>
            </div>
            <?php 
        if ($params['extended_album_enable_page'] && $items_per_page && $theme_row->page_nav_position == 'top' && $page_nav['total']) {
            WDWLibrary::ajax_html_frontend_page_nav($theme_row, $page_nav['total'], $page_nav['limit'], 'gal_front_form_' . $bwg, $items_per_page_arr, $bwg, $album_gallery_div_id, $params['album_id'], $type, $options_row->enable_seo, $params['extended_album_enable_page']);
        }
        if ($bwg_previous_album_id != $params['album_id']) {
            ?>
              <a class="bwg_back_<?php 
            echo $bwg;
            ?>
" onclick="spider_frontend_ajax('gal_front_form_<?php 
            echo $bwg;
            ?>
', '<?php 
            echo $bwg;
            ?>
', '<?php 
            echo $album_gallery_div_id;
            ?>
', 'back', '', 'album')"><?php 
            echo __('Back', 'bwg');
            ?>
</a>
              <?php 
        }
        ?>
            <div id="<?php 
        echo $album_gallery_div_id;
        ?>
" class="<?php 
        echo $album_gallery_div_class;
        ?>
">
              <input type="hidden" id="bwg_previous_album_id_<?php 
        echo $bwg;
        ?>
" name="bwg_previous_album_id_<?php 
        echo $bwg;
        ?>
" value="<?php 
        echo $bwg_previous_album_id;
        ?>
" />
              <input type="hidden" id="bwg_previous_album_page_number_<?php 
        echo $bwg;
        ?>
" name="bwg_previous_album_page_number_<?php 
        echo $bwg;
        ?>
" value="<?php 
        echo $bwg_previous_album_page_number;
        ?>
" />
              <?php 
        if ($type != 'gallery') {
            if (!$page_nav['total']) {
                ?>
                  <span class="bwg_back_<?php 
                echo $bwg;
                ?>
"><?php 
                echo __('Album is empty.', 'bwg');
                ?>
</span>
                  <?php 
            }
            foreach ($album_galleries_row as $album_galallery_row) {
                if ($album_galallery_row->is_album) {
                    $album_row = $this->model->get_album_row_data($album_galallery_row->alb_gal_id);
                    if (!$album_row) {
                        continue;
                    }
                    $preview_image = $album_row->preview_image;
                    if (!$preview_image) {
                        $preview_image = $album_row->random_preview_image;
                    }
                    $def_type = 'album';
                    $title = $album_row->name;
                    $description = wpautop($album_row->description);
                } else {
                    $gallery_row = $this->model->get_gallery_row_data($album_galallery_row->alb_gal_id);
                    if (!$gallery_row) {
                        continue;
                    }
                    $preview_image = $gallery_row->preview_image;
                    if (!$preview_image) {
                        $preview_image = $gallery_row->random_preview_image;
                    }
                    $def_type = 'gallery';
                    $title = $gallery_row->name;
                    $description = wpautop($gallery_row->description);
                }
                $local_preview_image = true;
                $parsed_prev_url = parse_url($preview_image, PHP_URL_SCHEME);
                if ($parsed_prev_url == 'http' || $parsed_prev_url == 'https') {
                    $local_preview_image = false;
                }
                if (!$preview_image) {
                    $preview_url = WD_BWG_URL . '/images/no-image.png';
                    $preview_path = WD_BWG_DIR . '/images/no-image.png';
                } else {
                    if ($local_preview_image) {
                        $preview_url = site_url() . '/' . $WD_BWG_UPLOAD_DIR . $preview_image;
                        $preview_path = ABSPATH . $WD_BWG_UPLOAD_DIR . $preview_image;
                    } else {
                        $preview_url = $preview_image;
                        $preview_path = $preview_image;
                    }
                }
                if ($local_preview_image) {
                    list($image_thumb_width, $image_thumb_height) = getimagesize(htmlspecialchars_decode($preview_path, ENT_COMPAT | ENT_QUOTES));
                    $scale = max($params['extended_album_thumb_width'] / $image_thumb_width, $params['extended_album_thumb_height'] / $image_thumb_height);
                    $image_thumb_width *= $scale;
                    $image_thumb_height *= $scale;
                    $thumb_left = ($params['extended_album_thumb_width'] - $image_thumb_width) / 2;
                    $thumb_top = ($params['extended_album_thumb_height'] - $image_thumb_height) / 2;
                } else {
                    $image_thumb_width = $params['extended_album_thumb_width'];
                    $image_thumb_height = $params['extended_album_thumb_height'];
                    $thumb_left = 0;
                    $thumb_top = 0;
                }
                if ($type != 'gallery') {
                    ?>
                    <div class="bwg_album_extended_div_<?php 
                    echo $bwg;
                    ?>
">
                      <div class="bwg_album_extended_thumb_div_<?php 
                    echo $bwg;
                    ?>
">
                        <a class="bwg_album_<?php 
                    echo $bwg;
                    ?>
" <?php 
                    echo $options_row->enable_seo ? 'href="' . add_query_arg(array("type_" . $bwg => $def_type, "album_gallery_id_" . $bwg => $album_galallery_row->alb_gal_id, "bwg_previous_album_id_" . $bwg => $album_gallery_id . ',' . $bwg_previous_album_id, "bwg_previous_album_page_number_" . $bwg => (isset($_REQUEST['page_number_' . $bwg]) ? esc_html($_REQUEST['page_number_' . $bwg]) : 0) . ',' . $bwg_previous_album_page_number), $_SERVER['REQUEST_URI']) . '"' : '';
                    ?>
 style="font-size: 0;" data-alb_gal_id="<?php 
                    echo $album_galallery_row->alb_gal_id;
                    ?>
" data-def_type="<?php 
                    echo $def_type;
                    ?>
" data-title="<?php 
                    htmlspecialchars(addslashes($title));
                    ?>
">
                          <span class="bwg_album_thumb_<?php 
                    echo $bwg;
                    ?>
" style="height:inherit;">
                            <span class="bwg_album_thumb_spun1_<?php 
                    echo $bwg;
                    ?>
">
                              <span class="bwg_album_thumb_spun2_<?php 
                    echo $bwg;
                    ?>
">
                                <img style="padding: 0; max-height:none; max-width:none; width:<?php 
                    echo $image_thumb_width;
                    ?>
px; height:<?php 
                    echo $image_thumb_height;
                    ?>
px; margin-left: <?php 
                    echo $thumb_left;
                    ?>
px; margin-top: <?php 
                    echo $thumb_top;
                    ?>
px;" src="<?php 
                    echo $preview_url;
                    ?>
" alt="<?php 
                    echo $title;
                    ?>
" />
                              </span>
                            </span>
                          </span>
                        </a>
                      </div>
                      <div class="bwg_album_extended_text_div_<?php 
                    echo $bwg;
                    ?>
">
                        <?php 
                    if ($title) {
                        ?>
                          <span class="bwg_title_spun_<?php 
                        echo $bwg;
                        ?>
"><?php 
                        echo $title;
                        ?>
</span>
                          <?php 
                    }
                    if ($params['extended_album_description_enable'] && $description) {
                        if (stripos($description, '<!--more-->') !== FALSE) {
                            $description_array = explode('<!--more-->', $description);
                            $description_short = $description_array[0];
                            $description_full = $description_array[1];
                            ?>
                            <span class="bwg_description_spun1_<?php 
                            echo $bwg;
                            ?>
">
                              <span class="bwg_description_spun2_<?php 
                            echo $bwg;
                            ?>
">
                                <span class="bwg_description_short_<?php 
                            echo $bwg;
                            ?>
">
                                  <?php 
                            echo $description_short;
                            ?>
                                </span>
                                <span class="bwg_description_full_<?php 
                            echo $bwg;
                            ?>
">
                                  <?php 
                            echo $description_full;
                            ?>
                                </span>
                              </span>
                              <span class="bwg_description_more_<?php 
                            echo $bwg;
                            ?>
 bwg_more"><?php 
                            echo __('More', 'bwg');
                            ?>
</span>
                            </span>
                            <?php 
                        } else {
                            ?>
                            <span class="bwg_description_spun1_<?php 
                            echo $bwg;
                            ?>
">
                              <span class="bwg_description_short_<?php 
                            echo $bwg;
                            ?>
">
                                <?php 
                            echo $description;
                            ?>
                              </span>
                            </span>
                            <?php 
                        }
                    }
                    ?>
                      </div>
                    </div>
                    <?php 
                }
            }
        } elseif ($type == 'gallery') {
            if ($options_row->show_album_name) {
                ?>
                  <div class="bwg_back_<?php 
                echo $bwg;
                ?>
" ><?php 
                echo isset($_POST['title_' . $bwg]) ? esc_html($_POST['title_' . $bwg]) : '';
                ?>
</div>
                  <?php 
            }
            if (!$page_nav['total']) {
                if ($bwg_search != '') {
                    ?>
                    <span class="bwg_back_<?php 
                    echo $bwg;
                    ?>
"><?php 
                    echo __('There are no images matching your search.', 'bwg');
                    ?>
</span>
                    <?php 
                } else {
                    ?>
                    <span class="bwg_back_<?php 
                    echo $bwg;
                    ?>
"><?php 
                    echo __('Gallery is empty.', 'bwg');
                    ?>
</span>
                    <?php 
                }
            }
            foreach ($image_rows as $image_row) {
                $is_embed = preg_match('/EMBED/', $image_row->filetype) == 1 ? true : false;
                $is_embed_video = preg_match('/VIDEO/', $image_row->filetype) == 1 ? true : false;
                if (!$is_embed) {
                    list($image_thumb_width, $image_thumb_height) = getimagesize(htmlspecialchars_decode(ABSPATH . $WD_BWG_UPLOAD_DIR . $image_row->thumb_url, ENT_COMPAT | ENT_QUOTES));
                } else {
                    if ($image_row->resolution != '') {
                        $resolution_arr = explode(" ", $image_row->resolution);
                        $resolution_w = intval($resolution_arr[0]);
                        $resolution_h = intval($resolution_arr[2]);
                        if ($resolution_w != 0 && $resolution_h != 0) {
                            $scale = $scale = max($params['extended_album_image_thumb_width'] / $resolution_w, $params['extended_album_image_thumb_height'] / $resolution_h);
                            $image_thumb_width = $resolution_w * $scale;
                            $image_thumb_height = $resolution_h * $scale;
                        } else {
                            $image_thumb_width = $params['extended_album_image_thumb_width'];
                            $image_thumb_height = $params['extended_album_image_thumb_height'];
                        }
                    } else {
                        $image_thumb_width = $params['extended_album_image_thumb_width'];
                        $image_thumb_height = $params['extended_album_image_thumb_height'];
                    }
                }
                $scale = max($params['extended_album_image_thumb_width'] / $image_thumb_width, $params['extended_album_image_thumb_height'] / $image_thumb_height);
                $image_thumb_width *= $scale;
                $image_thumb_height *= $scale;
                $thumb_left = ($params['extended_album_image_thumb_width'] - $image_thumb_width) / 2;
                $thumb_top = ($params['extended_album_image_thumb_height'] - $image_thumb_height) / 2;
                ?>
                  <a <?php 
                echo $params['thumb_click_action'] == 'open_lightbox' ? ' class="bwg_lightbox_' . $bwg . '"' . ($options_row->enable_seo ? ' href="' . ($is_embed ? $image_row->thumb_url : site_url() . '/' . $WD_BWG_UPLOAD_DIR . $image_row->image_url) . '"' : '') . ' data-image-id="' . $image_row->id . '" data-gallery-id="' . $album_gallery_id . '"' : ($params['thumb_click_action'] == 'redirect_to_url' && $image_row->redirect_url ? 'href="' . $image_row->redirect_url . '" target="' . ($params['thumb_link_target'] ? '_blank' : '') . '"' : '');
                ?>
>
                    <span class="bwg_standart_thumb_<?php 
                echo $bwg;
                ?>
">
                      <span class="bwg_standart_thumb_spun1_<?php 
                echo $bwg;
                ?>
">
                        <span class="bwg_standart_thumb_spun2_<?php 
                echo $bwg;
                ?>
">
                          <?php 
                if ($play_icon && $is_embed_video) {
                    ?>
                          <span class="bwg_play_icon_spun_<?php 
                    echo $bwg;
                    ?>
">
                             <i title="<?php 
                    echo __('Play', 'bwg');
                    ?>
"  class="fa fa-play bwg_play_icon_<?php 
                    echo $bwg;
                    ?>
"></i>
                          </span>
                            <?php 
                }
                if ($params['extended_album_image_title'] == 'hover') {
                    ?>
                            <span class="bwg_image_title_spun1_<?php 
                    echo $bwg;
                    ?>
">
                              <span class="bwg_image_title_spun2_<?php 
                    echo $bwg;
                    ?>
">
                                <?php 
                    echo $image_row->alt;
                    ?>
                              </span>
                            </span>
                            <?php 
                }
                ?>
                          <img style="max-height:none; max-width:none; width:<?php 
                echo $image_thumb_width;
                ?>
px; height:<?php 
                echo $image_thumb_height;
                ?>
px; margin-left: <?php 
                echo $thumb_left;
                ?>
px; margin-top: <?php 
                echo $thumb_top;
                ?>
px;" id="<?php 
                echo $image_row->id;
                ?>
" src="<?php 
                echo ($is_embed ? "" : site_url() . '/' . $WD_BWG_UPLOAD_DIR) . $image_row->thumb_url;
                ?>
" alt="<?php 
                echo $image_row->alt;
                ?>
" />
                        </span>
                      </span>
                      <?php 
                if ($params['extended_album_image_title'] == 'show') {
                    ?>
                        <span class="bwg_image_title_spun1_<?php 
                    echo $bwg;
                    ?>
">
                          <span class="bwg_image_title_spun2_<?php 
                    echo $bwg;
                    ?>
">
                            <?php 
                    echo $image_row->alt;
                    ?>
                          </span>
                        </span>
                        <?php 
                }
                ?>
                    </span>
                  </a>
                  <?php 
            }
        }
        ?>
              <script>
                jQuery(".bwg_description_more_<?php 
        echo $bwg;
        ?>
").click(function () {
                  if (jQuery(this).hasClass("bwg_more")) {
                    jQuery(this).parent().find(".bwg_description_full_<?php 
        echo $bwg;
        ?>
").show();
                    jQuery(this).attr("class", "bwg_description_more_<?php 
        echo $bwg;
        ?>
 bwg_hide");
                    jQuery(this).html("<?php 
        echo __('Hide', 'bwg');
        ?>
");
                  }
                  else {
                    jQuery(this).parent().find(".bwg_description_full_<?php 
        echo $bwg;
        ?>
").hide();
                    jQuery(this).attr("class", "bwg_description_more_<?php 
        echo $bwg;
        ?>
 bwg_more");
                    jQuery(this).html("<?php 
        echo __('More', 'bwg');
        ?>
");
                  }
                });
              </script>
            </div>
            <?php 
        if ($params['extended_album_enable_page'] && $items_per_page && $theme_row->page_nav_position == 'bottom' && $page_nav['total']) {
            WDWLibrary::ajax_html_frontend_page_nav($theme_row, $page_nav['total'], $page_nav['limit'], 'gal_front_form_' . $bwg, $items_per_page_arr, $bwg, $album_gallery_div_id, $params['album_id'], $type, $options_row->enable_seo, $params['extended_album_enable_page']);
        }
        ?>
          </div>
        </form>
        <div id="spider_popup_loading_<?php 
        echo $bwg;
        ?>
" class="spider_popup_loading"></div>
        <div id="spider_popup_overlay_<?php 
        echo $bwg;
        ?>
" class="spider_popup_overlay" onclick="spider_destroypopup(1000)"></div>
      </div>
    </div>
    <script>
      function bwg_gallery_box_<?php 
        echo $bwg;
        ?>
(gallery_id, image_id) {
        var filterTags = jQuery("#bwg_tags_id_bwg_album_extended_<?php 
        echo $bwg;
        ?>
" ).val() ? jQuery("#bwg_tags_id_bwg_album_extended_<?php 
        echo $bwg;
        ?>
" ).val() : 0;
        spider_createpopup('<?php 
        echo addslashes(add_query_arg($params_array, admin_url('admin-ajax.php')));
        ?>
&gallery_id=' + gallery_id + '&image_id=' + image_id + "&filter_tag_<?php 
        echo $bwg;
        ?>
=" +  filterTags, '<?php 
        echo $bwg;
        ?>
', '<?php 
        echo $params['popup_width'];
        ?>
', '<?php 
        echo $params['popup_height'];
        ?>
', 1, 'testpopup', 5);
      }
      function bwg_document_ready_<?php 
        echo $bwg;
        ?>
() {
        var bwg_touch_flag = false;
        jQuery(".bwg_lightbox_<?php 
        echo $bwg;
        ?>
").on("click", function () {
          if (!bwg_touch_flag) {
            bwg_touch_flag = true;
            setTimeout(function(){ bwg_touch_flag = false; }, 100);
            bwg_gallery_box_<?php 
        echo $bwg;
        ?>
(jQuery(this).attr("data-gallery-id"), jQuery(this).attr("data-image-id"));
            return false;
          }
        });
        jQuery(".bwg_album_<?php 
        echo $bwg;
        ?>
").on("click", function () {
          if (!bwg_touch_flag) {
            bwg_touch_flag = true;
            setTimeout(function(){ bwg_touch_flag = false; }, 100);
            spider_frontend_ajax('gal_front_form_<?php 
        echo $bwg;
        ?>
', '<?php 
        echo $bwg;
        ?>
', 'bwg_album_extended_<?php 
        echo $bwg;
        ?>
', jQuery(this).attr("data-alb_gal_id"), '<?php 
        echo $album_gallery_id;
        ?>
', jQuery(this).attr("data-def_type"), '', jQuery(this).attr("data-title"), 'default'); 
            return false;
          }
        });
      }
      jQuery(document).ready(function () {
        bwg_document_ready_<?php 
        echo $bwg;
        ?>
();
      });
    </script>
    <?php 
        if ($from_shortcode) {
            return;
        } else {
            die;
        }
    }
Example #2
0
    public function display($params, $from_shortcode = 0, $bwg = 0)
    {
        global $wp;
        $current_url = $wp->query_string;
        global $WD_BWG_UPLOAD_DIR;
        require_once WD_BWG_DIR . '/framework/WDWLibrary.php';
        if (!isset($params['image_title'])) {
            $params['image_title'] = 'none';
        }
        if (!isset($params['popup_fullscreen'])) {
            $params['popup_fullscreen'] = 0;
        }
        if (!isset($params['popup_autoplay'])) {
            $params['popup_autoplay'] = 0;
        }
        if (!isset($params['order_by'])) {
            $params['order_by'] = ' asc ';
        }
        if (!isset($params['popup_enable_pinterest'])) {
            $params['popup_enable_pinterest'] = 0;
        }
        if (!isset($params['popup_enable_tumblr'])) {
            $params['popup_enable_tumblr'] = 0;
        }
        if (!isset($params['show_search_box'])) {
            $params['show_search_box'] = 0;
        }
        if (!isset($params['search_box_width'])) {
            $params['search_box_width'] = 180;
        }
        if (!isset($params['popup_enable_info'])) {
            $params['popup_enable_info'] = 1;
        }
        if (!isset($params['popup_info_always_show'])) {
            $params['popup_info_always_show'] = 0;
        }
        if (!isset($params['popup_info_full_width'])) {
            $params['popup_info_full_width'] = 0;
        }
        if (!isset($params['popup_enable_rate'])) {
            $params['popup_enable_rate'] = 0;
        }
        if (!isset($params['thumb_click_action']) || $params['thumb_click_action'] == 'undefined') {
            $params['thumb_click_action'] = 'open_lightbox';
        }
        if (!isset($params['thumb_link_target'])) {
            $params['thumb_link_target'] = 1;
        }
        if (!isset($params['popup_hit_counter'])) {
            $params['popup_hit_counter'] = 0;
        }
        if (!isset($params['show_sort_images'])) {
            $params['show_sort_images'] = 0;
        }
        if (!isset($params['image_enable_page'])) {
            $params['image_enable_page'] = 1;
        }
        if (!isset($params['show_tag_box'])) {
            $params['show_tag_box'] = 0;
        }
        $from = isset($params['from']) ? esc_html($params['from']) : 0;
        $sort_direction = ' ' . $params['order_by'] . ' ';
        $options_row = $this->model->get_options_row_data();
        $placeholder = isset($options_row->placeholder) ? $options_row->placeholder : '';
        $play_icon = $options_row->play_icon;
        if ($from) {
            $params['gallery_id'] = $params['id'];
            $params['images_per_page'] = $params['count'];
            $params['sort_by'] = $params['show'] == 'random' ? 'RAND()' : 'order';
            if ($params['show'] == 'last') {
                $sort_direction = ' DESC ';
            } elseif ($params['show'] == 'first') {
                $sort_direction = ' ASC ';
            }
            $params['image_enable_page'] = 0;
            $params['image_title'] = $options_row->image_title_show_hover;
            $params['thumb_height'] = $params['height'];
            $params['thumb_width'] = $params['width'];
            $params['image_column_number'] = $params['count'];
            $params['popup_fullscreen'] = $options_row->popup_fullscreen;
            $params['popup_autoplay'] = $options_row->popup_autoplay;
            $params['popup_width'] = $options_row->popup_width;
            $params['popup_height'] = $options_row->popup_height;
            $params['popup_effect'] = $options_row->popup_type;
            $params['popup_enable_filmstrip'] = $options_row->popup_enable_filmstrip;
            $params['popup_filmstrip_height'] = $options_row->popup_filmstrip_height;
            $params['popup_enable_ctrl_btn'] = $options_row->popup_enable_ctrl_btn;
            $params['popup_enable_fullscreen'] = $options_row->popup_enable_fullscreen;
            $params['popup_enable_info'] = $options_row->popup_enable_info;
            $params['popup_info_always_show'] = $options_row->popup_info_always_show;
            $params['popup_info_full_width'] = $options_row->popup_info_full_width;
            $params['popup_hit_counter'] = $options_row->popup_hit_counter;
            $params['popup_enable_rate'] = $options_row->popup_enable_rate;
            $params['popup_interval'] = $options_row->popup_interval;
            $params['popup_enable_comment'] = $options_row->popup_enable_comment;
            $params['popup_enable_facebook'] = $options_row->popup_enable_facebook;
            $params['popup_enable_twitter'] = $options_row->popup_enable_twitter;
            $params['popup_enable_google'] = $options_row->popup_enable_google;
            $params['popup_enable_pinterest'] = $options_row->popup_enable_pinterest;
            $params['popup_enable_tumblr'] = $options_row->popup_enable_tumblr;
            $params['watermark_type'] = $options_row->watermark_type;
            $params['watermark_link'] = urlencode($options_row->watermark_link);
            $params['watermark_opacity'] = $options_row->watermark_opacity;
            $params['watermark_position'] = $options_row->watermark_position;
            $params['watermark_text'] = $options_row->watermark_text;
            $params['watermark_font_size'] = $options_row->watermark_font_size;
            $params['watermark_font'] = $options_row->watermark_font;
            $params['watermark_color'] = $options_row->watermark_color;
            $params['watermark_url'] = urlencode($options_row->watermark_url);
            $params['watermark_width'] = $options_row->watermark_width;
            $params['watermark_height'] = $options_row->watermark_height;
            $params['thumb_click_action'] = $options_row->thumb_click_action;
            $params['thumb_link_target'] = $options_row->thumb_link_target;
        }
        if (isset($_POST['sortImagesByValue_' . $bwg])) {
            $sort_by = esc_html($_POST['sortImagesByValue_' . $bwg]);
            if ($sort_by == 'random') {
                $params['sort_by'] = 'RAND()';
            } else {
                if ($sort_by == 'default') {
                    $params['sort_by'] = $params['sort_by'];
                } else {
                    $params['sort_by'] = $sort_by;
                }
            }
        }
        $theme_row = $this->model->get_theme_row_data($params['theme_id']);
        if (!$theme_row) {
            echo WDWLibrary::message(__('There is no theme selected or the theme was deleted.', 'bwg'), 'error');
            return;
        }
        if (isset($params['type'])) {
            $type = $params['type'];
        } else {
            $type = "";
        }
        $gallery_row = $this->model->get_gallery_row_data($params['gallery_id']);
        if (!$gallery_row && $type == '') {
            echo WDWLibrary::message(__('There is no gallery selected or the gallery was deleted.', 'bwg'), 'error');
            return;
        }
        $params['load_more_image_count'] = isset($params['load_more_image_count']) && $params['image_enable_page'] == 2 ? $params['load_more_image_count'] : $params['images_per_page'];
        $items_per_page = array('images_per_page' => $params['images_per_page'], 'load_more_image_count' => $params['load_more_image_count']);
        $image_rows = $this->model->get_image_rows_data($params, $bwg, $type, $sort_direction);
        $images_count = count($image_rows);
        if (!$image_rows) {
            echo WDWLibrary::message(__('There are no images in this gallery.', 'bwg'), 'error');
        }
        if ($params['image_enable_page'] && $params['images_per_page']) {
            $page_nav = $this->model->page_nav($params['gallery_id'], $bwg, $type);
        }
        $rgb_page_nav_font_color = WDWLibrary::spider_hex2rgb($theme_row->page_nav_font_color);
        $rgb_thumbs_bg_color = WDWLibrary::spider_hex2rgb($theme_row->thumbs_bg_color);
        $tags_rows = $this->model->get_tags_rows_data($params['gallery_id']);
        ?>
    <style>
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_standart_thumbnails_<?php 
        echo $bwg;
        ?>
 * {
        -moz-box-sizing: border-box;
        box-sizing: border-box;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_standart_thumb_spun1_<?php 
        echo $bwg;
        ?>
 {
        -moz-box-sizing: content-box;
        box-sizing: content-box;
        background-color: #<?php 
        echo $theme_row->thumb_bg_color;
        ?>
;
        display: inline-block;
        height: <?php 
        echo $params['thumb_height'];
        ?>
px;
        margin: <?php 
        echo $theme_row->thumb_margin;
        ?>
px;
        padding: <?php 
        echo $theme_row->thumb_padding;
        ?>
px;
        opacity: <?php 
        echo number_format($theme_row->thumb_transparent / 100, 2, ".", "");
        ?>
;
        filter: Alpha(opacity=<?php 
        echo $theme_row->thumb_transparent;
        ?>
);
        text-align: center;
        vertical-align: middle;
        <?php 
        echo $theme_row->thumb_transition ? 'transition: all 0.3s ease 0s;-webkit-transition: all 0.3s ease 0s;' : '';
        ?>
        width: <?php 
        echo $params['thumb_width'];
        ?>
px;
        z-index: 100;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_standart_thumb_spun1_<?php 
        echo $bwg;
        ?>
:hover {
        -ms-transform: <?php 
        echo $theme_row->thumb_hover_effect;
        ?>
(<?php 
        echo $theme_row->thumb_hover_effect_value;
        ?>
);
        -webkit-transform: <?php 
        echo $theme_row->thumb_hover_effect;
        ?>
(<?php 
        echo $theme_row->thumb_hover_effect_value;
        ?>
);
        backface-visibility: hidden;
        -webkit-backface-visibility: hidden;
        -moz-backface-visibility: hidden;
        -ms-backface-visibility: hidden;
        opacity: 1;
        filter: Alpha(opacity=100);
        transform: <?php 
        echo $theme_row->thumb_hover_effect;
        ?>
(<?php 
        echo $theme_row->thumb_hover_effect_value;
        ?>
);
        z-index: 102;
        position: relative;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_standart_thumb_spun2_<?php 
        echo $bwg;
        ?>
 {
        border: <?php 
        echo $theme_row->thumb_border_width;
        ?>
px <?php 
        echo $theme_row->thumb_border_style;
        ?>
 #<?php 
        echo $theme_row->thumb_border_color;
        ?>
;
        border-radius: <?php 
        echo $theme_row->thumb_border_radius;
        ?>
;
        box-shadow: <?php 
        echo $theme_row->thumb_box_shadow;
        ?>
;
        display: inline-block;
        height: <?php 
        echo $params['thumb_height'];
        ?>
px;
        overflow: hidden;
        width: <?php 
        echo $params['thumb_width'];
        ?>
px;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_standart_thumbnails_<?php 
        echo $bwg;
        ?>
 {
        background-color: rgba(<?php 
        echo $rgb_thumbs_bg_color['red'];
        ?>
, <?php 
        echo $rgb_thumbs_bg_color['green'];
        ?>
, <?php 
        echo $rgb_thumbs_bg_color['blue'];
        ?>
, <?php 
        echo number_format($theme_row->thumb_bg_transparent / 100, 2, ".", "");
        ?>
);
        display: inline-block;
        font-size: 0;
        max-width: <?php 
        echo $params['image_column_number'] * ($params['thumb_width'] + 2 * (2 + $theme_row->thumb_margin + $theme_row->thumb_padding + $theme_row->thumb_border_width));
        ?>
px;
        text-align: <?php 
        echo $theme_row->thumb_align;
        ?>
;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_standart_thumb_<?php 
        echo $bwg;
        ?>
 {
        display: inline-block;
        text-align: center;
      }
      <?php 
        if ($params['image_title'] == 'show') {
            /* Show image title at the bottom.*/
            ?>
        #bwg_container1_<?php 
            echo $bwg;
            ?>
 #bwg_container2_<?php 
            echo $bwg;
            ?>
 .bwg_title_spun1_<?php 
            echo $bwg;
            ?>
 {
          display: block;
          margin: 0 auto;
          opacity: 1;
          filter: Alpha(opacity=100);
          text-align: center;
          width: <?php 
            echo $params['thumb_width'];
            ?>
px;
        }
        <?php 
        } elseif ($params['image_title'] == 'hover') {
            /* Show image title on hover.*/
            ?>
        #bwg_container1_<?php 
            echo $bwg;
            ?>
 #bwg_container2_<?php 
            echo $bwg;
            ?>
 .bwg_title_spun1_<?php 
            echo $bwg;
            ?>
 {
          display: table;
          height: inherit;
          left: -3000px;
          opacity: 0;
          filter: Alpha(opacity=0);
          position: absolute;
          top: 0px;
          width: inherit;
        }
        <?php 
        }
        ?>
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_standart_thumb_spun1_<?php 
        echo $bwg;
        ?>
:hover .bwg_title_spun1_<?php 
        echo $bwg;
        ?>
 {
        left: <?php 
        echo $theme_row->thumb_padding;
        ?>
px;
        top: <?php 
        echo $theme_row->thumb_padding;
        ?>
px;
        opacity: 1;
        filter: Alpha(opacity=100);
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_title_spun2_<?php 
        echo $bwg;
        ?>
 {
        color: #<?php 
        echo $theme_row->thumb_title_font_color;
        ?>
;
        display: table-cell;
        font-family: <?php 
        echo $theme_row->thumb_title_font_style;
        ?>
;
        font-size: <?php 
        echo $theme_row->thumb_title_font_size;
        ?>
px;
        font-weight: <?php 
        echo $theme_row->thumb_title_font_weight;
        ?>
;
        height: inherit;
        padding: <?php 
        echo $theme_row->thumb_title_margin;
        ?>
;
        text-shadow: <?php 
        echo $theme_row->thumb_title_shadow;
        ?>
;
        vertical-align: middle;
        width: inherit;
        word-wrap: break-word;
      }
      /*pagination styles*/
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .tablenav-pages_<?php 
        echo $bwg;
        ?>
 {
        text-align: <?php 
        echo $theme_row->page_nav_align;
        ?>
;
        font-size: <?php 
        echo $theme_row->page_nav_font_size;
        ?>
px;
        font-family: <?php 
        echo $theme_row->page_nav_font_style;
        ?>
;
        font-weight: <?php 
        echo $theme_row->page_nav_font_weight;
        ?>
;
        color: #<?php 
        echo $theme_row->page_nav_font_color;
        ?>
;
        margin: 6px 0 4px;
        display: block;
        height: 30px;
        line-height: 30px;
      }
      @media only screen and (max-width : 320px) {
        #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .displaying-num_<?php 
        echo $bwg;
        ?>
 {
          display: none;
        }
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .displaying-num_<?php 
        echo $bwg;
        ?>
 {
        font-size: <?php 
        echo $theme_row->page_nav_font_size;
        ?>
px;
        font-family: <?php 
        echo $theme_row->page_nav_font_style;
        ?>
;
        font-weight: <?php 
        echo $theme_row->page_nav_font_weight;
        ?>
;
        color: #<?php 
        echo $theme_row->page_nav_font_color;
        ?>
;
        margin-right: 10px;
        vertical-align: middle;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .paging-input_<?php 
        echo $bwg;
        ?>
 {
        font-size: <?php 
        echo $theme_row->page_nav_font_size;
        ?>
px;
        font-family: <?php 
        echo $theme_row->page_nav_font_style;
        ?>
;
        font-weight: <?php 
        echo $theme_row->page_nav_font_weight;
        ?>
;
        color: #<?php 
        echo $theme_row->page_nav_font_color;
        ?>
;
        vertical-align: middle;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .tablenav-pages_<?php 
        echo $bwg;
        ?>
 a.disabled,
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .tablenav-pages_<?php 
        echo $bwg;
        ?>
 a.disabled:hover,
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .tablenav-pages_<?php 
        echo $bwg;
        ?>
 a.disabled:focus {
        cursor: default;
        color: rgba(<?php 
        echo $rgb_page_nav_font_color['red'];
        ?>
, <?php 
        echo $rgb_page_nav_font_color['green'];
        ?>
, <?php 
        echo $rgb_page_nav_font_color['blue'];
        ?>
, 0.5);
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .tablenav-pages_<?php 
        echo $bwg;
        ?>
 a {
        cursor: pointer;
        font-size: <?php 
        echo $theme_row->page_nav_font_size;
        ?>
px;
        font-family: <?php 
        echo $theme_row->page_nav_font_style;
        ?>
;
        font-weight: <?php 
        echo $theme_row->page_nav_font_weight;
        ?>
;
        color: #<?php 
        echo $theme_row->page_nav_font_color;
        ?>
;
        text-decoration: none;
        padding: <?php 
        echo $theme_row->page_nav_padding;
        ?>
;
        margin: <?php 
        echo $theme_row->page_nav_margin;
        ?>
;
        border-radius: <?php 
        echo $theme_row->page_nav_border_radius;
        ?>
;
        border-style: <?php 
        echo $theme_row->page_nav_border_style;
        ?>
;
        border-width: <?php 
        echo $theme_row->page_nav_border_width;
        ?>
px;
        border-color: #<?php 
        echo $theme_row->page_nav_border_color;
        ?>
;
        background-color: #<?php 
        echo $theme_row->page_nav_button_bg_color;
        ?>
;
        opacity: <?php 
        echo number_format($theme_row->page_nav_button_bg_transparent / 100, 2, ".", "");
        ?>
;
        filter: Alpha(opacity=<?php 
        echo $theme_row->page_nav_button_bg_transparent;
        ?>
);
        box-shadow: <?php 
        echo $theme_row->page_nav_box_shadow;
        ?>
;
        <?php 
        echo $theme_row->page_nav_button_transition ? 'transition: all 0.3s ease 0s;-webkit-transition: all 0.3s ease 0s;' : '';
        ?>
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_back_<?php 
        echo $bwg;
        ?>
 {
        background-color: rgba(0, 0, 0, 0);
        color: #<?php 
        echo $theme_row->album_compact_back_font_color;
        ?>
 !important;
        cursor: pointer;
        display: block;
        font-family: <?php 
        echo $theme_row->album_compact_back_font_style;
        ?>
;
        font-size: <?php 
        echo $theme_row->album_compact_back_font_size;
        ?>
px;
        font-weight: <?php 
        echo $theme_row->album_compact_back_font_weight;
        ?>
;
        text-decoration: none;
        padding: <?php 
        echo $theme_row->album_compact_back_padding;
        ?>
;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 #spider_popup_overlay_<?php 
        echo $bwg;
        ?>
 {
        background-color: #<?php 
        echo $theme_row->lightbox_overlay_bg_color;
        ?>
;
        opacity: <?php 
        echo number_format($theme_row->lightbox_overlay_bg_transparent / 100, 2, ".", "");
        ?>
;
        filter: Alpha(opacity=<?php 
        echo $theme_row->lightbox_overlay_bg_transparent;
        ?>
);
      }
     .bwg_play_icon_spun_<?php 
        echo $bwg;
        ?>
 {
        width: inherit;
        height: inherit;
        display: table;
        position: absolute;
      }	 
     .bwg_play_icon_<?php 
        echo $bwg;
        ?>
 {
        color: #<?php 
        echo $theme_row->thumb_title_font_color;
        ?>
;
        font-size: <?php 
        echo 2 * $theme_row->thumb_title_font_size;
        ?>
px;
        vertical-align: middle;
        display: table-cell !important;
        z-index: 1;
        text-align: center;
        margin: 0 auto;
      }
    </style>
    <div id="bwg_container1_<?php 
        echo $bwg;
        ?>
">
      <div id="bwg_container2_<?php 
        echo $bwg;
        ?>
">
        <form id="gal_front_form_<?php 
        echo $bwg;
        ?>
" method="post" action="#">
          <?php 
        if ($params['show_search_box']) {
            WDWLibrary::ajax_html_frontend_search_box('gal_front_form_' . $bwg, $bwg, 'bwg_standart_thumbnails_' . $bwg, $images_count, $params['search_box_width'], $placeholder);
        }
        if (isset($params['show_sort_images']) && $params['show_sort_images']) {
            WDWLibrary::ajax_html_frontend_sort_box('gal_front_form_' . $bwg, $bwg, 'bwg_standart_thumbnails_' . $bwg, $params['sort_by'], $params['search_box_width']);
        }
        if (isset($params['show_tag_box']) && $params['show_tag_box']) {
            WDWLibrary::ajax_html_frontend_search_tags('gal_front_form_' . $bwg, $bwg, 'bwg_standart_thumbnails_' . $bwg, $images_count, $tags_rows);
        }
        ?>
          <div class="bwg_back_<?php 
        echo $bwg;
        ?>
"><?php 
        echo $options_row->showthumbs_name ? $gallery_row->name : '';
        ?>
</div>
          <div style="background-color:rgba(0, 0, 0, 0); text-align: <?php 
        echo $theme_row->thumb_align;
        ?>
; width:100%; position: relative;">
            <div id="ajax_loading_<?php 
        echo $bwg;
        ?>
" style="position:absolute;width: 100%; z-index: 115; text-align: center; height: 100%; vertical-align: middle; display:none;">
              <div style="display: table; vertical-align: middle; width: 100%; height: 100%; background-color: #FFFFFF; opacity: 0.7; filter: Alpha(opacity=70);">
                <div style="display: table-cell; text-align: center; position: relative; vertical-align: middle;" >
                  <div id="loading_div_<?php 
        echo $bwg;
        ?>
" class="spider_ajax_loading" style="display: inline-block; text-align:center; position:relative; vertical-align:middle; background-image:url(<?php 
        echo WD_BWG_URL . '/images/ajax_loader.png';
        ?>
); float: none; width:50px;height:50px;background-size:50px 50px;">
                  </div>
                </div>
              </div>
            </div>
            <?php 
        if ($params['image_enable_page'] && $params['images_per_page'] && $theme_row->page_nav_position == 'top') {
            WDWLibrary::ajax_html_frontend_page_nav($theme_row, $page_nav['total'], $page_nav['limit'], 'gal_front_form_' . $bwg, $items_per_page, $bwg, 'bwg_standart_thumbnails_' . $bwg, 0, 'album', $options_row->enable_seo, $params['image_enable_page']);
        }
        ?>
            <div id="bwg_standart_thumbnails_<?php 
        echo $bwg;
        ?>
" class="bwg_standart_thumbnails_<?php 
        echo $bwg;
        ?>
">
              <?php 
        foreach ($image_rows as $image_row) {
            $is_embed = preg_match('/EMBED/', $image_row->filetype) == 1 ? true : false;
            $is_embed_video = preg_match('/VIDEO/', $image_row->filetype) == 1 ? true : false;
            if (!$is_embed) {
                list($image_thumb_width, $image_thumb_height) = getimagesize(htmlspecialchars_decode(ABSPATH . $WD_BWG_UPLOAD_DIR . $image_row->thumb_url, ENT_COMPAT | ENT_QUOTES));
            } else {
                $image_thumb_width = $params['thumb_width'];
                if ($image_row->resolution != '') {
                    $resolution_arr = explode(" ", $image_row->resolution);
                    $resolution_w = intval($resolution_arr[0]);
                    $resolution_h = intval($resolution_arr[2]);
                    if ($resolution_w != 0 && $resolution_h != 0) {
                        $scale = $scale = max($params['thumb_width'] / $resolution_w, $params['thumb_height'] / $resolution_h);
                        $image_thumb_width = $resolution_w * $scale;
                        $image_thumb_height = $resolution_h * $scale;
                    } else {
                        $image_thumb_width = $params['thumb_width'];
                        $image_thumb_height = $params['thumb_height'];
                    }
                } else {
                    $image_thumb_width = $params['thumb_width'];
                    $image_thumb_height = $params['thumb_height'];
                }
            }
            $scale = max($params['thumb_width'] / $image_thumb_width, $params['thumb_height'] / $image_thumb_height);
            $image_thumb_width *= $scale;
            $image_thumb_height *= $scale;
            $thumb_left = ($params['thumb_width'] - $image_thumb_width) / 2;
            $thumb_top = ($params['thumb_height'] - $image_thumb_height) / 2;
            ?>
                <a <?php 
            echo $params['thumb_click_action'] == 'open_lightbox' ? ' class="bwg_lightbox_' . $bwg . '"' . ($options_row->enable_seo ? ' href="' . ($is_embed ? $image_row->thumb_url : site_url() . '/' . $WD_BWG_UPLOAD_DIR . $image_row->image_url) . '"' : '') . ' data-image-id="' . $image_row->id . '"' : ($params['thumb_click_action'] == 'redirect_to_url' && $image_row->redirect_url ? 'href="' . $image_row->redirect_url . '" target="' . ($params['thumb_link_target'] ? '_blank' : '') . '"' : '');
            ?>
>
                  <span class="bwg_standart_thumb_<?php 
            echo $bwg;
            ?>
">
                    <?php 
            if ($params['image_title'] == 'show' and $theme_row->thumb_title_pos == 'top') {
                ?>
                      <span class="bwg_title_spun1_<?php 
                echo $bwg;
                ?>
">
                        <span class="bwg_title_spun2_<?php 
                echo $bwg;
                ?>
">
                          <?php 
                echo $image_row->alt;
                ?>
                        </span>
                      </span>
                      <?php 
            }
            ?>
                    <span class="bwg_standart_thumb_spun1_<?php 
            echo $bwg;
            ?>
">
                      <span class="bwg_standart_thumb_spun2_<?php 
            echo $bwg;
            ?>
">
                        <?php 
            if ($play_icon && $is_embed_video) {
                ?>
                        <span class="bwg_play_icon_spun_<?php 
                echo $bwg;
                ?>
">
                           <i title="<?php 
                echo __('Play', 'bwg');
                ?>
"  class="fa fa-play bwg_play_icon_<?php 
                echo $bwg;
                ?>
"></i>
                        </span>
                          <?php 
            }
            if ($params['image_title'] == 'hover') {
                ?>
                          <span class="bwg_title_spun1_<?php 
                echo $bwg;
                ?>
">
                            <span class="bwg_title_spun2_<?php 
                echo $bwg;
                ?>
">
                              <?php 
                echo $image_row->alt;
                ?>
                            </span>
                          </span>
                          <?php 
            }
            ?>
                        <img class="bwg_standart_thumb_img_<?php 
            echo $bwg;
            ?>
 bwg_img_clear bwg_img_custom" style="width:<?php 
            echo $image_thumb_width;
            ?>
px; height:<?php 
            echo $image_thumb_height;
            ?>
px; margin-left: <?php 
            echo $thumb_left;
            ?>
px; margin-top: <?php 
            echo $thumb_top;
            ?>
px;" id="<?php 
            echo $image_row->id;
            ?>
" src="<?php 
            echo ($is_embed ? "" : site_url() . '/' . $WD_BWG_UPLOAD_DIR) . $image_row->thumb_url;
            ?>
" alt="<?php 
            echo $image_row->alt;
            ?>
" />
                      </span>
                    </span>
                    <?php 
            if ($params['image_title'] == 'show' and $theme_row->thumb_title_pos == 'bottom') {
                ?>
                      <span class="bwg_title_spun1_<?php 
                echo $bwg;
                ?>
">
                        <span class="bwg_title_spun2_<?php 
                echo $bwg;
                ?>
">
                          <?php 
                echo $image_row->alt;
                ?>
                        </span>
                      </span>
                      <?php 
            }
            ?>
                  </span>
                </a>
                <?php 
        }
        ?>
            </div>
            <?php 
        if ($params['image_enable_page'] && $params['images_per_page'] && $theme_row->page_nav_position == 'bottom') {
            WDWLibrary::ajax_html_frontend_page_nav($theme_row, $page_nav['total'], $page_nav['limit'], 'gal_front_form_' . $bwg, $items_per_page, $bwg, 'bwg_standart_thumbnails_' . $bwg, 0, 'album', $options_row->enable_seo, $params['image_enable_page']);
        }
        ?>
          </div>
        </form>
        <div id="spider_popup_loading_<?php 
        echo $bwg;
        ?>
" class="spider_popup_loading"></div>
        <div id="spider_popup_overlay_<?php 
        echo $bwg;
        ?>
" class="spider_popup_overlay" onclick="spider_destroypopup(1000)"></div>
      </div>
    </div>
    <script>
      <?php 
        $params_array = array('tag_id' => isset($params['type']) ? $params['gallery_id'] : 0, 'action' => 'GalleryBox', 'current_view' => $bwg, 'gallery_id' => $params['gallery_id'], 'theme_id' => $params['theme_id'], 'thumb_width' => $params['thumb_width'], 'thumb_height' => $params['thumb_height'], 'open_with_fullscreen' => $params['popup_fullscreen'], 'open_with_autoplay' => $params['popup_autoplay'], 'image_width' => $params['popup_width'], 'image_height' => $params['popup_height'], 'image_effect' => $params['popup_effect'], 'wd_sor' => isset($params['type']) ? 'date' : ($params['sort_by'] == 'RAND()' ? 'order' : $params['sort_by']), 'wd_ord' => $sort_direction, 'enable_image_filmstrip' => $params['popup_enable_filmstrip'], 'image_filmstrip_height' => $params['popup_filmstrip_height'], 'enable_image_ctrl_btn' => $params['popup_enable_ctrl_btn'], 'enable_image_fullscreen' => $params['popup_enable_fullscreen'], 'popup_enable_info' => $params['popup_enable_info'], 'popup_info_always_show' => $params['popup_info_always_show'], 'popup_info_full_width' => $params['popup_info_full_width'], 'popup_hit_counter' => $params['popup_hit_counter'], 'popup_enable_rate' => $params['popup_enable_rate'], 'slideshow_interval' => $params['popup_interval'], 'enable_comment_social' => $params['popup_enable_comment'], 'enable_image_facebook' => $params['popup_enable_facebook'], 'enable_image_twitter' => $params['popup_enable_twitter'], 'enable_image_google' => $params['popup_enable_google'], 'enable_image_pinterest' => $params['popup_enable_pinterest'], 'enable_image_tumblr' => $params['popup_enable_tumblr'], 'watermark_type' => $params['watermark_type'], 'current_url' => urlencode($current_url));
        if ($params['watermark_type'] != 'none') {
            $params_array['watermark_link'] = urlencode($params['watermark_link']);
            $params_array['watermark_opacity'] = $params['watermark_opacity'];
            $params_array['watermark_position'] = $params['watermark_position'];
        }
        if ($params['watermark_type'] == 'text') {
            $params_array['watermark_text'] = $params['watermark_text'];
            $params_array['watermark_font_size'] = $params['watermark_font_size'];
            $params_array['watermark_font'] = $params['watermark_font'];
            $params_array['watermark_color'] = $params['watermark_color'];
        } elseif ($params['watermark_type'] == 'image') {
            $params_array['watermark_url'] = urlencode($params['watermark_url']);
            $params_array['watermark_width'] = $params['watermark_width'];
            $params_array['watermark_height'] = $params['watermark_height'];
        }
        ?>
      function bwg_gallery_box_<?php 
        echo $bwg;
        ?>
(image_id) {
        var filterTags = jQuery("#bwg_tags_id_bwg_standart_thumbnails_<?php 
        echo $bwg;
        ?>
" ).val() ? jQuery("#bwg_tags_id_bwg_standart_thumbnails_<?php 
        echo $bwg;
        ?>
" ).val() : 0;
        var filtersearchname = jQuery("#bwg_search_input_<?php 
        echo $bwg;
        ?>
" ).val() ? jQuery("#bwg_search_input_<?php 
        echo $bwg;
        ?>
" ).val() : '';
        spider_createpopup('<?php 
        echo addslashes(add_query_arg($params_array, admin_url('admin-ajax.php')));
        ?>
&image_id=' + image_id + "&filter_tag_<?php 
        echo $bwg;
        ?>
=" +  filterTags + "&filter_search_name_<?php 
        echo $bwg;
        ?>
=" +  filtersearchname, '<?php 
        echo $bwg;
        ?>
', '<?php 
        echo $params['popup_width'];
        ?>
', '<?php 
        echo $params['popup_height'];
        ?>
', 1, 'testpopup', 5, "<?php 
        echo $theme_row->lightbox_ctrl_btn_pos;
        ?>
");
      }
      function bwg_document_ready_<?php 
        echo $bwg;
        ?>
() {
        var bwg_touch_flag = false;
        jQuery(".bwg_lightbox_<?php 
        echo $bwg;
        ?>
").on("click", function () {
          if (!bwg_touch_flag) {
            bwg_touch_flag = true;
            setTimeout(function(){ bwg_touch_flag = false; }, 100);
            bwg_gallery_box_<?php 
        echo $bwg;
        ?>
(jQuery(this).attr("data-image-id"));
            return false;
          }
        });
      }
      jQuery(document).ready(function () {
        bwg_document_ready_<?php 
        echo $bwg;
        ?>
();
      });
    </script>
    <?php 
        if ($from_shortcode) {
            return;
        } else {
            die;
        }
    }
    public function display($params, $from_shortcode = 0, $bwg = 0)
    {
        global $wp;
        $current_url = $wp->query_string;
        global $WD_BWG_UPLOAD_DIR;
        require_once WD_BWG_DIR . '/framework/WDWLibrary.php';
        require_once WD_BWG_DIR . '/framework/WDWLibraryEmbed.php';
        $theme_row = $this->model->get_theme_row_data($params['theme_id']);
        if (!isset($params['order_by'])) {
            $order_by = 'asc';
        } else {
            $order_by = $params['order_by'];
        }
        if (!isset($params['popup_enable_pinterest'])) {
            $params['popup_enable_pinterest'] = 0;
        }
        if (!isset($params['popup_enable_tumblr'])) {
            $params['popup_enable_tumblr'] = 0;
        }
        if (!isset($params['show_search_box'])) {
            $params['show_search_box'] = 0;
        }
        if (!isset($params['search_box_width'])) {
            $params['search_box_width'] = 180;
        }
        if (!isset($params['popup_enable_info'])) {
            $params['popup_enable_info'] = 1;
        }
        if (!isset($params['popup_info_always_show'])) {
            $params['popup_info_always_show'] = 0;
        }
        if (!isset($params['popup_info_full_width'])) {
            $params['popup_info_full_width'] = 0;
        }
        if (!isset($params['popup_enable_rate'])) {
            $params['popup_enable_rate'] = 0;
        }
        if (!isset($params['thumb_click_action']) || $params['thumb_click_action'] == 'undefined') {
            $params['thumb_click_action'] = 'open_lightbox';
        }
        if (!isset($params['thumb_link_target'])) {
            $params['thumb_link_target'] = 1;
        }
        if (!isset($params['popup_hit_counter'])) {
            $params['popup_hit_counter'] = 0;
        }
        if (!$theme_row) {
            echo WDWLibrary::message(__('There is no theme selected or the theme was deleted.', 'bwg'), 'error');
            return;
        }
        $gallery_row = $this->model->get_gallery_row_data($params['gallery_id']);
        if (!$gallery_row) {
            echo WDWLibrary::message(__('There is no gallery selected or the gallery was deleted.', 'bwg'), 'error');
            return;
        }
        $image_rows = $this->model->get_image_rows_data($params['gallery_id'], 1, $params['sort_by'], $order_by, $bwg);
        $images_count = count($image_rows);
        if (!$image_rows) {
            echo WDWLibrary::message(__('There are no images in this gallery.', 'bwg'), 'error');
        }
        $page_nav = $this->model->page_nav($params['gallery_id'], 1, $bwg);
        $rgb_page_nav_font_color = WDWLibrary::spider_hex2rgb($theme_row->page_nav_font_color);
        $image_browser_images_conteiner = WDWLibrary::spider_hex2rgb($theme_row->image_browser_full_bg_color);
        $bwg_image_browser_image = WDWLibrary::spider_hex2rgb($theme_row->image_browser_bg_color);
        $image_title = $params['image_browser_title_enable'];
        $enable_image_description = $params['image_browser_description_enable'];
        $option_row = $this->model->get_option_row_data();
        $image_right_click = $option_row->image_right_click;
        if (!isset($params['popup_fullscreen'])) {
            $params['popup_fullscreen'] = 0;
        }
        if (!isset($params['popup_autoplay'])) {
            $params['popup_autoplay'] = 0;
        }
        $params_array = array('action' => 'GalleryBox', 'current_view' => $bwg, 'gallery_id' => $params['gallery_id'], 'theme_id' => $params['theme_id'], 'open_with_fullscreen' => $params['popup_fullscreen'], 'open_with_autoplay' => $params['popup_autoplay'], 'image_width' => $params['popup_width'], 'image_height' => $params['popup_height'], 'image_effect' => $params['popup_effect'], 'wd_sor' => $params['sort_by'], 'wd_ord' => $order_by, 'enable_image_filmstrip' => $params['popup_enable_filmstrip'], 'image_filmstrip_height' => $params['popup_filmstrip_height'], 'enable_image_ctrl_btn' => $params['popup_enable_ctrl_btn'], 'enable_image_fullscreen' => $params['popup_enable_fullscreen'], 'popup_enable_info' => $params['popup_enable_info'], 'popup_info_always_show' => $params['popup_info_always_show'], 'popup_info_full_width' => $params['popup_info_full_width'], 'popup_hit_counter' => $params['popup_hit_counter'], 'popup_enable_rate' => $params['popup_enable_rate'], 'slideshow_interval' => $params['popup_interval'], 'enable_comment_social' => $params['popup_enable_comment'], 'enable_image_facebook' => $params['popup_enable_facebook'], 'enable_image_twitter' => $params['popup_enable_twitter'], 'enable_image_google' => $params['popup_enable_google'], 'enable_image_pinterest' => $params['popup_enable_pinterest'], 'enable_image_tumblr' => $params['popup_enable_tumblr'], 'watermark_type' => $params['watermark_type'], 'current_url' => $current_url);
        $items_per_page = array('images_per_page' => 1, 'load_more_image_count' => 1);
        if ($params['watermark_type'] == 'none') {
            $params_array['watermark_font'] = '';
            $params_array['watermark_color'] = '';
            $params_array['watermark_font_size'] = '';
            $params_array['watermark_opacity'] = '';
            $text_align = '';
            $vertical_align = '';
            $params_array['watermark_width'] = '';
            $show_watermark = FALSE;
        }
        if ($params['watermark_type'] != 'none') {
            $params_array['watermark_link'] = urlencode($params['watermark_link']);
            $params_array['watermark_opacity'] = $params['watermark_opacity'];
            $params_array['watermark_position'] = $params['watermark_position'] != 'undefined' ? $params['watermark_position'] : 'top-center';
            $position = explode('-', $params_array['watermark_position']);
            $vertical_align = $position[0];
            $text_align = $position[1];
        }
        if ($params['watermark_type'] == 'text') {
            $show_watermark = TRUE;
            $watermark_text_image = TRUE;
            $params_array['watermark_text'] = $params['watermark_text'];
            $params_array['watermark_font_size'] = $params['watermark_font_size'];
            $params_array['watermark_font'] = $params['watermark_font'];
            $params_array['watermark_color'] = $params['watermark_color'];
            $params_array['watermark_width'] = '';
            $watermark_image_or_text = $params_array['watermark_text'];
            $watermark_a = 'bwg_watermark_text_' . $bwg;
            $watermark_div = 'class="bwg_image_browser_watermark_text_' . $bwg . '"';
        } elseif ($params['watermark_type'] == 'image') {
            $show_watermark = TRUE;
            $watermark_text_image = FALSE;
            $params_array['watermark_url'] = urlencode($params['watermark_url']);
            $params_array['watermark_width'] = $params['watermark_width'];
            $params_array['watermark_height'] = $params['watermark_height'];
            $watermark_image_or_text = '<img class="bwg_image_browser_watermark_img_' . $bwg . '" src="' . $params_array['watermark_url'] . '" />';
            $watermark_a = '';
            $watermark_div = 'class="bwg_image_browser_watermark_' . $bwg . '"';
            $params_array['watermark_font'] = '';
            $params_array['watermark_color'] = '';
            $params_array['watermark_font_size'] = '';
        }
        ?>
    <style>
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .image_browser_images_conteiner_<?php 
        echo $bwg;
        ?>
 * {
        -moz-box-sizing: border-box;
        box-sizing: border-box;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .image_browser_images_conteiner_<?php 
        echo $bwg;
        ?>
{
				background-color: rgba(<?php 
        echo $image_browser_images_conteiner['red'];
        ?>
, <?php 
        echo $image_browser_images_conteiner['green'];
        ?>
, <?php 
        echo $image_browser_images_conteiner['blue'];
        ?>
, <?php 
        echo number_format($theme_row->image_browser_full_transparent / 100, 2, ".", "");
        ?>
);
				text-align: center;
				width: 100%;
				border-style: <?php 
        echo $theme_row->image_browser_full_border_style;
        ?>
;
				border-width: <?php 
        echo $theme_row->image_browser_full_border_width;
        ?>
px;
				border-color: #<?php 
        echo $theme_row->image_browser_full_border_color;
        ?>
;
				padding: <?php 
        echo $theme_row->image_browser_full_padding;
        ?>
;
				border-radius: <?php 
        echo $theme_row->image_browser_full_border_radius;
        ?>
;
				position:relative;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .image_browser_images_<?php 
        echo $bwg;
        ?>
 {
				display: inline-block;
				-moz-box-sizing: border-box;
				box-sizing: border-box;
				font-size: 0;
				text-align: center;
				max-width: 100%;
				width: <?php 
        echo $params['image_browser_width'];
        ?>
px;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .image_browser_image_buttons_conteiner_<?php 
        echo $bwg;
        ?>
 {
				text-align: <?php 
        echo $theme_row->image_browser_align;
        ?>
;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .image_browser_image_buttons_<?php 
        echo $bwg;
        ?>
 {
				display: inline-block;
				width:100%;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_image_browser_image_<?php 
        echo $bwg;
        ?>
 {
        background-color: rgba(<?php 
        echo $bwg_image_browser_image['red'];
        ?>
, <?php 
        echo $bwg_image_browser_image['green'];
        ?>
, <?php 
        echo $bwg_image_browser_image['blue'];
        ?>
, <?php 
        echo number_format($theme_row->image_browser_transparent / 100, 2, ".", "");
        ?>
);
				text-align: center;
				/*display: inline-block;*/
				vertical-align: middle;
				margin: <?php 
        echo $theme_row->image_browser_margin;
        ?>
;
				padding: <?php 
        echo $theme_row->image_browser_padding;
        ?>
;
				border-radius: <?php 
        echo $theme_row->image_browser_border_radius;
        ?>
;
				border: <?php 
        echo $theme_row->image_browser_border_width;
        ?>
px <?php 
        echo $theme_row->image_browser_border_style;
        ?>
 #<?php 
        echo $theme_row->image_browser_border_color;
        ?>
;
				box-shadow: <?php 
        echo $theme_row->image_browser_box_shadow;
        ?>
;
				/*z-index: 100;*/
				position: relative;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_image_alt_<?php 
        echo $bwg;
        ?>
{
				display: table;
				width: 100%;
				font-size: <?php 
        echo $theme_row->image_browser_img_font_size;
        ?>
px;
				font-family: <?php 
        echo $theme_row->image_browser_img_font_family;
        ?>
;
				color: #<?php 
        echo $theme_row->image_browser_img_font_color;
        ?>
;
				text-align:<?php 
        echo $theme_row->image_browser_image_description_align;
        ?>
;
				padding-left: 8px;
        word-break: break-word;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_image_browser_img_<?php 
        echo $bwg;
        ?>
 {
        padding: 0 !important;
				max-width: 100% !important;
				height: inherit !important;
				width: 100%;				
      }
      @media only screen and (max-width : 320px) {
				#bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .displaying-num_<?php 
        echo $bwg;
        ?>
 {
				  display: none;
				}
				#bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_image_alt_<?php 
        echo $bwg;
        ?>
 {
				  font-size: 10px !important;
				}
				#bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_watermark_text_<?php 
        echo $bwg;
        ?>
,
				#bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_watermark_text_<?php 
        echo $bwg;
        ?>
:hover {
				  font-size: 10px !important;
				  text-decoration: none;
				  margin: 4px;
				  font-family: <?php 
        echo $params_array['watermark_font'];
        ?>
;
				  color: #<?php 
        echo $params_array['watermark_color'];
        ?>
 !important;
				  opacity: <?php 
        echo number_format($params_array['watermark_opacity'] / 100, 2, ".", "");
        ?>
;
			  	filter: Alpha(opacity=<?php 
        echo $params_array['watermark_opacity'];
        ?>
);
          text-decoration: none;
				  position: relative;
				  z-index: 10141;
				}
				#bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_image_browser_image_description_<?php 
        echo $bwg;
        ?>
 {
          color: #<?php 
        echo $theme_row->image_browser_img_font_color;
        ?>
;
				  display: table;
				  width: 100%;
				  text-align: left;
				  font-size: 8px !important;
				  font-family: <?php 
        echo $theme_row->image_browser_img_font_family;
        ?>
;
				  padding: <?php 
        echo $theme_row->image_browser_image_description_padding;
        ?>
;
				  /*word-break: break-all;*/
				  border-style: <?php 
        echo $theme_row->image_browser_image_description_border_style;
        ?>
;
				  background-color: #<?php 
        echo $theme_row->image_browser_image_description_bg_color;
        ?>
;
				  border-radius: <?php 
        echo $theme_row->image_browser_image_description_border_radius;
        ?>
;
				  border-width: <?php 
        echo $theme_row->image_browser_image_description_border_width;
        ?>
px;
				}
        
				#bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .tablenav-pages_<?php 
        echo $bwg;
        ?>
 a {
				  font-size: 10px !important;
				}				
      }
      /*pagination styles*/
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .tablenav-pages_<?php 
        echo $bwg;
        ?>
 {
				text-align: <?php 
        echo $theme_row->page_nav_align;
        ?>
;
				font-size: <?php 
        echo $theme_row->page_nav_font_size;
        ?>
px;
				font-family: <?php 
        echo $theme_row->page_nav_font_style;
        ?>
;
				font-weight: <?php 
        echo $theme_row->page_nav_font_weight;
        ?>
;
				color: #<?php 
        echo $theme_row->page_nav_font_color;
        ?>
;
				margin: 6px 0 4px;
				display: block;
				height: 30px;
				line-height: 30px;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .displaying-num_<?php 
        echo $bwg;
        ?>
 {
				font-size: <?php 
        echo $theme_row->page_nav_font_size;
        ?>
px;
				font-family: <?php 
        echo $theme_row->page_nav_font_style;
        ?>
;
				font-weight: <?php 
        echo $theme_row->page_nav_font_weight;
        ?>
;
				color: #<?php 
        echo $theme_row->page_nav_font_color;
        ?>
;
				margin-right: 10px;
				vertical-align: middle;
				display: none;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .paging-input_<?php 
        echo $bwg;
        ?>
 {
				font-size: <?php 
        echo $theme_row->page_nav_font_size;
        ?>
px;
				font-family: <?php 
        echo $theme_row->page_nav_font_style;
        ?>
;
				font-weight: <?php 
        echo $theme_row->page_nav_font_weight;
        ?>
;
				color: #<?php 
        echo $theme_row->page_nav_font_color;
        ?>
;
				vertical-align: middle;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .tablenav-pages_<?php 
        echo $bwg;
        ?>
 a.disabled,
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .tablenav-pages_<?php 
        echo $bwg;
        ?>
 a.disabled:hover,
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .tablenav-pages_<?php 
        echo $bwg;
        ?>
 a.disabled:focus {
				cursor: default;
				color: rgba(<?php 
        echo $rgb_page_nav_font_color['red'];
        ?>
, <?php 
        echo $rgb_page_nav_font_color['green'];
        ?>
, <?php 
        echo $rgb_page_nav_font_color['blue'];
        ?>
, 0.5);
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .tablenav-pages_<?php 
        echo $bwg;
        ?>
 a.next-page:hover,
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .tablenav-pages_<?php 
        echo $bwg;
        ?>
 a.prev-page:hover {
        color: #000000;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .tablenav-pages_<?php 
        echo $bwg;
        ?>
 a {
				cursor: pointer;
				font-size: 15px;
				font-family: <?php 
        echo $theme_row->page_nav_font_style;
        ?>
;
				font-weight: <?php 
        echo $theme_row->page_nav_font_weight;
        ?>
;
				color: #<?php 
        echo $theme_row->page_nav_font_color;
        ?>
;
				text-decoration: none;
				padding: 0% 7%;
				margin: <?php 
        echo $theme_row->page_nav_margin;
        ?>
;
				border-radius: <?php 
        echo $theme_row->page_nav_border_radius;
        ?>
;
				border-style: none;
				border-width: <?php 
        echo $theme_row->page_nav_border_width;
        ?>
px;
				border-color: #<?php 
        echo $theme_row->page_nav_border_color;
        ?>
;
				background-color: #<?php 
        echo $theme_row->page_nav_button_bg_color;
        ?>
;
				opacity: <?php 
        echo number_format($theme_row->page_nav_button_bg_transparent / 100, 2, ".", "");
        ?>
;
				filter: Alpha(opacity=<?php 
        echo $theme_row->page_nav_button_bg_transparent;
        ?>
);
				<?php 
        echo $theme_row->page_nav_button_transition ? 'transition: all 0.3s ease 0s;-webkit-transition: all 0.3s ease 0s;' : '';
        ?>
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .tablenav-pages_<?php 
        echo $bwg;
        ?>
 .first-page,
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .tablenav-pages_<?php 
        echo $bwg;
        ?>
 .last-page {
        padding: 0% 7%; 		        
      }
	    #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .tablenav-pages_<?php 
        echo $bwg;
        ?>
 .next-page {
        margin: 0% 4% 0% 0%; 		        
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .tablenav-pages_<?php 
        echo $bwg;
        ?>
 .prev-page {
        margin: 0% 0% 0% 4%; 		        
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 #spider_popup_overlay_<?php 
        echo $bwg;
        ?>
 {
				background-color: #<?php 
        echo $theme_row->lightbox_overlay_bg_color;
        ?>
;
        opacity: <?php 
        echo number_format($theme_row->lightbox_overlay_bg_transparent / 100, 2, ".", "");
        ?>
;
        filter: Alpha(opacity=<?php 
        echo $theme_row->lightbox_overlay_bg_transparent;
        ?>
);
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_image_browser_image_desp_<?php 
        echo $bwg;
        ?>
 {
				display: table;
				clear: both;
				text-align: center;
        padding: <?php 
        echo $theme_row->image_browser_image_description_margin;
        ?>
;
				width: 100%;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_image_browser_image_description_<?php 
        echo $bwg;
        ?>
 {
        color: #<?php 
        echo $theme_row->image_browser_img_font_color;
        ?>
;
				display: table;
				width: 100%;
				text-align: left;
				font-size: <?php 
        echo $theme_row->image_browser_img_font_size;
        ?>
px;
				font-family: <?php 
        echo $theme_row->image_browser_img_font_family;
        ?>
;
				padding: <?php 
        echo $theme_row->image_browser_image_description_padding;
        ?>
;
				word-break: break-word;
				border-style: <?php 
        echo $theme_row->image_browser_image_description_border_style;
        ?>
;
				background-color: #<?php 
        echo $theme_row->image_browser_image_description_bg_color;
        ?>
;
				border-radius: <?php 
        echo $theme_row->image_browser_image_description_border_radius;
        ?>
;
				border-width: <?php 
        echo $theme_row->image_browser_image_description_border_width;
        ?>
px;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_image_browser_image_alt_<?php 
        echo $bwg;
        ?>
 {
      	display:table;
        clear: both;
        text-align: center;
        padding: 8px;
        width: 100%;
      }
      /*watermark*/
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_watermark_text_<?php 
        echo $bwg;
        ?>
,
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_watermark_text_<?php 
        echo $bwg;
        ?>
:hover {
				text-decoration: none;
				margin: 4px;
				font-size: <?php 
        echo $params_array['watermark_font_size'];
        ?>
px;
				font-family: <?php 
        echo $params_array['watermark_font'];
        ?>
;
				color: #<?php 
        echo $params_array['watermark_color'];
        ?>
 !important;
				opacity: <?php 
        echo number_format($params_array['watermark_opacity'] / 100, 2, ".", "");
        ?>
;
				filter: Alpha(opacity=<?php 
        echo $params_array['watermark_opacity'];
        ?>
);
				position: relative;
				z-index: 10141;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_image_browser_image_contain_<?php 
        echo $bwg;
        ?>
{
				position: absolute;
				text-align: center;
				vertical-align: middle;
				width: 100%;
				height: 100%;
				cursor: pointer;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_image_browser_watermark_contain_<?php 
        echo $bwg;
        ?>
{
        display: table;
				vertical-align: middle;
				width: 100%;
				height: 100%;
      }	 
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_image_browser_watermark_cont_<?php 
        echo $bwg;
        ?>
{
        display: table-cell;
				text-align: <?php 
        echo $text_align;
        ?>
;
				position: relative;
				vertical-align: <?php 
        echo $vertical_align;
        ?>
;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_image_browser_watermark_<?php 
        echo $bwg;
        ?>
{
				display: inline-block;
				overflow: hidden;
				position: relative;
				vertical-align: middle;
				z-index: 10140;
				width: <?php 
        echo $params_array['watermark_width'];
        ?>
px;
				max-width: <?php 
        echo $params_array['watermark_width'] / $params['image_browser_width'] * 100;
        ?>
%;
				margin: 10px 10px 10px 10px ;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_image_browser_watermark_text_<?php 
        echo $bwg;
        ?>
{
        display: inline-block;
				overflow: hidden;
				position: relative;
				vertical-align: middle;
				z-index: 10140;
				margin: 10px 10px 10px 10px ;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_image_browser_watermark_img_<?php 
        echo $bwg;
        ?>
{
				max-width: 100%;
				opacity: <?php 
        echo number_format($params_array['watermark_opacity'] / 100, 2, ".", "");
        ?>
;
				filter: Alpha(opacity=<?php 
        echo $params_array['watermark_opacity'];
        ?>
);
				position: relative;
				z-index: 10141;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_none_selectable {
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        -khtml-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
      }
    </style>
    <div id="bwg_container1_<?php 
        echo $bwg;
        ?>
">
      <div id="bwg_container2_<?php 
        echo $bwg;
        ?>
">
        <form id="gal_front_form_<?php 
        echo $bwg;
        ?>
" method="post" action="#">
          <?php 
        if ($params['show_search_box']) {
            WDWLibrary::ajax_html_frontend_search_box('gal_front_form_' . $bwg, $bwg, 'bwg_standart_thumbnails_' . $bwg, $images_count, $params['search_box_width']);
        }
        ?>
          <div class="image_browser_images_conteiner_<?php 
        echo $bwg;
        ?>
">
            <div id="ajax_loading_<?php 
        echo $bwg;
        ?>
" style="position:absolute;width: 100%; z-index: 115; text-align: center; height: 100%; vertical-align: middle; display:none;">
              <div style="display: table; vertical-align: middle; width: 100%; height: 100%; background-color: #FFFFFF; opacity: 0.7; filter: Alpha(opacity=70);">
                <div style="display: table-cell; text-align: center; position: relative; vertical-align: middle;" >
                  <div id="loading_div_<?php 
        echo $bwg;
        ?>
" class="spider_ajax_loading" style="display: inline-block; text-align:center; position:relative; vertical-align:middle; background-image:url(<?php 
        echo WD_BWG_URL . '/images/ajax_loader.png';
        ?>
); float: none; width:50px;height:50px;background-size:50px 50px;">
                  </div>
                </div>
              </div>
            </div>
            <div class="image_browser_images_<?php 
        echo $bwg;
        ?>
" id="bwg_standart_thumbnails_<?php 
        echo $bwg;
        ?>
" >
              <?php 
        if ($theme_row->page_nav_position == 'top') {
            WDWLibrary::ajax_html_frontend_page_nav($theme_row, $page_nav['total'], $page_nav['limit'], 'gal_front_form_' . $bwg, $items_per_page, $bwg, 'bwg_standart_thumbnails_' . $bwg, 0, 'album', $option_row->enable_seo);
        }
        foreach ($image_rows as $image_row) {
            $params_array['image_id'] = isset($_POST['image_id']) ? esc_html($_POST['image_id']) : $image_row->id;
            $is_embed = preg_match('/EMBED/', $image_row->filetype) == 1 ? true : false;
            $is_embed_16x9 = (preg_match('/EMBED/', $image_row->filetype) == 1 ? true : false) && (preg_match('/VIDEO/', $image_row->filetype) == 1 ? true : false) && !(preg_match('/INSTAGRAM/', $image_row->filetype) == 1 ? true : false);
            $is_embed_instagram_post = preg_match('/INSTAGRAM_POST/', $image_row->filetype) == 1 ? true : false;
            ?>
  
                <div class="image_browser_image_buttons_conteiner_<?php 
            echo $bwg;
            ?>
">
                  <div class="image_browser_image_buttons_<?php 
            echo $bwg;
            ?>
">
                    <div class="bwg_image_browser_image_alt_<?php 
            echo $bwg;
            ?>
">
                      <?php 
            if ($image_title) {
                ?>
                        <div class="bwg_image_alt_<?php 
                echo $bwg;
                ?>
" id="alt<?php 
                echo $image_row->id;
                ?>
">
                          <?php 
                echo html_entity_decode($image_row->alt);
                ?>
                        </div>
                      <?php 
            }
            ?>
                    </div> 
                    <div class="bwg_image_browser_image_<?php 
            echo $bwg;
            ?>
">
                      <?php 
            if ($show_watermark) {
                ?>
                        <div class="bwg_image_browser_image_contain_<?php 
                echo $bwg;
                ?>
" id="bwg_image_browser_image_contain_<?php 
                echo $image_row->id;
                ?>
">
                          <div class="bwg_image_browser_watermark_contain_<?php 
                echo $bwg;
                ?>
">
                            <div class="bwg_image_browser_watermark_cont_<?php 
                echo $bwg;
                ?>
">
                              <div <?php 
                echo $watermark_div;
                ?>
 >
                                <a class="bwg_none_selectable <?php 
                echo $watermark_a;
                ?>
" id="watermark_a<?php 
                echo $image_row->id;
                ?>
" href="<?php 
                echo urldecode($params_array['watermark_link']);
                ?>
" target="_blank">
                                  <?php 
                echo $watermark_image_or_text;
                ?>
                                </a>
                              </div>
                            </div>
                          </div>
                        </div>
                        <?php 
            }
            if (!$is_embed) {
                ?>
                        <a style="position:relative;" <?php 
                echo $params['thumb_click_action'] == 'open_lightbox' ? ' class="bwg_lightbox_' . $bwg . '" data-image-id="' . $image_row->id . '"' : ($params['thumb_click_action'] == 'redirect_to_url' && $image_row->redirect_url ? 'href="' . $image_row->redirect_url . '" target="' . ($params['thumb_link_target'] ? '_blank' : '') . '"' : '');
                ?>
>
                          <img class="bwg_image_browser_img_<?php 
                echo $bwg;
                ?>
" src="<?php 
                echo site_url() . '/' . $WD_BWG_UPLOAD_DIR . $image_row->image_url;
                ?>
" alt="<?php 
                echo $image_row->alt;
                ?>
" />
                        </a>
                      <?php 
            } else {
                /*$is_embed*/
                if ($is_embed_16x9) {
                    WDWLibraryEmbed::display_embed($image_row->filetype, $image_row->filename, array('id' => "bwg_embed_frame_16x9_" . $bwg, 'width' => $params['image_browser_width'], 'height' => $params['image_browser_width'] * 0.5625, 'frameborder' => "0", 'allowfullscreen' => "allowfullscreen", 'style' => "position: relative; margin:0;"));
                } elseif ($is_embed_instagram_post) {
                    WDWLibraryEmbed::display_embed($image_row->filetype, $image_row->filename, array('id' => "bwg_embed_frame_instapost_" . $bwg, 'width' => $params['image_browser_width'], 'height' => $params['image_browser_width'] + 88, 'frameborder' => "0", 'allowfullscreen' => "allowfullscreen", 'style' => "position: relative; margin:0;"));
                } else {
                    /*for instagram image, video and flickr enable lightbox onclick*/
                    ?>
                          <a style="position:relative;" <?php 
                    echo $params['thumb_click_action'] == 'open_lightbox' ? ' class="bwg_lightbox_' . $bwg . '" data-image-id="' . $image_row->id . '"' : ($image_row->redirect_url ? 'href="' . $image_row->redirect_url . '" target="' . ($params['thumb_link_target'] ? '_blank' : '') . '"' : '');
                    ?>
>
                            <?php 
                    WDWLibraryEmbed::display_embed($image_row->filetype, $image_row->filename, array('id' => "bwg_embed_frame_" . $bwg, 'width' => $params['image_browser_width'], 'height' => 'auto', 'frameborder' => "0", 'allowfullscreen' => "allowfullscreen", 'style' => "position: relative; margin:0;"));
                    ?>
                          </a>

                        <?php 
                }
            }
            ?>
                      <script>
                      function bwg_image_browser_<?php 
            echo $bwg;
            ?>
() {
                        jQuery('#bwg_embed_frame_16x9_<?php 
            echo $bwg;
            ?>
').width(jQuery('#bwg_embed_frame_16x9_<?php 
            echo $bwg;
            ?>
').parent().width());
                        jQuery('#bwg_embed_frame_16x9_<?php 
            echo $bwg;
            ?>
').height(jQuery('#bwg_embed_frame_16x9_<?php 
            echo $bwg;
            ?>
').width() * 0.5625);
                        jQuery('#bwg_embed_frame_instapost_<?php 
            echo $bwg;
            ?>
').width(jQuery('#bwg_embed_frame_16x9_<?php 
            echo $bwg;
            ?>
').parent().width());
                        jQuery('#bwg_embed_frame_instapost_<?php 
            echo $bwg;
            ?>
').height(jQuery('#bwg_embed_frame_instapost_<?php 
            echo $bwg;
            ?>
').width() +88);

                        var bwg_image_browser_width = jQuery('.image_browser_images_<?php 
            echo $bwg;
            ?>
').width();
                        if (bwg_image_browser_width <= 108) {
                          jQuery('.paging-input_<?php 
            echo $bwg;
            ?>
').css('display', 'none');
                        }
                        else if (bwg_image_browser_width <= 200) {
                          jQuery('.paging-input_<?php 
            echo $bwg;
            ?>
').css('margin', '0% 0% 0% 0%');
                          jQuery('.paging-input_<?php 
            echo $bwg;
            ?>
').css('display', 'inline');
                          jQuery('.tablenav-pages_<?php 
            echo $bwg;
            ?>
 .next-page').css('margin', '0% 0% 0% 0%');
                          jQuery('.tablenav-pages_<?php 
            echo $bwg;
            ?>
 .prev-page').css('margin', '0% 0% 0% 0%');
                        }
                        else if (bwg_image_browser_width <= 580) {
                          jQuery('.paging-input_<?php 
            echo $bwg;
            ?>
').css('display', 'inline');
                          jQuery('.tablenav-pages_<?php 
            echo $bwg;
            ?>
 a').css('font-size', '13px');
                          jQuery('.paging-input_<?php 
            echo $bwg;
            ?>
').css('margin', '0% 7% 0% 7%');
                          jQuery('.tablenav-pages_<?php 
            echo $bwg;
            ?>
 .next-page').css('margin', '0% 0% 0% 0%');
                          jQuery('.tablenav-pages_<?php 
            echo $bwg;
            ?>
 .prev-page').css('margin', '0% 0% 0% 0%');
                        }
                        else {
                          jQuery('.tablenav-pages_<?php 
            echo $bwg;
            ?>
 a').css('font-size', '15px');
                          jQuery('.paging-input_<?php 
            echo $bwg;
            ?>
').css('margin', '0%  14% 0%  14%');
                          jQuery('.paging-input_<?php 
            echo $bwg;
            ?>
').css('display', 'inline');
                          jQuery('.tablenav-pages_<?php 
            echo $bwg;
            ?>
 .next-page').css('margin', '0% 0% 0% 0%');
                          jQuery('.tablenav-pages_<?php 
            echo $bwg;
            ?>
 .prev-page').css('margin', '0% 0% 0% 0%');
                        }
                      }
                      setTimeout(function() {
                        bwg_image_browser_<?php 
            echo $bwg;
            ?>
();
                      }, 3);
                      </script>
                    </div>
                      <?php 
            if ($enable_image_description && $image_row->description != "") {
                ?>
                      <div class="bwg_image_browser_image_desp_<?php 
                echo $bwg;
                ?>
">                    
                        <div class="bwg_image_browser_image_description_<?php 
                echo $bwg;
                ?>
" id="alt<?php 
                echo $image_row->id;
                ?>
">
                          <?php 
                echo html_entity_decode($image_row->description);
                ?>
                        </div>                  
                      </div>
                        <?php 
            }
            ?>
                  </div>
                </div>
                <?php 
        }
        if ($theme_row->page_nav_position == 'bottom') {
            WDWLibrary::ajax_html_frontend_page_nav($theme_row, $page_nav['total'], $page_nav['limit'], 'gal_front_form_' . $bwg, $items_per_page, $bwg, 'bwg_standart_thumbnails_' . $bwg, 0, 'album', $option_row->enable_seo);
        }
        ?>
            </div>
          </div>
        </form>
        <div id="spider_popup_loading_<?php 
        echo $bwg;
        ?>
" class="spider_popup_loading"></div>
        <div id="spider_popup_overlay_<?php 
        echo $bwg;
        ?>
" class="spider_popup_overlay" onclick="spider_destroypopup(1000)"></div>
      </div>
    </div>
    <script>
      jQuery(window).load(function () {
        <?php 
        if ($image_right_click) {
            ?>
          /* Disable right click.*/
          jQuery('div[id^="bwg_container"]').bind("contextmenu", function (e) {
            return false;
          });
          jQuery('div[id^="bwg_container"]').css('webkitTouchCallout','none');
          <?php 
        }
        ?>
      });
      jQuery(window).resize(function() {
        bwg_image_browser_<?php 
        echo $bwg;
        ?>
();
      });
      function bwg_gallery_box_<?php 
        echo $bwg;
        ?>
(image_id) {
        spider_createpopup('<?php 
        echo addslashes(add_query_arg($params_array, admin_url('admin-ajax.php')));
        ?>
&image_id=' + image_id, '<?php 
        echo $bwg;
        ?>
', '<?php 
        echo $params['popup_width'];
        ?>
', '<?php 
        echo $params['popup_height'];
        ?>
', 1, 'testpopup', 5, "<?php 
        echo $theme_row->lightbox_ctrl_btn_pos;
        ?>
");
      }
      function bwg_document_ready_<?php 
        echo $bwg;
        ?>
() {
        var bwg_touch_flag = false;
        jQuery(".bwg_lightbox_<?php 
        echo $bwg;
        ?>
").on("click", function () {
          if (!bwg_touch_flag) {
            bwg_touch_flag = true;
            setTimeout(function(){ bwg_touch_flag = false; }, 100);
            bwg_gallery_box_<?php 
        echo $bwg;
        ?>
(jQuery(this).attr("data-image-id"));
            return false;
          }
        });
      }
      jQuery(document).ready(function () {
        bwg_document_ready_<?php 
        echo $bwg;
        ?>
();
      });
    </script>
    <?php 
        if ($from_shortcode) {
            return;
        } else {
            die;
        }
    }
    public function display($params, $from_shortcode = 0, $bwg = 0)
    {
        global $wp;
        $current_url = $wp->query_string;
        global $WD_BWG_UPLOAD_DIR;
        require_once WD_BWG_DIR . '/framework/WDWLibrary.php';
        if (!isset($params['extended_album_image_title'])) {
            $params['extended_album_image_title'] = 'none';
        }
        $theme_row = $this->model->get_theme_row_data($params['theme_id']);
        if (!$theme_row) {
            echo WDWLibrary::message(__('There is no theme selected or the theme was deleted.', 'bwg'), 'error');
            return;
        }
        $type = isset($_POST['type_' . $bwg]) ? esc_html($_POST['type_' . $bwg]) : 'album';
        $album_gallery_id = isset($_POST['album_gallery_id_' . $bwg]) ? esc_html($_POST['album_gallery_id_' . $bwg]) : $params['album_id'];
        if (!$album_gallery_id) {
            echo WDWLibrary::message(__('There is no album selected or the album was deleted.', 'bwg'), 'error');
            return;
        }
        if ($type == 'gallery') {
            $items_per_page = $params['extended_album_images_per_page'];
            $items_col_num = $params['extended_album_image_column_number'];
            $image_rows = $this->model->get_image_rows_data($album_gallery_id, $items_per_page, $params['sort_by'], $bwg);
            $page_nav = $this->model->gallery_page_nav($album_gallery_id, $items_per_page, $bwg);
            $album_gallery_div_id = 'bwg_album_extended_' . $bwg;
            $album_gallery_div_class = 'bwg_standart_thumbnails_' . $bwg;
        } else {
            $items_per_page = $params['extended_albums_per_page'];
            $items_col_num = 1;
            $album_galleries_row = $this->model->get_alb_gals_row($album_gallery_id, $items_per_page, $params['sort_by'], $bwg);
            $page_nav = $this->model->album_page_nav($album_gallery_id, $items_per_page, $bwg);
            $album_gallery_div_id = 'bwg_album_extended_' . $bwg;
            $album_gallery_div_class = 'bwg_album_extended_thumbnails_' . $bwg;
        }
        $bwg_previous_album_id = isset($_POST['bwg_previous_album_id_' . $bwg]) ? esc_html($_POST['bwg_previous_album_id_' . $bwg]) : 0;
        $bwg_previous_album_page_number = isset($_POST['bwg_previous_album_page_number_' . $bwg]) ? esc_html($_POST['bwg_previous_album_page_number_' . $bwg]) : 0;
        $rgb_page_nav_font_color = WDWLibrary::spider_hex2rgb($theme_row->page_nav_font_color);
        $rgb_album_extended_thumbs_bg_color = WDWLibrary::spider_hex2rgb($theme_row->album_extended_thumbs_bg_color);
        $rgb_album_extended_div_bg_color = WDWLibrary::spider_hex2rgb($theme_row->album_extended_div_bg_color);
        $rgb_thumbs_bg_color = WDWLibrary::spider_hex2rgb($theme_row->thumbs_bg_color);
        ?>
    <style>
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_album_extended_thumbnails_<?php 
        echo $bwg;
        ?>
 * {
       -moz-box-sizing: border-box;
       box-sizing: border-box;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_album_extended_thumbnails_<?php 
        echo $bwg;
        ?>
 {
        display: block;
        -moz-box-sizing: border-box;
        box-sizing: border-box;
        background-color: rgba(<?php 
        echo $rgb_album_extended_thumbs_bg_color['red'];
        ?>
, <?php 
        echo $rgb_album_extended_thumbs_bg_color['green'];
        ?>
, <?php 
        echo $rgb_album_extended_thumbs_bg_color['blue'];
        ?>
, <?php 
        echo $theme_row->album_extended_thumb_bg_transparent / 100;
        ?>
);
        font-size: 0;
        text-align: <?php 
        echo $theme_row->album_extended_thumb_align;
        ?>
;
        max-width: inherit;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_album_extended_thumbnails_<?php 
        echo $bwg;
        ?>
 a {
        cursor: pointer;
        text-decoration: none;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_album_extended_div_<?php 
        echo $bwg;
        ?>
 {
        display: table;
        width: 100%;
        height: <?php 
        echo $params['extended_album_height'];
        ?>
px;
        border-spacing: <?php 
        echo $theme_row->album_extended_div_padding;
        ?>
px;
        border-bottom: <?php 
        echo $theme_row->album_extended_div_separator_width;
        ?>
px <?php 
        echo $theme_row->album_extended_div_separator_style;
        ?>
 #<?php 
        echo $theme_row->album_extended_div_separator_color;
        ?>
;
        background-color: rgba(<?php 
        echo $rgb_album_extended_div_bg_color['red'];
        ?>
, <?php 
        echo $rgb_album_extended_div_bg_color['green'];
        ?>
, <?php 
        echo $rgb_album_extended_div_bg_color['blue'];
        ?>
, <?php 
        echo $theme_row->album_extended_div_bg_transparent / 100;
        ?>
);
        border-radius: <?php 
        echo $theme_row->album_extended_div_border_radius;
        ?>
;
        margin: <?php 
        echo $theme_row->album_extended_div_margin;
        ?>
;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_album_extended_thumb_div_<?php 
        echo $bwg;
        ?>
 {
        background-color: #<?php 
        echo $theme_row->album_extended_thumb_div_bg_color;
        ?>
;
        border-radius: <?php 
        echo $theme_row->album_extended_thumb_div_border_radius;
        ?>
;
        text-align: center;
        border: <?php 
        echo $theme_row->album_extended_thumb_div_border_width;
        ?>
px <?php 
        echo $theme_row->album_extended_thumb_div_border_style;
        ?>
 #<?php 
        echo $theme_row->album_extended_thumb_div_border_color;
        ?>
;
        display: table-cell;
        vertical-align: middle;
        padding: <?php 
        echo $theme_row->album_extended_thumb_div_padding;
        ?>
;
      }
      @media only screen and (max-width : 320px) {
        #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_album_extended_thumb_div_<?php 
        echo $bwg;
        ?>
 {
          display: table-row;
        }
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_album_extended_text_div_<?php 
        echo $bwg;
        ?>
 {
        background-color: #<?php 
        echo $theme_row->album_extended_text_div_bg_color;
        ?>
;
        border-radius: <?php 
        echo $theme_row->album_extended_text_div_border_radius;
        ?>
;
        border: <?php 
        echo $theme_row->album_extended_text_div_border_width;
        ?>
px <?php 
        echo $theme_row->album_extended_text_div_border_style;
        ?>
 #<?php 
        echo $theme_row->album_extended_text_div_border_color;
        ?>
;
        display: table-cell;
        width: 100%;
        border-collapse: collapse;
        vertical-align: middle;
        padding: <?php 
        echo $theme_row->album_extended_text_div_padding;
        ?>
;
      }
      @media only screen and (max-width : 320px) {
        #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_album_extended_text_div_<?php 
        echo $bwg;
        ?>
 {
          display: table-row;
        }
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_title_spun_<?php 
        echo $bwg;
        ?>
 {
        border: <?php 
        echo $theme_row->album_extended_title_span_border_width;
        ?>
px <?php 
        echo $theme_row->album_extended_title_span_border_style;
        ?>
 #<?php 
        echo $theme_row->album_extended_title_span_border_color;
        ?>
;
        color: #<?php 
        echo $theme_row->album_extended_title_font_color;
        ?>
;
        display: block;
        font-family: <?php 
        echo $theme_row->album_extended_title_font_style;
        ?>
;
        font-size: <?php 
        echo $theme_row->album_extended_title_font_size;
        ?>
px;
        font-weight: <?php 
        echo $theme_row->album_extended_title_font_weight;
        ?>
;
        height: inherit;
        margin-bottom: <?php 
        echo $theme_row->album_extended_title_margin_bottom;
        ?>
px;
        padding: <?php 
        echo $theme_row->album_extended_title_padding;
        ?>
;
        text-align: left;
        vertical-align: middle;
        width: inherit;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_description_spun1_<?php 
        echo $bwg;
        ?>
 {
        border: <?php 
        echo $theme_row->album_extended_desc_span_border_width;
        ?>
px <?php 
        echo $theme_row->album_extended_desc_span_border_style;
        ?>
 #<?php 
        echo $theme_row->album_extended_desc_span_border_color;
        ?>
;
        display: inline-block;
        color: #<?php 
        echo $theme_row->album_extended_desc_font_color;
        ?>
;
        font-size: <?php 
        echo $theme_row->album_extended_desc_font_size;
        ?>
px;
        font-weight: <?php 
        echo $theme_row->album_extended_desc_font_weight;
        ?>
;
        font-family: <?php 
        echo $theme_row->album_extended_desc_font_style;
        ?>
;
        height: inherit;
        padding: <?php 
        echo $theme_row->album_extended_desc_padding;
        ?>
;
        vertical-align: middle;
        width: inherit;
        word-wrap: break-word;
        word-break: break-word;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_description_spun1_<?php 
        echo $bwg;
        ?>
 * {
        margin: 0;
        text-align: left !important;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_description_spun2_<?php 
        echo $bwg;
        ?>
 {
        float: left;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_description_short_<?php 
        echo $bwg;
        ?>
 {
        display: inline;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_description_full_<?php 
        echo $bwg;
        ?>
 {
        display: none;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_description_more_<?php 
        echo $bwg;
        ?>
 {
        clear: both;
        color: #<?php 
        echo $theme_row->album_extended_desc_more_color;
        ?>
;
        cursor: pointer;
        float: right;
        font-size: <?php 
        echo $theme_row->album_extended_desc_more_size;
        ?>
px;
        font-weight: normal;
      }
      /*Album thumbs styles.*/
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_album_thumb_<?php 
        echo $bwg;
        ?>
 {
        display: inline-block;
        text-align: center;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_album_thumb_spun1_<?php 
        echo $bwg;
        ?>
 {
        background-color: #<?php 
        echo $theme_row->album_extended_thumb_bg_color;
        ?>
;
        border-radius: <?php 
        echo $theme_row->album_extended_thumb_border_radius;
        ?>
;
        border: <?php 
        echo $theme_row->album_extended_thumb_border_width;
        ?>
px <?php 
        echo $theme_row->album_extended_thumb_border_style;
        ?>
 #<?php 
        echo $theme_row->album_extended_thumb_border_color;
        ?>
;
        box-shadow: <?php 
        echo $theme_row->album_extended_thumb_box_shadow;
        ?>
;
        display: inline-block;
        height: <?php 
        echo $params['extended_album_thumb_height'];
        ?>
px;
        margin: <?php 
        echo $theme_row->album_extended_thumb_margin;
        ?>
px;
        opacity: <?php 
        echo $theme_row->album_extended_thumb_transparent / 100;
        ?>
;
        filter: Alpha(opacity=<?php 
        echo $theme_row->album_extended_thumb_transparent;
        ?>
);
        <?php 
        echo $theme_row->album_extended_thumb_transition ? 'transition: all 0.3s ease 0s;-webkit-transition: all 0.3s ease 0s;' : '';
        ?>
        padding: <?php 
        echo $theme_row->album_extended_thumb_padding;
        ?>
px;
        text-align: center;
        vertical-align: middle;
        width: <?php 
        echo $params['extended_album_thumb_width'];
        ?>
px;
        z-index: 100;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_album_thumb_spun1_<?php 
        echo $bwg;
        ?>
:hover {
        opacity: 1;
        filter: Alpha(opacity=100);
        transform: <?php 
        echo $theme_row->album_extended_thumb_hover_effect;
        ?>
(<?php 
        echo $theme_row->album_extended_thumb_hover_effect_value;
        ?>
);
        -ms-transform: <?php 
        echo $theme_row->album_extended_thumb_hover_effect;
        ?>
(<?php 
        echo $theme_row->album_extended_thumb_hover_effect_value;
        ?>
);
        -webkit-transform: <?php 
        echo $theme_row->album_extended_thumb_hover_effect;
        ?>
(<?php 
        echo $theme_row->album_extended_thumb_hover_effect_value;
        ?>
);
        backface-visibility: hidden;
        -webkit-backface-visibility: hidden;
        -moz-backface-visibility: hidden;
        -ms-backface-visibility: hidden;
        z-index: 102;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_album_thumb_spun2_<?php 
        echo $bwg;
        ?>
 {
        display: inline-block;
        height: <?php 
        echo $params['extended_album_thumb_height'];
        ?>
px;
        overflow: hidden;
        width: <?php 
        echo $params['extended_album_thumb_width'];
        ?>
px;
      }
      /*Image thumbs styles.*/
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_standart_thumb_spun1_<?php 
        echo $bwg;
        ?>
 {
        background-color: #<?php 
        echo $theme_row->thumb_bg_color;
        ?>
;
        border-radius: <?php 
        echo $theme_row->thumb_border_radius;
        ?>
;
        border: <?php 
        echo $theme_row->thumb_border_width;
        ?>
px <?php 
        echo $theme_row->thumb_border_style;
        ?>
 #<?php 
        echo $theme_row->thumb_border_color;
        ?>
;
        box-shadow: <?php 
        echo $theme_row->thumb_box_shadow;
        ?>
;
        display: inline-block;
        height: <?php 
        echo $params['extended_album_image_thumb_height'];
        ?>
px;
        margin: <?php 
        echo $theme_row->thumb_margin;
        ?>
px;
        opacity: <?php 
        echo $theme_row->thumb_transparent / 100;
        ?>
;
        filter: Alpha(opacity=<?php 
        echo $theme_row->thumb_transparent;
        ?>
);
        <?php 
        echo $theme_row->thumb_transition ? 'transition: all 0.3s ease 0s;-webkit-transition: all 0.3s ease 0s;' : '';
        ?>
        padding: <?php 
        echo $theme_row->thumb_padding;
        ?>
px;
        text-align: center;
        vertical-align: middle;
        width: <?php 
        echo $params['extended_album_image_thumb_width'];
        ?>
px;
        z-index: 100;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_standart_thumb_spun1_<?php 
        echo $bwg;
        ?>
:hover {
        -ms-transform: <?php 
        echo $theme_row->thumb_hover_effect;
        ?>
(<?php 
        echo $theme_row->thumb_hover_effect_value;
        ?>
);
        -webkit-transform: <?php 
        echo $theme_row->thumb_hover_effect;
        ?>
(<?php 
        echo $theme_row->thumb_hover_effect_value;
        ?>
);
        backface-visibility: hidden;
        -webkit-backface-visibility: hidden;
        -moz-backface-visibility: hidden;
        -ms-backface-visibility: hidden;
        opacity: 1;
        filter: Alpha(opacity=100);
        transform: <?php 
        echo $theme_row->thumb_hover_effect;
        ?>
(<?php 
        echo $theme_row->thumb_hover_effect_value;
        ?>
);
        z-index: 102;
        position: relative;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_standart_thumb_spun2_<?php 
        echo $bwg;
        ?>
 {
        display: inline-block;
        height: <?php 
        echo $params['extended_album_image_thumb_height'];
        ?>
px;
        overflow: hidden;
        width: <?php 
        echo $params['extended_album_image_thumb_width'];
        ?>
px;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_standart_thumbnails_<?php 
        echo $bwg;
        ?>
 {
        -moz-box-sizing: border-box;
        display: inline-block;
        background-color: rgba(<?php 
        echo $rgb_thumbs_bg_color['red'];
        ?>
, <?php 
        echo $rgb_thumbs_bg_color['green'];
        ?>
, <?php 
        echo $rgb_thumbs_bg_color['blue'];
        ?>
, <?php 
        echo $theme_row->thumb_bg_transparent / 100;
        ?>
);
        box-sizing: border-box;
        font-size: 0;
        max-width: <?php 
        echo $params['extended_album_image_column_number'] * ($params['extended_album_image_thumb_width'] + 2 * (2 + $theme_row->thumb_margin + $theme_row->thumb_padding + $theme_row->thumb_border_width));
        ?>
px;
        text-align: <?php 
        echo $theme_row->thumb_align;
        ?>
;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_standart_thumbnails_<?php 
        echo $bwg;
        ?>
 a {
        cursor: pointer;
        text-decoration: none;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_standart_thumb_<?php 
        echo $bwg;
        ?>
 {
        display: inline-block;
        text-align: center;
      }
      <?php 
        if ($params['extended_album_image_title'] == 'show') {
            /* Show image title at the bottom.*/
            ?>
        #bwg_container1_<?php 
            echo $bwg;
            ?>
 #bwg_container2_<?php 
            echo $bwg;
            ?>
 .bwg_image_title_spun1_<?php 
            echo $bwg;
            ?>
 {
          display: block;
          margin: 0 auto;
          opacity: 1;
          filter: Alpha(opacity=100);
          text-align: center;
          width: <?php 
            echo $params['extended_album_image_thumb_width'];
            ?>
px;
        }
        <?php 
        } elseif ($params['extended_album_image_title'] == 'hover') {
            /* Show image title on hover.*/
            ?>
        #bwg_container1_<?php 
            echo $bwg;
            ?>
 #bwg_container2_<?php 
            echo $bwg;
            ?>
 .bwg_image_title_spun1_<?php 
            echo $bwg;
            ?>
 {
          display: table;
          height: inherit;
          left: -3000px;
          opacity: 0;
          filter: Alpha(opacity=0);
          position: absolute;
          top: 0px;
          width: inherit;
        }
        <?php 
        }
        ?>
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_standart_thumb_spun1_<?php 
        echo $bwg;
        ?>
:hover .bwg_image_title_spun1_<?php 
        echo $bwg;
        ?>
 {
        left: <?php 
        echo $theme_row->thumb_padding;
        ?>
px;
        top: <?php 
        echo $theme_row->thumb_padding;
        ?>
px;
        opacity: 1;
        filter: Alpha(opacity=100);
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_image_title_spun2_<?php 
        echo $bwg;
        ?>
 {
        color: #<?php 
        echo $theme_row->thumb_title_font_color;
        ?>
;
        display: table-cell;
        font-family: <?php 
        echo $theme_row->thumb_title_font_style;
        ?>
;
        font-size: <?php 
        echo $theme_row->thumb_title_font_size;
        ?>
px;
        font-weight: <?php 
        echo $theme_row->thumb_title_font_weight;
        ?>
;
        height: inherit;
        margin: <?php 
        echo $theme_row->thumb_title_margin;
        ?>
;
        text-shadow: <?php 
        echo $theme_row->thumb_title_shadow;
        ?>
;
        vertical-align: middle;
        width: inherit;
        word-break: break-all;
        word-wrap: break-word;
      }
      /*Pagination styles.*/
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .tablenav-pages_<?php 
        echo $bwg;
        ?>
 {
        text-align: <?php 
        echo $theme_row->page_nav_align;
        ?>
;
        font-size: <?php 
        echo $theme_row->page_nav_font_size;
        ?>
px;
        font-family: <?php 
        echo $theme_row->page_nav_font_style;
        ?>
;
        font-weight: <?php 
        echo $theme_row->page_nav_font_weight;
        ?>
;
        color: #<?php 
        echo $theme_row->page_nav_font_color;
        ?>
;
        margin: 6px 0 4px;
        display: block;
        height: 30px;
        line-height: 30px;
      }
      @media only screen and (max-width : 320px) {
        #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .displaying-num_<?php 
        echo $bwg;
        ?>
 {
          display: none;
        }
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .displaying-num_<?php 
        echo $bwg;
        ?>
 {
        font-size: <?php 
        echo $theme_row->page_nav_font_size;
        ?>
px;
        font-family: <?php 
        echo $theme_row->page_nav_font_style;
        ?>
;
        font-weight: <?php 
        echo $theme_row->page_nav_font_weight;
        ?>
;
        color: #<?php 
        echo $theme_row->page_nav_font_color;
        ?>
;
        margin-right: 10px;
        vertical-align: middle;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .paging-input_<?php 
        echo $bwg;
        ?>
 {
        font-size: <?php 
        echo $theme_row->page_nav_font_size;
        ?>
px;
        font-family: <?php 
        echo $theme_row->page_nav_font_style;
        ?>
;
        font-weight: <?php 
        echo $theme_row->page_nav_font_weight;
        ?>
;
        color: #<?php 
        echo $theme_row->page_nav_font_color;
        ?>
;
        vertical-align: middle;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .tablenav-pages_<?php 
        echo $bwg;
        ?>
 a.disabled,
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .tablenav-pages_<?php 
        echo $bwg;
        ?>
 a.disabled:hover,
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .tablenav-pages_<?php 
        echo $bwg;
        ?>
 a.disabled:focus {
        cursor: default;
        color: rgba(<?php 
        echo $rgb_page_nav_font_color['red'];
        ?>
, <?php 
        echo $rgb_page_nav_font_color['green'];
        ?>
, <?php 
        echo $rgb_page_nav_font_color['blue'];
        ?>
, 0.5);
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .tablenav-pages_<?php 
        echo $bwg;
        ?>
 a {
        cursor: pointer;
        font-size: <?php 
        echo $theme_row->page_nav_font_size;
        ?>
px;
        font-family: <?php 
        echo $theme_row->page_nav_font_style;
        ?>
;
        font-weight: <?php 
        echo $theme_row->page_nav_font_weight;
        ?>
;
        color: #<?php 
        echo $theme_row->page_nav_font_color;
        ?>
;
        text-decoration: none;
        padding: <?php 
        echo $theme_row->page_nav_padding;
        ?>
;
        margin: <?php 
        echo $theme_row->page_nav_margin;
        ?>
;
        border-radius: <?php 
        echo $theme_row->page_nav_border_radius;
        ?>
;
        border-style: <?php 
        echo $theme_row->page_nav_border_style;
        ?>
;
        border-width: <?php 
        echo $theme_row->page_nav_border_width;
        ?>
px;
        border-color: #<?php 
        echo $theme_row->page_nav_border_color;
        ?>
;
        background-color: #<?php 
        echo $theme_row->page_nav_button_bg_color;
        ?>
;
        opacity: <?php 
        echo $theme_row->page_nav_button_bg_transparent / 100;
        ?>
;
        filter: Alpha(opacity=<?php 
        echo $theme_row->page_nav_button_bg_transparent;
        ?>
);
        box-shadow: <?php 
        echo $theme_row->page_nav_box_shadow;
        ?>
;
        <?php 
        echo $theme_row->page_nav_button_transition ? 'transition: all 0.3s ease 0s;-webkit-transition: all 0.3s ease 0s;' : '';
        ?>
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_back_<?php 
        echo $bwg;
        ?>
 {
        background-color: rgba(0, 0, 0, 0);
        color: #<?php 
        echo $theme_row->album_extended_back_font_color;
        ?>
 !important;
        cursor: pointer;
        display: block;
        font-family: <?php 
        echo $theme_row->album_extended_back_font_style;
        ?>
;
        font-size: <?php 
        echo $theme_row->album_extended_back_font_size;
        ?>
px;
        font-weight: <?php 
        echo $theme_row->album_extended_back_font_weight;
        ?>
;
        text-decoration: none;
        padding: <?php 
        echo $theme_row->album_extended_back_padding;
        ?>
;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 #spider_popup_overlay_<?php 
        echo $bwg;
        ?>
 {
        background-color: #<?php 
        echo $theme_row->lightbox_overlay_bg_color;
        ?>
;
        opacity: <?php 
        echo $theme_row->lightbox_overlay_bg_transparent / 100;
        ?>
;
        filter: Alpha(opacity=<?php 
        echo $theme_row->lightbox_overlay_bg_transparent;
        ?>
);
      }
    </style>
    <div id="bwg_container1_<?php 
        echo $bwg;
        ?>
">
      <div id="bwg_container2_<?php 
        echo $bwg;
        ?>
">
        <form id="gal_front_form_<?php 
        echo $bwg;
        ?>
" method="post" action="#">
          <div style="background-color:rgba(0, 0, 0, 0); text-align:center; width:100%;">
            <?php 
        if ($params['extended_album_enable_page'] && $items_per_page && $theme_row->page_nav_position == 'top' && $page_nav['total']) {
            WDWLibrary::ajax_html_frontend_page_nav($theme_row, $page_nav['total'], $page_nav['limit'], 'gal_front_form_' . $bwg, $items_per_page, $bwg, $album_gallery_div_id, $params['album_id']);
        }
        ?>
            <div id="bwg_album_extended_<?php 
        echo $bwg;
        ?>
" class="<?php 
        echo $album_gallery_div_class;
        ?>
">
              <div id="ajax_loading_<?php 
        echo $bwg;
        ?>
" style="position:absolute;">
                <div id="opacity_div_<?php 
        echo $bwg;
        ?>
" style="display:none; background-color:#FFFFFF; opacity:0.7; filter:Alpha(opacity=70); position:absolute; z-index:105;"></div>
                <span id="loading_div_<?php 
        echo $bwg;
        ?>
" style="display:none; text-align:center; position:relative; vertical-align:middle; z-index:107">
                  <img src="<?php 
        echo WD_BWG_URL . '/images/ajax_loader.png';
        ?>
" class="spider_ajax_loading" style="float: none; width:50px;">
                </span>
              </div>
              <?php 
        if ($bwg_previous_album_id) {
            ?>
                <a class="bwg_back_<?php 
            echo $bwg;
            ?>
" onclick="spider_frontend_ajax('gal_front_form_<?php 
            echo $bwg;
            ?>
', '<?php 
            echo $bwg;
            ?>
', 'bwg_album_extended_<?php 
            echo $bwg;
            ?>
', 'back')"><?php 
            echo __('Back', 'bwg');
            ?>
</a>
                <?php 
        }
        ?>
              <input type="hidden" id="bwg_previous_album_id_<?php 
        echo $bwg;
        ?>
" name="bwg_previous_album_id_<?php 
        echo $bwg;
        ?>
" value="<?php 
        echo $bwg_previous_album_id;
        ?>
" />
              <input type="hidden" id="bwg_previous_album_page_number_<?php 
        echo $bwg;
        ?>
" name="bwg_previous_album_page_number_<?php 
        echo $bwg;
        ?>
" value="<?php 
        echo $bwg_previous_album_page_number;
        ?>
" />
              <?php 
        if ($type != 'gallery') {
            if (!$page_nav['total']) {
                ?>
                  <span class="bwg_back_<?php 
                echo $bwg;
                ?>
"><?php 
                echo __('Album is empty.', 'bwg');
                ?>
</span>
                  <?php 
            }
            foreach ($album_galleries_row as $album_galallery_row) {
                if ($album_galallery_row->is_album) {
                    $album_row = $this->model->get_album_row_data($album_galallery_row->alb_gal_id);
                    $preview_image = $album_row->preview_image;
                    if (!$preview_image) {
                        $preview_image = $album_row->random_preview_image;
                    }
                    $def_type = 'album';
                    $title = $album_row->name;
                    $description = wpautop($album_row->description);
                } else {
                    $gallery_row = $this->model->get_gallery_row_data($album_galallery_row->alb_gal_id);
                    $preview_image = $gallery_row->preview_image;
                    if (!$preview_image) {
                        $preview_image = $gallery_row->random_preview_image;
                    }
                    $def_type = 'gallery';
                    $title = $gallery_row->name;
                    $description = wpautop($gallery_row->description);
                }
                if (!$preview_image) {
                    $preview_url = WD_BWG_URL . '/images/no-image.png';
                    $preview_path = WD_BWG_DIR . '/images/no-image.png';
                } else {
                    $preview_url = site_url() . '/' . $WD_BWG_UPLOAD_DIR . $preview_image;
                    $preview_path = ABSPATH . $WD_BWG_UPLOAD_DIR . $preview_image;
                }
                list($image_thumb_width, $image_thumb_height) = getimagesize(htmlspecialchars_decode($preview_path, ENT_COMPAT | ENT_QUOTES));
                $scale = max($params['extended_album_thumb_width'] / $image_thumb_width, $params['extended_album_thumb_height'] / $image_thumb_height);
                $image_thumb_width *= $scale;
                $image_thumb_height *= $scale;
                $thumb_left = ($params['extended_album_thumb_width'] - $image_thumb_width) / 2;
                $thumb_top = ($params['extended_album_thumb_height'] - $image_thumb_height) / 2;
                if ($type != 'gallery') {
                    ?>
                    <div class="bwg_album_extended_div_<?php 
                    echo $bwg;
                    ?>
">
                      <div class="bwg_album_extended_thumb_div_<?php 
                    echo $bwg;
                    ?>
">
                        <a style="font-size: 0;" onclick="spider_frontend_ajax('gal_front_form_<?php 
                    echo $bwg;
                    ?>
', '<?php 
                    echo $bwg;
                    ?>
', 'bwg_album_extended_<?php 
                    echo $bwg;
                    ?>
', '<?php 
                    echo $album_galallery_row->alb_gal_id;
                    ?>
', '<?php 
                    echo $album_gallery_id;
                    ?>
', '<?php 
                    echo $def_type;
                    ?>
')">
                          <span class="bwg_album_thumb_<?php 
                    echo $bwg;
                    ?>
" style="height:inherit;">
                            <span class="bwg_album_thumb_spun1_<?php 
                    echo $bwg;
                    ?>
">
                              <span class="bwg_album_thumb_spun2_<?php 
                    echo $bwg;
                    ?>
">
                                <img style="padding: 0; max-height:none; max-width:none; width:<?php 
                    echo $image_thumb_width;
                    ?>
px; height:<?php 
                    echo $image_thumb_height;
                    ?>
px; margin-left: <?php 
                    echo $thumb_left;
                    ?>
px; margin-top: <?php 
                    echo $thumb_top;
                    ?>
px;" src="<?php 
                    echo $preview_url;
                    ?>
" alt="<?php 
                    echo $title;
                    ?>
" />
                              </span>
                            </span>
                          </span>
                        </a>
                      </div>
                      <div class="bwg_album_extended_text_div_<?php 
                    echo $bwg;
                    ?>
">
                        <?php 
                    if ($title) {
                        ?>
                          <span class="bwg_title_spun_<?php 
                        echo $bwg;
                        ?>
"><?php 
                        echo $title;
                        ?>
</span>
                          <?php 
                    }
                    if ($params['extended_album_description_enable'] && $description) {
                        if (stripos($description, '<!--more-->') !== FALSE) {
                            $description_array = explode('<!--more-->', $description);
                            $description_short = $description_array[0];
                            $description_full = $description_array[1];
                            ?>
                            <span class="bwg_description_spun1_<?php 
                            echo $bwg;
                            ?>
">
                              <span class="bwg_description_spun2_<?php 
                            echo $bwg;
                            ?>
">
                                <span class="bwg_description_short_<?php 
                            echo $bwg;
                            ?>
">
                                  <?php 
                            echo $description_short;
                            ?>
                                </span>
                                <span class="bwg_description_full_<?php 
                            echo $bwg;
                            ?>
">
                                  <?php 
                            echo $description_full;
                            ?>
                                </span>
                              </span>
                              <span class="bwg_description_more_<?php 
                            echo $bwg;
                            ?>
 bwg_more"><?php 
                            echo __('More', 'bwg');
                            ?>
</span>
                            </span>
                            <?php 
                        } else {
                            ?>
                            <span class="bwg_description_spun1_<?php 
                            echo $bwg;
                            ?>
">
                              <span class="bwg_description_short_<?php 
                            echo $bwg;
                            ?>
">
                                <?php 
                            echo $description;
                            ?>
                              </span>
                            </span>
                            <?php 
                        }
                    }
                    ?>
                      </div>
                    </div>
                    <?php 
                }
            }
        } elseif ($type == 'gallery') {
            if (!$page_nav['total']) {
                ?>
                  <span class="bwg_back_<?php 
                echo $bwg;
                ?>
"><?php 
                echo __('Gallery is empty.', 'bwg');
                ?>
</span>
                  <?php 
            }
            foreach ($image_rows as $image_row) {
                $params_array = array('action' => 'GalleryBox', 'current_view' => $bwg, 'image_id' => isset($_POST['image_id']) ? esc_html($_POST['image_id']) : $image_row->id, 'gallery_id' => $album_gallery_id, 'theme_id' => $params['theme_id'], 'thumb_width' => $params['extended_album_image_thumb_width'], 'thumb_height' => $params['extended_album_image_thumb_height'], 'image_width' => $params['popup_width'], 'image_height' => $params['popup_height'], 'image_effect' => $params['popup_effect'], 'sort_by' => $params['sort_by'], 'enable_image_filmstrip' => $params['popup_enable_filmstrip'], 'image_filmstrip_height' => $params['popup_filmstrip_height'], 'enable_image_ctrl_btn' => $params['popup_enable_ctrl_btn'], 'enable_image_fullscreen' => $params['popup_enable_fullscreen'], 'slideshow_interval' => $params['popup_interval'], 'enable_comment_social' => $params['popup_enable_comment'], 'enable_image_facebook' => $params['popup_enable_facebook'], 'enable_image_twitter' => $params['popup_enable_twitter'], 'enable_image_google' => $params['popup_enable_google'], 'watermark_type' => $params['watermark_type'], 'current_url' => $current_url);
                if ($params['watermark_type'] != 'none') {
                    $params_array['watermark_link'] = $params['watermark_link'];
                    $params_array['watermark_opacity'] = $params['watermark_opacity'];
                    $params_array['watermark_position'] = $params['watermark_position'];
                }
                if ($params['watermark_type'] == 'text') {
                    $params_array['watermark_text'] = $params['watermark_text'];
                    $params_array['watermark_font_size'] = $params['watermark_font_size'];
                    $params_array['watermark_font'] = $params['watermark_font'];
                    $params_array['watermark_color'] = $params['watermark_color'];
                } elseif ($params['watermark_type'] == 'image') {
                    $params_array['watermark_url'] = $params['watermark_url'];
                    $params_array['watermark_width'] = $params['watermark_width'];
                    $params_array['watermark_height'] = $params['watermark_height'];
                }
                list($image_thumb_width, $image_thumb_height) = getimagesize(htmlspecialchars_decode(ABSPATH . $WD_BWG_UPLOAD_DIR . $image_row->thumb_url, ENT_COMPAT | ENT_QUOTES));
                $scale = max($params['extended_album_image_thumb_width'] / $image_thumb_width, $params['extended_album_image_thumb_height'] / $image_thumb_height);
                $image_thumb_width *= $scale;
                $image_thumb_height *= $scale;
                $thumb_left = ($params['extended_album_image_thumb_width'] - $image_thumb_width) / 2;
                $thumb_top = ($params['extended_album_image_thumb_height'] - $image_thumb_height) / 2;
                ?>
                  <a style="font-size: 0;" onclick="spider_createpopup('<?php 
                echo addslashes(add_query_arg($params_array, admin_url('admin-ajax.php')));
                ?>
', '<?php 
                echo $bwg;
                ?>
', '<?php 
                echo $params['popup_width'];
                ?>
', '<?php 
                echo $params['popup_height'];
                ?>
', 1, 'testpopup', 5); return false;">
                    <span class="bwg_standart_thumb_<?php 
                echo $bwg;
                ?>
">
                      <span class="bwg_standart_thumb_spun1_<?php 
                echo $bwg;
                ?>
">
                        <span class="bwg_standart_thumb_spun2_<?php 
                echo $bwg;
                ?>
">
                          <img style="max-height:none; max-width:none; width:<?php 
                echo $image_thumb_width;
                ?>
px; height:<?php 
                echo $image_thumb_height;
                ?>
px; margin-left: <?php 
                echo $thumb_left;
                ?>
px; margin-top: <?php 
                echo $thumb_top;
                ?>
px;" id="<?php 
                echo $image_row->id;
                ?>
" src="<?php 
                echo site_url() . '/' . $WD_BWG_UPLOAD_DIR . $image_row->thumb_url;
                ?>
" alt="<?php 
                echo $image_row->alt;
                ?>
" />
                          <?php 
                if ($params['extended_album_image_title'] == 'hover') {
                    ?>
                            <span class="bwg_image_title_spun1_<?php 
                    echo $bwg;
                    ?>
">
                              <span class="bwg_image_title_spun2_<?php 
                    echo $bwg;
                    ?>
">
                                <?php 
                    echo $image_row->alt;
                    ?>
                              </span>
                            </span>
                            <?php 
                }
                ?>
                        </span>
                      </span>
                      <?php 
                if ($params['extended_album_image_title'] == 'show') {
                    ?>
                        <span class="bwg_image_title_spun1_<?php 
                    echo $bwg;
                    ?>
">
                          <span class="bwg_image_title_spun2_<?php 
                    echo $bwg;
                    ?>
">
                            <?php 
                    echo $image_row->alt;
                    ?>
                          </span>
                        </span>
                        <?php 
                }
                ?>
                    </span>
                  </a>
                  <?php 
            }
        }
        ?>
              <script>
                jQuery(".bwg_description_more_<?php 
        echo $bwg;
        ?>
").click(function () {
                  if (jQuery(this).hasClass("bwg_more")) {
                    jQuery(this).parent().find(".bwg_description_full_<?php 
        echo $bwg;
        ?>
").show();
                    jQuery(this).attr("class", "bwg_description_more_<?php 
        echo $bwg;
        ?>
 bwg_hide");
                    jQuery(this).html("<?php 
        echo __('Hide', 'bwg');
        ?>
");
                  }
                  else {
                    jQuery(this).parent().find(".bwg_description_full_<?php 
        echo $bwg;
        ?>
").hide();
                    jQuery(this).attr("class", "bwg_description_more_<?php 
        echo $bwg;
        ?>
 bwg_more");
                    jQuery(this).html("<?php 
        echo __('More', 'bwg');
        ?>
");
                  }
                });
              </script>
            </div>
            <?php 
        if ($params['extended_album_enable_page'] && $items_per_page && $theme_row->page_nav_position == 'bottom' && $page_nav['total']) {
            WDWLibrary::ajax_html_frontend_page_nav($theme_row, $page_nav['total'], $page_nav['limit'], 'gal_front_form_' . $bwg, $items_per_page, $bwg, $album_gallery_div_id, $params['album_id']);
        }
        ?>
          </div>
        </form>
        <div id="spider_popup_loading_<?php 
        echo $bwg;
        ?>
" class="spider_popup_loading"></div>
        <div id="spider_popup_overlay_<?php 
        echo $bwg;
        ?>
" class="spider_popup_overlay" onclick="spider_destroypopup(1000)"></div>
      </div>
    </div>
    <?php 
        if ($from_shortcode) {
            return;
        } else {
            die;
        }
    }
    public function display($params, $from_shortcode = 0, $bwg = 0)
    {
        global $wp;
        $current_url = $wp->query_string;
        global $WD_BWG_UPLOAD_DIR;
        require_once WD_BWG_DIR . '/framework/WDWLibrary.php';
        if (!isset($params['compuct_album_image_title'])) {
            $params['compuct_album_image_title'] = 'none';
        }
        if (!isset($params['compuct_album_view_type'])) {
            $album_view_type = 'thumbnail';
        } else {
            $album_view_type = $params['compuct_album_view_type'];
        }
        if (!isset($params['popup_fullscreen'])) {
            $params['popup_fullscreen'] = 0;
        }
        if (!isset($params['popup_autoplay'])) {
            $params['popup_autoplay'] = 0;
        }
        if (!isset($params['popup_enable_pinterest'])) {
            $params['popup_enable_pinterest'] = 0;
        }
        if (!isset($params['popup_enable_tumblr'])) {
            $params['popup_enable_tumblr'] = 0;
        }
        if (!isset($params['show_search_box'])) {
            $params['show_search_box'] = 0;
        }
        if (!isset($params['search_box_width'])) {
            $params['search_box_width'] = 180;
        }
        if (!isset($params['popup_enable_info'])) {
            $params['popup_enable_info'] = 1;
        }
        if (!isset($params['popup_info_always_show'])) {
            $params['popup_info_always_show'] = 0;
        }
        if (!isset($params['popup_info_full_width'])) {
            $params['popup_info_full_width'] = 0;
        }
        if (!isset($params['popup_enable_rate'])) {
            $params['popup_enable_rate'] = 0;
        }
        if (!isset($params['thumb_click_action']) || $params['thumb_click_action'] == 'undefined') {
            $params['thumb_click_action'] = 'open_lightbox';
        }
        if (!isset($params['thumb_link_target'])) {
            $params['thumb_link_target'] = 1;
        }
        if (!isset($params['popup_hit_counter'])) {
            $params['popup_hit_counter'] = 0;
        }
        if (!isset($params['order_by'])) {
            $params['order_by'] = ' ASC ';
        }
        if (!isset($params['show_sort_images'])) {
            $params['show_sort_images'] = 0;
        }
        $options_row = $this->model->get_options_row_data();
        if (!isset($params['show_album_name'])) {
            $params['show_album_name'] = $options_row->show_album_name;
        }
        $from = isset($params['from']) ? esc_html($params['from']) : 0;
        $type = isset($_POST['type_' . $bwg]) ? esc_html($_POST['type_' . $bwg]) : (isset($params['type']) ? $params['type'] : 'album');
        $bwg_search = isset($_POST['bwg_search_' . $bwg]) && esc_html($_POST['bwg_search_' . $bwg]) != '' ? esc_html($_POST['bwg_search_' . $bwg]) : '';
        $sort_direction = ' ' . $params['order_by'] . ' ';
        $play_icon = $options_row->play_icon;
        if ($from === "widget") {
            $params['album_id'] = $params['id'];
            $params['sort_by'] = $params['show'] == 'random' ? 'RAND()' : 'order';
            if ($params['show'] == 'last') {
                $sort_direction = ' DESC ';
            }
            $params['compuct_albums_per_page'] = $params['count'];
            $params['compuct_album_column_number'] = $options_row->album_column_number;
            $params['compuct_album_image_column_number'] = $options_row->image_column_number;
            $params['compuct_album_thumb_width'] = $params['width'];
            $params['compuct_album_thumb_height'] = $params['height'];
            $params['compuct_album_image_thumb_width'] = $params['width'];
            $params['compuct_album_image_thumb_height'] = $params['height'];
            $params['compuct_album_title'] = $options_row->album_title_show_hover;
            $params['compuct_album_enable_page'] = 0;
            $params['compuct_album_image_title'] = $options_row->image_title_show_hover;
            $params['popup_width'] = $options_row->popup_width;
            $params['popup_height'] = $options_row->popup_height;
            $params['popup_effect'] = $options_row->popup_type;
            $params['popup_enable_filmstrip'] = $options_row->popup_enable_filmstrip;
            $params['popup_filmstrip_height'] = $options_row->popup_filmstrip_height;
            $params['popup_enable_ctrl_btn'] = $options_row->popup_enable_ctrl_btn;
            $params['popup_enable_fullscreen'] = $options_row->popup_enable_fullscreen;
            $params['popup_enable_info'] = $options_row->popup_enable_info;
            $params['popup_info_always_show'] = $options_row->popup_info_always_show;
            $params['popup_info_full_width'] = $options_row->popup_info_full_width;
            $params['popup_hit_counter'] = $options_row->popup_hit_counter;
            $params['popup_enable_rate'] = $options_row->popup_enable_rate;
            $params['popup_interval'] = $options_row->popup_interval;
            $params['popup_enable_comment'] = $options_row->popup_enable_comment;
            $params['popup_enable_facebook'] = $options_row->popup_enable_facebook;
            $params['popup_enable_twitter'] = $options_row->popup_enable_twitter;
            $params['popup_enable_google'] = $options_row->popup_enable_google;
            $params['popup_enable_pinterest'] = $options_row->popup_enable_pinterest;
            $params['popup_enable_tumblr'] = $options_row->popup_enable_tumblr;
            $params['watermark_type'] = $options_row->watermark_type;
            $params['watermark_link'] = $options_row->watermark_link;
            $params['watermark_opacity'] = $options_row->watermark_opacity;
            $params['watermark_position'] = $options_row->watermark_position;
            $params['watermark_text'] = $options_row->watermark_text;
            $params['watermark_font_size'] = $options_row->watermark_font_size;
            $params['watermark_font'] = $options_row->watermark_font;
            $params['watermark_color'] = $options_row->watermark_color;
            $params['watermark_url'] = $options_row->watermark_url;
            $params['watermark_width'] = $options_row->watermark_width;
            $params['watermark_height'] = $options_row->watermark_height;
        }
        $theme_row = $this->model->get_theme_row_data($params['theme_id']);
        if (!$theme_row) {
            echo WDWLibrary::message(__('There is no theme selected or the theme was deleted.', 'bwg'), 'error');
            return;
        }
        $album_gallery_id = isset($_POST['album_gallery_id_' . $bwg]) ? esc_html($_POST['album_gallery_id_' . $bwg]) : $params['album_id'];
        $album_row_data = $this->model->get_album_row_data($album_gallery_id);
        if (!$album_gallery_id || $type == 'album' && !$album_row_data) {
            echo WDWLibrary::message(__('There is no album selected or the album was deleted.', 'bwg'), 'error');
            return;
        }
        if ($type == 'gallery') {
            $items_per_page = $params['compuct_album_images_per_page'];
            $items_col_num = $params['compuct_album_image_column_number'];
            if (isset($_POST['sortImagesByValue_' . $bwg])) {
                $sort_by = esc_html($_POST['sortImagesByValue_' . $bwg]);
                if ($sort_by == 'random') {
                    $params['sort_by'] = 'RAND()';
                } else {
                    if ($sort_by == 'default') {
                        $params['sort_by'] = $params['sort_by'];
                    } else {
                        $params['sort_by'] = $sort_by;
                    }
                }
            }
            $image_rows = $this->model->get_image_rows_data($album_gallery_id, $items_per_page, $params['sort_by'], $bwg, $sort_direction);
            $images_count = count($image_rows);
            if (!$image_rows) {
                echo WDWLibrary::message(__('There are no images in this gallery.', 'bwg'), 'error');
            }
            $page_nav = $this->model->gallery_page_nav($album_gallery_id, $items_per_page, $bwg);
            $album_gallery_div_id = 'bwg_album_compact_' . $bwg;
            $album_gallery_div_class = 'bwg_standart_thumbnails_' . $bwg;
        } else {
            $items_per_page = $params['compuct_albums_per_page'];
            $items_col_num = $params['compuct_album_column_number'];
            $album_galleries_row = $this->model->get_alb_gals_row($album_gallery_id, $items_per_page, 'order', $bwg, ' ASC ');
            if (!$album_galleries_row) {
                echo WDWLibrary::message(__('There is no album selected or the album was deleted.', 'bwg'), 'error');
                return;
            }
            $page_nav = $this->model->album_page_nav($album_gallery_id, $items_per_page, $bwg);
            $album_gallery_div_id = 'bwg_album_compact_' . $bwg;
            $album_gallery_div_class = 'bwg_album_thumbnails_' . $bwg;
        }
        if ($type == 'gallery') {
            if ($album_view_type == 'masonry') {
                $form_child_div_style = 'background-color:rgba(0, 0, 0, 0); position:relative; text-align:' . $theme_row->masonry_thumb_align . '; width:100%;';
                $form_child_div_id = 'bwg_masonry_thumbnails_div_' . $bwg;
                $album_gallery_div_id = 'bwg_masonry_thumbnails_' . $bwg;
                $album_gallery_div_class = 'bwg_masonry_thumbnails_' . $bwg;
            } else {
                $form_child_div_style = 'background-color:rgba(0, 0, 0, 0); position:relative; text-align:' . $theme_row->thumb_align . '; width:100%;';
                $form_child_div_id = '';
            }
        } else {
            $form_child_div_id = '';
            $form_child_div_style = 'background-color:rgba(0, 0, 0, 0); position:relative; text-align:' . $theme_row->album_compact_thumb_align . '; width:100%;';
        }
        $bwg_previous_album_id = isset($_POST['bwg_previous_album_id_' . $bwg]) ? esc_html($_POST['bwg_previous_album_id_' . $bwg]) : 0;
        $bwg_previous_album_page_number = isset($_POST['bwg_previous_album_page_number_' . $bwg]) ? esc_html($_POST['bwg_previous_album_page_number_' . $bwg]) : 0;
        $rgb_page_nav_font_color = WDWLibrary::spider_hex2rgb($theme_row->page_nav_font_color);
        $rgb_album_compact_thumbs_bg_color = WDWLibrary::spider_hex2rgb($theme_row->album_compact_thumbs_bg_color);
        $rgb_thumbs_bg_color = WDWLibrary::spider_hex2rgb($theme_row->thumbs_bg_color);
        ?>
	
    <style>
      /*Album thumbs styles.*/
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_album_thumb_<?php 
        echo $bwg;
        ?>
 {
        display: inline-block;
        text-align: center;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .<?php 
        echo $album_gallery_div_class;
        ?>
 * {
        -moz-box-sizing: content-box;
        box-sizing: content-box;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_album_thumb_spun1_<?php 
        echo $bwg;
        ?>
 {
        background-color: #<?php 
        echo $theme_row->album_compact_thumb_bg_color;
        ?>
;
        display: inline-block;
        height: <?php 
        echo $params['compuct_album_thumb_height'];
        ?>
px;
        margin: <?php 
        echo $theme_row->album_compact_thumb_margin;
        ?>
px;
        opacity: <?php 
        echo number_format($theme_row->album_compact_thumb_transparent / 100, 2, ".", "");
        ?>
;
        filter: Alpha(opacity=<?php 
        echo $theme_row->album_compact_thumb_transparent;
        ?>
);
        <?php 
        echo $theme_row->album_compact_thumb_transition ? 'transition: all 0.3s ease 0s;-webkit-transition: all 0.3s ease 0s;' : '';
        ?>
        padding: <?php 
        echo $theme_row->album_compact_thumb_padding;
        ?>
px;
        text-align: center;
        vertical-align: middle;
        width: <?php 
        echo $params['compuct_album_thumb_width'];
        ?>
px;
        z-index: 100;
        -webkit-backface-visibility: visible;
        -ms-backface-visibility: visible;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_album_thumb_spun1_<?php 
        echo $bwg;
        ?>
:hover {
        opacity: 1;
        filter: Alpha(opacity=100);
        transform: <?php 
        echo $theme_row->album_compact_thumb_hover_effect;
        ?>
(<?php 
        echo $theme_row->album_compact_thumb_hover_effect_value;
        ?>
);
        -ms-transform: <?php 
        echo $theme_row->album_compact_thumb_hover_effect;
        ?>
(<?php 
        echo $theme_row->album_compact_thumb_hover_effect_value;
        ?>
);
        -webkit-transform: <?php 
        echo $theme_row->album_compact_thumb_hover_effect;
        ?>
(<?php 
        echo $theme_row->album_compact_thumb_hover_effect_value;
        ?>
);
        backface-visibility: hidden;
        -webkit-backface-visibility: hidden;
        -moz-backface-visibility: hidden;
        -ms-backface-visibility: hidden;
        z-index: 102;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_album_thumb_spun2_<?php 
        echo $bwg;
        ?>
 {
        border-radius: <?php 
        echo $theme_row->album_compact_thumb_border_radius;
        ?>
;
        border: <?php 
        echo $theme_row->album_compact_thumb_border_width;
        ?>
px <?php 
        echo $theme_row->album_compact_thumb_border_style;
        ?>
 #<?php 
        echo $theme_row->album_compact_thumb_border_color;
        ?>
;
        box-shadow: <?php 
        echo $theme_row->album_compact_thumb_box_shadow;
        ?>
;
        display: inline-block;
        height: <?php 
        echo $params['compuct_album_thumb_height'];
        ?>
px;
        overflow: hidden;
        width: <?php 
        echo $params['compuct_album_thumb_width'];
        ?>
px;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_album_thumbnails_<?php 
        echo $bwg;
        ?>
 {
        display: inline-block;
        -moz-box-sizing: border-box;
        box-sizing: border-box;
        background-color: rgba(<?php 
        echo $rgb_album_compact_thumbs_bg_color['red'];
        ?>
, <?php 
        echo $rgb_album_compact_thumbs_bg_color['green'];
        ?>
, <?php 
        echo $rgb_album_compact_thumbs_bg_color['blue'];
        ?>
, <?php 
        echo number_format($theme_row->album_compact_thumb_bg_transparent / 100, 2, ".", "");
        ?>
);
        font-size: 0;
        text-align: <?php 
        echo $theme_row->album_compact_thumb_align;
        ?>
;
        max-width: <?php 
        echo $items_col_num * ($params['compuct_album_thumb_width'] + 2 * (2 + $theme_row->album_compact_thumb_margin + $theme_row->album_compact_thumb_padding + $theme_row->album_compact_thumb_border_width));
        ?>
px;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_album_thumbnails_<?php 
        echo $bwg;
        ?>
 .bwg_link {
        border: none;
        cursor: pointer;
        text-decoration: none;
        font-size: 0;
      }
      <?php 
        if ($params['compuct_album_title'] == 'show') {
            /* Show album/gallery title at the bottom.*/
            ?>
        #bwg_container1_<?php 
            echo $bwg;
            ?>
 #bwg_container2_<?php 
            echo $bwg;
            ?>
 .bwg_title_spun1_<?php 
            echo $bwg;
            ?>
 {
          display: block;
          opacity: 1;
          filter: Alpha(opacity=100);
          text-align: center;
          width: <?php 
            echo $params['compuct_album_thumb_width'];
            ?>
px;
        }
        <?php 
        } elseif ($params['compuct_album_title'] == 'hover') {
            /* Show album/gallery title on hover.*/
            ?>
        #bwg_container1_<?php 
            echo $bwg;
            ?>
 #bwg_container2_<?php 
            echo $bwg;
            ?>
 .bwg_title_spun1_<?php 
            echo $bwg;
            ?>
 {
          display: table;
          height: inherit;
          left: -3000px;
          opacity: 0;
          filter: Alpha(opacity=0);
          position: absolute;
          top: 0px;
          width: inherit;
        }
        <?php 
        }
        ?>
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_album_thumb_spun1_<?php 
        echo $bwg;
        ?>
:hover .bwg_title_spun1_<?php 
        echo $bwg;
        ?>
 {
        left: <?php 
        echo $theme_row->album_compact_thumb_padding;
        ?>
px;
        top: <?php 
        echo $theme_row->album_compact_thumb_padding;
        ?>
px;
        opacity: 1;
        filter: Alpha(opacity=100);
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_title_spun2_<?php 
        echo $bwg;
        ?>
 {
        color: #<?php 
        echo $theme_row->album_compact_title_font_color;
        ?>
;
        display: table-cell;
        font-family: <?php 
        echo $theme_row->album_compact_title_font_style;
        ?>
;
        font-size: <?php 
        echo $theme_row->album_compact_title_font_size;
        ?>
px;
        font-weight: <?php 
        echo $theme_row->album_compact_title_font_weight;
        ?>
;
        height: inherit;
        padding: <?php 
        echo $theme_row->album_compact_title_margin;
        ?>
;
        text-shadow: <?php 
        echo $theme_row->album_compact_title_shadow;
        ?>
;
        vertical-align: middle;
        width: inherit;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_album_thumbnails_<?php 
        echo $bwg;
        ?>
 {
        display: inline-block;
        -moz-box-sizing: border-box;
        box-sizing: border-box;
        background-color: rgba(<?php 
        echo $rgb_album_compact_thumbs_bg_color['red'];
        ?>
, <?php 
        echo $rgb_album_compact_thumbs_bg_color['green'];
        ?>
, <?php 
        echo $rgb_album_compact_thumbs_bg_color['blue'];
        ?>
, <?php 
        echo number_format($theme_row->album_compact_thumb_bg_transparent / 100, 2, ".", "");
        ?>
);
        font-size: 0;
        text-align: <?php 
        echo $theme_row->album_compact_thumb_align;
        ?>
;
        max-width: <?php 
        echo $items_col_num * ($params['compuct_album_thumb_width'] + 2 * (2 + $theme_row->album_compact_thumb_margin + $theme_row->album_compact_thumb_padding + $theme_row->album_compact_thumb_border_width));
        ?>
px;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_album_thumbnails_<?php 
        echo $bwg;
        ?>
 .bwg_link {
        border: none;
        cursor: pointer;
        text-decoration: none;
        font-size: 0;
      }
      /*Image thumbs styles.*/
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_standart_thumb_spun1_<?php 
        echo $bwg;
        ?>
 {
        background-color: #<?php 
        echo $theme_row->thumb_bg_color;
        ?>
;
        display: inline-block;
        height: <?php 
        echo $params['compuct_album_image_thumb_height'];
        ?>
px;
        margin: <?php 
        echo $theme_row->thumb_margin;
        ?>
px;
        opacity: <?php 
        echo number_format($theme_row->thumb_transparent / 100, 2, ".", "");
        ?>
;
        filter: Alpha(opacity=<?php 
        echo $theme_row->thumb_transparent;
        ?>
);
        <?php 
        echo $theme_row->thumb_transition ? 'transition: all 0.3s ease 0s;-webkit-transition: all 0.3s ease 0s;' : '';
        ?>
        padding: <?php 
        echo $theme_row->thumb_padding;
        ?>
px;
        text-align: center;
        vertical-align: middle;
        width: <?php 
        echo $params['compuct_album_image_thumb_width'];
        ?>
px;
        z-index: 100;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_standart_thumb_spun1_<?php 
        echo $bwg;
        ?>
:hover {
        -ms-transform: <?php 
        echo $theme_row->thumb_hover_effect;
        ?>
(<?php 
        echo $theme_row->thumb_hover_effect_value;
        ?>
);
        -webkit-transform: <?php 
        echo $theme_row->thumb_hover_effect;
        ?>
(<?php 
        echo $theme_row->thumb_hover_effect_value;
        ?>
);
        backface-visibility: hidden;
        -webkit-backface-visibility: hidden;
        -moz-backface-visibility: hidden;
        -ms-backface-visibility: hidden;
        opacity: 1;
        filter: Alpha(opacity=100);
        transform: <?php 
        echo $theme_row->thumb_hover_effect;
        ?>
(<?php 
        echo $theme_row->thumb_hover_effect_value;
        ?>
);
        z-index: 102;
        position: relative;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_standart_thumb_spun2_<?php 
        echo $bwg;
        ?>
 {
        border-radius: <?php 
        echo $theme_row->thumb_border_radius;
        ?>
;
        border: <?php 
        echo $theme_row->thumb_border_width;
        ?>
px <?php 
        echo $theme_row->thumb_border_style;
        ?>
 #<?php 
        echo $theme_row->thumb_border_color;
        ?>
;
        box-shadow: <?php 
        echo $theme_row->thumb_box_shadow;
        ?>
;
        display: inline-block;
        height: <?php 
        echo $params['compuct_album_image_thumb_height'];
        ?>
px;
        overflow: hidden;
        width: <?php 
        echo $params['compuct_album_image_thumb_width'];
        ?>
px;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_standart_thumbnails_<?php 
        echo $bwg;
        ?>
 {
        -moz-box-sizing: border-box;
        display: inline-block;
        background-color: rgba(<?php 
        echo $rgb_thumbs_bg_color['red'];
        ?>
, <?php 
        echo $rgb_thumbs_bg_color['green'];
        ?>
, <?php 
        echo $rgb_thumbs_bg_color['blue'];
        ?>
, <?php 
        echo number_format($theme_row->thumb_bg_transparent / 100, 2, ".", "");
        ?>
);
        box-sizing: border-box;
        font-size: 0;
        max-width: <?php 
        echo $params['compuct_album_image_column_number'] * ($params['compuct_album_image_thumb_width'] + 2 * (2 + $theme_row->thumb_margin + $theme_row->thumb_padding + $theme_row->thumb_border_width));
        ?>
px;
        text-align: <?php 
        echo $theme_row->thumb_align;
        ?>
;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_standart_thumbnails_<?php 
        echo $bwg;
        ?>
 .bwg_link {
        border: none;
        cursor: pointer;
        text-decoration: none;
        font-size: 0;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_standart_thumb_<?php 
        echo $bwg;
        ?>
 {
        display: inline-block;
        text-align: center;
      }
      <?php 
        if ($params['compuct_album_image_title'] == 'show') {
            /* Show image title at the bottom.*/
            ?>
        #bwg_container1_<?php 
            echo $bwg;
            ?>
 #bwg_container2_<?php 
            echo $bwg;
            ?>
 .bwg_image_title_spun1_<?php 
            echo $bwg;
            ?>
 {
          display: block;
          margin: 0 auto;
          opacity: 1;
          filter: Alpha(opacity=100);
          text-align: center;
          width: <?php 
            echo $params['compuct_album_thumb_width'];
            ?>
px;
        }
        <?php 
        } elseif ($params['compuct_album_image_title'] == 'hover') {
            /* Show image title on hover.*/
            ?>
        #bwg_container1_<?php 
            echo $bwg;
            ?>
 #bwg_container2_<?php 
            echo $bwg;
            ?>
 .bwg_image_title_spun1_<?php 
            echo $bwg;
            ?>
 {
          display: table;
          height: inherit;
          left: -3000px;
          opacity: 0;
          filter: Alpha(opacity=0);
          position: absolute;
          top: 0px;
          width: inherit;
        }
        <?php 
        }
        ?>
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_standart_thumb_spun1_<?php 
        echo $bwg;
        ?>
:hover .bwg_image_title_spun1_<?php 
        echo $bwg;
        ?>
 {
        left: <?php 
        echo $theme_row->thumb_padding;
        ?>
px;
        top: <?php 
        echo $theme_row->thumb_padding;
        ?>
px;
        opacity: 1;
        filter: Alpha(opacity=100);
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_image_title_spun2_<?php 
        echo $bwg;
        ?>
 {
        color: #<?php 
        echo $theme_row->thumb_title_font_color;
        ?>
;
        display: table-cell;
        font-family: <?php 
        echo $theme_row->thumb_title_font_style;
        ?>
;
        font-size: <?php 
        echo $theme_row->thumb_title_font_size;
        ?>
px;
        font-weight: <?php 
        echo $theme_row->thumb_title_font_weight;
        ?>
;
        height: inherit;
        margin: <?php 
        echo $theme_row->thumb_title_margin;
        ?>
;
        text-shadow: <?php 
        echo $theme_row->thumb_title_shadow;
        ?>
;
        vertical-align: middle;
        width: inherit;
        word-wrap: break-word;
      }
      /*Pagination styles.*/
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .tablenav-pages_<?php 
        echo $bwg;
        ?>
 {
        text-align: <?php 
        echo $theme_row->page_nav_align;
        ?>
;
        font-size: <?php 
        echo $theme_row->page_nav_font_size;
        ?>
px;
        font-family: <?php 
        echo $theme_row->page_nav_font_style;
        ?>
;
        font-weight: <?php 
        echo $theme_row->page_nav_font_weight;
        ?>
;
        color: #<?php 
        echo $theme_row->page_nav_font_color;
        ?>
;
        margin: 6px 0 4px;
        display: block;
        height: 30px;
        line-height: 30px;
      }
      @media only screen and (max-width : 320px) {
        #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .displaying-num_<?php 
        echo $bwg;
        ?>
 {
          display: none;
        }
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .displaying-num_<?php 
        echo $bwg;
        ?>
 {
        font-size: <?php 
        echo $theme_row->page_nav_font_size;
        ?>
px;
        font-family: <?php 
        echo $theme_row->page_nav_font_style;
        ?>
;
        font-weight: <?php 
        echo $theme_row->page_nav_font_weight;
        ?>
;
        color: #<?php 
        echo $theme_row->page_nav_font_color;
        ?>
;
        margin-right: 10px;
        vertical-align: middle;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .paging-input_<?php 
        echo $bwg;
        ?>
 {
        font-size: <?php 
        echo $theme_row->page_nav_font_size;
        ?>
px;
        font-family: <?php 
        echo $theme_row->page_nav_font_style;
        ?>
;
        font-weight: <?php 
        echo $theme_row->page_nav_font_weight;
        ?>
;
        color: #<?php 
        echo $theme_row->page_nav_font_color;
        ?>
;
        vertical-align: middle;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .tablenav-pages_<?php 
        echo $bwg;
        ?>
 a.disabled,
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .tablenav-pages_<?php 
        echo $bwg;
        ?>
 a.disabled:hover,
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .tablenav-pages_<?php 
        echo $bwg;
        ?>
 a.disabled:focus {
        cursor: default;
        color: rgba(<?php 
        echo $rgb_page_nav_font_color['red'];
        ?>
, <?php 
        echo $rgb_page_nav_font_color['green'];
        ?>
, <?php 
        echo $rgb_page_nav_font_color['blue'];
        ?>
, 0.5);
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .tablenav-pages_<?php 
        echo $bwg;
        ?>
 a {
        cursor: pointer;
        font-size: <?php 
        echo $theme_row->page_nav_font_size;
        ?>
px;
        font-family: <?php 
        echo $theme_row->page_nav_font_style;
        ?>
;
        font-weight: <?php 
        echo $theme_row->page_nav_font_weight;
        ?>
;
        color: #<?php 
        echo $theme_row->page_nav_font_color;
        ?>
;
        text-decoration: none;
        padding: <?php 
        echo $theme_row->page_nav_padding;
        ?>
;
        margin: <?php 
        echo $theme_row->page_nav_margin;
        ?>
;
        border-radius: <?php 
        echo $theme_row->page_nav_border_radius;
        ?>
;
        border-style: <?php 
        echo $theme_row->page_nav_border_style;
        ?>
;
        border-width: <?php 
        echo $theme_row->page_nav_border_width;
        ?>
px;
        border-color: #<?php 
        echo $theme_row->page_nav_border_color;
        ?>
;
        background-color: #<?php 
        echo $theme_row->page_nav_button_bg_color;
        ?>
;
        opacity: <?php 
        echo number_format($theme_row->page_nav_button_bg_transparent / 100, 2, ".", "");
        ?>
;
        filter: Alpha(opacity=<?php 
        echo $theme_row->page_nav_button_bg_transparent;
        ?>
);
        box-shadow: <?php 
        echo $theme_row->page_nav_box_shadow;
        ?>
;
        <?php 
        echo $theme_row->page_nav_button_transition ? 'transition: all 0.3s ease 0s;-webkit-transition: all 0.3s ease 0s;' : '';
        ?>
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_back_<?php 
        echo $bwg;
        ?>
 {
        background-color: rgba(0, 0, 0, 0);
        color: #<?php 
        echo $theme_row->album_compact_back_font_color;
        ?>
 !important;
        cursor: pointer;
        display: block;
        font-family: <?php 
        echo $theme_row->album_compact_back_font_style;
        ?>
;
        font-size: <?php 
        echo $theme_row->album_compact_back_font_size;
        ?>
px;
        font-weight: <?php 
        echo $theme_row->album_compact_back_font_weight;
        ?>
;
        text-decoration: none;
        padding: <?php 
        echo $theme_row->album_compact_back_padding;
        ?>
;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 #spider_popup_overlay_<?php 
        echo $bwg;
        ?>
 {
        background-color: #<?php 
        echo $theme_row->lightbox_overlay_bg_color;
        ?>
;
        opacity: <?php 
        echo number_format($theme_row->lightbox_overlay_bg_transparent / 100, 2, ".", "");
        ?>
;
        filter: Alpha(opacity=<?php 
        echo $theme_row->lightbox_overlay_bg_transparent;
        ?>
);
      }
      .bwg_play_icon_spun_<?php 
        echo $bwg;
        ?>
	 {
        width: inherit;
        height: inherit;
        display: table;
        position: absolute;
      }	 
     .bwg_play_icon_<?php 
        echo $bwg;
        ?>
 {
        color: #<?php 
        echo $theme_row->thumb_title_font_color;
        ?>
;
        font-size: <?php 
        echo 2 * $theme_row->thumb_title_font_size;
        ?>
px;
        vertical-align: middle;
        display: table-cell !important;
        z-index: 1;
        text-align: center;
        margin: 0 auto;
      }
    </style>
		<?php 
        $album_row = $this->model->get_album_row_data($album_gallery_id);
        ?>
				
    <div id="bwg_container1_<?php 
        echo $bwg;
        ?>
">
      <div id="bwg_container2_<?php 
        echo $bwg;
        ?>
">
        <form id="gal_front_form_<?php 
        echo $bwg;
        ?>
" method="post" action="#">
          <?php 
        if ($params['show_search_box'] && $type == 'gallery') {
            WDWLibrary::ajax_html_frontend_search_box('gal_front_form_' . $bwg, $bwg, $album_gallery_div_id, $images_count, $params['search_box_width']);
        }
        if (isset($params['show_sort_images']) && $params['show_sort_images'] && $type == 'gallery') {
            WDWLibrary::ajax_html_frontend_sort_box('gal_front_form_' . $bwg, $bwg, $album_gallery_div_id, $params['sort_by'], $params['search_box_width']);
        }
        ?>
          <div id="<?php 
        echo $form_child_div_id;
        ?>
" style="<?php 
        echo $form_child_div_style;
        ?>
">
            <div id="ajax_loading_<?php 
        echo $bwg;
        ?>
" style="position:absolute;width: 100%; z-index: 115; text-align: center; height: 100%; vertical-align: middle; display: none;">
              <div style="display: table; vertical-align: middle; width: 100%; height: 100%; background-color: #FFFFFF; opacity: 0.7; filter: Alpha(opacity=70);">
                <div style="display: table-cell; text-align: center; position: relative; vertical-align: middle;" >
                  <div id="loading_div_<?php 
        echo $bwg;
        ?>
" style="display: inline-block; text-align:center; position:relative; vertical-align:middle;">
                    <img src="<?php 
        echo WD_BWG_URL . '/images/ajax_loader.png';
        ?>
" class="spider_ajax_loading" style="float: none; width:50px;">
                  </div>
                </div>
              </div>
            </div>
            <?php 
        if ($params['compuct_album_enable_page'] && $items_per_page && $theme_row->page_nav_position == 'top' && $page_nav['total']) {
            WDWLibrary::ajax_html_frontend_page_nav($theme_row, $page_nav['total'], $page_nav['limit'], 'gal_front_form_' . $bwg, $items_per_page, $bwg, $album_gallery_div_id, $params['album_id'], $type);
        }
        if ($bwg_previous_album_id) {
            ?>
              <a class="bwg_back_<?php 
            echo $bwg;
            ?>
" onclick="spider_frontend_ajax('gal_front_form_<?php 
            echo $bwg;
            ?>
', '<?php 
            echo $bwg;
            ?>
', '<?php 
            echo $album_gallery_div_id;
            ?>
', 'back')"><?php 
            echo __('Back', 'bwg');
            ?>
</a>
              <?php 
        }
        if ($options_row->show_album_name) {
            if ($type == 'gallery') {
                ?>
              <div class="bwg_back_<?php 
                echo $bwg;
                ?>
" ><?php 
                echo isset($_POST['title_' . $bwg]) ? esc_html($_POST['title_' . $bwg]) : '';
                ?>
</div>
              <?php 
            } else {
                ?>
	      <div class="bwg_back_<?php 
                echo $bwg;
                ?>
"><?php 
                echo $album_row->name;
                ?>
</div>
	      	<?php 
            }
        }
        ?>
            <div id="<?php 
        echo $album_gallery_div_id;
        ?>
" class="<?php 
        echo $album_gallery_div_class;
        ?>
" >
              <input type="hidden" id="bwg_previous_album_id_<?php 
        echo $bwg;
        ?>
" name="bwg_previous_album_id_<?php 
        echo $bwg;
        ?>
" value="<?php 
        echo $bwg_previous_album_id;
        ?>
" />
              <input type="hidden" id="bwg_previous_album_page_number_<?php 
        echo $bwg;
        ?>
" name="bwg_previous_album_page_number_<?php 
        echo $bwg;
        ?>
" value="<?php 
        echo $bwg_previous_album_page_number;
        ?>
" />
              <?php 
        if ($type != 'gallery') {
            if (!$page_nav['total']) {
                ?>
                  <span class="bwg_back_<?php 
                echo $bwg;
                ?>
"><?php 
                echo __('Album is empty.', 'bwg');
                ?>
</span>
                  <?php 
            }
            foreach ($album_galleries_row as $album_galallery_row) {
                if ($album_galallery_row->is_album) {
                    $album_row = $this->model->get_album_row_data($album_galallery_row->alb_gal_id);
                    if (!$album_row) {
                        continue;
                    }
                    $preview_image = $album_row->preview_image;
                    if (!$preview_image) {
                        $preview_image = $album_row->random_preview_image;
                    }
                    $def_type = 'album';
                    $title = $album_row->name;
                    $permalink = $album_row->permalink;
                } else {
                    $gallery_row = $this->model->get_gallery_row_data($album_galallery_row->alb_gal_id);
                    if (!$gallery_row) {
                        continue;
                    }
                    $preview_image = $gallery_row->preview_image;
                    if (!$preview_image) {
                        $preview_image = $gallery_row->random_preview_image;
                    }
                    $def_type = 'gallery';
                    $title = $gallery_row->name;
                    $permalink = $gallery_row->permalink;
                }
                $local_preview_image = true;
                $parsed_prev_url = parse_url($preview_image, PHP_URL_SCHEME);
                if ($parsed_prev_url == 'http' || $parsed_prev_url == 'https') {
                    $local_preview_image = false;
                }
                if (!$preview_image) {
                    $preview_url = WD_BWG_URL . '/images/no-image.png';
                    $preview_path = WD_BWG_DIR . '/images/no-image.png';
                } else {
                    if ($local_preview_image) {
                        $preview_url = site_url() . '/' . $WD_BWG_UPLOAD_DIR . $preview_image;
                        $preview_path = ABSPATH . $WD_BWG_UPLOAD_DIR . $preview_image;
                    } else {
                        $preview_url = $preview_image;
                        $preview_path = $preview_image;
                    }
                }
                if ($local_preview_image) {
                    list($image_thumb_width, $image_thumb_height) = getimagesize(htmlspecialchars_decode($preview_path, ENT_COMPAT | ENT_QUOTES));
                    $scale = max($params['compuct_album_thumb_width'] / $image_thumb_width, $params['compuct_album_thumb_height'] / $image_thumb_height);
                    $image_thumb_width *= $scale;
                    $image_thumb_height *= $scale;
                    $thumb_left = ($params['compuct_album_thumb_width'] - $image_thumb_width) / 2;
                    $thumb_top = ($params['compuct_album_thumb_height'] - $image_thumb_height) / 2;
                } else {
                    $image_thumb_width = $params['compuct_album_thumb_width'];
                    $image_thumb_height = $params['compuct_album_thumb_height'];
                    $thumb_left = 0;
                    $thumb_top = 0;
                }
                if ($type != 'gallery') {
                    ?>
                    <a class="bwg_link" <?php 
                    echo "href='" . ($from !== "widget" ? $local_preview_image ? str_replace("/thumb/", "/", $preview_url) : $preview_url : $permalink) . "'";
                    ?>
 
                    <?php 
                    echo $from !== "widget" ? " onclick=\"spider_frontend_ajax('gal_front_form_" . $bwg . "', '" . $bwg . "', 'bwg_album_compact_" . $bwg . "', '" . $album_galallery_row->alb_gal_id . "', '" . $album_gallery_id . "', '" . $def_type . "', '', '" . htmlspecialchars(addslashes($title)) . "', 'default'); return false;\"" : 'onclick="window.location=' . "'" . $permalink . "'" . '"';
                    ?>
>  
                      <span class="bwg_album_thumb_<?php 
                    echo $bwg;
                    ?>
">
                        <?php 
                    if ($params['compuct_album_title'] == 'show' && $theme_row->album_compact_thumb_title_pos == 'top') {
                        ?>
                          <span class="bwg_title_spun1_<?php 
                        echo $bwg;
                        ?>
">
                            <span class="bwg_title_spun2_<?php 
                        echo $bwg;
                        ?>
">
                              <?php 
                        echo $title;
                        ?>
                            </span>
                          </span>
                          <?php 
                    }
                    ?>
                        <span class="bwg_album_thumb_spun1_<?php 
                    echo $bwg;
                    ?>
">
                          <span class="bwg_album_thumb_spun2_<?php 
                    echo $bwg;
                    ?>
">
                            <img style="padding: 0 !important; max-height: none !important; max-width: none !important; width: <?php 
                    echo $image_thumb_width;
                    ?>
px; height:<?php 
                    echo $image_thumb_height;
                    ?>
px; margin-left: <?php 
                    echo $thumb_left;
                    ?>
px; margin-top: <?php 
                    echo $thumb_top;
                    ?>
px;" src="<?php 
                    echo $preview_url;
                    ?>
" alt="<?php 
                    echo $title;
                    ?>
" />
                            <?php 
                    if ($params['compuct_album_title'] == 'hover') {
                        ?>
                              <span class="bwg_title_spun1_<?php 
                        echo $bwg;
                        ?>
">
                                <span class="bwg_title_spun2_<?php 
                        echo $bwg;
                        ?>
">
                                  <?php 
                        echo $title;
                        ?>
                                </span>
                              </span>
                              <?php 
                    }
                    ?>
                          </span>
                        </span>
                        <?php 
                    if ($params['compuct_album_title'] == 'show' && $theme_row->album_compact_thumb_title_pos == 'bottom') {
                        ?>
                          <span class="bwg_title_spun1_<?php 
                        echo $bwg;
                        ?>
">
                            <span class="bwg_title_spun2_<?php 
                        echo $bwg;
                        ?>
">
                              <?php 
                        echo $title;
                        ?>
                            </span>
                          </span>
                          <?php 
                    }
                    ?>
                      </span>
                    </a>
                    <?php 
                }
            }
        } elseif ($type == 'gallery') {
            if (!$page_nav['total']) {
                if ($bwg_search != '') {
                    ?>
                    <span class="bwg_back_<?php 
                    echo $bwg;
                    ?>
"><?php 
                    echo __('There are no images matching your search.', 'bwg');
                    ?>
</span>
                    <?php 
                } else {
                    ?>
                    <span class="bwg_back_<?php 
                    echo $bwg;
                    ?>
"><?php 
                    echo __('Gallery is empty.', 'bwg');
                    ?>
</span>
                    <?php 
                }
            }
            foreach ($image_rows as $image_row) {
                $params_array = array('action' => 'GalleryBox', 'current_view' => $bwg, 'image_id' => isset($_POST['image_id']) ? esc_html($_POST['image_id']) : $image_row->id, 'gallery_id' => $album_gallery_id, 'theme_id' => $params['theme_id'], 'thumb_width' => $params['compuct_album_image_thumb_width'], 'thumb_height' => $params['compuct_album_image_thumb_height'], 'open_with_fullscreen' => $params['popup_fullscreen'], 'open_with_autoplay' => $params['popup_autoplay'], 'image_width' => $params['popup_width'], 'image_height' => $params['popup_height'], 'image_effect' => $params['popup_effect'], 'wd_sor' => $params['sort_by'], 'wd_ord' => $params['order_by'], 'enable_image_filmstrip' => $params['popup_enable_filmstrip'], 'image_filmstrip_height' => $params['popup_filmstrip_height'], 'enable_image_ctrl_btn' => $params['popup_enable_ctrl_btn'], 'enable_image_fullscreen' => $params['popup_enable_fullscreen'], 'popup_enable_info' => $params['popup_enable_info'], 'popup_info_always_show' => $params['popup_info_always_show'], 'popup_info_full_width' => $params['popup_info_full_width'], 'popup_hit_counter' => $params['popup_hit_counter'], 'popup_enable_rate' => $params['popup_enable_rate'], 'slideshow_interval' => $params['popup_interval'], 'enable_comment_social' => $params['popup_enable_comment'], 'enable_image_facebook' => $params['popup_enable_facebook'], 'enable_image_twitter' => $params['popup_enable_twitter'], 'enable_image_google' => $params['popup_enable_google'], 'enable_image_pinterest' => $params['popup_enable_pinterest'], 'enable_image_tumblr' => $params['popup_enable_tumblr'], 'watermark_type' => $params['watermark_type'], 'current_url' => $current_url);
                if ($params['watermark_type'] != 'none') {
                    $params_array['watermark_link'] = $params['watermark_link'];
                    $params_array['watermark_opacity'] = $params['watermark_opacity'];
                    $params_array['watermark_position'] = $params['watermark_position'];
                }
                if ($params['watermark_type'] == 'text') {
                    $params_array['watermark_text'] = $params['watermark_text'];
                    $params_array['watermark_font_size'] = $params['watermark_font_size'];
                    $params_array['watermark_font'] = $params['watermark_font'];
                    $params_array['watermark_color'] = $params['watermark_color'];
                } elseif ($params['watermark_type'] == 'image') {
                    $params_array['watermark_url'] = $params['watermark_url'];
                    $params_array['watermark_width'] = $params['watermark_width'];
                    $params_array['watermark_height'] = $params['watermark_height'];
                }
                $is_video = $image_row->filetype == "YOUTUBE" || $image_row->filetype == "VIMEO";
                $is_embed = preg_match('/EMBED/', $image_row->filetype) == 1 ? true : false;
                $is_embed_video = preg_match('/VIDEO/', $image_row->filetype) == 1 ? true : false;
                if (!$is_embed) {
                    list($image_thumb_width, $image_thumb_height) = getimagesize(htmlspecialchars_decode(ABSPATH . $WD_BWG_UPLOAD_DIR . $image_row->thumb_url, ENT_COMPAT | ENT_QUOTES));
                } else {
                    if ($image_row->resolution != '') {
                        $resolution_arr = explode(" ", $image_row->resolution);
                        $resolution_w = intval($resolution_arr[0]);
                        $resolution_h = intval($resolution_arr[2]);
                        if ($resolution_w != 0 && $resolution_h != 0) {
                            $scale = $scale = max($params['compuct_album_image_thumb_width'] / $resolution_w, $params['compuct_album_image_thumb_height'] / $resolution_h);
                            $image_thumb_width = $resolution_w * $scale;
                            $image_thumb_height = $resolution_h * $scale;
                        } else {
                            $image_thumb_width = $params['compuct_album_image_thumb_width'];
                            $image_thumb_height = $params['compuct_album_image_thumb_height'];
                        }
                    } else {
                        $image_thumb_width = $params['compuct_album_image_thumb_width'];
                        $image_thumb_height = $params['compuct_album_image_thumb_height'];
                    }
                }
                $scale = max($params['compuct_album_image_thumb_width'] / $image_thumb_width, $params['compuct_album_image_thumb_height'] / $image_thumb_height);
                $image_thumb_width *= $scale;
                $image_thumb_height *= $scale;
                $thumb_left = ($params['compuct_album_image_thumb_width'] - $image_thumb_width) / 2;
                $thumb_top = ($params['compuct_album_image_thumb_height'] - $image_thumb_height) / 2;
                ?>
                  <a class="bwg_link" <?php 
                echo $params['thumb_click_action'] == 'open_lightbox' ? 'href="' . ($is_embed ? $image_row->thumb_url : site_url() . '/' . $WD_BWG_UPLOAD_DIR . $image_row->image_url) . '"' : ($image_row->redirect_url ? 'href="' . $image_row->redirect_url . '"' : '');
                ?>
 
                  <?php 
                echo $params['thumb_click_action'] == 'open_lightbox' ? ' onclick="spider_createpopup(\'' . addslashes(add_query_arg($params_array, admin_url('admin-ajax.php'))) . '\', ' . $bwg . ', ' . $params['popup_width'] . ', ' . $params['popup_height'] . ', 1, \'testpopup\', 5); return false;"' : ($image_row->redirect_url ? $params['thumb_link_target'] ? ' onclick="window.open(' . "'" . $image_row->redirect_url . "'," . "'" . '_blank' . "'" . ')"' : 'onclick="window.location=' . "'" . $image_row->redirect_url . "'" . '"' : '');
                ?>
>

                    <span class="bwg_standart_thumb_<?php 
                echo $bwg;
                ?>
">
                      <?php 
                if ($params['compuct_album_image_title'] == 'show' && $theme_row->album_compact_thumb_title_pos == 'top') {
                    ?>
                        <span class="bwg_image_title_spun1_<?php 
                    echo $bwg;
                    ?>
">
                          <span class="bwg_image_title_spun2_<?php 
                    echo $bwg;
                    ?>
">
                            <?php 
                    echo $image_row->alt;
                    ?>
                          </span>
                        </span>
                        <?php 
                }
                ?>
                      <span class="bwg_standart_thumb_spun1_<?php 
                echo $bwg;
                ?>
">
                        <span class="bwg_standart_thumb_spun2_<?php 
                echo $bwg;
                ?>
">
                          <?php 
                if ($play_icon && $is_embed_video) {
                    ?>
                          <span class="bwg_play_icon_spun_<?php 
                    echo $bwg;
                    ?>
">
                             <i title="<?php 
                    echo __('Play', 'bwg');
                    ?>
"  class="fa fa-play bwg_play_icon_<?php 
                    echo $bwg;
                    ?>
"></i>
                          </span>
                            <?php 
                }
                if ($params['compuct_album_image_title'] == 'hover') {
                    ?>
                            <span class="bwg_image_title_spun1_<?php 
                    echo $bwg;
                    ?>
">
                              <span class="bwg_image_title_spun2_<?php 
                    echo $bwg;
                    ?>
">
                                <?php 
                    echo $image_row->alt;
                    ?>
                              </span>
                            </span>
                            <?php 
                }
                ?>
                          <img style="max-height:none; max-width:none; width:<?php 
                echo $image_thumb_width;
                ?>
px; height:<?php 
                echo $image_thumb_height;
                ?>
px; margin-left: <?php 
                echo $thumb_left;
                ?>
px; margin-top: <?php 
                echo $thumb_top;
                ?>
px;" id="<?php 
                echo $image_row->id;
                ?>
" src="<?php 
                echo ($is_embed ? "" : site_url() . '/' . $WD_BWG_UPLOAD_DIR) . $image_row->thumb_url;
                ?>
" alt="<?php 
                echo $image_row->alt;
                ?>
" />
                        </span>
                      </span>
                      <?php 
                if ($params['compuct_album_image_title'] == 'show' && $theme_row->album_compact_thumb_title_pos == 'bottom') {
                    ?>
                        <span class="bwg_image_title_spun1_<?php 
                    echo $bwg;
                    ?>
">
                          <span class="bwg_image_title_spun2_<?php 
                    echo $bwg;
                    ?>
">
                            <?php 
                    echo $image_row->alt;
                    ?>
                          </span>
                        </span>
                        <?php 
                }
                ?>
                    </span>
                  </a>
                  <?php 
            }
        }
        ?>
            </div>
            <?php 
        if ($params['compuct_album_enable_page'] && $items_per_page && $theme_row->page_nav_position == 'bottom' && $page_nav['total']) {
            WDWLibrary::ajax_html_frontend_page_nav($theme_row, $page_nav['total'], $page_nav['limit'], 'gal_front_form_' . $bwg, $items_per_page, $bwg, $album_gallery_div_id, $params['album_id'], $type);
        }
        ?>
          </div>
        </form>
        <div id="spider_popup_loading_<?php 
        echo $bwg;
        ?>
" class="spider_popup_loading"></div>
        <div id="spider_popup_overlay_<?php 
        echo $bwg;
        ?>
" class="spider_popup_overlay" onclick="spider_destroypopup(1000)"></div>
      </div>
    </div>

    <?php 
        if ($from_shortcode) {
            return;
        } else {
            die;
        }
    }
    public function display($params, $from_shortcode = 0, $bwg = 0)
    {
        global $wp;
        $current_url = $wp->query_string;
        global $WD_BWG_UPLOAD_DIR;
        require_once WD_BWG_DIR . '/framework/WDWLibrary.php';
        if (!isset($params['image_title'])) {
            $params['image_title'] = 'none';
        }
        $from = isset($params['from']) ? esc_html($params['from']) : 0;
        $sort_direction = ' ASC ';
        if ($from) {
            $options_row = $this->model->get_options_row_data();
            $params['gallery_id'] = $params['id'];
            $params['images_per_page'] = $params['count'];
            $params['sort_by'] = $params['show'] == 'random' ? 'RAND()' : 'order';
            if ($params['show'] == 'last') {
                $sort_direction = ' DESC ';
            }
            $params['image_enable_page'] = 0;
            $params['image_title'] = $options_row->image_title_show_hover;
            $params['thumb_height'] = $params['height'];
            $params['thumb_width'] = $params['width'];
            $params['image_column_number'] = $params['count'];
            $params['popup_width'] = $options_row->popup_width;
            $params['popup_height'] = $options_row->popup_height;
            $params['popup_effect'] = $options_row->popup_type;
            $params['popup_enable_filmstrip'] = $options_row->popup_enable_filmstrip;
            $params['popup_filmstrip_height'] = $options_row->popup_filmstrip_height;
            $params['popup_enable_ctrl_btn'] = $options_row->popup_enable_ctrl_btn;
            $params['popup_enable_fullscreen'] = $options_row->popup_enable_fullscreen;
            $params['popup_interval'] = $options_row->popup_interval;
            $params['popup_enable_comment'] = $options_row->popup_enable_comment;
            $params['popup_enable_facebook'] = $options_row->popup_enable_facebook;
            $params['popup_enable_twitter'] = $options_row->popup_enable_twitter;
            $params['popup_enable_google'] = $options_row->popup_enable_google;
            $params['watermark_type'] = $options_row->watermark_type;
            $params['watermark_link'] = $options_row->watermark_link;
            $params['watermark_opacity'] = $options_row->watermark_opacity;
            $params['watermark_position'] = $options_row->watermark_position;
            $params['watermark_text'] = $options_row->watermark_text;
            $params['watermark_font_size'] = $options_row->watermark_font_size;
            $params['watermark_font'] = $options_row->watermark_font;
            $params['watermark_color'] = $options_row->watermark_color;
            $params['watermark_url'] = $options_row->watermark_url;
            $params['watermark_width'] = $options_row->watermark_width;
            $params['watermark_height'] = $options_row->watermark_height;
        }
        $theme_row = $this->model->get_theme_row_data($params['theme_id']);
        if (!$theme_row) {
            echo WDWLibrary::message(__('There is no theme selected or the theme was deleted.', 'bwg'), 'error');
            return;
        }
        if (isset($params['type'])) {
            $type = $params['type'];
        } else {
            $type = "";
        }
        $gallery_row = $this->model->get_gallery_row_data($params['gallery_id']);
        if (!$gallery_row && $type == '') {
            echo WDWLibrary::message(__('There is no gallery selected or the gallery was deleted.', 'bwg'), 'error');
            return;
        }
        $image_rows = $this->model->get_image_rows_data($params['gallery_id'], $params['images_per_page'], $params['sort_by'], $bwg, $type, $sort_direction);
        if (!$image_rows) {
            echo WDWLibrary::message(__('There are no images in this gallery.', 'bwg'), 'error');
        }
        if ($params['image_enable_page'] && $params['images_per_page']) {
            $page_nav = $this->model->page_nav($params['gallery_id'], $params['images_per_page'], $bwg, $type);
        }
        $rgb_page_nav_font_color = WDWLibrary::spider_hex2rgb($theme_row->page_nav_font_color);
        $rgb_thumbs_bg_color = WDWLibrary::spider_hex2rgb($theme_row->thumbs_bg_color);
        ?>
    <style>
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_standart_thumbnails_<?php 
        echo $bwg;
        ?>
 * {
        -moz-box-sizing: border-box;
        box-sizing: border-box;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_standart_thumb_spun1_<?php 
        echo $bwg;
        ?>
 {
        -moz-box-sizing: content-box;
        box-sizing: content-box;
        background-color: #<?php 
        echo $theme_row->thumb_bg_color;
        ?>
;
        border: <?php 
        echo $theme_row->thumb_border_width;
        ?>
px <?php 
        echo $theme_row->thumb_border_style;
        ?>
 #<?php 
        echo $theme_row->thumb_border_color;
        ?>
;
        border-radius: <?php 
        echo $theme_row->thumb_border_radius;
        ?>
;
        box-shadow: <?php 
        echo $theme_row->thumb_box_shadow;
        ?>
;
        display: inline-block;
        height: <?php 
        echo $params['thumb_height'];
        ?>
px;
        margin: <?php 
        echo $theme_row->thumb_margin;
        ?>
px;
        padding: <?php 
        echo $theme_row->thumb_padding;
        ?>
px;
        opacity: <?php 
        echo $theme_row->thumb_transparent / 100;
        ?>
;
        filter: Alpha(opacity=<?php 
        echo $theme_row->thumb_transparent;
        ?>
);
        text-align: center;
        vertical-align: middle;
        <?php 
        echo $theme_row->thumb_transition ? 'transition: all 0.3s ease 0s;-webkit-transition: all 0.3s ease 0s;' : '';
        ?>
        width: <?php 
        echo $params['thumb_width'];
        ?>
px;
        z-index: 100;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_standart_thumb_spun1_<?php 
        echo $bwg;
        ?>
:hover {
        -ms-transform: <?php 
        echo $theme_row->thumb_hover_effect;
        ?>
(<?php 
        echo $theme_row->thumb_hover_effect_value;
        ?>
);
        -webkit-transform: <?php 
        echo $theme_row->thumb_hover_effect;
        ?>
(<?php 
        echo $theme_row->thumb_hover_effect_value;
        ?>
);
        backface-visibility: hidden;
        -webkit-backface-visibility: hidden;
        -moz-backface-visibility: hidden;
        -ms-backface-visibility: hidden;
        opacity: 1;
        filter: Alpha(opacity=100);
        transform: <?php 
        echo $theme_row->thumb_hover_effect;
        ?>
(<?php 
        echo $theme_row->thumb_hover_effect_value;
        ?>
);
        z-index: 102;
        position: relative;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_standart_thumb_spun2_<?php 
        echo $bwg;
        ?>
 {
        display: inline-block;
        height: <?php 
        echo $params['thumb_height'];
        ?>
px;
        overflow: hidden;
        width: <?php 
        echo $params['thumb_width'];
        ?>
px;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_standart_thumbnails_<?php 
        echo $bwg;
        ?>
 {
        background-color: rgba(<?php 
        echo $rgb_thumbs_bg_color['red'];
        ?>
, <?php 
        echo $rgb_thumbs_bg_color['green'];
        ?>
, <?php 
        echo $rgb_thumbs_bg_color['blue'];
        ?>
, <?php 
        echo $theme_row->thumb_bg_transparent / 100;
        ?>
);
        display: inline-block;
        font-size: 0;
        max-width: <?php 
        echo $params['image_column_number'] * ($params['thumb_width'] + 2 * (2 + $theme_row->thumb_margin + $theme_row->thumb_padding + $theme_row->thumb_border_width));
        ?>
px;
        text-align: <?php 
        echo $theme_row->thumb_align;
        ?>
;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_standart_thumbnails_<?php 
        echo $bwg;
        ?>
 a {
        cursor: pointer;
        text-decoration: none;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_standart_thumb_<?php 
        echo $bwg;
        ?>
 {
        display: inline-block;
        text-align: center;
      }
      <?php 
        if ($params['image_title'] == 'show') {
            /* Show image title at the bottom.*/
            ?>
        #bwg_container1_<?php 
            echo $bwg;
            ?>
 #bwg_container2_<?php 
            echo $bwg;
            ?>
 .bwg_title_spun1_<?php 
            echo $bwg;
            ?>
 {
          display: block;
          margin: 0 auto;
          opacity: 1;
          filter: Alpha(opacity=100);
          text-align: center;
          width: <?php 
            echo $params['thumb_width'];
            ?>
px;
        }
        <?php 
        } elseif ($params['image_title'] == 'hover') {
            /* Show image title on hover.*/
            ?>
        #bwg_container1_<?php 
            echo $bwg;
            ?>
 #bwg_container2_<?php 
            echo $bwg;
            ?>
 .bwg_title_spun1_<?php 
            echo $bwg;
            ?>
 {
          display: table;
          height: inherit;
          left: -3000px;
          opacity: 0;
          filter: Alpha(opacity=0);
          position: absolute;
          top: 0px;
          width: inherit;
        }
        <?php 
        }
        ?>
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_standart_thumb_spun1_<?php 
        echo $bwg;
        ?>
:hover .bwg_title_spun1_<?php 
        echo $bwg;
        ?>
 {
        left: <?php 
        echo $theme_row->thumb_padding;
        ?>
px;
        top: <?php 
        echo $theme_row->thumb_padding;
        ?>
px;
        opacity: 1;
        filter: Alpha(opacity=100);
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_title_spun2_<?php 
        echo $bwg;
        ?>
 {
        color: #<?php 
        echo $theme_row->thumb_title_font_color;
        ?>
;
        display: table-cell;
        font-family: <?php 
        echo $theme_row->thumb_title_font_style;
        ?>
;
        font-size: <?php 
        echo $theme_row->thumb_title_font_size;
        ?>
px;
        font-weight: <?php 
        echo $theme_row->thumb_title_font_weight;
        ?>
;
        height: inherit;
        margin: <?php 
        echo $theme_row->thumb_title_margin;
        ?>
;
        text-shadow: <?php 
        echo $theme_row->thumb_title_shadow;
        ?>
;
        vertical-align: middle;
        width: inherit;
        word-break: break-all;
        word-wrap: break-word;
      }
      /*pagination styles*/
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .tablenav-pages_<?php 
        echo $bwg;
        ?>
 {
        text-align: <?php 
        echo $theme_row->page_nav_align;
        ?>
;
        font-size: <?php 
        echo $theme_row->page_nav_font_size;
        ?>
px;
        font-family: <?php 
        echo $theme_row->page_nav_font_style;
        ?>
;
        font-weight: <?php 
        echo $theme_row->page_nav_font_weight;
        ?>
;
        color: #<?php 
        echo $theme_row->page_nav_font_color;
        ?>
;
        margin: 6px 0 4px;
        display: block;
        height: 30px;
        line-height: 30px;
      }
      @media only screen and (max-width : 320px) {
        #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .displaying-num_<?php 
        echo $bwg;
        ?>
 {
          display: none;
        }
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .displaying-num_<?php 
        echo $bwg;
        ?>
 {
        font-size: <?php 
        echo $theme_row->page_nav_font_size;
        ?>
px;
        font-family: <?php 
        echo $theme_row->page_nav_font_style;
        ?>
;
        font-weight: <?php 
        echo $theme_row->page_nav_font_weight;
        ?>
;
        color: #<?php 
        echo $theme_row->page_nav_font_color;
        ?>
;
        margin-right: 10px;
        vertical-align: middle;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .paging-input_<?php 
        echo $bwg;
        ?>
 {
        font-size: <?php 
        echo $theme_row->page_nav_font_size;
        ?>
px;
        font-family: <?php 
        echo $theme_row->page_nav_font_style;
        ?>
;
        font-weight: <?php 
        echo $theme_row->page_nav_font_weight;
        ?>
;
        color: #<?php 
        echo $theme_row->page_nav_font_color;
        ?>
;
        vertical-align: middle;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .tablenav-pages_<?php 
        echo $bwg;
        ?>
 a.disabled,
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .tablenav-pages_<?php 
        echo $bwg;
        ?>
 a.disabled:hover,
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .tablenav-pages_<?php 
        echo $bwg;
        ?>
 a.disabled:focus {
        cursor: default;
        color: rgba(<?php 
        echo $rgb_page_nav_font_color['red'];
        ?>
, <?php 
        echo $rgb_page_nav_font_color['green'];
        ?>
, <?php 
        echo $rgb_page_nav_font_color['blue'];
        ?>
, 0.5);
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .tablenav-pages_<?php 
        echo $bwg;
        ?>
 a {
        cursor: pointer;
        font-size: <?php 
        echo $theme_row->page_nav_font_size;
        ?>
px;
        font-family: <?php 
        echo $theme_row->page_nav_font_style;
        ?>
;
        font-weight: <?php 
        echo $theme_row->page_nav_font_weight;
        ?>
;
        color: #<?php 
        echo $theme_row->page_nav_font_color;
        ?>
;
        text-decoration: none;
        padding: <?php 
        echo $theme_row->page_nav_padding;
        ?>
;
        margin: <?php 
        echo $theme_row->page_nav_margin;
        ?>
;
        border-radius: <?php 
        echo $theme_row->page_nav_border_radius;
        ?>
;
        border-style: <?php 
        echo $theme_row->page_nav_border_style;
        ?>
;
        border-width: <?php 
        echo $theme_row->page_nav_border_width;
        ?>
px;
        border-color: #<?php 
        echo $theme_row->page_nav_border_color;
        ?>
;
        background-color: #<?php 
        echo $theme_row->page_nav_button_bg_color;
        ?>
;
        opacity: <?php 
        echo $theme_row->page_nav_button_bg_transparent / 100;
        ?>
;
        filter: Alpha(opacity=<?php 
        echo $theme_row->page_nav_button_bg_transparent;
        ?>
);
        box-shadow: <?php 
        echo $theme_row->page_nav_box_shadow;
        ?>
;
        <?php 
        echo $theme_row->page_nav_button_transition ? 'transition: all 0.3s ease 0s;-webkit-transition: all 0.3s ease 0s;' : '';
        ?>
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 #spider_popup_overlay_<?php 
        echo $bwg;
        ?>
 {
        background-color: #<?php 
        echo $theme_row->lightbox_overlay_bg_color;
        ?>
;
        opacity: <?php 
        echo $theme_row->lightbox_overlay_bg_transparent / 100;
        ?>
;
        filter: Alpha(opacity=<?php 
        echo $theme_row->lightbox_overlay_bg_transparent;
        ?>
);
      }
    </style>

    <div id="bwg_container1_<?php 
        echo $bwg;
        ?>
">
      <div id="bwg_container2_<?php 
        echo $bwg;
        ?>
">
        <form id="gal_front_form_<?php 
        echo $bwg;
        ?>
" method="post" action="#">
          <div style="background-color:rgba(0, 0, 0, 0); text-align:center; width:100%;">
            <?php 
        if ($params['image_enable_page'] && $params['images_per_page'] && $theme_row->page_nav_position == 'top') {
            WDWLibrary::ajax_html_frontend_page_nav($theme_row, $page_nav['total'], $page_nav['limit'], 'gal_front_form_' . $bwg, $params['images_per_page'], $bwg, 'bwg_standart_thumbnails_' . $bwg);
        }
        ?>
            <div id="bwg_standart_thumbnails_<?php 
        echo $bwg;
        ?>
" class="bwg_standart_thumbnails_<?php 
        echo $bwg;
        ?>
">
              <div id="ajax_loading_<?php 
        echo $bwg;
        ?>
" style="position:absolute;">
                <div id="opacity_div_<?php 
        echo $bwg;
        ?>
" style="display:none; background-color:#FFFFFF; opacity:0.7; filter:Alpha(opacity=70); position:absolute; z-index:105;"></div>
                <span id="loading_div_<?php 
        echo $bwg;
        ?>
" style="display:none; text-align:center; position:relative; vertical-align:middle; z-index:107">
                  <img src="<?php 
        echo WD_BWG_URL . '/images/ajax_loader.png';
        ?>
" class="spider_ajax_loading" style="float: none; width:50px;">
                </span>
              </div>
              <?php 
        foreach ($image_rows as $image_row) {
            $params_array = array('tag_id' => isset($params['type']) ? $params['gallery_id'] : 0, 'action' => 'GalleryBox', 'current_view' => $bwg, 'image_id' => isset($_POST['image_id']) ? esc_html($_POST['image_id']) : $image_row->id, 'gallery_id' => $params['gallery_id'], 'theme_id' => $params['theme_id'], 'thumb_width' => $params['thumb_width'], 'thumb_height' => $params['thumb_height'], 'image_width' => $params['popup_width'], 'image_height' => $params['popup_height'], 'image_effect' => $params['popup_effect'], 'sort_by' => isset($params['type']) ? 'order' : ($params['sort_by'] == 'RAND()' ? 'order' : $params['sort_by']), 'enable_image_filmstrip' => $params['popup_enable_filmstrip'], 'image_filmstrip_height' => $params['popup_filmstrip_height'], 'enable_image_ctrl_btn' => $params['popup_enable_ctrl_btn'], 'enable_image_fullscreen' => $params['popup_enable_fullscreen'], 'slideshow_interval' => $params['popup_interval'], 'enable_comment_social' => $params['popup_enable_comment'], 'enable_image_facebook' => $params['popup_enable_facebook'], 'enable_image_twitter' => $params['popup_enable_twitter'], 'enable_image_google' => $params['popup_enable_google'], 'watermark_type' => $params['watermark_type'], 'current_url' => $current_url);
            if ($params['watermark_type'] != 'none') {
                $params_array['watermark_link'] = $params['watermark_link'];
                $params_array['watermark_opacity'] = $params['watermark_opacity'];
                $params_array['watermark_position'] = $params['watermark_position'];
            }
            if ($params['watermark_type'] == 'text') {
                $params_array['watermark_text'] = $params['watermark_text'];
                $params_array['watermark_font_size'] = $params['watermark_font_size'];
                $params_array['watermark_font'] = $params['watermark_font'];
                $params_array['watermark_color'] = $params['watermark_color'];
            } elseif ($params['watermark_type'] == 'image') {
                $params_array['watermark_url'] = $params['watermark_url'];
                $params_array['watermark_width'] = $params['watermark_width'];
                $params_array['watermark_height'] = $params['watermark_height'];
            }
            list($image_thumb_width, $image_thumb_height) = getimagesize(htmlspecialchars_decode(ABSPATH . $WD_BWG_UPLOAD_DIR . $image_row->thumb_url, ENT_COMPAT | ENT_QUOTES));
            $scale = max($params['thumb_width'] / $image_thumb_width, $params['thumb_height'] / $image_thumb_height);
            $image_thumb_width *= $scale;
            $image_thumb_height *= $scale;
            $thumb_left = ($params['thumb_width'] - $image_thumb_width) / 2;
            $thumb_top = ($params['thumb_height'] - $image_thumb_height) / 2;
            ?>
                <a style="font-size: 0;" onclick="spider_createpopup('<?php 
            echo addslashes(add_query_arg($params_array, admin_url('admin-ajax.php')));
            ?>
', '<?php 
            echo $bwg;
            ?>
', '<?php 
            echo $params['popup_width'];
            ?>
', '<?php 
            echo $params['popup_height'];
            ?>
', 1, 'testpopup', 5); return false;">
                  <span class="bwg_standart_thumb_<?php 
            echo $bwg;
            ?>
">
                    <span class="bwg_standart_thumb_spun1_<?php 
            echo $bwg;
            ?>
">
                      <span class="bwg_standart_thumb_spun2_<?php 
            echo $bwg;
            ?>
">
                        <img class="bwg_standart_thumb_img_<?php 
            echo $bwg;
            ?>
" style="max-height: none !important;  max-width: none !important; padding: 0 !important; width:<?php 
            echo $image_thumb_width;
            ?>
px; height:<?php 
            echo $image_thumb_height;
            ?>
px; margin-left: <?php 
            echo $thumb_left;
            ?>
px; margin-top: <?php 
            echo $thumb_top;
            ?>
px;" id="<?php 
            echo $image_row->id;
            ?>
" src="<?php 
            echo site_url() . '/' . $WD_BWG_UPLOAD_DIR . $image_row->thumb_url;
            ?>
" alt="<?php 
            echo $image_row->alt;
            ?>
" />
                        <?php 
            if ($params['image_title'] == 'hover') {
                ?>
                          <span class="bwg_title_spun1_<?php 
                echo $bwg;
                ?>
">
                            <span class="bwg_title_spun2_<?php 
                echo $bwg;
                ?>
">
                              <?php 
                echo $image_row->alt;
                ?>
                            </span>
                          </span>
                          <?php 
            }
            ?>
                      </span>
                    </span>
                    <?php 
            if ($params['image_title'] == 'show') {
                ?>
                      <span class="bwg_title_spun1_<?php 
                echo $bwg;
                ?>
">
                        <span class="bwg_title_spun2_<?php 
                echo $bwg;
                ?>
">
                          <?php 
                echo $image_row->alt;
                ?>
                        </span>
                      </span>
                      <?php 
            }
            ?>
                  </span>
                </a>
                <?php 
        }
        ?>
            </div>
            <?php 
        if ($params['image_enable_page'] && $params['images_per_page'] && $theme_row->page_nav_position == 'bottom') {
            WDWLibrary::ajax_html_frontend_page_nav($theme_row, $page_nav['total'], $page_nav['limit'], 'gal_front_form_' . $bwg, $params['images_per_page'], $bwg, 'bwg_standart_thumbnails_' . $bwg);
        }
        ?>
          </div>
        </form>
        <div id="spider_popup_loading_<?php 
        echo $bwg;
        ?>
" class="spider_popup_loading"></div>
        <div id="spider_popup_overlay_<?php 
        echo $bwg;
        ?>
" class="spider_popup_overlay" onclick="spider_destroypopup(1000)"></div>
      </div>
    </div>
    <?php 
        if ($from_shortcode) {
            return;
        } else {
            die;
        }
    }
    public function display($params, $from_shortcode = 0, $bwg = 0)
    {
        global $wp;
        $current_url = $wp->query_string;
        global $WD_BWG_UPLOAD_DIR;
        require_once WD_BWG_DIR . '/framework/WDWLibrary.php';
        $theme_row = $this->model->get_theme_row_data($params['theme_id']);
        if (!$theme_row) {
            echo WDWLibrary::message(__('There is no theme selected or the theme was deleted.', 'bwg'), 'error');
            return;
        }
        $gallery_row = $this->model->get_gallery_row_data($params['gallery_id']);
        if (!$gallery_row) {
            echo WDWLibrary::message(__('There is no gallery selected or the gallery was deleted.', 'bwg'), 'error');
            return;
        }
        $image_rows = $this->model->get_image_rows_data($params['gallery_id'], 1, $params['sort_by'], $bwg);
        if (!$image_rows) {
            echo WDWLibrary::message(__('There are no images in this gallery.', 'bwg'), 'error');
        }
        $page_nav = $this->model->page_nav($params['gallery_id'], 1, $bwg);
        $rgb_page_nav_font_color = WDWLibrary::spider_hex2rgb($theme_row->page_nav_font_color);
        $image_browser_images_conteiner = WDWLibrary::spider_hex2rgb($theme_row->image_browser_full_bg_color);
        $bwg_image_browser_image = WDWLibrary::spider_hex2rgb($theme_row->image_browser_bg_color);
        $image_title = $params['image_browser_title_enable'];
        $enable_image_description = $params['image_browser_description_enable'];
        $params_array = array('action' => 'GalleryBox', 'current_view' => $bwg, 'gallery_id' => $params['gallery_id'], 'theme_id' => $params['theme_id'], 'image_width' => $params['popup_width'], 'image_height' => $params['popup_height'], 'image_effect' => $params['popup_effect'], 'sort_by' => $params['sort_by'], 'enable_image_filmstrip' => $params['popup_enable_filmstrip'], 'image_filmstrip_height' => $params['popup_filmstrip_height'], 'enable_image_ctrl_btn' => $params['popup_enable_ctrl_btn'], 'enable_image_fullscreen' => $params['popup_enable_fullscreen'], 'slideshow_interval' => $params['popup_interval'], 'enable_comment_social' => $params['popup_enable_comment'], 'enable_image_facebook' => $params['popup_enable_facebook'], 'enable_image_twitter' => $params['popup_enable_twitter'], 'enable_image_google' => $params['popup_enable_google'], 'watermark_type' => $params['watermark_type'], 'current_url' => $current_url);
        if ($params['watermark_type'] == 'none') {
            $show_watermark = FALSE;
        }
        if ($params['watermark_type'] != 'none') {
            $params_array['watermark_link'] = $params['watermark_link'];
            $params_array['watermark_opacity'] = $params['watermark_opacity'];
            $params_array['watermark_position'] = $params['watermark_position'] != 'undefined' ? $params['watermark_position'] : 'top-center';
            $position = explode('-', $params_array['watermark_position']);
            $vertical_align = $position[0];
            $text_align = $position[1];
        }
        if ($params['watermark_type'] == 'text') {
            $show_watermark = TRUE;
            $watermark_text_image = TRUE;
            $params_array['watermark_text'] = $params['watermark_text'];
            $params_array['watermark_font_size'] = $params['watermark_font_size'];
            $params_array['watermark_font'] = $params['watermark_font'];
            $params_array['watermark_color'] = $params['watermark_color'];
            $params_array['watermark_width'] = '';
            $watermark_image_or_text = $params_array['watermark_text'];
            $watermark_a = 'bwg_watermark_text_' . $bwg;
            $watermark_div = 'class="bwg_image_browser_watermark_text_' . $bwg . '"';
        } elseif ($params['watermark_type'] == 'image') {
            $show_watermark = TRUE;
            $watermark_text_image = FALSE;
            $params_array['watermark_url'] = $params['watermark_url'];
            $params_array['watermark_width'] = $params['watermark_width'];
            $params_array['watermark_height'] = $params['watermark_height'];
            $watermark_image_or_text = '<img class="bwg_image_browser_watermark_img_' . $bwg . '" src="' . $params_array['watermark_url'] . '" />';
            $watermark_a = '';
            $watermark_div = 'class="bwg_image_browser_watermark_' . $bwg . '"';
        }
        ?>
    <style>
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .image_browser_images_conteiner_<?php 
        echo $bwg;
        ?>
 * {
        -moz-box-sizing: border-box;
        box-sizing: border-box;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .image_browser_images_conteiner_<?php 
        echo $bwg;
        ?>
{
				background-color: rgba(<?php 
        echo $image_browser_images_conteiner['red'];
        ?>
, <?php 
        echo $image_browser_images_conteiner['green'];
        ?>
, <?php 
        echo $image_browser_images_conteiner['blue'];
        ?>
, <?php 
        echo $theme_row->image_browser_full_transparent / 100;
        ?>
);
				text-align: center;
				width: 100%;
				border-style: <?php 
        echo $theme_row->image_browser_full_border_style;
        ?>
;
				border-width: <?php 
        echo $theme_row->image_browser_full_border_width;
        ?>
px;
				border-color: #<?php 
        echo $theme_row->image_browser_full_border_color;
        ?>
;
				padding: <?php 
        echo $theme_row->image_browser_full_padding;
        ?>
;
				border-radius: <?php 
        echo $theme_row->image_browser_full_border_radius;
        ?>
;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .image_browser_images_<?php 
        echo $bwg;
        ?>
 {
				display: inline-block;
				-moz-box-sizing: border-box;
				box-sizing: border-box;
				font-size: 0;
				text-align: center;
				max-width: 100%;
				width: <?php 
        echo $params['image_browser_width'];
        ?>
px;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .image_browser_image_buttons_conteiner_<?php 
        echo $bwg;
        ?>
 {
				text-align: <?php 
        echo $theme_row->image_browser_align;
        ?>
;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .image_browser_image_buttons_<?php 
        echo $bwg;
        ?>
 {
				display: inline-block;
				width:100%;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_image_browser_image_<?php 
        echo $bwg;
        ?>
 {
        background-color: rgba(<?php 
        echo $bwg_image_browser_image['red'];
        ?>
, <?php 
        echo $bwg_image_browser_image['green'];
        ?>
, <?php 
        echo $bwg_image_browser_image['blue'];
        ?>
, <?php 
        echo $theme_row->image_browser_transparent / 100;
        ?>
);
				text-align: center;
				display: inline-block;
				vertical-align: middle;
				margin: <?php 
        echo $theme_row->image_browser_margin;
        ?>
;
				padding: <?php 
        echo $theme_row->image_browser_padding;
        ?>
;
				border-radius: <?php 
        echo $theme_row->image_browser_border_radius;
        ?>
;
				border: <?php 
        echo $theme_row->image_browser_border_width;
        ?>
px <?php 
        echo $theme_row->image_browser_border_style;
        ?>
 #<?php 
        echo $theme_row->image_browser_border_color;
        ?>
;
				box-shadow: <?php 
        echo $theme_row->image_browser_box_shadow;
        ?>
;
				/*z-index: 100;*/
				position: relative;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_image_alt_<?php 
        echo $bwg;
        ?>
{
				display: table;
				width: 100%;
				font-size: <?php 
        echo $theme_row->image_browser_img_font_size;
        ?>
px;
				font-family: <?php 
        echo $theme_row->image_browser_img_font_family;
        ?>
;
				color: #<?php 
        echo $theme_row->image_browser_img_font_color;
        ?>
;
				text-align:<?php 
        echo $theme_row->image_browser_image_description_align;
        ?>
;
				padding-left: 8px;
        word-break: break-all;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_image_browser_img_<?php 
        echo $bwg;
        ?>
 {
        padding: 0 !important;
				max-width: 100% !important;
				height: inherit !important;
				width: 100%;				
      }
      @media only screen and (max-width : 320px) {
				#bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .displaying-num_<?php 
        echo $bwg;
        ?>
 {
				  display: none;
				}
				#bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_image_alt_<?php 
        echo $bwg;
        ?>
 {
				  font-size: 10px !important;
				}
				#bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_watermark_text_<?php 
        echo $bwg;
        ?>
,
				#bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_watermark_text_<?php 
        echo $bwg;
        ?>
:hover {
				  font-size: 10px !important;
				  text-decoration: none;
				  margin: 4px;
				  font-family: <?php 
        echo $params_array['watermark_font'];
        ?>
;
				  color: #<?php 
        echo $params_array['watermark_color'];
        ?>
 !important;
				  opacity: <?php 
        echo $params_array['watermark_opacity'] / 100;
        ?>
;
			  	filter: Alpha(opacity=<?php 
        echo $params_array['watermark_opacity'];
        ?>
);
          text-decoration: none;
				  position: relative;
				  z-index: 10141;
				}
				#bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_image_browser_image_description_<?php 
        echo $bwg;
        ?>
 {
          color: #<?php 
        echo $theme_row->image_browser_img_font_color;
        ?>
;
				  display: table;
				  width: 100%;
				  text-align: left;
				  font-size: 8px !important;
				  font-family: <?php 
        echo $theme_row->image_browser_img_font_family;
        ?>
;
				  padding: <?php 
        echo $theme_row->image_browser_image_description_padding;
        ?>
;
				  /*word-break: break-all;*/
				  border-style: <?php 
        echo $theme_row->image_browser_image_description_border_style;
        ?>
;
				  background-color: #<?php 
        echo $theme_row->image_browser_image_description_bg_color;
        ?>
;
				  border-radius: <?php 
        echo $theme_row->image_browser_image_description_border_radius;
        ?>
;
				  border-width: <?php 
        echo $theme_row->image_browser_image_description_border_width;
        ?>
px;
				}
				#bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .tablenav-pages_<?php 
        echo $bwg;
        ?>
 a {
				  font-size: 10px !important;
				}				
      }
      /*pagination styles*/
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .tablenav-pages_<?php 
        echo $bwg;
        ?>
 {
				text-align: <?php 
        echo $theme_row->page_nav_align;
        ?>
;
				font-size: <?php 
        echo $theme_row->page_nav_font_size;
        ?>
px;
				font-family: <?php 
        echo $theme_row->page_nav_font_style;
        ?>
;
				font-weight: <?php 
        echo $theme_row->page_nav_font_weight;
        ?>
;
				color: #<?php 
        echo $theme_row->page_nav_font_color;
        ?>
;
				margin: 6px 0 4px;
				display: block;
				height: 30px;
				line-height: 30px;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .displaying-num_<?php 
        echo $bwg;
        ?>
 {
				font-size: <?php 
        echo $theme_row->page_nav_font_size;
        ?>
px;
				font-family: <?php 
        echo $theme_row->page_nav_font_style;
        ?>
;
				font-weight: <?php 
        echo $theme_row->page_nav_font_weight;
        ?>
;
				color: #<?php 
        echo $theme_row->page_nav_font_color;
        ?>
;
				margin-right: 10px;
				vertical-align: middle;
				display: none;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .paging-input_<?php 
        echo $bwg;
        ?>
 {
				font-size: <?php 
        echo $theme_row->page_nav_font_size;
        ?>
px;
				font-family: <?php 
        echo $theme_row->page_nav_font_style;
        ?>
;
				font-weight: <?php 
        echo $theme_row->page_nav_font_weight;
        ?>
;
				color: #<?php 
        echo $theme_row->page_nav_font_color;
        ?>
;
				vertical-align: middle;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .tablenav-pages_<?php 
        echo $bwg;
        ?>
 a.disabled,
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .tablenav-pages_<?php 
        echo $bwg;
        ?>
 a.disabled:hover,
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .tablenav-pages_<?php 
        echo $bwg;
        ?>
 a.disabled:focus {
				cursor: default;
				color: rgba(<?php 
        echo $rgb_page_nav_font_color['red'];
        ?>
, <?php 
        echo $rgb_page_nav_font_color['green'];
        ?>
, <?php 
        echo $rgb_page_nav_font_color['blue'];
        ?>
, 0.5);
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .tablenav-pages_<?php 
        echo $bwg;
        ?>
 a.next-page:hover,
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .tablenav-pages_<?php 
        echo $bwg;
        ?>
 a.prev-page:hover {
        color: #000000;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .tablenav-pages_<?php 
        echo $bwg;
        ?>
 a {
				cursor: pointer;
				font-size: 15px;
				font-family: <?php 
        echo $theme_row->page_nav_font_style;
        ?>
;
				font-weight: <?php 
        echo $theme_row->page_nav_font_weight;
        ?>
;
				color: #<?php 
        echo $theme_row->page_nav_font_color;
        ?>
;
				text-decoration: none;
				padding: 0% 7%;
				margin: <?php 
        echo $theme_row->page_nav_margin;
        ?>
;
				border-radius: <?php 
        echo $theme_row->page_nav_border_radius;
        ?>
;
				border-style: none;
				border-width: <?php 
        echo $theme_row->page_nav_border_width;
        ?>
px;
				border-color: #<?php 
        echo $theme_row->page_nav_border_color;
        ?>
;
				background-color: #<?php 
        echo $theme_row->page_nav_button_bg_color;
        ?>
;
				opacity: <?php 
        echo $theme_row->page_nav_button_bg_transparent / 100;
        ?>
;
				filter: Alpha(opacity=<?php 
        echo $theme_row->page_nav_button_bg_transparent;
        ?>
);
				<?php 
        echo $theme_row->page_nav_button_transition ? 'transition: all 0.3s ease 0s;-webkit-transition: all 0.3s ease 0s;' : '';
        ?>
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .tablenav-pages_<?php 
        echo $bwg;
        ?>
 .first-page,
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .tablenav-pages_<?php 
        echo $bwg;
        ?>
 .last-page {
        padding: 0% 2%; 		        
      }
	    #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .tablenav-pages_<?php 
        echo $bwg;
        ?>
 .next-page {
        margin: 0% 4% 0% 0%; 		        
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .tablenav-pages_<?php 
        echo $bwg;
        ?>
 .prev-page {
        margin: 0% 0% 0% 4%; 		        
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 #spider_popup_overlay_<?php 
        echo $bwg;
        ?>
 {
				background-color: #<?php 
        echo $theme_row->lightbox_overlay_bg_color;
        ?>
;
        opacity: <?php 
        echo $theme_row->lightbox_overlay_bg_transparent / 100;
        ?>
;
        filter: Alpha(opacity=<?php 
        echo $theme_row->lightbox_overlay_bg_transparent;
        ?>
);
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_image_browser_image_desp_<?php 
        echo $bwg;
        ?>
 {
				display: table;
				clear: both;
				text-align: center;
        padding: <?php 
        echo $theme_row->image_browser_image_description_margin;
        ?>
;
				width: 100%;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_image_browser_image_description_<?php 
        echo $bwg;
        ?>
 {
        color: #<?php 
        echo $theme_row->image_browser_img_font_color;
        ?>
;
				display: table;
				width: 100%;
				text-align: left;
				font-size: <?php 
        echo $theme_row->image_browser_img_font_size;
        ?>
px;
				font-family: <?php 
        echo $theme_row->image_browser_img_font_family;
        ?>
;
				padding: <?php 
        echo $theme_row->image_browser_image_description_padding;
        ?>
;
				word-break: break-all;
				border-style: <?php 
        echo $theme_row->image_browser_image_description_border_style;
        ?>
;
				background-color: #<?php 
        echo $theme_row->image_browser_image_description_bg_color;
        ?>
;
				border-radius: <?php 
        echo $theme_row->image_browser_image_description_border_radius;
        ?>
;
				border-width: <?php 
        echo $theme_row->image_browser_image_description_border_width;
        ?>
px;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_image_browser_image_alt_<?php 
        echo $bwg;
        ?>
 {
      	display:table;
        clear: both;
        text-align: center;
        padding: 8px;
        width: 100%;
      }
      /*watermark*/
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_watermark_text_<?php 
        echo $bwg;
        ?>
,
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_watermark_text_<?php 
        echo $bwg;
        ?>
:hover {
				text-decoration: none;
				margin: 4px;
				font-size: <?php 
        echo $params_array['watermark_font_size'];
        ?>
px;
				font-family: <?php 
        echo $params_array['watermark_font'];
        ?>
;
				color: #<?php 
        echo $params_array['watermark_color'];
        ?>
 !important;
				opacity: <?php 
        echo $params_array['watermark_opacity'] / 100;
        ?>
;
				filter: Alpha(opacity=<?php 
        echo $params_array['watermark_opacity'];
        ?>
);
				position: relative;
				z-index: 10141;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_image_browser_image_contain_<?php 
        echo $bwg;
        ?>
{
				position: absolute;
				text-align: center;
				vertical-align: middle;
				width: 100%;
				height: 100%;
				cursor: pointer;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_image_browser_watermark_contain_<?php 
        echo $bwg;
        ?>
{
        display: table;
				vertical-align: middle;
				width: 100%;
				height: 100%;
      }	 
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_image_browser_watermark_cont_<?php 
        echo $bwg;
        ?>
{
        display: table-cell;
				text-align: <?php 
        echo $text_align;
        ?>
;
				position: relative;
				vertical-align: <?php 
        echo $vertical_align;
        ?>
;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_image_browser_watermark_<?php 
        echo $bwg;
        ?>
{
				display: inline-block;
				overflow: hidden;
				position: relative;
				vertical-align: middle;
				z-index: 10140;
				width: <?php 
        echo $params_array['watermark_width'];
        ?>
px;
				max-width: <?php 
        echo $params_array['watermark_width'] / $params['image_browser_width'] * 100;
        ?>
%;
				margin: 10px 10px 10px 10px ;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_image_browser_watermark_text_<?php 
        echo $bwg;
        ?>
{
        display: inline-block;
				overflow: hidden;
				position: relative;
				vertical-align: middle;
				z-index: 10140;
				margin: 10px 10px 10px 10px ;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_image_browser_watermark_img_<?php 
        echo $bwg;
        ?>
{
				max-width: 100%;
				opacity: <?php 
        echo $params_array['watermark_opacity'] / 100;
        ?>
;
				filter: Alpha(opacity=<?php 
        echo $params_array['watermark_opacity'];
        ?>
);
				position: relative;
				z-index: 10141;
      }
      #bwg_container1_<?php 
        echo $bwg;
        ?>
 #bwg_container2_<?php 
        echo $bwg;
        ?>
 .bwg_none_selectable {
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        -khtml-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
      }
    </style>
    <div id="bwg_container1_<?php 
        echo $bwg;
        ?>
">
      <div id="bwg_container2_<?php 
        echo $bwg;
        ?>
">
        <form id="gal_front_form_<?php 
        echo $bwg;
        ?>
" method="post" action="#">
          <div class="image_browser_images_conteiner_<?php 
        echo $bwg;
        ?>
">
            <div class="image_browser_images_<?php 
        echo $bwg;
        ?>
" id="bwg_standart_thumbnails_<?php 
        echo $bwg;
        ?>
" >
              <div id="ajax_loading_<?php 
        echo $bwg;
        ?>
" style="position:absolute;">
                <div id="opacity_div_<?php 
        echo $bwg;
        ?>
" style="display:none; background-color: rgba(255, 255, 255, 0.7); position:absolute; z-index:105;"></div>
                <span id="loading_div_<?php 
        echo $bwg;
        ?>
" style="display:none; text-align:center; position:relative; vertical-align:middle; z-index:107">
                  <img src="<?php 
        echo WD_BWG_URL . '/images/ajax_loader.png';
        ?>
" class="spider_ajax_loading" style="float: none; width:50px;">
                </span>
              </div>
              <?php 
        if ($theme_row->page_nav_position == 'top') {
            WDWLibrary::ajax_html_frontend_page_nav($theme_row, $page_nav['total'], $page_nav['limit'], 'gal_front_form_' . $bwg, 1, $bwg, 'bwg_standart_thumbnails_' . $bwg);
        }
        foreach ($image_rows as $image_row) {
            $params_array['image_id'] = isset($_POST['image_id']) ? esc_html($_POST['image_id']) : $image_row->id;
            $popup_url = add_query_arg(array($params_array), admin_url('admin-ajax.php'));
            ?>
  
                <div class="image_browser_image_buttons_conteiner_<?php 
            echo $bwg;
            ?>
">
                  <div class="image_browser_image_buttons_<?php 
            echo $bwg;
            ?>
">
                    <div class="bwg_image_browser_image_alt_<?php 
            echo $bwg;
            ?>
">
                      <?php 
            if ($image_title) {
                ?>
                        <div class="bwg_image_alt_<?php 
                echo $bwg;
                ?>
" id="alt<?php 
                echo $image_row->id;
                ?>
">
                          <?php 
                echo $image_row->alt;
                ?>
                        </div>
                      <?php 
            }
            ?>
                    </div> 
                    <div class="bwg_image_browser_image_<?php 
            echo $bwg;
            ?>
">
                      <?php 
            if ($show_watermark) {
                ?>
                        <div class="bwg_image_browser_image_contain_<?php 
                echo $bwg;
                ?>
" id="bwg_image_browser_image_contain_<?php 
                echo $image_row->id;
                ?>
">
                          <div class="bwg_image_browser_watermark_contain_<?php 
                echo $bwg;
                ?>
">
                            <div class="bwg_image_browser_watermark_cont_<?php 
                echo $bwg;
                ?>
">
                              <div <?php 
                echo $watermark_div;
                ?>
 >
                                <a class="bwg_none_selectable <?php 
                echo $watermark_a;
                ?>
" id="watermark_a<?php 
                echo $image_row->id;
                ?>
" href="<?php 
                echo $params_array['watermark_link'];
                ?>
" target="_blank">
                                  <?php 
                echo $watermark_image_or_text;
                ?>
                                </a>
                              </div>
                            </div>
                          </div>
                        </div>
                        <?php 
            }
            ?>
                      <a style="position:relative;" onclick="spider_createpopup('<?php 
            echo addslashes(add_query_arg($params_array, admin_url('admin-ajax.php')));
            ?>
', '<?php 
            echo $bwg;
            ?>
', '<?php 
            echo $params['popup_width'];
            ?>
', '<?php 
            echo $params['popup_height'];
            ?>
', 1, 'testpopup', 5); return false;">
                        <img class="bwg_image_browser_img_<?php 
            echo $bwg;
            ?>
" src="<?php 
            echo site_url() . '/' . $WD_BWG_UPLOAD_DIR . $image_row->image_url;
            ?>
" alt="<?php 
            echo $image_row->alt;
            ?>
" />
                      </a>
                    <script>	
                      setTimeout(function(){
                        if (jQuery('.image_browser_images_<?php 
            echo $bwg;
            ?>
').width() <= 108) {
                          jQuery('.paging-input_<?php 
            echo $bwg;
            ?>
').css('display', 'none');
                        }
                        if (jQuery('.image_browser_images_<?php 
            echo $bwg;
            ?>
').width() <= 200 && jQuery('.image_browser_images_<?php 
            echo $bwg;
            ?>
').width() > 108) {
                          jQuery('.paging-input_<?php 
            echo $bwg;
            ?>
').css('display', 'inline');
                          jQuery('.paging-input_<?php 
            echo $bwg;
            ?>
').css('margin', '0% 3% 0% 3%');
                          jQuery('.tablenav-pages_<?php 
            echo $bwg;
            ?>
 .next-page').css('margin', '0% 0% 0% 0%');
                          jQuery('.tablenav-pages_<?php 
            echo $bwg;
            ?>
 .prev-page').css('margin', '0% 0% 0% 0%');
                        }
                        else {
                          if (jQuery('.image_browser_images_<?php 
            echo $bwg;
            ?>
').width() > 200 && jQuery('.image_browser_images_<?php 
            echo $bwg;
            ?>
').width() <= 580) {
                            jQuery('.paging-input_<?php 
            echo $bwg;
            ?>
').css('display', 'inline');
                            jQuery('.tablenav-pages_<?php 
            echo $bwg;
            ?>
 a').css('font-size', '13px');
                            jQuery('.paging-input_<?php 
            echo $bwg;
            ?>
').css('margin', '0% 10% 0% 10%');
                            jQuery('.tablenav-pages_<?php 
            echo $bwg;
            ?>
 .next-page').css('margin', '0% 3% 0% 0%');
                            jQuery('.tablenav-pages_<?php 
            echo $bwg;
            ?>
 .prev-page').css('margin', '0% 0% 0% 3%');
                          }
                          if (jQuery('.image_browser_images_<?php 
            echo $bwg;
            ?>
').width() > 580) {
                            jQuery('.tablenav-pages_<?php 
            echo $bwg;
            ?>
 a').css('font-size', '15px');
                            jQuery('.paging-input_<?php 
            echo $bwg;
            ?>
').css('margin', '0%  17% 0%  17%');
                            jQuery('.paging-input_<?php 
            echo $bwg;
            ?>
').css('display', 'inline');
                            jQuery('.tablenav-pages_<?php 
            echo $bwg;
            ?>
 .next-page').css('margin', '0% 4% 0% 0%');
                            jQuery('.tablenav-pages_<?php 
            echo $bwg;
            ?>
 .prev-page').css('margin', '0% 0% 0% 4%');
                          }
                        }
                      }, 3);
                      jQuery(window).resize(function() {
                        if (jQuery('.image_browser_images_<?php 
            echo $bwg;
            ?>
').width() <= 108) {
                          jQuery('.paging-input_<?php 
            echo $bwg;
            ?>
').css('display', 'none');					  
                        }
                        if (jQuery('.image_browser_images_<?php 
            echo $bwg;
            ?>
').width() <= 200 && jQuery('.image_browser_images_<?php 
            echo $bwg;
            ?>
').width() > 108) {
                          jQuery('.paging-input_<?php 
            echo $bwg;
            ?>
').css('margin', '0% 2% 0% 2%');
                          jQuery('.paging-input_<?php 
            echo $bwg;
            ?>
').css('display', 'inline');
                          jQuery('.tablenav-pages_<?php 
            echo $bwg;
            ?>
 .next-page').css('margin', '0% 0% 0% 0%');
                          jQuery('.tablenav-pages_<?php 
            echo $bwg;
            ?>
 .prev-page').css('margin', '0% 0% 0% 0%');						
                        }
                        else {
                          if (jQuery('.image_browser_images_<?php 
            echo $bwg;
            ?>
').width() > 200 && jQuery('.image_browser_images_<?php 
            echo $bwg;
            ?>
').width() <= 580) {
                            jQuery('.tablenav-pages_<?php 
            echo $bwg;
            ?>
 a').css('font-size', '13px');
                            jQuery('.paging-input_<?php 
            echo $bwg;
            ?>
').css('margin', '0% 10% 0% 10%');
                            jQuery('.tablenav-pages_<?php 
            echo $bwg;
            ?>
 .next-page').css('margin', '0% 3% 0% 0%');
                            jQuery('.tablenav-pages_<?php 
            echo $bwg;
            ?>
 .prev-page').css('margin', '0% 0% 0% 3%');
                            jQuery('.paging-input_<?php 
            echo $bwg;
            ?>
').css('display', 'inline');
                          }
                          else if (jQuery('.image_browser_images_<?php 
            echo $bwg;
            ?>
').width() > 580) {
                            jQuery('.tablenav-pages_<?php 
            echo $bwg;
            ?>
 a').css('font-size', '15px');
                            jQuery('.paging-input_<?php 
            echo $bwg;
            ?>
').css('margin', '0%  17% 0%  17%');
                            jQuery('.tablenav-pages_<?php 
            echo $bwg;
            ?>
 .next-page').css('margin', '0% 4% 0% 0%');
                            jQuery('.tablenav-pages_<?php 
            echo $bwg;
            ?>
 .prev-page').css('margin', '0% 0% 0% 4%');
                            jQuery('.paging-input_<?php 
            echo $bwg;
            ?>
').css('display', 'inline');
                          }
                        }
                      });
                    </script>				  
                    </div>
                      <?php 
            if ($enable_image_description && $image_row->description != "") {
                ?>
                      <div class="bwg_image_browser_image_desp_<?php 
                echo $bwg;
                ?>
">                    
                        <div class="bwg_image_browser_image_description_<?php 
                echo $bwg;
                ?>
" id="alt<?php 
                echo $image_row->id;
                ?>
">
                          <?php 
                echo $image_row->description;
                ?>
                        </div>                  
                      </div>
                      <?php 
            }
            ?>
                  </div>
                </div>
                <?php 
        }
        if ($theme_row->page_nav_position == 'bottom') {
            WDWLibrary::ajax_html_frontend_page_nav($theme_row, $page_nav['total'], $page_nav['limit'], 'gal_front_form_' . $bwg, 1, $bwg, 'bwg_standart_thumbnails_' . $bwg);
        }
        ?>
            </div>
          </div>
        </form>
        <div id="spider_popup_loading_<?php 
        echo $bwg;
        ?>
" class="spider_popup_loading"></div>
        <div id="spider_popup_overlay_<?php 
        echo $bwg;
        ?>
" class="spider_popup_overlay" onclick="spider_destroypopup(1000)"></div>
      </div>
    </div>
    <script>
      jQuery(window).load(function () {
        /* Disable right click.*/
        jQuery('div[id^="bwg_container"]').bind("contextmenu", function (e) {
          return false;
        });
      });
    </script>
    <?php 
        if ($from_shortcode) {
            return;
        } else {
            die;
        }
    }