public function display()
    {
        $gallery_rows = $this->model->get_gallery_rows_data();
        $album_rows = $this->model->get_album_rows_data();
        $option_row = $this->model->get_option_row_data();
        $theme_rows = $this->model->get_theme_rows_data();
        $from_menu = isset($_GET['page']) && esc_html($_GET['page']) == 'BWGShortcode' ? TRUE : FALSE;
        $shortcodes = $this->model->get_shortcode_data();
        $shortcode_max_id = $this->model->get_shortcode_max_id();
        $effects = array('none' => 'None', 'cubeH' => 'Cube Horizontal', 'cubeV' => 'Cube Vertical', 'fade' => 'Fade', 'sliceH' => 'Slice Horizontal', 'sliceV' => 'Slice Vertical', 'slideH' => 'Slide Horizontal', 'slideV' => 'Slide Vertical', 'scaleOut' => 'Scale Out', 'scaleIn' => 'Scale In', 'blockScale' => 'Block Scale', 'kaleidoscope' => 'Kaleidoscope', 'fan' => 'Fan', 'blindH' => 'Blind Horizontal', 'blindV' => 'Blind Vertical', 'random' => 'Random');
        $watermark_fonts = array('arial' => 'Arial', 'Lucida grande' => 'Lucida grande', 'segoe ui' => 'Segoe ui', 'tahoma' => 'Tahoma', 'trebuchet ms' => 'Trebuchet ms', 'verdana' => 'Verdana', 'cursive' => 'Cursive', 'fantasy' => 'Fantasy', 'monospace' => 'Monospace', 'serif' => 'Serif');
        if (!$from_menu) {
            ?>
    <html xmlns="http://www.w3.org/1999/xhtml">
      <head>
        <title>Photo Gallery</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <script language="javascript" type="text/javascript" src="<?php 
            echo site_url();
            ?>
/wp-includes/js/tinymce/tiny_mce_popup.js"></script>
        <script language="javascript" type="text/javascript" src="<?php 
            echo site_url();
            ?>
/wp-includes/js/tinymce/utils/mctabs.js"></script>
        <script language="javascript" type="text/javascript" src="<?php 
            echo site_url();
            ?>
/wp-includes/js/tinymce/utils/form_utils.js"></script>
      <?php 
            wp_print_scripts('jquery');
        }
        wp_print_scripts('jquery-ui-core');
        wp_print_scripts('jquery-ui-widget');
        wp_print_scripts('jquery-ui-position');
        wp_print_scripts('jquery-ui-tooltip');
        ?>
        <link rel="stylesheet" href="<?php 
        echo WD_BWG_URL . '/css/bwg_shortcode.css?ver=' . wd_bwg_version();
        ?>
">
        <link rel="stylesheet" href="<?php 
        echo WD_BWG_URL . '/css/jquery-ui-1.10.3.custom.css';
        ?>
">
        <script language="javascript" type="text/javascript" src="<?php 
        echo WD_BWG_URL . '/js/bwg_shortcode.js?ver=' . wd_bwg_version();
        ?>
"></script>
        <script language="javascript" type="text/javascript" src="<?php 
        echo WD_BWG_URL . '/js/jscolor/jscolor.js?ver=' . wd_bwg_version();
        ?>
"></script>
        <?php 
        if (!$from_menu) {
            ?>
        <base target="_self">
      </head>
      <body id="link" onLoad="tinyMCEPopup.executeOnLoad('init();');document.body.style.display='';" dir="ltr" class="forceColors">
        <?php 
            if (isset($_POST['tagtext'])) {
                echo '<script>tinyMCEPopup.close();</script></body></html>';
                die;
            }
            ?>
        <form method="post" action="#" id="bwg_shortcode_form">
          <?php 
            wp_nonce_field('BWGShortcode', 'bwg_nonce');
            ?>
          <div class="tabs" role="tablist" tabindex="-1">
            <ul>
              <li id="display_tab" class="current" role="tab" tabindex="0">
                <span>
                  <a href="javascript:mcTabs.displayTab('display_tab','display_panel');" onMouseDown="return false;" tabindex="-1">Display</a>
                </span>
              </li>
            </ul>
          </div>
          <div class="panel_wrapper">
            <div id="display_panel" class="panel current">
        <?php 
        } else {
            ?>
        <form method="post" action="#" id="bwg_shortcode_form">
          <?php 
            wp_nonce_field('BWGShortcode', 'bwg_nonce');
            ?>
          <div id="display_panel" style="width: 99%; margin-top: 30px;">
        <?php 
        }
        ?>
              <div style="text-align:center; height:100px;">
                <span class="gallery_type" onClick="bwg_gallery_type('thumbnails')">
                  <div style="text-align: center;"><input type="radio" id="thumbnails" name="gallery_type" value="thumbnails" /><label for="thumbnails">Thumbnails</label></div>
                  <label for="thumbnails"><img src="<?php 
        echo WD_BWG_URL . '/images/thumbnails.jpg';
        ?>
" /></label>
                </span>
                <span title="This view is disabled in free version." class="gallery_type">
                  <div style="text-align: center;"><input disabled="disabled" type="radio" id="thumbnails_masonry" name="gallery_type" value="thumbnails_masonry" /><label class="spider_free_version_label" for="thumbnails_masonry">Masonry</label></div>
                  <label><img style="opacity:0.5; filter: Alpha(opacity=50);" disabled="disabled" src="<?php 
        echo WD_BWG_URL . '/images/thumbnails_masonry.jpg';
        ?>
" /></label>
                </span>
		<span title="This view is disabled in free version." class="gallery_type">
                  <div style="text-align: center;"><input disabled="disabled" type="radio" id="thumbnails_mosaic" name="gallery_type" value="thumbnails_mosaic" /><label class="spider_free_version_label" for="thumbnails_mosaic">Mosaic</label></div>
                  <label for="thumbnails_mosaic"><img style="opacity:0.5; filter: Alpha(opacity=50);" disabled="disabled" src="<?php 
        echo WD_BWG_URL . '/images/thumbnails_mosaic.jpg';
        ?>
" /></label>
                </span>
                <span class="gallery_type" onClick="bwg_gallery_type('slideshow')">
                  <div style="text-align: center;"><input type="radio" id="slideshow" name="gallery_type" value="slideshow" /><label for="slideshow">Slideshow</label></div>
                  <label for="slideshow"><img src="<?php 
        echo WD_BWG_URL . '/images/slideshow.jpg';
        ?>
" /></label>
                </span>
                <span class="gallery_type" onClick="bwg_gallery_type('image_browser')">
                  <div style="text-align: center;"><input type="radio" id="image_browser" name="gallery_type" value="image_browser" /><label for="image_browser">Image Browser</label></div>
                  <label for="image_browser"><img src="<?php 
        echo WD_BWG_URL . '/images/image_browser.jpg';
        ?>
" /></label>
                </span>
                <span class="gallery_type" onClick="bwg_gallery_type('album_compact_preview')">
                  <div style="text-align: center;"><input type="radio" id="album_compact_preview" name="gallery_type" value="album_compact_preview" /><label for="album_compact_preview">Compact Album</label></div>
                  <label for="album_compact_preview"><img src="<?php 
        echo WD_BWG_URL . '/images/album_compact_preview.jpg';
        ?>
" /></label>
                </span>
                <span title="This view is disabled in free version." class="gallery_type">
                  <div style="text-align: center;"><input disabled="disabled" type="radio" id="album_masonry_preview" name="gallery_type" value="album_masonry_preview" /><label class="spider_free_version_label" for="album_masonry_preview">Masonry Album</label></div>
                  <label for="album_masonry_preview"><img style="opacity:0.5; filter: Alpha(opacity=50);" disabled="disabled" src="<?php 
        echo WD_BWG_URL . '/images/thumbnails_masonry.jpg';
        ?>
" /></label>
                </span>
                <span class="gallery_type" onClick="bwg_gallery_type('album_extended_preview')">
                  <div style="text-align: center;"><input type="radio" id="album_extended_preview" name="gallery_type" value="album_extended_preview" /><label for="album_extended_preview">Extended Album</label></div>
                  <label for="album_extended_preview"><img src="<?php 
        echo WD_BWG_URL . '/images/album_extended_preview.jpg';
        ?>
" /></label>
                </span>
                <span title="This view is disabled in free version." class="gallery_type">
                  <div style="text-align: center;"><input disabled="disabled" type="radio" id="blog_style" name="gallery_type" value="blog_style" /><label class="spider_free_version_label" for="blog_style">Blog Style</label></div>
                  <label><img style="opacity:0.5; filter: Alpha(opacity=50);" disabled="disabled" src="<?php 
        echo WD_BWG_URL . '/images/blog_style.jpg';
        ?>
" /></label>
                </span>			
		  <span title="This view is disabled in free version." class="gallery_type">
                  <div style="text-align: center;"><input disabled="disabled" type="radio" id="carousel" name="gallery_type" value="carousel" /><label class="spider_free_version_label" for="carousel">Carousel</label></div>
                  <label for="carousel"><img style="opacity:0.5; filter: Alpha(opacity=50);" disabled="disabled" src="<?php 
        echo WD_BWG_URL . '/images/Carousel.png';
        ?>
" /></label>
                </span>
              </div>
              <hr />
              <div class="bwg_short_div" style="border-right: 1px solid #000000;">
              <table>
                <tbody>
                  <tr id="tr_theme">
                    <td <?php 
        echo get_option("wd_bwg_theme_version") ? 'title="This option is disabled in free version." class="spider_label spider_free_version_label"' : 'class="spider_label"';
        ?>
><label for="theme">Theme: </label></td>
                    <td>
                      <select name="theme" id="theme" style="width:150px;" <?php 
        echo get_option("wd_bwg_theme_version") ? 'disabled="disabled"' : '';
        ?>
>
                        <option value="0" selected="selected">Select Theme</option>
                        <?php 
        foreach ($theme_rows as $theme_row) {
            ?>
                          <option <?php 
            echo $theme_row->default_theme ? 'selected="selected"' : '';
            ?>
 value="<?php 
            echo $theme_row->id;
            ?>
"><?php 
            echo $theme_row->name;
            ?>
</option>
                          <?php 
        }
        ?>
                      </select>
                    </td>
                  </tr>
                  <tr id="tr_gallery">
                    <td class="spider_label"><label for="gallery">Gallery: </label></td>
                    <td>
                      <select name="gallery" id="gallery" style="width:150px;">
                        <option value="0" selected="selected">Select Gallery</option>
                        <?php 
        foreach ($gallery_rows as $gallery_row) {
            ?>
                          <option value="<?php 
            echo $gallery_row->id;
            ?>
"><?php 
            echo $gallery_row->name;
            ?>
</option>
                          <?php 
        }
        ?>
                      </select>
                    </td>
                  </tr>
                  <tr id="tr_album">
                    <td title="The selected album expanded content will be displayed." class="spider_label"><label for="album">Album: </label></td>
                    <td>
                      <select name="album" id="album" style="width:150px;">
                        <option value="0" selected="selected">Select Album</option>
                        <?php 
        foreach ($album_rows as $album_row) {
            ?>
                          <option value="<?php 
            echo $album_row->id;
            ?>
"><?php 
            echo $album_row->name;
            ?>
</option>
                          <?php 
        }
        ?>
                      </select>
                    </td>
                  </tr>
                  <tr id="tr_sort_by">
                    <td class="spider_label"><label for="sort_by">Sort images by: </label></td>
                    <td>
                      <select name="sort_by" id="sort_by" style="width:150px;">
                        <option value="order" selected="selected">Order</option>
                        <option value="alt">Title</option>
                        <option value="date">Date</option>
                        <option value="filename">Filename</option>
                        <option value="size">Size</option>
                        <option value="filetype">Type</option>
                        <option value="resolution">Resolution</option>
                      </select>
                    </td>
                  </tr>
                  <tr id="tr_order_by">
                    <td class="spider_label"><label>Order images: </label></td>
                    <td>
                      <input type="radio" name="order_by" id="order_by_1" value="asc" checked="checked" /><label for="order_by_1">Ascending</label>
                      <input type="radio" name="order_by" id="order_by_0" value="desc" /><label for="order_by_0">Descending</label>
                    </td>
                  </tr>
                  <tr id="tr_show_search_box">
                    <td class="spider_label"><label>Show search box: </label></td>
                    <td>
                      <input type="radio" name="show_search_box" id="show_search_box_1" value="1" <?php 
        if ($option_row->show_search_box) {
            echo 'checked="checked"';
        }
        ?>
 onchange="bwg_show_search_box()" /><label for="show_search_box_1">Yes</label>
                      <input type="radio" name="show_search_box" id="show_search_box_0" value="0" <?php 
        if (!$option_row->show_search_box) {
            echo 'checked="checked"';
        }
        ?>
 onchange="bwg_show_search_box()" /><label for="show_search_box_0">No</label>
                    </td>
                  </tr>
                  <tr id="tr_search_box_width">
                    <td class="spider_label"><label for="search_box_width">Search box width: </label></td>
                    <td><input type="text" name="search_box_width" id="search_box_width" value="<?php 
        echo $option_row->search_box_width;
        ?>
" class="spider_int_input" /> px</td>
                  </tr>
                  <tr id="tr_show_tag_box">
                    <td class="spider_label"><label>Show tag box: </label></td>
                    <td>
                      <input type="radio" name="show_tag_box" id="show_tag_box_1" value="1" <?php 
        if ($option_row->show_tag_box) {
            echo 'checked="checked"';
        }
        ?>
 /><label for="show_tag_box_1">Yes</label>
                      <input type="radio" name="show_tag_box" id="show_tag_box_0" value="0" <?php 
        if (!$option_row->show_tag_box) {
            echo 'checked="checked"';
        }
        ?>
 /><label for="show_search_box_0">No</label>
                    </td>
                  </tr>
									<tr id="tr_show_sort_images">
                    <td class="spider_label"><label>Show "Order by" dropdown list: </label></td>
                    <td>
                      <input type="radio" name="show_sort_images" id="show_sort_images_1" value="1" <?php 
        if ($option_row->show_sort_images) {
            echo 'checked="checked"';
        }
        ?>
 onchange="" /><label for="show_sort_images_1">Yes</label>
                      <input type="radio" name="show_sort_images" id="show_sort_images_0" value="0" <?php 
        if (!$option_row->show_sort_images) {
            echo 'checked="checked"';
        }
        ?>
 onchange="" /><label for="show_sort_images_0">No</label>
                    </td>
                  </tr>
                  <!--Thumbnails, Masonry viewies-->
                  <tr id="tr_masonry_hor_ver">
                    <td class="spider_label"><label>Masonry: </label></td>
                    <td>
                      <input type="radio" name="masonry_hor_ver" id="masonry_ver" value="vertical" onclick="bwg_change_label('image_column_number_label', 'Number of image rows: ');
                                                                                                            bwg_change_label('thumb_width_height_label', 'Image thumbnail width: ');
                                                                                                            jQuery('#thumb_width').show();
                                                                                                            jQuery('#thumb_height').hide();
                                                                                                            jQuery('#thumb_width_height_separator').hide();" <?php 
        echo $option_row->masonry == 'vertical' ? 'checked' : '';
        ?>
 /><label for="masonry_ver">Vertical</label>
                      <input type="radio" name="masonry_hor_ver" id="masonry_hor" value="horizontal" onclick="bwg_change_label('image_column_number_label', 'Max. number of image columns: ');
                                                                                                              bwg_change_label('thumb_width_height_label', 'Image Thumbnail Height: ');
                                                                                                              jQuery('#thumb_width').hide();
                                                                                                              jQuery('#thumb_height').show();
                                                                                                              jQuery('#thumb_width_height_separator').hide();" <?php 
        echo $option_row->masonry == 'horizontal' ? 'checked' : '';
        ?>
 /><label for="masonry_hor">Horizontal</label>
                    </td>
                  </tr>
                  <!--Thumbnails, Mosaic viewies-->
                  <tr id="tr_mosaic_hor_ver">
                    <td class="spider_label"><label>Mosaic: </label></td>
                    <td>
                      <input type="radio" name="mosaic_hor_ver" id="mosaic_ver" value="vertical" onclick="bwg_change_label('image_column_number_label', 'Number of image rows: ');
                                                                                                            bwg_change_label('thumb_width_height_label', 'Image thumbnail width: ');
                                                                                                            jQuery('#thumb_width').show();
                                                                                                            jQuery('#thumb_height').hide();
                                                                                                            jQuery('#thumb_width_height_separator').hide();" <?php 
        echo $option_row->mosaic == 'vertical' ? 'checked' : '';
        ?>
 /><label for="mosaic_ver">Vertical</label>
                      <input type="radio" name="mosaic_hor_ver" id="mosaic_hor" value="horizontal" onclick="bwg_change_label('image_column_number_label', 'Max. number of image columns: ');
                                                                                                              bwg_change_label('thumb_width_height_label', 'Image Thumbnail Height: ');
                                                                                                              jQuery('#thumb_width').hide();
                                                                                                              jQuery('#thumb_height').show();
                                                                                                              jQuery('#thumb_width_height_separator').hide();" <?php 
        echo $option_row->mosaic == 'horizontal' ? 'checked' : '';
        ?>
 /><label for="mosaic_hor">Horizontal</label>
                    
                  
                    </td>
                  </tr>
                  <tr id="tr_resizable_mosaic">
                    <td title="Mosaic thumbnails do not have fixed size, but are proportional to the width of the parent container. This option keeps thumbs to look nice when viewed with very large or very small screen. Prevents zooming of thumbs." class="spider_label"><label for="resizable_mosaic">Resizable mosaic</label></td>
                    <td>
                      <input type="radio" name="resizable_mosaic" id="resizable_mosaic_1" value="1" <?php 
        echo $option_row->resizable_mosaic == 1 ? 'checked' : '';
        ?>
 /><label for="resizable_mosaic_1">Yes</label>
                      <input type="radio" name="resizable_mosaic" id="resizable_mosaic_0" value="0" <?php 
        echo $option_row->resizable_mosaic == 0 ? 'checked' : '';
        ?>
 /><label for="resizable_mosaic_0">No</label>
                      <br />
                    </td>
                  </tr>
                  <tr id="tr_mosaic_total_width">
                    <td title="Percentage of container's width" class="spider_label"><label for="mosaic_total_width">Total width of mosaic: </label></td>
                    <td><input type="text" name="mosaic_total_width" id="mosaic_total_width" value="<?php 
        echo $option_row->mosaic_total_width;
        ?>
" class="spider_int_input" /> %</td>
                  </tr>
                 <!--Thumbnails, Masonry and Mosaic viewies-->
                  <tr id="tr_image_column_number">
                    <td class="spider_label"><label id="image_column_number_label" for="image_column_number">Max. number of image columns: </label></td>
                    <td><input type="text" name="image_column_number" id="image_column_number" value="<?php 
        echo $option_row->image_column_number;
        ?>
" class="spider_int_input" /></td>
                  </tr>
                  <tr id="tr_images_per_page">
                    <td title="If you want to display all images you should leave it blank or insert 0." class="spider_label"><label for="images_per_page">Images per page: </label></td>
                    <td><input type="text" name="images_per_page" id="images_per_page" value="<?php 
        echo $option_row->images_per_page;
        ?>
" class="spider_int_input" /></td>
                  </tr>
                  <tr id="tr_image_title_hover">
                    <td class="spider_label"><label>Image title: </label></td>
                    <td>
                      <input type="radio" name="image_title" id="image_title_hover" value="hover" <?php 
        echo $option_row->image_title_show_hover == 'hover' ? 'checked' : '';
        ?>
 /><label for="image_title_hover">Show on hover</label><br />
                      <input type="radio" name="image_title" id="image_title_show" value="show" <?php 
        echo $option_row->image_title_show_hover == 'show' ? 'checked' : '';
        ?>
 /><label for="image_title_show">Always show</label><br />
                      <input type="radio" name="image_title" id="image_title_none" value="none" <?php 
        echo $option_row->image_title_show_hover == 'none' ? 'checked' : '';
        ?>
 /><label for="image_title_none">Don't show</label>
                    </td>
                  </tr>
                  <tr id="tr_image_enable_page">
                    <td class="spider_label"><label>Enable pagination: </label></td>
                    <td>
                      <input type="radio" name="image_enable_page" class="hide_load_count" id="image_page_yes" value="1" <?php 
        echo $option_row->image_enable_page == '1' ? 'checked' : '';
        ?>
 onchange="bwg_loadmore()"/><label for="image_page_yes">Yes</label>
                      <input type="radio" name="image_enable_page" class="hide_load_count" id="image_page_no" value="0" <?php 
        echo $option_row->image_enable_page == '0' ? 'checked' : '';
        ?>
 onchange="bwg_loadmore()"/><label for="image_page_no">No</label>
                      <input type="radio" name="image_enable_page" id="image_page_loadmore" value="2" <?php 
        echo $option_row->image_enable_page == '2' ? 'checked' : '';
        ?>
 onchange="bwg_loadmore()"/><label for="image_page_loadmore">Load More</label>
                      <input type="radio" name="image_enable_page" id="image_page_scrol_load" value="3" <?php 
        echo $option_row->image_enable_page == '3' ? 'checked' : '';
        ?>
 onchange="bwg_loadmore()"/><label for="image_page_scrol_load">Scroll Load</label>
                    </td>
                  </tr>
                  <tr id="tr_load_more_image_count">
                    <td class="spider_label"><label for="load_more_image_count">Images per load: </label></td>
                    <td><input type="text" name="load_more_image_count" id="load_more_image_count" value="<?php 
        echo $option_row->images_per_page;
        ?>
" class="spider_int_input" /></td>
                  </tr> 
                  <tr id="tr_thumb_width_height">
                    <td title="Maximum values for thumbnail dimension." class="spider_label"><label id="thumb_width_height_label" for="thumb_width">Image Thumbnail dimensions: </label></td>
                    <td>
                      <input type="text" name="thumb_width" id="thumb_width" value="<?php 
        echo $option_row->thumb_width;
        ?>
" class="spider_int_input" /><span id="thumb_width_height_separator"> x </span>
                      <input type="text" name="thumb_height" id="thumb_height" value="<?php 
        echo $option_row->thumb_height;
        ?>
" class="spider_int_input" /> px
                    </td>
                  </tr>

                  <!--Compact Album view-->
                  <tr id="tr_compuct_album_column_number">
                    <td class="spider_label"><label for="compuct_album_column_number">Max. number of album columns: </label></td>
                    <td><input type="text" name="compuct_album_column_number" id="compuct_album_column_number" value="<?php 
        echo $option_row->album_column_number;
        ?>
" class="spider_int_input" /></td>
                  </tr>
                  <tr id="tr_compuct_albums_per_page">
                    <td title="If you want to display all albums you should leave it blank or insert 0." class="spider_label"><label for="compuct_albums_per_page">Albums per page: </label></td>
                    <td><input type="text" name="compuct_albums_per_page" id="compuct_albums_per_page" value="<?php 
        echo $option_row->albums_per_page;
        ?>
" class="spider_int_input" /></td>
                  </tr>
                  <tr id="tr_compuct_album_title_hover">
                    <td class="spider_label"><label>Album title: </label></td>
                    <td>
                      <input type="radio" name="compuct_album_title" id="compuct_album_title_hover" value="hover" <?php 
        echo $option_row->album_title_show_hover == 'hover' ? 'checked' : '';
        ?>
 /><label for="compuct_album_title_hover">Show on hover</label><br />
                      <input type="radio" name="compuct_album_title" id="compuct_album_title_show" value="show" <?php 
        echo $option_row->album_title_show_hover == 'show' ? 'checked' : '';
        ?>
 /><label for="compuct_album_title_show">Always show</label><br />
                      <input type="radio" name="compuct_album_title" id="compuct_album_title_none" value="none" <?php 
        echo $option_row->album_title_show_hover == 'none' ? 'checked' : '';
        ?>
 /><label for="compuct_album_title_none">Don't show</label>
                    </td>
                  </tr>
                  <tr id="tr_compuct_album_thumb_width_height">
                    <td title="Maximum values for album thumb width and height." class="spider_label"><label for="compuct_album_thumb_width">Album Thumbnail dimensions: </label></td>
                    <td>
                      <input type="text" name="compuct_album_thumb_width" id="compuct_album_thumb_width" value="<?php 
        echo $option_row->album_thumb_width;
        ?>
" class="spider_int_input" /> x 
                      <input type="text" name="compuct_album_thumb_height" id="compuct_album_thumb_height" value="<?php 
        echo $option_row->album_thumb_height;
        ?>
" class="spider_int_input" /> px
                    </td>
                  </tr>
                  <tr id="tr_compuct_album_view_type">
                    <td title="The gallery images view type in the album.<br /><br />This option is disabled in free version." class="spider_label spider_free_version_label"><label>Album view type: </label></td>
                    <td>
                      <input disabled="disabled" type="radio" name="compuct_album_view_type" id="compuct_album_view_type_1" value="thumbnail" <?php 
        if ($option_row->album_view_type == "thumbnail") {
            echo 'checked="checked"';
        }
        ?>
 onchange="bwg_change_compuct_album_view_type()" /><label for="compuct_album_view_type_1">Thumbnail</label>
                      <input disabled="disabled" type="radio" name="compuct_album_view_type" id="compuct_album_view_type_0" value="masonry" <?php 
        if ($option_row->album_view_type == "masonry") {
            echo 'checked="checked"';
        }
        ?>
 onchange="bwg_change_compuct_album_view_type()" /><label for="compuct_album_view_type_0">Masonry</label>
                      <input disabled="disabled" type="radio" name="compuct_album_view_type" id="compuct_album_view_type_2" value="mosaic" <?php 
        if ($option_row->album_view_type == "mosaic") {
            echo 'checked="checked"';
        }
        ?>
 onchange="bwg_change_compuct_album_view_type()" /><label for="compuct_album_view_type_2">Mosaic</label>
                    </td>
                  </tr>
                  <tr id="tr_compuct_album_mosaic_hor_ver">
                    <td title="This option is disabled in free version." class="spider_label spider_free_version_label"><label>Mosaic: </label></td>
                    <td>
                      <input disabled="disabled" type="radio" name="compuct_album_mosaic_hor_ver" id="compuct_album_mosaic_ver" value="vertical" onclick="bwg_change_label('compuct_album_image_column_number', 'Number of image rows: ');
                                                                                                            bwg_change_label('compuct_album_image_thumb_dimensions', 'Image thumbnail width: ');
                                                                                                            jQuery('#compuct_album_image_thumb_width').show();
                                                                                                            jQuery('#compuct_album_image_thumb_height').hide();
                                                                                                            jQuery('#compuct_album_image_thumb_dimensions_x').hide();" <?php 
        echo $option_row->mosaic == 'vertical' ? 'checked' : '';
        ?>
 /><label for="compuct_album_mosaic_ver">Vertical</label>
                      <input disabled="disabled" type="radio" name="compuct_album_mosaic_hor_ver" id="compuct_album_mosaic_hor" value="horizontal" onclick="bwg_change_label('compuct_album_image_column_number', 'Max. number of image columns: ');
                                                                                                              bwg_change_label('compuct_album_image_thumb_dimensions', 'Image thumbnail height: ');
                                                                                                              jQuery('#compuct_album_image_thumb_width').hide();
                                                                                                              jQuery('#compuct_album_image_thumb_height').show();
                                                                                                              jQuery('#compuct_album_image_thumb_dimensions_x').hide();" <?php 
        echo $option_row->mosaic == 'horizontal' ? 'checked' : '';
        ?>
 /><label for="compuct_album_mosaic_hor">Horizontal</label>
                    
                  
                    </td>
                  </tr>
                  <tr id="tr_compuct_album_resizable_mosaic">
                    <td title="Mosaic thumbnails do not have fixed size, but are proportional to the width of the parent container. This option keeps thumbs to look nice when viewed with very large or very small screen. Prevents zooming of thumbs.<br /><br />This option is disabled in free version." class="spider_label spider_free_version_label"><label for="compuct_album_resizable_mosaic">Resizable mosaic</label></td>
                    <td>
                      <input disabled="disabled" type="radio" name="compuct_album_resizable_mosaic" id="compuct_album_resizable_mosaic_1" value="1" <?php 
        echo $option_row->resizable_mosaic == 1 ? 'checked' : '';
        ?>
 /><label for="compuct_album_resizable_mosaic_1">Yes</label>
                      <input disabled="disabled" type="radio" name="compuct_album_resizable_mosaic" id="compuct_album_resizable_mosaic_0" value="0" <?php 
        echo $option_row->resizable_mosaic == 0 ? 'checked' : '';
        ?>
 /><label for="compuct_album_resizable_mosaic_0">No</label>
                      <br />
                    </td>
                  </tr>
                  <tr id="tr_compuct_album_mosaic_total_width">
                    <td title="Percentage of container's width" class="spider_label"><label for="compuct_album_mosaic_total_width">Total width of mosaic: </label></td>
                    <td><input type="text" name="compuct_album_mosaic_total_width" id="compuct_album_mosaic_total_width" value="<?php 
        echo $option_row->mosaic_total_width;
        ?>
" class="spider_int_input" /> percent</td>
                  </tr>
                  <tr id="tr_compuct_album_image_column_number">
                    <td class="spider_label"><label for="compuct_album_image_column_number">Max. number of image columns: </label></td>
                    <td><input type="text" name="compuct_album_image_column_number" id="compuct_album_image_column_number" value="<?php 
        echo $option_row->image_column_number;
        ?>
" class="spider_int_input" /></td>
                  </tr>
                  <tr id="tr_compuct_album_images_per_page">
                    <td title="If you want to display all images you should leave it blank or insert 0." class="spider_label"><label for="compuct_album_images_per_page">Images per page: </label></td>
                    <td><input type="text" name="compuct_album_images_per_page" id="compuct_album_images_per_page" value="<?php 
        echo $option_row->images_per_page;
        ?>
" class="spider_int_input" /></td>
                  </tr>
                  <tr id="tr_compuct_album_image_title">
                    <td class="spider_label"><label>Image title: </label></td>
                    <td>
                      <input type="radio" name="compuct_album_image_title" id="compuct_album_image_title_hover" value="hover" <?php 
        echo $option_row->image_title_show_hover == 'hover' ? 'checked' : '';
        ?>
 /><label for="compuct_album_image_title_hover">Show on hover</label><br />
                      <input type="radio" name="compuct_album_image_title" id="compuct_album_image_title_show" value="show" <?php 
        echo $option_row->image_title_show_hover == 'show' ? 'checked' : '';
        ?>
 /><label for="compuct_album_image_title_show">Always show</label><br />
                      <input type="radio" name="compuct_album_image_title" id="compuct_album_image_title_none" value="none" <?php 
        echo $option_row->image_title_show_hover == 'none' ? 'checked' : '';
        ?>
 /><label for="compuct_album_image_title_none">Don't show</label>
                    </td>
                  </tr>
                  <tr id="tr_compuct_album_image_thumb_width_height">
                    <td title="Maximum values for thumbnail width and height." class="spider_label"><label for="compuct_album_image_thumb_width" id="compuct_album_image_thumb_dimensions">Image thumbnail dimensions: </label></td>
                    <td>
                      <input type="text" name="compuct_album_image_thumb_width" id="compuct_album_image_thumb_width" value="<?php 
        echo $option_row->thumb_width;
        ?>
" class="spider_int_input" /><span id="compuct_album_image_thumb_dimensions_x" > x </span>
                      <input type="text" name="compuct_album_image_thumb_height" id="compuct_album_image_thumb_height" value="<?php 
        echo $option_row->thumb_height;
        ?>
" class="spider_int_input" /> px
                    </td>
                  </tr>
                  <tr id="tr_compuct_album_enable_page">
                    <td class="spider_label"><label>Enable pagination: </label></td>
                    <td>
                      <input type="radio" name="compuct_album_enable_page" class="hide_load_count" id="compuct_album_page_yes" value="1" <?php 
        echo $option_row->album_enable_page == '1' ? 'checked' : '';
        ?>
 onchange="bwg_loadmore()"/><label for="compuct_album_page_yes">Yes</label>
                      <input type="radio" name="compuct_album_enable_page"  class="hide_load_count"  id="compuct_album_page_no" value="0" <?php 
        echo $option_row->album_enable_page == '0' ? 'checked' : '';
        ?>
 onchange="bwg_loadmore()" /><label for="compuct_album_page_no">No</label>  
                      <input type="radio" name="compuct_album_enable_page" id="compuct_album_page_loadmore" value="2" <?php 
        echo $option_row->album_enable_page == '2' ? 'checked' : '';
        ?>
 onchange="bwg_loadmore()" /><label for="compuct_album_page_loadmore">Load More</label>
                       <input type="radio" name="compuct_album_enable_page" id="compuct_album_page_scrol_load" value="3" <?php 
        echo $option_row->album_enable_page == '3' ? 'checked' : '';
        ?>
 onchange="bwg_loadmore()" /><label for="compuct_album_page_scrol_load">Scroll Load</label>
                    </td>
		  </tr>
                   <tr id="tr_compuct_albums_per_page_load_more">
                    <td title="If you want to display all albums you should leave it blank or insert 0." class="spider_label"><label for="compuct_albums_per_page_load_more">Albums per load: </label></td>
                    <td><input type="text" name="compuct_albums_per_page_load_more" id="compuct_albums_per_page_load_more" value="<?php 
        echo $option_row->albums_per_page;
        ?>
" class="spider_int_input" /></td>
                  </tr>
                   <tr id="tr_compuct_album_load_more_image_count">
                    <td class="spider_label"><label for="compuct_album_load_more_image_count">Images per load: </label></td>
                    <td><input type="text" name="compuct_album_load_more_image_count" id="compuct_album_load_more_image_count" value="<?php 
        echo $option_row->images_per_page;
        ?>
" class="spider_int_input" /></td>
                  </tr>

                  <!--Extended Album view-->
                  <tr id="tr_extended_albums_per_page">
                    <td title="If you want to display all albums you should leave it blank or insert 0." class="spider_label"><label for="extended_albums_per_page">Albums per page: </label></td>
                    <td><input type="text" name="extended_albums_per_page" id="extended_albums_per_page" value="<?php 
        echo $option_row->albums_per_page;
        ?>
" class="spider_int_input" /></td>
                  </tr>
                  <tr id="tr_extended_album_height">
                    <td class="spider_label"><label for="extended_album_height">Album row height: </label></td>
                    <td><input type="text" name="extended_album_height" id="extended_album_height" value="<?php 
        echo $option_row->extended_album_height;
        ?>
" class="spider_int_input" /> px</td>
                  </tr>
                  <tr id="tr_extended_album_description_enable">
                    <td title="If you disable description only the title of the album will be displayed." class="spider_label"><label>Enable album description: </label></td>
                    <td>
                      <input type="radio" name="extended_album_description_enable" id="extended_album_description_yes" value="1" <?php 
        echo $option_row->extended_album_description_enable ? 'checked' : '';
        ?>
 /><label for="extended_album_description_yes">Yes</label>
                      <input type="radio" name="extended_album_description_enable" id="extended_album_description_no" value="0" <?php 
        echo $option_row->extended_album_description_enable ? '' : 'checked';
        ?>
 /><label for="extended_album_description_no">No</label>
                    </td>
                  </tr>
                  <tr id="tr_extended_album_thumb_width_height">
                    <td title="Maximum values for album thumb width and height." class="spider_label"><label for="extended_album_thumb_width">Album thumbnail dimensions: </label></td>
                    <td>
                      <input type="text" name="extended_album_thumb_width" id="extended_album_thumb_width" value="<?php 
        echo $option_row->album_thumb_width;
        ?>
" class="spider_int_input" /> x 
                      <input type="text" name="extended_album_thumb_height" id="extended_album_thumb_height" value="<?php 
        echo $option_row->album_thumb_height;
        ?>
" class="spider_int_input" /> px
                    </td>
                  </tr>
                  <tr id="tr_extended_album_view_type">
                    <td title="The gallery images view type in the album.<br /><br />This option is disabled in free version." class="spider_label spider_free_version_label"><label>Album view type: </label></td>
                    <td>
                      <input disabled="disabled" type="radio" name="extended_album_view_type" id="extended_album_view_type_1" value="thumbnail" <?php 
        if ($option_row->album_view_type == "thumbnail") {
            echo 'checked="checked"';
        }
        ?>
 onchange="bwg_change_extended_album_view_type()" /><label for="extended_album_view_type_1">Thumbnail</label>
                      <input disabled="disabled" type="radio" name="extended_album_view_type" id="extended_album_view_type_0" value="masonry" <?php 
        if ($option_row->album_view_type == "masonry") {
            echo 'checked="checked"';
        }
        ?>
 onchange="bwg_change_extended_album_view_type()" /><label for="extended_album_view_type_0">Masonry</label>
                      <input disabled="disabled" type="radio" name="extended_album_view_type" id="extended_album_view_type_2" value="mosaic" <?php 
        if ($option_row->album_view_type == "mosaic") {
            echo 'checked="checked"';
        }
        ?>
 onchange="bwg_change_extended_album_view_type()" /><label for="extended_album_view_type_2">Mosaic</label>
                    </td>
                  </tr>				  
                  <tr id="tr_extended_album_mosaic_hor_ver">
                    <td title="This option is disabled in free version." class="spider_label spider_free_version_label"><label>Mosaic: </label></td>
                    <td>
                      <input disabled="disabled" type="radio" name="extended_album_mosaic_hor_ver" id="extended_album_mosaic_ver" value="vertical" onclick="bwg_change_label('extended_album_image_column_number', 'Number of image rows: ');
                                                                                                            bwg_change_label('extended_album_image_thumb_dimensions', 'Image thumbnail width: ');
                                                                                                            jQuery('#extended_album_image_thumb_width').show();
                                                                                                            jQuery('#extended_album_image_thumb_height').hide();
                                                                                                            jQuery('#extended_album_image_thumb_dimensions_x').hide();" <?php 
        echo $option_row->mosaic == 'vertical' ? 'checked' : '';
        ?>
 /><label for="extended_album_mosaic_ver">Vertical</label>
                      <input disabled="disabled" type="radio" name="extended_album_mosaic_hor_ver" id="extended_album_mosaic_hor" value="horizontal" onclick="bwg_change_label('extended_album_image_column_number', 'Max. number of image columns: ');
                                                                                                              bwg_change_label('extended_album_image_thumb_dimensions', 'Image thumbnail height: ');
                                                                                                              jQuery('#extended_album_image_thumb_width').hide();
                                                                                                              jQuery('#extended_album_image_thumb_height').show();
                                                                                                              jQuery('#extended_album_image_thumb_dimensions_x').hide();" <?php 
        echo $option_row->mosaic == 'horizontal' ? 'checked' : '';
        ?>
 /><label for="extended_album_mosaic_hor">Horizontal</label>
                    
                  
                    </td>
                  </tr>
                  <tr id="tr_extended_album_resizable_mosaic">
                    <td title="Mosaic thumbnails do not have fixed size, but are proportional to the width of the parent container. This option keeps thumbs to look nice when viewed with very large or very small screen. Prevents zooming of thumbs.<br /><br />This option is disabled in free version." class="spider_label spider_free_version_label"><label for="extended_album_resizable_mosaic">Resizable mosaic: </label></td>
                    <td>
                      <input disabled="disabled" type="radio" name="extended_album_resizable_mosaic" id="extended_album_resizable_mosaic_1" value="1" <?php 
        echo $option_row->resizable_mosaic == 1 ? 'checked' : '';
        ?>
 /><label for="extended_album_resizable_mosaic_1">Yes</label>
                      <input disabled="disabled" type="radio" name="extended_album_resizable_mosaic" id="extended_album_resizable_mosaic_0" value="0" <?php 
        echo $option_row->resizable_mosaic == 0 ? 'checked' : '';
        ?>
 /><label for="extended_album_resizable_mosaic_0">No</label>
                      <br />
                    </td>
                  </tr>
                  
                  <tr id="tr_extended_album_mosaic_total_width">
                    <td title="Percentage of container's width" class="spider_label"><label for="extended_album_mosaic_total_width">Total width of mosaic: </label></td>
                    <td><input type="text" name="extended_album_mosaic_total_width" id="extended_album_mosaic_total_width" value="<?php 
        echo $option_row->mosaic_total_width;
        ?>
" class="spider_int_input" /> percent</td>
                  </tr>
                  <tr id="tr_extended_album_image_column_number">
                    <td class="spider_label"><label for="extended_album_image_column_number">Max. number of image columns: </label></td>
                    <td><input type="text" name="extended_album_image_column_number" id="extended_album_image_column_number" value="<?php 
        echo $option_row->image_column_number;
        ?>
" class="spider_int_input" /></td>
                  </tr>
                  <tr id="tr_extended_album_images_per_page">
                    <td title="If you want to display all images you should leave it blank or insert 0." class="spider_label"><label for="extended_album_images_per_page">Images per page: </label></td>
                    <td><input type="text" name="extended_album_images_per_page" id="extended_album_images_per_page" value="<?php 
        echo $option_row->images_per_page;
        ?>
" class="spider_int_input" /></td>
                  </tr>
                  <tr id="tr_extended_album_image_title">
                    <td class="spider_label"><label>Image title: </label></td>
                    <td>
                      <input type="radio" name="extended_album_image_title" id="extended_album_image_title_hover" value="hover" <?php 
        echo $option_row->image_title_show_hover == 'hover' ? 'checked' : '';
        ?>
 /><label for="extended_album_image_title_hover">Show on hover</label><br />
                      <input type="radio" name="extended_album_image_title" id="extended_album_image_title_show" value="show" <?php 
        echo $option_row->image_title_show_hover == 'show' ? 'checked' : '';
        ?>
 /><label for="extended_album_image_title_show">Always show</label><br />
                      <input type="radio" name="extended_album_image_title" id="extended_album_image_title_none" value="none" <?php 
        echo $option_row->image_title_show_hover == 'none' ? 'checked' : '';
        ?>
 /><label for="extended_album_image_title_none">Don't show</label>
                    </td>
                  </tr>
                  <tr id="tr_extended_album_image_thumb_width_height">
                    <td title="Maximum values for thumbnail width and height." class="spider_label"><label for="extended_album_image_thumb_width" id="extended_album_image_thumb_dimensions">Image Thumbnail dimensions: </label></td>
                    <td>
                      <input type="text" name="extended_album_image_thumb_width" id="extended_album_image_thumb_width" value="<?php 
        echo $option_row->thumb_width;
        ?>
" class="spider_int_input" /><span id="extended_album_image_thumb_dimensions_x" > x </span>
                      <input type="text" name="extended_album_image_thumb_height" id="extended_album_image_thumb_height" value="<?php 
        echo $option_row->thumb_height;
        ?>
" class="spider_int_input" /> px
                    </td>
                  </tr>
                  <tr id="tr_extended_album_enable_page">
                    <td class="spider_label"><label>Enable pagination: </label></td>
                    <td>
                      <input type="radio" name="extended_album_enable_page" id="extended_album_page_yes" value="1" <?php 
        echo $option_row->album_enable_page == '1' ? 'checked' : '';
        ?>
 onchange="bwg_loadmore()"/><label for="extended_album_page_yes">Yes</label>
                      <input type="radio" name="extended_album_enable_page" id="extended_album_page_no" value="0" <?php 
        echo $option_row->album_enable_page == '0' ? 'checked' : '';
        ?>
 onchange="bwg_loadmore()"/><label for="extended_album_page_no">No</label>
                      <input type="radio" name="extended_album_enable_page" id="extended_album_page_loadmore" value="2" <?php 
        echo $option_row->album_enable_page == '2' ? 'checked' : '';
        ?>
 onchange="bwg_loadmore()"/><label for="extended_album_page_loadmore">Load More</label>
                      <input type="radio" name="extended_album_enable_page" id="extended_album_page_scrol_load" value="3" <?php 
        echo $option_row->album_enable_page == '3' ? 'checked' : '';
        ?>
 onchange="bwg_loadmore()"/><label for="extended_album_page_scrol_load">Scroll Load </label>
                    </td>
                  </tr>
                   <tr id="tr_extended_albums_per_page_load_more">
                    <td title="If you want to display all albums you should leave it blank or insert 0." class="spider_label"><label for="extended_albums_per_page_load_more">Albums per load: </label></td>
                    <td><input type="text" name="extended_albums_per_page_load_more" id="extended_albums_per_page_load_more" value="<?php 
        echo $option_row->albums_per_page;
        ?>
" class="spider_int_input" /></td>
                  </tr>
                   <tr id="tr_extended_album_load_more_image_count">
                    <td class="spider_label"><label for="extended_album_load_more_image_count">Images per load: </label></td>
                    <td><input type="text" name="extended_album_load_more_image_count" id="extended_album_load_more_image_count" value="<?php 
        echo $option_row->images_per_page;
        ?>
" class="spider_int_input" /></td>
                  </tr>

                  <!--Image Browser view-->
                  <tr id="tr_image_browser_width_height">
                    <td title="Maximum value for image width." class="spider_label"><label for="image_browser_width">Image width: </label></td>
                    <td>
                      <input type="text" name="image_browser_width" id="image_browser_width" value="<?php 
        echo $option_row->image_browser_width;
        ?>
" class="spider_int_input" /> px
                    </td>
                  </tr>
                  <tr id="tr_image_browser_title_enable">
                    <td class="spider_label"><label>Enable image title: </label></td>
                    <td>
                      <input type="radio" name="image_browser_title_enable" id="image_browser_title_yes" value="1" <?php 
        echo $option_row->image_browser_title_enable ? 'checked' : '';
        ?>
 /><label for="image_browser_title_es">Yes</label>
                      <input type="radio" name="image_browser_title_enable" id="image_browser_title_no" value="0" <?php 
        echo $option_row->image_browser_title_enable ? '' : 'checked';
        ?>
 /><label for="image_browser_title_no">No</label>
                    </td>
                  </tr>
                  <tr id="tr_image_browser_description_enable">
                    <td class="spider_label"><label>Enable image description: </label></td>
                    <td>
                      <input type="radio" name="image_browser_description_enable" id="image_browser_description_yes" value="1" <?php 
        echo $option_row->image_browser_description_enable ? 'checked' : '';
        ?>
 /><label for="image_browser_description_yes">Yes</label>
                      <input type="radio" name="image_browser_description_enable" id="image_browser_description_no" value="0" <?php 
        echo $option_row->image_browser_description_enable ? '' : 'checked';
        ?>
 /><label for="image_browser_description_no">No</label>
                    </td>
                  </tr>

                  <!--Blog Style view-->
                  <tr id="tr_blog_style_width_height">
                    <td title="Maximum value for image width." class="spider_label"><label for="blog_style_width">Image width: </label></td>
                    <td>
                      <input type="text" name="blog_style_width" id="blog_style_width" value="<?php 
        echo $option_row->blog_style_width;
        ?>
" class="spider_int_input" /> px
                    </td>
                  </tr>
                  <tr id="tr_blog_style_title_enable">
                    <td class="spider_label"><label>Enable image title: </label></td>
                    <td>
                      <input type="radio" name="blog_style_title_enable" id="blog_style_title_yes" value="1" <?php 
        echo $option_row->blog_style_title_enable ? 'checked' : '';
        ?>
 /><label for="blog_style_title_es">Yes</label>
                      <input type="radio" name="blog_style_title_enable" id="blog_style_title_no" value="0" <?php 
        echo $option_row->blog_style_title_enable ? '' : 'checked';
        ?>
 /><label for="blog_style_title_no">No</label>
                    </td>
                  </tr>
                  <tr id="tr_blog_style_images_per_page">
                    <td title="If you want to display all images you should leave it blank or insert 0." class="spider_label"><label for="blog_style_images_per_page">Images per page: </label></td>
                    <td><input type="text" name="blog_style_images_per_page" id="blog_style_images_per_page" value="<?php 
        echo $option_row->blog_style_images_per_page;
        ?>
" class="spider_int_input" /></td>
                  </tr>
                  <tr id="tr_blog_style_enable_page">
                    <td class="spider_label"><label>Enable pagination: </label></td>
                    <td>
                      <input type="radio" name="blog_style_enable_page" id="blog_style_page_yes" value="1" <?php 
        echo $option_row->blog_style_enable_page == '1' ? 'checked' : '';
        ?>
 onchange="bwg_loadmore()" /><label for="blog_style_page_yes">Yes</label>
                      <input type="radio" name="blog_style_enable_page" id="blog_style_page_no" value="0" <?php 
        echo $option_row->blog_style_enable_page == '0' ? 'checked' : '';
        ?>
 onchange="bwg_loadmore()" /><label for="blog_style_page_no">No</label>
                      <input type="radio" name="blog_style_enable_page" id="blog_style_page_loadmore" value="2" <?php 
        echo $option_row->blog_style_enable_page == '2' ? 'checked' : '';
        ?>
 onchange="bwg_loadmore()" /><label for="blog_style_page_loadmore">Load more</label>
                      <input type="radio" name="blog_style_enable_page" id="blog_style_page_scrol_load" value="3" <?php 
        echo $option_row->blog_style_enable_page == '3' ? 'checked' : '';
        ?>
 onchange="bwg_loadmore()" /><label for="blog_style_page_scrol_load">Scroll Load </label>
                    </td>
                  </tr>
                  <tr id="tr_blog_style_load_more_image_count">
                    <td class="spider_label"><label for="blog_style_load_more_image_count">Images per load: </label></td>
                    <td><input type="text" name="blog_style_load_more_image_count" id="blog_style_load_more_image_count" value="<?php 
        echo $option_row->blog_style_images_per_page;
        ?>
" class="spider_int_input" /></td>
                  </tr>

                  <!--Slideshow view-->
                  <tr id="tr_slideshow_effect">
                    <td class="spider_label"><label for="slideshow_effect">Slideshow Effect: </label></td>
                    <td>
                      <select name="slideshow_effect" id="slideshow_effect" style="width:150px;">
                        <?php 
        foreach ($effects as $key => $effect) {
            ?>
                          <option value="<?php 
            echo $key;
            ?>
" <?php 
            echo $key != 'none' && $key != 'fade' ? 'disabled="disabled" title="This effect is disabled in free version."' : '';
            ?>
 <?php 
            echo $option_row->slideshow_type == $key ? 'selected' : '';
            ?>
><?php 
            echo $effect;
            ?>
</option>
                          <?php 
        }
        ?>
                      </select>
                    </td>
                  </tr>
                  <tr id="tr_slideshow_interval">
                    <td title="Interval between two images." class="spider_label"><label for="slideshow_interval">Time interval: </label></td>
                    <td><input type="text" name="slideshow_interval" id="slideshow_interval" value="<?php 
        echo $option_row->slideshow_interval;
        ?>
" class="spider_int_input" /> sec.</td>
                  </tr>
                  <tr id="tr_slideshow_width_height">
                    <td title="Maximum values for slideshow width and height." class="spider_label"><label for="slideshow_width">Slideshow dimensions: </label></td>
                    <td>
                      <input type="text" name="slideshow_width" id="slideshow_width" value="<?php 
        echo $option_row->slideshow_width;
        ?>
" class="spider_int_input" /> x 
                      <input type="text" name="slideshow_height" id="slideshow_height" value="<?php 
        echo $option_row->slideshow_height;
        ?>
" class="spider_int_input" /> px
                    </td>
                  </tr>
                  <tr id="tr_enable_slideshow_autoplay">
                    <td class="spider_label"><label>Enable Autoplay: </label></td>
                    <td>
                      <input type="radio" name="enable_slideshow_autoplay" id="slideshow_autoplay_yes" value="1" <?php 
        echo $option_row->slideshow_enable_autoplay ? 'checked' : '';
        ?>
 /><label for="slideshow_autoplay_yes">Yes</label>
                      <input type="radio" name="enable_slideshow_autoplay" id="slideshow_autoplay_no" value="0" <?php 
        echo $option_row->slideshow_enable_autoplay ? '' : 'checked';
        ?>
 /><label for="slideshow_autoplay_no">No</label>
                    </td>
                  </tr>
                  <tr id="tr_enable_slideshow_shuffle">
                    <td class="spider_label"><label>Enable Shuffle: </label></td>
                    <td>
                      <input type="radio" name="enable_slideshow_shuffle" id="slideshow_shuffle_yes" value="1" <?php 
        echo $option_row->slideshow_enable_shuffle ? 'checked' : '';
        ?>
 /><label for="slideshow_shuffle_yes">Yes</label>
                      <input type="radio" name="enable_slideshow_shuffle" id="slideshow_shuffle_no" value="0" <?php 
        echo $option_row->slideshow_enable_shuffle ? '' : 'checked';
        ?>
 /><label for="slideshow_shuffle_no">No</label>
                    </td>
                  </tr>
                  <tr id="tr_enable_slideshow_ctrl">
                    <td class="spider_label"><label>Enable control buttons: </label></td>
                    <td>
                      <input type="radio" name="enable_slideshow_ctrl" id="slideshow_ctrl_yes" value="1" <?php 
        echo $option_row->slideshow_enable_ctrl ? 'checked' : '';
        ?>
 /><label for="slideshow_ctrl_yes">Yes</label>
                      <input type="radio" name="enable_slideshow_ctrl" id="slideshow_ctrl_no" value="0" <?php 
        echo $option_row->slideshow_enable_ctrl ? '' : 'checked';
        ?>
 /><label for="slideshow_ctrl_no">No</label>
                    </td>
                  </tr>
                  <tr id="tr_enable_slideshow_filmstrip">
                    <td title="Enable slideshow filmstrip view<br /><br />This option is disabled in free version." class="spider_label spider_free_version_label"><label>Enable slideshow filmstrip: </label></td>
                    <td>
                      <input disabled="disabled" type="radio" name="enable_slideshow_filmstrip" id="slideshow_filmstrip_yes" value="1" onClick="bwg_enable_disable('', 'tr_slideshow_filmstrip_height', 'slideshow_filmstrip_yes')" <?php 
        echo $option_row->slideshow_enable_filmstrip ? 'checked' : '';
        ?>
 /><label for="slideshow_filmstrip_yes">Yes</label>
                      <input disabled="disabled" type="radio" name="enable_slideshow_filmstrip" id="slideshow_filmstrip_no" value="0" onClick="bwg_enable_disable('none', 'tr_slideshow_filmstrip_height', 'slideshow_filmstrip_no')" <?php 
        echo $option_row->slideshow_enable_filmstrip ? '' : 'checked';
        ?>
 /><label for="slideshow_filmstrip_no">No</label>
                    </td>
                  </tr>
                  <tr id="tr_slideshow_filmstrip_height">
                    <td class="spider_label spider_free_version_label"><label for="slideshow_filmstrip_height">Slideshow Filmstrip size: </label></td>
                    <td class="spider_free_version_label"><input disabled="disabled" type="text" name="slideshow_filmstrip_height" id="slideshow_filmstrip_height" value="<?php 
        echo $option_row->slideshow_filmstrip_height;
        ?>
" class="spider_int_input spider_free_version_label" /> px</td>
                  </tr>
                </tbody>
              </table>
              </div>
              <div class="bwg_short_div" style="border-right: 1px solid #000000;">
              <table>
                <!--Slideshow view-->
                <tbody id="tbody_slideshow">
                  <tr id="tr_slideshow_enable_title">
                    <td class="spider_label"><label>Enable Image Title: </label></td>
                    <td>
                      <input type="radio" name="slideshow_enable_title" id="slideshow_title_yes" value="1" <?php 
        echo $option_row->slideshow_enable_title ? 'checked' : '';
        ?>
 onClick="bwg_enable_disable('', 'tr_slideshow_title_position', 'slideshow_title_yes')" /><label for="slideshow_title_yes">Yes</label>
                      <input type="radio" name="slideshow_enable_title" id="slideshow_title_no" value="0" <?php 
        echo $option_row->slideshow_enable_title ? '' : 'checked';
        ?>
 onClick="bwg_enable_disable('none', 'tr_slideshow_title_position', 'slideshow_title_no')" /><label for="slideshow_title_no">No</label>
                    </td>
                  </tr>
                  <tr id="tr_slideshow_title_position">
                    <td title="Image title position on slideshow" class="spider_label"><label>Title Position: </label></td>
                    <td>
                      <table class="bws_position_table">
                        <tbody>
                          <tr>
                            <td><input type="radio" value="top-left" id="slideshow_title_top-left" name="slideshow_title_position" <?php 
        echo $option_row->slideshow_title_position == 'top-left' ? 'checked' : '';
        ?>
></td>
                            <td><input type="radio" value="top-center" id="slideshow_title_top-center" name="slideshow_title_position" <?php 
        echo $option_row->slideshow_title_position == 'top-center' ? 'checked' : '';
        ?>
></td>
                            <td><input type="radio" value="top-right" id="slideshow_title_top-right" name="slideshow_title_position" <?php 
        echo $option_row->slideshow_title_position == 'top-right' ? 'checked' : '';
        ?>
></td>
                          </tr>
                          <tr>
                            <td><input type="radio" value="middle-left" id="slideshow_title_middle-left" name="slideshow_title_position" <?php 
        echo $option_row->slideshow_title_position == 'middle-left' ? 'checked' : '';
        ?>
></td>
                            <td><input type="radio" value="middle-center" id="slideshow_title_middle-center" name="slideshow_title_position" <?php 
        echo $option_row->slideshow_title_position == 'middle-center' ? 'checked' : '';
        ?>
></td>
                            <td><input type="radio" value="middle-right" id="slideshow_title_middle-right" name="slideshow_title_position" <?php 
        echo $option_row->slideshow_title_position == 'middle-right' ? 'checked' : '';
        ?>
></td>
                          </tr>
                          <tr>
                            <td><input type="radio" value="bottom-left" id="slideshow_title_bottom-left" name="slideshow_title_position" <?php 
        echo $option_row->slideshow_title_position == 'bottom-left' ? 'checked' : '';
        ?>
></td>
                            <td><input type="radio" value="bottom-center" id="slideshow_title_bottom-center" name="slideshow_title_position" <?php 
        echo $option_row->slideshow_title_position == 'bottom-center' ? 'checked' : '';
        ?>
></td>
                            <td><input type="radio" value="bottom-right" id="slideshow_title_bottom-right" name="slideshow_title_position" <?php 
        echo $option_row->slideshow_title_position == 'bottom-right' ? 'checked' : '';
        ?>
></td>
                          </tr>
                        </tbody>
                      </table>
                    </td>
                  </tr>
                  <tr id="tr_slideshow_full_width_title">
                    <td title="Display image title based on the slideshow dimensions." class="spider_label">
                      <label>Full width title:</label>
                    </td>
                    <td>
                      <input type="radio" name="slideshow_title_full_width" id="slideshow_title_full_width_1" value="1" <?php 
        if ($option_row->slideshow_title_full_width) {
            echo 'checked="checked"';
        }
        ?>
  /><label for="slideshow_title_full_width_1">Yes</label>
                      <input type="radio" name="slideshow_title_full_width" id="slideshow_title_full_width_0" value="0" <?php 
        if (!$option_row->slideshow_title_full_width) {
            echo 'checked="checked"';
        }
        ?>
  /><label for="slideshow_title_full_width_0">No</label>
                    </td>
                  </tr>
                  <tr id="tr_slideshow_enable_description">
                    <td class="spider_label"><label>Enable Image Description: </label></td>
                    <td>
                      <input type="radio" name="slideshow_enable_description" id="slideshow_description_yes" value="1" <?php 
        echo $option_row->slideshow_enable_description ? 'checked' : '';
        ?>
 onClick="bwg_enable_disable('', 'tr_slideshow_description_position', 'slideshow_description_yes')" /><label for="slideshow_description_yes">Yes</label>
                      <input type="radio" name="slideshow_enable_description" id="slideshow_description_no" value="0" <?php 
        echo $option_row->slideshow_enable_description ? '' : 'checked';
        ?>
 onClick="bwg_enable_disable('none', 'tr_slideshow_description_position', 'slideshow_description_no')" /><label for="slideshow_description_no">No</label>
                    </td>
                  </tr>
                  <tr id="tr_slideshow_description_position">
                    <td title="Image description position on slideshow" class="spider_label"><label>Description Position: </label></td>
                    <td>
                      <table class="bws_position_table">
                        <tbody>
                          <tr>
                            <td><input type="radio" value="top-left" id="slideshow_description_top-left" name="slideshow_description_position" <?php 
        echo $option_row->slideshow_description_position == 'top-left' ? 'checked' : '';
        ?>
></td>
                            <td><input type="radio" value="top-center" id="slideshow_description_top-center" name="slideshow_description_position" <?php 
        echo $option_row->slideshow_description_position == 'top-center' ? 'checked' : '';
        ?>
></td>
                            <td><input type="radio" value="top-right" id="slideshow_description_top-right" name="slideshow_description_position" <?php 
        echo $option_row->slideshow_description_position == 'top-right' ? 'checked' : '';
        ?>
></td>
                          </tr>
                          <tr>
                            <td><input type="radio" value="middle-left" id="slideshow_description_middle-left" name="slideshow_description_position" <?php 
        echo $option_row->slideshow_description_position == 'middle-left' ? 'checked' : '';
        ?>
></td>
                            <td><input type="radio" value="middle-center" id="slideshow_description_middle-center" name="slideshow_description_position" <?php 
        echo $option_row->slideshow_description_position == 'middle-center' ? 'checked' : '';
        ?>
></td>
                            <td><input type="radio" value="middle-right" id="slideshow_description_middle-right" name="slideshow_description_position" <?php 
        echo $option_row->slideshow_description_position == 'middle-right' ? 'checked' : '';
        ?>
></td>
                          </tr>
                          <tr>
                            <td><input type="radio" value="bottom-left" id="slideshow_description_bottm-Left" name="slideshow_description_position" <?php 
        echo $option_row->slideshow_description_position == 'bottom-left' ? 'checked' : '';
        ?>
></td>
                            <td><input type="radio" value="bottom-center" id="slideshow_description_bottom-center" name="slideshow_description_position" <?php 
        echo $option_row->slideshow_description_position == 'bottom-center' ? 'checked' : '';
        ?>
></td>
                            <td><input type="radio" value="bottom-right" id="slideshow_description_bottm-right" name="slideshow_description_position" <?php 
        echo $option_row->slideshow_description_position == 'bottom-right' ? 'checked' : '';
        ?>
></td>
                          </tr>
                        </tbody>
                      </table>
                    </td>
                  </tr>
                  <tr id="tr_enable_slideshow_music">
                    <td class="spider_label"><label>Enable Slideshow Music: </label></td>
                    <td>
                      <input type="radio" name="enable_slideshow_music" id="slideshow_music_yes" value="1" onClick="bwg_enable_disable('', 'tr_slideshow_music_url', 'slideshow_music_yes')" <?php 
        echo $option_row->slideshow_enable_music ? 'checked' : '';
        ?>
 /><label for="slideshow_music_yes">Yes</label>
                      <input type="radio" name="enable_slideshow_music" id="slideshow_music_no" value="0" onClick="bwg_enable_disable('none', 'tr_slideshow_music_url', 'slideshow_music_no')" <?php 
        echo $option_row->slideshow_enable_music ? '' : 'checked';
        ?>
 /><label for="slideshow_music_no">No</label>
                    </td>
                  </tr>
                  <tr id="tr_slideshow_music_url">
                    <td title="Enter absolute audio file url or add file from Options page." class="spider_label">
                      <label for="slideshow_music_url">Music url: </label>
                    </td>
                    <td>
                      <input type="text" id="slideshow_music_url" name="slideshow_music_url" value="<?php 
        echo $option_row->slideshow_audio_url;
        ?>
" style="display:inline-block;" />
                    </td>
                  </tr>
                </tbody>

                <!--Lightbox view-->
                <tbody id="tbody_popup_other">
                  <tr id="tr_thumb_click_action">
                    <td class="spider_label"><label>Thumb click action: </label></td>
                    <td>
                      <input type="radio" name="thumb_click_action" id="thumb_click_action_1" value="open_lightbox" <?php 
        if ($option_row->thumb_click_action == 'open_lightbox') {
            echo 'checked="checked"';
        }
        ?>
 onchange="bwg_thumb_click_action()" /><label for="thumb_click_action_1">Open lightbox</label><br />
                      <input type="radio" name="thumb_click_action" id="thumb_click_action_2" value="redirect_to_url" <?php 
        if ($option_row->thumb_click_action == 'redirect_to_url') {
            echo 'checked="checked"';
        }
        ?>
 onchange="bwg_thumb_click_action()" /><label for="thumb_click_action_2">Redirect to url</label><br />
                      <input type="radio" name="thumb_click_action" id="thumb_click_action_3" value="do_nothing" <?php 
        if ($option_row->thumb_click_action == 'do_nothing') {
            echo 'checked="checked"';
        }
        ?>
 onchange="bwg_thumb_click_action()" /><label for="thumb_click_action_3">Do Nothing</label>
                    </td>
                  </tr>
                  <tr id="tr_thumb_link_target">
                    <td title="Open new window when redirecting." class="spider_label"><label>Open in new window: </label></td>
                    <td>
                      <input type="radio" name="thumb_link_target" id="thumb_link_target_yes" value="1" <?php 
        if ($option_row->thumb_link_target) {
            echo 'checked="checked"';
        }
        ?>
 /><label for="thumb_link_target_yes">Yes</label>
                      <input type="radio" name="thumb_link_target" id="thumb_link_target_no" value="0" <?php 
        if (!$option_row->thumb_link_target) {
            echo 'checked="checked"';
        }
        ?>
 /><label for="thumb_link_target_no">No</label>
                    </td>
                  </tr>
                </tbody>
                <tbody id="tbody_popup">
                  <tr id="tr_popup_fullscreen">
                    <td title="Enable full width feature for the lightbox." class="spider_label">
                      <label>Full width lightbox:</label>
                    </td>
                    <td>
                      <input type="radio" name="popup_fullscreen" id="popup_fullscreen_1" value="1" <?php 
        if ($option_row->popup_fullscreen) {
            echo 'checked="checked"';
        }
        ?>
 onchange="bwg_popup_fullscreen()" /><label for="popup_fullscreen_1">Yes</label>
                      <input type="radio" name="popup_fullscreen" id="popup_fullscreen_0" value="0" <?php 
        if (!$option_row->popup_fullscreen) {
            echo 'checked="checked"';
        }
        ?>
 onchange="bwg_popup_fullscreen()" /><label for="popup_fullscreen_0">No</label>
                    </td>
                  </tr>	
                  <tr id="tr_popup_width_height">
                    <td title="Maximum values for lightbox width and height." class="spider_label"><label for="popup_width">Lightbox dimensions: </label></td>
                    <td>
                      <input type="text" name="popup_width" id="popup_width" value="<?php 
        echo $option_row->popup_width;
        ?>
" class="spider_int_input" /> x 
                      <input type="text" name="popup_height" id="popup_height" value="<?php 
        echo $option_row->popup_height;
        ?>
" class="spider_int_input" /> px
                    </td>
                  </tr>
                  <tr id="tr_popup_effect">
                    <td title="Lightbox slideshow effect." class="spider_label"><label for="popup_effect">Lightbox effect: </label></td>
                    <td>
                      <select name="popup_effect" id="popup_effect" style="width:150px;">
                        <?php 
        foreach ($effects as $key => $effect) {
            ?>
                          <option value="<?php 
            echo $key;
            ?>
" <?php 
            echo $key != 'none' && $key != 'fade' ? 'disabled="disabled" title="This effect is disabled in free version."' : '';
            ?>
 <?php 
            echo $option_row->popup_type == $key ? 'selected' : '';
            ?>
><?php 
            echo $effect;
            ?>
</option>
                          <?php 
        }
        ?>
                      </select>
                    </td>
                  </tr>
                  <tr id="tr_popup_autoplay">
                    <td class="spider_label">
                      <label>Lightbox autoplay: </label>
                    </td>
                    <td>
                      <input type="radio" name="popup_autoplay" id="popup_autoplay_1" value="1" <?php 
        if ($option_row->popup_autoplay) {
            echo 'checked="checked"';
        }
        ?>
  /><label for="popup_autoplay_1">Yes</label>
                      <input type="radio" name="popup_autoplay" id="popup_autoplay_0" value="0" <?php 
        if (!$option_row->popup_autoplay) {
            echo 'checked="checked"';
        }
        ?>
  /><label for="popup_autoplay_0">No</label>
                    </td>
                  </tr>
                  <tr id="tr_popup_interval">
                    <td title="Interval between two images." class="spider_label"><label for="popup_interval">Time interval: </label></td>
                    <td><input type="text" name="popup_interval" id="popup_interval" value="<?php 
        echo $option_row->popup_interval;
        ?>
" class="spider_int_input" /> sec.</td>
                  </tr>
                  <tr id="tr_popup_enable_filmstrip">
                    <td title="Enable filmstrip view for images<br /><br />This option is disabled in free version." class="spider_label spider_free_version_label"><label>Enable filmstrip in lightbox: </label></td>
                    <td>
                      <input disabled="disabled" type="radio" name="popup_enable_filmstrip" id="popup_filmstrip_yes" value="1" onClick="bwg_enable_disable('', 'tr_popup_filmstrip_height', 'popup_filmstrip_yes')" <?php 
        echo $option_row->popup_enable_filmstrip ? 'checked' : '';
        ?>
 /><label for="popup_filmstrip_yes">Yes</label>
                      <input disabled="disabled" type="radio" name="popup_enable_filmstrip" id="popup_filmstrip_no" value="0" onClick="bwg_enable_disable('none', 'tr_popup_filmstrip_height', 'popup_filmstrip_no')" <?php 
        echo $option_row->popup_enable_filmstrip ? '' : 'checked';
        ?>
 /><label for="popup_filmstrip_no">No</label>
                    </td>
                  </tr>
                  <tr id="tr_popup_filmstrip_height">
                    <td title="This option is disabled in free version." class="spider_label spider_free_version_label"><label for="popup_filmstrip_height">Filmstrip size: </label></td>
                    <td class="spider_free_version_label"><input disabled="disabled" type="text" name="popup_filmstrip_height" id="popup_filmstrip_height" value="<?php 
        echo $option_row->popup_filmstrip_height;
        ?>
" class="spider_int_input spider_free_version_label" /> px</td>
                  </tr>
                  <tr id="tr_popup_hit_counter">
                    <td title="This option is disabled in free version." class="spider_label spider_free_version_label"><label>Display hit counter: </label></td>
                    <td>
                      <input disabled="disabled" type="radio" name="popup_hit_counter" id="popup_hit_counter_yes" value="1" <?php 
        echo $option_row->popup_hit_counter ? 'checked' : '';
        ?>
 /><label for="popup_hit_counter_yes">Yes</label>
                      <input disabled="disabled" type="radio" name="popup_hit_counter" id="popup_hit_counter_no" value="0" <?php 
        echo $option_row->popup_hit_counter ? '' : 'checked';
        ?>
 /><label for="popup_hit_counter_no">No</label>
                    </td>
                  </tr>
                  <tr id="tr_popup_enable_ctrl_btn">
                    <td title="Enable control buttons in lightbox" class="spider_label"><label>Enable control buttons: </label></td>
                    <td>
                      <input type="radio" name="popup_enable_ctrl_btn" id="popup_ctrl_btn_yes" value="1" onClick="bwg_enable_disable('', 'tbody_popup_ctrl_btn', 'popup_ctrl_btn_yes');" <?php 
        echo $option_row->popup_enable_ctrl_btn ? 'checked' : '';
        ?>
 /><label for="popup_ctrl_btn_yes">Yes</label>
                      <input type="radio" name="popup_enable_ctrl_btn" id="popup_ctrl_btn_no" value="0" onClick="bwg_enable_disable('none', 'tbody_popup_ctrl_btn', 'popup_ctrl_btn_no');" <?php 
        echo $option_row->popup_enable_ctrl_btn ? '' : 'checked';
        ?>
 /><label for="popup_ctrl_btn_no">No</label>
                    </td>
                  </tr>
                </tbody>
                <tbody id="tbody_popup_ctrl_btn">
                  <tr id="tr_popup_enable_fullscreen">
                    <td title="Enable fullscreen view for images" class="spider_label"><label>Enable fullscreen: </label></td>
                    <td>
                      <input type="radio" name="popup_enable_fullscreen" id="popup_fullscreen_yes" value="1" <?php 
        echo $option_row->popup_enable_fullscreen ? 'checked' : '';
        ?>
 /><label for="popup_fullscreen_yes">Yes</label>
                      <input type="radio" name="popup_enable_fullscreen" id="popup_fullscreen_no" value="0" <?php 
        echo $option_row->popup_enable_fullscreen ? '' : 'checked';
        ?>
 /><label for="popup_fullscreen_no">No</label>
                    </td>
                  </tr>
                  <tr id="tr_popup_enable_info">
                    <td title="Enable title, description for images" class="spider_label"><label>Enable info: </label></td>
                    <td>
                      <input type="radio" name="popup_enable_info" id="popup_info_yes" value="1" <?php 
        echo $option_row->popup_enable_info ? 'checked="checked"' : '';
        ?>
 /><label for="popup_info_yes">Yes</label>
                      <input type="radio" name="popup_enable_info" id="popup_info_no" value="0" <?php 
        echo $option_row->popup_enable_info ? '' : 'checked="checked"';
        ?>
 /><label for="popup_info_no">No</label>
                    </td>
                  </tr>
                  <tr id="tr_popup_info_always_show">
                    <td class="spider_label"><label>Display info by default: </label></td>
                    <td>
                      <input type="radio" name="popup_info_always_show" id="popup_info_always_show_yes" value="1" <?php 
        echo $option_row->popup_info_always_show ? 'checked="checked"' : '';
        ?>
 /><label for="popup_info_always_show_yes">Yes</label>
                      <input type="radio" name="popup_info_always_show" id="popup_info_always_show_no" value="0" <?php 
        echo $option_row->popup_info_always_show ? '' : 'checked="checked"';
        ?>
 /><label for="popup_info_always_show_no">No</label>
                    </td>
                  </tr>
                  <tr id="tr_popup_info_full_width">
                    <td title="Display image information based on the lightbox dimensions." class="spider_label"><label>Full width info:</label></td>
                    <td>
                      <input type="radio" name="popup_info_full_width" id="popup_info_full_width_1" value="1" <?php 
        if ($option_row->popup_info_full_width) {
            echo 'checked="checked"';
        }
        ?>
  /><label for="popup_info_full_width_1">Yes</label>
                      <input type="radio" name="popup_info_full_width" id="popup_info_full_width_0" value="0" <?php 
        if (!$option_row->popup_info_full_width) {
            echo 'checked="checked"';
        }
        ?>
  /><label for="popup_info_full_width_0">No</label>
                    </td>
                  </tr>
                  <tr id="tr_popup_enable_rate">
                    <td title="Enable rating for images<br /><br />This option is disabled in free version." class="spider_label spider_free_version_label"><label>Enable rating: </label></td>
                    <td>
                      <input disabled="disabled" type="radio" name="popup_enable_rate" id="popup_rate_yes" value="1" <?php 
        echo $option_row->popup_enable_rate ? 'checked="checked"' : '';
        ?>
 /><label for="popup_rate_yes">Yes</label>
                      <input disabled="disabled" type="radio" name="popup_enable_rate" id="popup_rate_no" value="0" <?php 
        echo $option_row->popup_enable_rate ? '' : 'checked="checked"';
        ?>
 /><label for="popup_rate_no">No</label>
                    </td>
                  </tr>
                  <tr id="tr_popup_enable_comment">
                    <td title="Enable comments for images<br /><br />This option is disabled in free version." class="spider_label spider_free_version_label"><label>Enable comments: </label></td>
                    <td>
                      <input disabled="disabled" type="radio" name="popup_enable_comment" id="popup_comment_yes" value="1" <?php 
        echo $option_row->popup_enable_comment ? 'checked' : '';
        ?>
 /><label for="popup_comment_yes">Yes</label>
                      <input disabled="disabled" type="radio" name="popup_enable_comment" id="popup_comment_no" value="0" <?php 
        echo $option_row->popup_enable_comment ? '' : 'checked';
        ?>
 /><label for="popup_comment_no">No</label>
                    </td>
                  </tr>
                  <tr id="tr_popup_enable_facebook">
                    <td title="Enable Facebook share button for images<br /><br />This option is disabled in free version." class="spider_label spider_free_version_label"><label>Enable Facebook button: </label></td>
                    <td>
                      <input disabled="disabled" type="radio" name="popup_enable_facebook" id="popup_facebook_yes" value="1" <?php 
        echo $option_row->popup_enable_facebook ? 'checked' : '';
        ?>
 /><label for="popup_facebook_yes">Yes</label>
                      <input disabled="disabled" type="radio" name="popup_enable_facebook" id="popup_facebook_no" value="0" <?php 
        echo $option_row->popup_enable_facebook ? '' : 'checked';
        ?>
 /><label for="popup_facebook_no">No</label>
                    </td>
                  </tr>
                  <tr id="tr_popup_enable_twitter">
                    <td title="Enable Twitter share button for images<br /><br />This option is disabled in free version." class="spider_label spider_free_version_label"><label>Enable Twitter button: </label></td>
                    <td>
                      <input disabled="disabled" type="radio" name="popup_enable_twitter" id="popup_twitter_yes" value="1" <?php 
        echo $option_row->popup_enable_twitter ? 'checked' : '';
        ?>
 /><label for="popup_twitter_yes">Yes</label>
                      <input disabled="disabled" type="radio" name="popup_enable_twitter" id="popup_twitter_no" value="0" <?php 
        echo $option_row->popup_enable_twitter ? '' : 'checked';
        ?>
 /><label for="popup_twitter_no">No</label>
                    </td>
                  </tr>
                  <tr id="tr_popup_enable_google">
                    <td title="Enable Google+ share button for images<br /><br />This option is disabled in free version." class="spider_label spider_free_version_label"><label>Enable Google+ button: </label></td>
                    <td>
                      <input disabled="disabled" type="radio" name="popup_enable_google" id="popup_google_yes" value="1" <?php 
        echo $option_row->popup_enable_google ? 'checked' : '';
        ?>
 /><label for="popup_google_yes">Yes</label>
                      <input disabled="disabled" type="radio" name="popup_enable_google" id="popup_google_no" value="0" <?php 
        echo $option_row->popup_enable_google ? '' : 'checked';
        ?>
 /><label for="popup_google_no">No</label>
                    </td>
                  </tr>
                  <tr id="tr_popup_enable_pinterest">
                    <td title="Enable Pinterest share button for images<br /><br />This option is disabled in free version." class="spider_label spider_free_version_label"><label>Enable Pinterest button: </label></td>
                    <td>
                      <input disabled="disabled" type="radio" name="popup_enable_pinterest" id="popup_pinterest_yes" value="1" <?php 
        echo $option_row->popup_enable_pinterest ? 'checked' : '';
        ?>
 /><label for="popup_pinterest_yes">Yes</label>
                      <input disabled="disabled" type="radio" name="popup_enable_pinterest" id="popup_pinterest_no" value="0" <?php 
        echo $option_row->popup_enable_pinterest ? '' : 'checked';
        ?>
 /><label for="popup_pinterest_no">No</label>
                    </td>
                  </tr>
                  <tr id="tr_popup_enable_tumblr">
                    <td title="Enable Tumblr share button for images<br /><br />This option is disabled in free version." class="spider_label spider_free_version_label"><label>Enable Tumblr button: </label></td>
                    <td>
                      <input disabled="disabled" type="radio" name="popup_enable_tumblr" id="popup_tumblr_yes" value="1" <?php 
        echo $option_row->popup_enable_tumblr ? 'checked' : '';
        ?>
 /><label for="popup_tumblr_yes">Yes</label>
                      <input disabled="disabled" type="radio" name="popup_enable_tumblr" id="popup_tumblr_no" value="0" <?php 
        echo $option_row->popup_enable_tumblr ? '' : 'checked';
        ?>
 /><label for="popup_tumblr_no">No</label>
                    </td>
                  </tr>
                </tbody>
              </table>
              </div>
              <div class="bwg_short_div">
              <table>
                <tbody>
                  <tr id="tr_watermark_type">
                    <td class="spider_label"><label>Advertisement Type: </label></td>
                    <td>
                      <input type="radio" name="watermark_type" id="watermark_type_none" value="none" onClick="bwg_watermark('watermark_type_none')" <?php 
        echo $option_row->watermark_type == 'none' ? 'checked' : '';
        ?>
 /><label for="watermark_type_none">None</label>
                      <input type="radio" name="watermark_type" id="watermark_type_text" value="text" onClick="bwg_watermark('watermark_type_text')" <?php 
        echo $option_row->watermark_type == 'text' ? 'checked' : '';
        ?>
 /><label for="watermark_type_text">Text</label>
                      <input type="radio" name="watermark_type" id="watermark_type_image" value="image" onClick="bwg_watermark('watermark_type_image')" <?php 
        echo $option_row->watermark_type == 'image' ? 'checked' : '';
        ?>
 /><label for="watermark_type_image">Image</label>
                    </td>
                  </tr>
                  <tr id="tr_watermark_link">
                    <td title="Enter absolute url, e.g. http://www.example.com" class="spider_label">
                      <label for="watermark_link">Advertisement link: </label>
                    </td>
                    <td>
                      <input type="text" id="watermark_link" name="watermark_link" value="<?php 
        echo $option_row->watermark_link;
        ?>
" style="display:inline-block;" />
                    </td>
                  </tr>
                  <tr id="tr_watermark_url">
                    <td title="Enter absolute image file url or add file from Options page." class="spider_label">
                      <label for="watermark_url">Advertisement url: </label>
                    </td>
                    <td>
                      <input type="text" id="watermark_url" name="watermark_url" value="<?php 
        echo $option_row->watermark_url;
        ?>
" style="display:inline-block;" />
                    </td>
                  </tr>
                  <tr id="tr_watermark_width_height">
                    <td title="Maximum values for watermark image width and height." class="spider_label"><label for="watermark_width">Advertisement dimensions: </label></td>
                    <td>
                      <input type="text" name="watermark_width" id="watermark_width" value="<?php 
        echo $option_row->watermark_width;
        ?>
" class="spider_int_input" /> x 
                      <input type="text" name="watermark_height" id="watermark_height" value="<?php 
        echo $option_row->watermark_height;
        ?>
" class="spider_int_input" /> px
                    </td>
                  </tr>
                  <tr id="tr_watermark_text">
                    <td class="spider_label"><label for="watermark_text">Advertisement text: </label></td>
                    <td>
                      <input type="text" name="watermark_text" id="watermark_text" value="<?php 
        echo $option_row->watermark_text;
        ?>
" />
                    </td>
                  </tr>
                  <tr id="tr_watermark_font_size">
                    <td class="spider_label"><label for="watermark_font_size">Advertisement font size: </label></td>
                    <td>
                      <input type="text" name="watermark_font_size" id="watermark_font_size" value="<?php 
        echo $option_row->watermark_font_size;
        ?>
" class="spider_int_input" /> px
                    </td>
                  </tr>
                  <tr id="tr_watermark_font">
                    <td class="spider_label"><label for="watermark_font">Advertisement font style: </label></td>
                    <td>
                      <select name="watermark_font" id="watermark_font" style="width:150px;">
                        <?php 
        foreach ($watermark_fonts as $watermark_font) {
            ?>
                          <option value="<?php 
            echo $watermark_font;
            ?>
" <?php 
            echo $option_row->watermark_font == $watermark_font ? 'selected' : '';
            ?>
><?php 
            echo $watermark_font;
            ?>
</option>
                          <?php 
        }
        ?>
                      </select>
                    </td>
                  </tr>
                  <tr id="tr_watermark_color">
                    <td class="spider_label"><label for="watermark_color">Advertisement color: </label></td>
                    <td>
                      <input type="text" name="watermark_color" id="watermark_color" value="<?php 
        echo $option_row->watermark_color;
        ?>
" class="color" />
                    </td>
                  </tr>
                  <tr id="tr_watermark_opacity">
                    <td title="Value must be between 0 to 100." class="spider_label"><label for="watermark_opacity">Advertisement opacity: </label></td>
                    <td>
                      <input type="text" name="watermark_opacity" id="watermark_opacity" value="<?php 
        echo $option_row->watermark_opacity;
        ?>
" class="spider_int_input" /> %
                    </td>
                  </tr>
                  <tr id="tr_watermark_position">
                    <td class="spider_label"><label>Advertisement Position: </label></td>
                    <td>
                      <table class="bws_position_table">
                        <tbody>
                          <tr>
                            <td><input type="radio" value="top-left" id="watermark_top-left" name="watermark_position" <?php 
        echo $option_row->watermark_position == 'top-left' ? 'checked' : '';
        ?>
></td>
                            <td><input type="radio" value="top-center" id="watermark_top-center" name="watermark_position" <?php 
        echo $option_row->watermark_position == 'top-center' ? 'checked' : '';
        ?>
></td>
                            <td><input type="radio" value="top-right" id="watermark_top-right" name="watermark_position" <?php 
        echo $option_row->watermark_position == 'top-right' ? 'checked' : '';
        ?>
></td>
                          </tr>
                          <tr>
                            <td><input type="radio" value="middle-left" id="watermark_middle-left" name="watermark_position" <?php 
        echo $option_row->watermark_position == 'middle-left' ? 'checked' : '';
        ?>
></td>
                            <td><input type="radio" value="middle-center" id="watermark_middle-center" name="watermark_position" <?php 
        echo $option_row->watermark_position == 'middle-center' ? 'checked' : '';
        ?>
></td>
                            <td><input type="radio" value="middle-right" id="watermark_middle-right" name="watermark_position" <?php 
        echo $option_row->watermark_position == 'middle-right' ? 'checked' : '';
        ?>
></td>
                          </tr>
                          <tr>
                            <td><input type="radio" value="bottom-left" id="watermark_bottom-left" name="watermark_position" <?php 
        echo $option_row->watermark_position == 'bottom-left' ? 'checked' : '';
        ?>
></td>
                            <td><input type="radio" value="bottom-center" id="watermark_bottom-center" name="watermark_position" <?php 
        echo $option_row->watermark_position == 'bottom-center' ? 'checked' : '';
        ?>
></td>
                            <td><input type="radio" value="bottom-right" id="watermark_bottom-right" name="watermark_position" <?php 
        echo $option_row->watermark_position == 'bottom-right' ? 'checked' : '';
        ?>
></td>
                          </tr>
                        </tbody>
                      </table>
                    </td>
                  </tr>
                </tbody>
              </table>
              </div>
          <?php 
        if (!$from_menu) {
            ?>
            </div>
          </div>
          <div class="mceActionPanel">
            <div style="float:left;">
              <a id="bwg_pro_version_link" class="button button-primary" target="_blank" style="line-height: 25px; padding: 0 5px; text-decoration: none; vertical-align: middle; width: inherit; float: left;" href="http://wpdemo.web-dorado.com/thumbnails-view-2/">Please see Pro <span id="bwg_pro_version">Thumbnail</span> View</a>
            </div>
            <div style="float:right;">
              <input type="button" id="insert" name="insert" value="Insert" onClick="bwg_insert_shortcode('');" />
              <input type="button" id="cancel" name="cancel" value="Cancel" onClick="tinyMCEPopup.close();" />
            </div>
          </div>
          <?php 
        } else {
            $tagtext = '';
            $tagfunction = '';
            if (isset($_POST['currrent_id'])) {
                $currrent_id = stripslashes($_POST['currrent_id']);
                $title = isset($_POST['title']) ? stripslashes($_POST['title']) : '';
                $tagtext = '[Best_Wordpress_Gallery id="' . $currrent_id . '"' . $title . ']';
                $tagfunction = "<?php echo photo_gallery(" . $currrent_id . "); ?>";
            }
            ?>
            <hr style="float: left; width: 100%;" />
            <span style="float: left; width: 100%;">
              <a id="bwg_pro_version_link" class="button button-primary" target="_blank" style="display: table; margin-bottom: 5px;" href="https://web-dorado.com/files/fromPhotoGallery.php">Please see Pro <span id="bwg_pro_version">Thumbnail</span> View</a>
              <input type="button" class="button-primary" id="insert" name="insert" value="Generate" onclick="bwg_insert_shortcode('');" />
              <input type="button" class="button-secondary" id="import" name="import" value="Import" onclick="bwg_update_shortcode()" />
              <div>
                <input type="text" size="55" id="bwg_shortcode" name="bwg_shortcode" value='<?php 
            echo $tagtext;
            ?>
' onclick="bwg_onKeyDown(event)" />
                <b>Shortcode</b>
              </div>
              <div>
                <input type="text" size="55" id="bwg_function" name="bwg_function" value="<?php 
            echo $tagfunction;
            ?>
" onclick="spider_select_value(this)" readonly="readonly" />
                <b>PHP function</b>
              </div>
            </span>
            </div>
            <?php 
        }
        ?>
          <input type="hidden" id="tagtext" name="tagtext" value="" />
          <input type="hidden" id="currrent_id" name="currrent_id" value="" />
          <input type="hidden" id="title" name="title" value="" />
          <input type="hidden" id="bwg_insert" name="bwg_insert" value="" />
          <input type="hidden" id="task" name="task" value="" />
        </form>
        <script type="text/javascript">
          var shortcodes = [];
          var shortcode_id = 1;
          <?php 
        foreach ($shortcodes as $shortcode) {
            ?>
            shortcodes[<?php 
            echo $shortcode->id;
            ?>
] = '<?php 
            echo addslashes($shortcode->tagtext);
            ?>
';
            <?php 
        }
        ?>
          shortcode_id = <?php 
        echo $shortcode_max_id + 1;
        ?>
;
          window.onload = bwg_shortcode_load;
          var params = get_params("Best_Wordpress_Gallery");
          var bwg_insert = 1;
          bwg_update_shortcode();
          <?php 
        if (!$from_menu) {
            ?>
          var content = tinyMCE.activeEditor.selection.getContent();
          <?php 
        } else {
            ?>
          var content = jQuery("#bwg_shortcode").val();
          <?php 
        }
        ?>
          function bwg_update_shortcode() {
            params = get_params("Best_Wordpress_Gallery");
            if (!params) { // Insert.
            <?php 
        if (!$from_menu) {
            ?>
              jQuery('#insert').val('Insert');
            <?php 
        }
        ?>
              bwg_gallery_type('thumbnails');
            }
            else { // Update.
              if (params['id']) {
                shortcode_id = params['id'];
                if(typeof shortcodes[shortcode_id] === 'undefined'){
                  alert("There is no shortcode with such ID!");
                  bwg_gallery_type('thumbnails');
                  return 0;
                }
                var short_code = get_short_params(shortcodes[shortcode_id]);
                bwg_insert = 0;
              }
              else {
                var short_code = get_params("Best_Wordpress_Gallery");
              }
            <?php 
        if (!$from_menu) {
            ?>
              jQuery('#insert').val('Update');
            <?php 
        } else {
            ?>
              content = jQuery("#bwg_shortcode").val();
            <?php 
        }
        ?>
              jQuery('#insert').attr('onclick', "bwg_insert_shortcode(content)");
              jQuery("select[id=theme] option[value='" + short_code['theme_id'] + "']").attr('selected', 'selected');
              switch (short_code['gallery_type']) {
                case 'thumbnails': {
                  jQuery("select[id=gallery] option[value='" + short_code['gallery_id'] + "']").attr('selected', 'selected');
                  jQuery("select[id=sort_by] option[value='" + short_code['sort_by'] + "']").attr('selected', 'selected');
                  if (short_code['order_by'] == 'asc') {
                    jQuery("#order_by_1").attr('checked', 'checked');
                  }
                  else {
                    jQuery("#order_by_0").attr('checked', 'checked');
                  }
                  if (short_code['show_search_box'] == 1) {
                    jQuery("#show_search_box_1").attr('checked', 'checked');
                    jQuery("#tr_search_box_width").css('display', '');
                  }
                  else {
                    jQuery("#show_search_box_0").attr('checked', 'checked');
                    jQuery("#tr_search_box_width").css('display', 'none');
                  }
									if (short_code['show_sort_images'] == 1) {
                    jQuery("#show_sort_images_1").attr('checked', 'checked');
                  }
                  else {
                    jQuery("#show_sort_images_0").attr('checked', 'checked');
                  }
                  if (short_code['show_tag_box'] == 1) {
                    jQuery("#show_tag_box_1").attr('checked', 'checked');
                  }
                  else {
                    jQuery("#show_tag_box_0").attr('checked', 'checked');
                  }
                  if (short_code['search_box_width']) {
                    jQuery("#search_box_width").val(short_code['search_box_width']);
                  }
                  jQuery("#image_column_number").val(short_code['image_column_number']);
                  jQuery("#images_per_page").val(short_code['images_per_page']);
                  jQuery("#load_more_image_count").val(short_code['load_more_image_count']);
                  jQuery("#image_title_" + short_code['image_title']).attr('checked', 'checked');
                  if (short_code['image_enable_page'] == 1) {
                    jQuery("#image_page_yes").attr('checked', 'checked');
                  }
                  else if (short_code['image_enable_page'] == 0) {
                    jQuery("#image_page_no").attr('checked', 'checked');
                  }
                  else if (short_code['image_enable_page'] == 2) {
                    jQuery("#image_page_loadmore").attr('checked', 'checked');
                  }
                   else if (short_code['image_enable_page'] == 3) {
                    jQuery("#image_page_scrol_load").attr('checked', 'checked');
                  }
                  jQuery("#thumb_width").val(short_code['thumb_width']);
                  jQuery("#thumb_height").val(short_code['thumb_height']);
                  break;

                }
                case 'slideshow': {
                  jQuery("select[id=gallery] option[value='" + short_code['gallery_id'] + "']").attr('selected', 'selected');
                  jQuery("select[id=sort_by] option[value='" + short_code['sort_by'] + "']").attr('selected', 'selected');
                  if (short_code['order_by'] == 'asc') {
                    jQuery("#order_by_1").attr('checked', 'checked');
                  }
                  else {
                    jQuery("#order_by_0").attr('checked', 'checked');
                  }
                  jQuery("select[id=slideshow_effect] option[value='" + short_code['slideshow_effect'] + "']").attr('selected', 'selected');
                  jQuery("#slideshow_interval").val(short_code['slideshow_interval']);
                  jQuery("#slideshow_width").val(short_code['slideshow_width']);
                  jQuery("#slideshow_height").val(short_code['slideshow_height']);
                  if (short_code['enable_slideshow_autoplay'] == 1) {
                    jQuery("#slideshow_autoplay_yes").attr('checked', 'checked');
                  }
                  else {
                    jQuery("#slideshow_autoplay_no").attr('checked', 'checked');
                  }
                  if (short_code['enable_slideshow_shuffle'] == 1) {
                    jQuery("#slideshow_shuffle_yes").attr('checked', 'checked');
                  }
                  else {
                    jQuery("#slideshow_shuffle_no").attr('checked', 'checked');
                  }
                  if (short_code['enable_slideshow_ctrl'] == 1) {
                    jQuery("#slideshow_ctrl_yes").attr('checked', 'checked');
                  }
                  else {
                    jQuery("#slideshow_ctrl_no").attr('checked', 'checked');
                  }
                  if (short_code['enable_slideshow_filmstrip'] == 1) {
                    jQuery("#slideshow_filmstrip_yes").attr('checked', 'checked');
                    jQuery("#slideshow_filmstrip_height").val(short_code['slideshow_filmstrip_height']);
                    bwg_enable_disable('', 'tr_slideshow_filmstrip_height', 'slideshow_filmstrip_yes');
                  }
                  else {
                    jQuery("#slideshow_filmstrip_no").attr('checked', 'checked');
                  }
                  if (short_code['slideshow_enable_title'] == 1) {
                    jQuery("#slideshow_title_yes").attr('checked', 'checked');
                    jQuery("#slideshow_title_" + short_code['slideshow_title_position']).attr('checked', 'checked');
                    bwg_enable_disable('', 'tr_slideshow_title_position', 'slideshow_title_yes');
                  }
                  else {
                    jQuery("#slideshow_title_no").attr('checked', 'checked');
                  }
                  if (short_code['slideshow_enable_description'] == 1) {
                    jQuery("#slideshow_description_yes").attr('checked', 'checked');
                    jQuery("#slideshow_description_" + short_code['slideshow_description_position']).attr('checked', 'checked');
                    bwg_enable_disable('', 'tr_slideshow_description_position', 'slideshow_description_yes');
                  }
                  else {
                    jQuery("#slideshow_description_no").attr('checked', 'checked');
                  }
                  if (short_code['enable_slideshow_music'] == 1) {
                    jQuery("#slideshow_music_yes").attr('checked', 'checked');
                    jQuery("#slideshow_music_url").val(short_code['slideshow_music_url']);
                    bwg_enable_disable('', 'tr_slideshow_music_url', 'slideshow_music_yes');
                  }
                  else {
                    jQuery("#slideshow_music_no").attr('checked', 'checked');
                  }
                  break;

                }
                case 'image_browser': {
                  jQuery("select[id=gallery] option[value='" + short_code['gallery_id'] + "']").attr('selected', 'selected');
                  jQuery("select[id=sort_by] option[value='" + short_code['sort_by'] + "']").attr('selected', 'selected');
                  if (short_code['order_by'] == 'asc') {
                    jQuery("#order_by_1").attr('checked', 'checked');
                  }
                  else {
                    jQuery("#order_by_0").attr('checked', 'checked');
                  }
                  if (short_code['show_search_box'] == 1) {
                    jQuery("#show_search_box_1").attr('checked', 'checked');
                    jQuery("#tr_search_box_width").css('display', '');
                  }
                  else {
                    jQuery("#show_search_box_0").attr('checked', 'checked');
                    jQuery("#tr_search_box_width").css('display', 'none');
                  }
                  if (short_code['search_box_width']) {
                    jQuery("#search_box_width").val(short_code['search_box_width']);
                  }
                  jQuery("#image_browser_width").val(short_code['image_browser_width']);
                  if (short_code['image_browser_title_enable'] == 1) {
                    jQuery("#image_browser_title_yes").attr('checked', 'checked');
                  }
                  else {
                    jQuery("#image_browser_title_no").attr('checked', 'checked');
                  }
                  if (short_code['image_browser_description_enable'] == 1) {
                    jQuery("#image_browser_description_yes").attr('checked', 'checked');
                  }
                  else {
                    jQuery("#image_browser_description_no").attr('checked', 'checked');
                  }
                  break;

                }
                case 'album_compact_preview': {
                  jQuery("select[id=album] option[value='" + short_code['album_id'] + "']").attr('selected', 'selected');
                  jQuery("select[id=sort_by] option[value='" + short_code['sort_by'] + "']").attr('selected', 'selected');
                  if (short_code['order_by'] == 'asc') {
                    jQuery("#order_by_1").attr('checked', 'checked');
                  }
                  else {
                    jQuery("#order_by_0").attr('checked', 'checked');
                  }
                  if (short_code['show_search_box'] == 1) {
                    jQuery("#show_search_box_1").attr('checked', 'checked');
                    jQuery("#tr_search_box_width").css('display', '');
                  }
                  else {
                    jQuery("#show_search_box_0").attr('checked', 'checked');
                    jQuery("#tr_search_box_width").css('display', 'none');
                  }
									if (short_code['show_sort_images'] == 1) {
                    jQuery("#show_sort_images_1").attr('checked', 'checked');
                  }
                  else {
                    jQuery("#show_sort_images_0").attr('checked', 'checked');
                  }
                  if (short_code['search_box_width']) {
                    jQuery("#search_box_width").val(short_code['search_box_width']);
                  }
                  jQuery("#compuct_album_column_number").val(short_code['compuct_album_column_number']);
                  jQuery("#compuct_albums_per_page").val(short_code['compuct_albums_per_page']);
                  jQuery("#compuct_album_title_" + short_code['compuct_album_title']).attr('checked', 'checked');
                  jQuery("#compuct_album_thumb_width").val(short_code['compuct_album_thumb_width']);
                  jQuery("#compuct_album_thumb_height").val(short_code['compuct_album_thumb_height']);
                  jQuery("#compuct_album_image_column_number").val(short_code['compuct_album_image_column_number']);
                  jQuery("#compuct_album_images_per_page").val(short_code['compuct_album_images_per_page']);
                  jQuery("#compuct_album_image_title_" + short_code['compuct_album_image_title']).attr('checked', 'checked');
                  jQuery("#compuct_album_image_thumb_width").val(short_code['compuct_album_image_thumb_width']);
                  jQuery("#compuct_album_image_thumb_height").val(short_code['compuct_album_image_thumb_height']);
                  jQuery("#compuct_album_load_more_image_count").val(short_code['compuct_album_load_more_image_count']);
                  jQuery("#compuct_albums_per_page_load_more").val(short_code['compuct_albums_per_page_load_more']);
                  if (short_code['compuct_album_enable_page'] == 1) {
                    jQuery("#compuct_album_page_yes").attr('checked', 'checked');
                  }
                  else if (short_code['compuct_album_enable_page'] == 0) {
                    jQuery("#compuct_album_page_no").attr('checked', 'checked');
                  }
                  else if (short_code['compuct_album_enable_page'] == 2) {
                    jQuery("#compuct_album_page_loadmore").attr('checked', 'checked');
                  }
                  else if (short_code['compuct_album_enable_page'] == 3) {
                    jQuery("#compuct_album_page_scrol_load").attr('checked', 'checked');
                  }
                  if (short_code['compuct_album_view_type'] == 'thumbnail') {				  
                    jQuery("#compuct_album_view_type_1").attr('checked', 'checked');								  
                  }
                  else if (short_code['compuct_album_view_type'] == 'masonry'){ 
                    jQuery("#compuct_album_view_type_0").attr('checked', 'checked');
                  }
                  else{
                    jQuery("#compuct_album_view_type_2").attr('checked', 'checked');
                  }
                  if (short_code['compuct_album_mosaic_hor_ver'] == "vertical") {
                    jQuery("#compuct_album_mosaic_ver").attr('checked', 'checked');
                  }
                  else {
                    jQuery("#compuct_album_mosaic_hor").attr('checked', 'checked');
                  }
                  if (short_code['compuct_album_resizable_mosaic'] == 1) {
                    jQuery("#compuct_album_resizable_mosaic_1").attr('checked', 'checked');
                  }
                  else {
                    jQuery("#compuct_album_resizable_mosaic_0").attr('checked', 'checked');
                  }
                  if (short_code['show_tag_box'] == 1) {
                    jQuery("#show_tag_box_1").attr('checked', 'checked');
                  }
                  else {
                    jQuery("#show_tag_box_0").attr('checked', 'checked');
                  }
                  jQuery("#compuct_album_mosaic_total_width").val(short_code['compuct_album_mosaic_total_width']);
                  break;

                }
                case 'album_extended_preview': {
                  jQuery("select[id=album] option[value='" + short_code['album_id'] + "']").attr('selected', 'selected');
                  jQuery("select[id=sort_by] option[value='" + short_code['sort_by'] + "']").attr('selected', 'selected');
                  if (short_code['order_by'] == 'asc') {
                    jQuery("#order_by_1").attr('checked', 'checked');
                  }
                  else {
                    jQuery("#order_by_0").attr('checked', 'checked');
                  }
                  if (short_code['show_search_box'] == 1) {
                    jQuery("#show_search_box_1").attr('checked', 'checked');
                    jQuery("#tr_search_box_width").css('display', '');
                  }
                  else {
                    jQuery("#show_search_box_0").attr('checked', 'checked');
                    jQuery("#tr_search_box_width").css('display', 'none');
                  }
									if (short_code['show_sort_images'] == 1) {
                    jQuery("#show_sort_images_1").attr('checked', 'checked');
                  }
                  else {
                    jQuery("#show_sort_images_0").attr('checked', 'checked');
                  }
                  if (short_code['search_box_width']) {
                    jQuery("#search_box_width").val(short_code['search_box_width']);
                  }
                  jQuery("#extended_albums_per_page").val(short_code['extended_albums_per_page']);
                  jQuery("#extended_album_height").val(short_code['extended_album_height']);
                  if (short_code['extended_album_description_enable'] == 1) {
                    jQuery("#extended_album_description_yes").attr('checked', 'checked');
                  }
                  else {
                    jQuery("#extended_album_description_no").attr('checked', 'checked');
                  }
                  jQuery("#extended_album_thumb_width").val(short_code['extended_album_thumb_width']);
                  jQuery("#extended_album_thumb_height").val(short_code['extended_album_thumb_height']);
                  jQuery("#extended_album_image_column_number").val(short_code['extended_album_image_column_number']);
                  jQuery("#extended_album_images_per_page").val(short_code['extended_album_images_per_page']);
                  jQuery("#extended_album_image_title_" + short_code['extended_album_image_title']).attr('checked', 'checked');
                  jQuery("#extended_album_image_thumb_width").val(short_code['extended_album_image_thumb_width']);
                  jQuery("#extended_album_image_thumb_height").val(short_code['extended_album_image_thumb_height']);
                  jQuery("#extended_albums_per_page_load_more").val(short_code['extended_albums_per_page_load_more']);
		  jQuery("#extended_album_load_more_image_count").val(short_code['extended_album_load_more_image_count']);
                  if (short_code['extended_album_enable_page'] == 1) {
                    jQuery("#extended_album_page_yes").attr('checked', 'checked');
                  }
                  else if (short_code['extended_album_enable_page'] == 0) {
                    jQuery("#extended_album_page_no").attr('checked', 'checked');
                  }
                   else if (short_code['extended_album_enable_page'] == 2) {
                    jQuery("#extended_album_page_loadmore").attr('checked', 'checked');
                  }
                  else if (short_code['extended_album_enable_page'] == 3){
                    jQuery("#extended_album_page_scrol_load").attr('checked', 'checked');
                  }
                  if (short_code['extended_album_view_type'] == 'thumbnail') {  
                    jQuery("#extended_album_view_type_1").attr('checked', 'checked');
                  }
                  else if(short_code['extended_album_view_type'] == 'masonry'){
                    jQuery("#extended_album_view_type_0").attr('checked', 'checked');
                  }
                  else{
                    jQuery("#extended_album_view_type_2").attr('checked', 'checked');
                  }
                  if (short_code['extended_album_mosaic_hor_ver'] == "vertical") {
                    jQuery("#extended_album_mosaic_ver").attr('checked', 'checked');
                  }
                  else {
                    jQuery("#extended_album_mosaic_hor").attr('checked', 'checked');
                  }
                  if (short_code['extended_album_resizable_mosaic'] == 1) {
                    jQuery("#extended_album_resizable_mosaic_1").attr('checked', 'checked');
                  }
                  else {
                    jQuery("#extended_album_resizable_mosaic_0").attr('checked', 'checked');
                  }
                  if (short_code['show_tag_box'] == 1) {
                    jQuery("#show_tag_box_1").attr('checked', 'checked');
                  }
                  else {
                    jQuery("#show_tag_box_0").attr('checked', 'checked');
                  }
                  jQuery("#extended_album_mosaic_total_width").val(short_code['extended_album_mosaic_total_width']);
                  break;

                }
              }
              // Lightbox.
              if (short_code['gallery_type'] != 'slideshow') {
                jQuery("#popup_width").val(short_code['popup_width']);
                jQuery("#popup_height").val(short_code['popup_height']);
                jQuery("select[id=popup_effect] option[value='" + short_code['popup_effect'] + "']").attr('selected', 'selected');
                jQuery("#popup_interval").val(short_code['popup_interval']);
                if (short_code['popup_fullscreen'] == 1) {
                  jQuery("#popup_fullscreen_1").attr('checked', 'checked'); 
                  jQuery("#tr_popup_width_height").css('display', 'none');
                }
                else {
                  jQuery("#popup_fullscreen_0").attr('checked', 'checked');
                  jQuery("#tr_popup_width_height").css('display', '');
                }
                if (short_code['popup_autoplay'] == 1) {
                  jQuery("#popup_autoplay_1").attr('checked', 'checked'); 
                }
                else {
                  jQuery("#popup_autoplay_0").attr('checked', 'checked');
                }
                if (short_code['popup_enable_filmstrip'] == 1) {
                  jQuery("#popup_filmstrip_yes").attr('checked', 'checked');
                  jQuery("#popup_filmstrip_height").val(short_code['popup_filmstrip_height']);
                  bwg_enable_disable('', 'tr_popup_filmstrip_height', 'popup_filmstrip_yes');
                }
                else {
                  jQuery("#popup_filmstrip_no").attr('checked', 'checked');
                }
                if (short_code['popup_enable_ctrl_btn'] == 1) {
                  jQuery("#popup_ctrl_btn_yes").attr('checked', 'checked');
                  bwg_enable_disable('', 'tbody_popup_ctrl_btn', 'popup_ctrl_btn_yes');
                  if (short_code['popup_enable_fullscreen'] == 1) {
                    jQuery("#popup_fullscreen_yes").attr('checked', 'checked');
                  }
                  else {
                    jQuery("#popup_fullscreen_no").attr('checked', 'checked');
                  }
                  if (short_code['popup_enable_info'] == 1 || !short_code['popup_enable_info']) {
                    jQuery("#popup_info_yes").attr('checked', 'checked');
                  }
                  else {
                    jQuery("#popup_info_no").attr('checked', 'checked');
                  }
                  if (short_code['show_tag_box'] == 0 || !short_code['show_tag_box']) {
                    jQuery("#show_tag_box_0").attr('checked', 'checked');
                  }
                  else {
                    jQuery("#show_tag_box_1").attr('checked', 'checked');
                  }
                  if (short_code['popup_info_full_width'] == 1) {
                    jQuery("#popup_info_full_width_1").attr('checked', 'checked');
                  }
                  else {
                    jQuery("#popup_info_full_width_0").attr('checked', 'checked');
                  }
                  if (short_code['popup_info_always_show'] == 1 && short_code['popup_info_always_show']) {
                    jQuery("#popup_info_always_show_yes").attr('checked', 'checked');
                  }
                  else {
                    jQuery("#popup_info_always_show_no").attr('checked', 'checked');
                  }
                  if (short_code['popup_enable_rate'] == 1 && short_code['popup_enable_rate']) {
                    jQuery("#popup_rate_yes").attr('checked', 'checked');
                  }
                  else {
                    jQuery("#popup_rate_no").attr('checked', 'checked');
                  }
                  if (short_code['popup_enable_comment'] == 1) {
                    jQuery("#popup_comment_yes").attr('checked', 'checked');
                  }
                  else {
                    jQuery("#popup_comment_no").attr('checked', 'checked');
                  }
                  if (short_code['popup_hit_counter'] == 1 && short_code['popup_hit_counter']) {
                    jQuery("#popup_hit_counter_yes").attr('checked', 'checked');
                  }
                  else {
                    jQuery("#popup_hit_counter_no").attr('checked', 'checked');
                  }
                  if (short_code['popup_enable_facebook'] == 1) {
                    jQuery("#popup_facebook_yes").attr('checked', 'checked');
                  }
                  else {
                    jQuery("#popup_facebook_no").attr('checked', 'checked');
                  }
                  if (short_code['popup_enable_twitter'] == 1) {
                    jQuery("#popup_twitter_yes").attr('checked', 'checked');
                  }
                  else {
                    jQuery("#popup_twitter_no").attr('checked', 'checked');
                  }
                  if (short_code['popup_enable_google'] == 1) {
                    jQuery("#popup_google_yes").attr('checked', 'checked');
                  }
                  else {
                    jQuery("#popup_google_no").attr('checked', 'checked');
                  }
                  if (short_code['popup_enable_pinterest'] == 1) {
                    jQuery("#popup_pinterest_yes").attr('checked', 'checked');
                  }
                  else {
                    jQuery("#popup_pinterest_no").attr('checked', 'checked');
                  }
                  if (short_code['popup_enable_tumblr'] == 1) {
                    jQuery("#popup_tumblr_yes").attr('checked', 'checked');
                  }
                  else {
                    jQuery("#popup_tumblr_no").attr('checked', 'checked');
                  }
                }
                else {
                  jQuery("#popup_ctrl_btn_no").attr('checked', 'checked');
                }
                if (!short_code['thumb_click_action'] || short_code['thumb_click_action'] == 'undefined' || short_code['thumb_click_action'] == 'open_lightbox') {
                  jQuery("#thumb_click_action_1").attr('checked', 'checked'); 
                }
                else if (short_code['thumb_click_action'] == 'redirect_to_url') {
                  jQuery("#thumb_click_action_2").attr('checked', 'checked');
                }
                else if (short_code['thumb_click_action'] == 'do_nothing') {
                  jQuery("#thumb_click_action_3").attr('checked', 'checked');
                }
                if (short_code['thumb_link_target'] == 1 || !short_code['thumb_link_target'] || short_code['thumb_link_target'] == 'undefined') {
                  jQuery("#thumb_link_target_yes").attr('checked', 'checked'); 
                }
                else {
                  jQuery("#thumb_link_target_no").attr('checked', 'checked');
                }
                bwg_thumb_click_action();
              }
              // Watermark.
              if (short_code['watermark_type'] == 'text') {
                jQuery("#watermark_type_text").attr('checked', 'checked');
                jQuery("#watermark_link").val(decodeURIComponent(short_code['watermark_link']));
                jQuery("#watermark_text").val(short_code['watermark_text']);
                jQuery("#watermark_font_size").val(short_code['watermark_font_size']);
                jQuery("select[id=watermark_font] option[value='" + short_code['watermark_font'] + "']").attr('selected', 'selected');
                jQuery("#watermark_color").val(short_code['watermark_color']);
                jQuery("#watermark_opacity").val(short_code['watermark_opacity']);
                jQuery("#watermark_type_text").attr('checked', 'checked');
                jQuery("#watermark_" + short_code['watermark_position']).attr('checked', 'checked');
              }
              else if (short_code['watermark_type'] == 'image') {
                jQuery("#watermark_type_image").attr('checked', 'checked');
                jQuery("#watermark_link").val(decodeURIComponent(short_code['watermark_link']));
                jQuery("#watermark_url").val(short_code['watermark_url']);
                jQuery("#watermark_width").val(short_code['watermark_width']);
                jQuery("#watermark_height").val(short_code['watermark_height']);
                jQuery("#watermark_opacity").val(short_code['watermark_opacity']);
                jQuery("#watermark_type_image").attr('checked', 'checked');
                jQuery("#watermark_" + short_code['watermark_position']).attr('checked', 'checked');
              }
              else {
                jQuery("#watermark_type_none").attr('checked', 'checked');
              }
              bwg_watermark('watermark_type_' + short_code['watermark_type']);
              bwg_gallery_type(short_code['gallery_type']);
            }
          }
          // Get shortcodes attributes.
          function get_params(module_name) {
            <?php 
        if (!$from_menu) {
            ?>
            var selected_text = tinyMCE.activeEditor.selection.getContent();
            <?php 
        } else {
            ?>
            var selected_text = jQuery("#bwg_shortcode").val();
            <?php 
        }
        ?>
            var module_start_index = selected_text.indexOf("[" + module_name);
            var module_end_index = selected_text.indexOf("]", module_start_index);
            var module_str = "";
            if ((module_start_index >= 0) && (module_end_index >= 0)) {
              module_str = selected_text.substring(module_start_index + 1, module_end_index);
            }
            else {
              return false;
            }
            var params_str = module_str.substring(module_str.indexOf(" ") + 1);
            var key_values = params_str.split('" ');
            var short_code_attr = new Array();
            for (var key in key_values) {
              var short_code_index = key_values[key].split('=')[0];
              var short_code_value = key_values[key].split('=')[1];
              short_code_value = short_code_value.replace(/\"/g, '');
              short_code_attr[short_code_index] = short_code_value;
            }
            return short_code_attr;
          }
          function get_short_params(tagtext) {
            var params_str = tagtext.substring(tagtext.indexOf(" ") + 1);
            var key_values = params_str.split('" ');
            var short_code_attr = new Array();
            for (var key in key_values) {
              var short_code_index = key_values[key].split('=')[0];
              var short_code_value = key_values[key].split('=')[1];
              short_code_value = short_code_value.replace(/\"/g, '');
              short_code_attr[short_code_index] = short_code_value;
            }
            return short_code_attr;
          }
          function bwg_insert_shortcode(content) {
            var gallery_type = jQuery("input[name=gallery_type]:checked").val();
            var theme = jQuery("#theme").val();
            var title = "";
            var short_code = '[Best_Wordpress_Gallery';
            var tagtext = ' gallery_type="' + gallery_type + '" theme_id="' + theme + '"';
            switch (gallery_type) {
              case 'thumbnails': {
                tagtext += ' gallery_id="' + jQuery("#gallery").val() + '"';
                tagtext += ' sort_by="' + jQuery("#sort_by").val() + '"';
                tagtext += ' order_by="' + jQuery("input[name=order_by]:checked").val() + '"';
                tagtext += ' show_search_box="' + jQuery("input[name=show_search_box]:checked").val() + '"';
                tagtext += ' show_sort_images="' + jQuery("input[name=show_sort_images]:checked").val() + '"';
                tagtext += ' search_box_width="' + jQuery("#search_box_width").val() + '"';
                tagtext += ' image_column_number="' + jQuery("#image_column_number").val() + '"';
                tagtext += ' images_per_page="' + jQuery("#images_per_page").val() + '"';
                tagtext += ' image_title="' + jQuery("input[name=image_title]:checked").val() + '"';
                tagtext += ' image_enable_page="' + jQuery("input[name=image_enable_page]:checked").val() + '"';
                tagtext += ' thumb_width="' + jQuery("#thumb_width").val() + '"';
                tagtext += ' thumb_height="' + jQuery("#thumb_height").val() + '"';
                title = ' gal_title="' + jQuery.trim(jQuery('#gallery option:selected').text().replace("'", "").replace('"', '')) + '"';
                tagtext += ' load_more_image_count="' + jQuery("#load_more_image_count").val() + '"';
                tagtext += ' show_tag_box="' + jQuery("input[name=show_tag_box]:checked").val() + '"';
                break;

              }
              case 'slideshow': {
                tagtext += ' gallery_id="' + jQuery("#gallery").val() + '"';
                tagtext += ' sort_by="' + jQuery("#sort_by").val() + '"';
                tagtext += ' order_by="' + jQuery("input[name=order_by]:checked").val() + '"';
                tagtext += ' slideshow_effect="' + jQuery("#slideshow_effect").val() + '"';
                tagtext += ' slideshow_interval="' + jQuery("#slideshow_interval").val() + '"';
                tagtext += ' slideshow_width="' + jQuery("#slideshow_width").val() + '"';
                tagtext += ' slideshow_height="' + jQuery("#slideshow_height").val() + '"';
                tagtext += ' enable_slideshow_autoplay="' + jQuery("input[name=enable_slideshow_autoplay]:checked").val() + '"';
                tagtext += ' enable_slideshow_shuffle="' + jQuery("input[name=enable_slideshow_shuffle]:checked").val() + '"';
                tagtext += ' enable_slideshow_ctrl="' + jQuery("input[name=enable_slideshow_ctrl]:checked").val() + '"';
                tagtext += ' enable_slideshow_filmstrip="' + jQuery("input[name=enable_slideshow_filmstrip]:checked").val() + '"';
                tagtext += ' slideshow_filmstrip_height="' + jQuery("#slideshow_filmstrip_height").val() + '"';
                tagtext += ' slideshow_enable_title="' + jQuery("input[name=slideshow_enable_title]:checked").val() + '"';
                tagtext += ' slideshow_title_position="' + jQuery("input[name=slideshow_title_position]:checked").val() + '"';
                tagtext += ' slideshow_title_full_width="' + jQuery("input[name=slideshow_title_full_width]:checked").val() + '"';  				
                tagtext += ' slideshow_enable_description="' + jQuery("input[name=slideshow_enable_description]:checked").val() + '"';
                tagtext += ' slideshow_description_position="' + jQuery("input[name=slideshow_description_position]:checked").val() + '"';
                tagtext += ' enable_slideshow_music="' + jQuery("input[name=enable_slideshow_music]:checked").val() + '"';
                tagtext += ' slideshow_music_url="' + jQuery("#slideshow_music_url").val() + '"';
								title = ' gal_title="' + jQuery.trim(jQuery('#gallery option:selected').text().replace("'", "").replace('"', '')) + '"';
                break;

              }
              case 'image_browser': {
                tagtext += ' gallery_id="' + jQuery("#gallery").val() + '"';
                tagtext += ' sort_by="' + jQuery("#sort_by").val() + '"';
                tagtext += ' order_by="' + jQuery("input[name=order_by]:checked").val() + '"';
                tagtext += ' show_search_box="' + jQuery("input[name=show_search_box]:checked").val() + '"';
                tagtext += ' search_box_width="' + jQuery("#search_box_width").val() + '"';
                tagtext += ' image_browser_width="' + jQuery("#image_browser_width").val() + '"';
                tagtext += ' image_browser_title_enable="' + jQuery("input[name=image_browser_title_enable]:checked").val() + '"';
                tagtext += ' image_browser_description_enable="' + jQuery("input[name=image_browser_description_enable]:checked").val() + '"';
								title = ' gal_title="' + jQuery.trim(jQuery('#gallery option:selected').text().replace("'", "").replace('"', '')) + '"';
                break;

              }
              case 'album_compact_preview': {
                tagtext += ' album_id="' + jQuery("#album").val() + '"';
                tagtext += ' sort_by="' + jQuery("#sort_by").val() + '"';
                tagtext += ' order_by="' + jQuery("input[name=order_by]:checked").val() + '"';
                tagtext += ' show_search_box="' + jQuery("input[name=show_search_box]:checked").val() + '"';
								tagtext += ' show_sort_images="' + jQuery("input[name=show_sort_images]:checked").val() + '"';
                tagtext += ' search_box_width="' + jQuery("#search_box_width").val() + '"';
                tagtext += ' compuct_album_column_number="' + jQuery("#compuct_album_column_number").val() + '"';
                tagtext += ' compuct_albums_per_page="' + jQuery("#compuct_albums_per_page").val() + '"';
                tagtext += ' compuct_album_title="' + jQuery("input[name=compuct_album_title]:checked").val() + '"';
                tagtext += ' compuct_album_view_type="' + jQuery("input[name=compuct_album_view_type]:checked").val() + '"';
                tagtext += ' compuct_album_mosaic_hor_ver="' + jQuery("input[name=compuct_album_mosaic_hor_ver]:checked").val() + '"';
                tagtext += ' compuct_album_resizable_mosaic="' + jQuery("input[name=compuct_album_resizable_mosaic]:checked").val() + '"';
                tagtext += ' compuct_album_mosaic_total_width="' + jQuery("#compuct_album_mosaic_total_width").val() + '"';
                tagtext += ' compuct_album_thumb_width="' + jQuery("#compuct_album_thumb_width").val() + '"';
                tagtext += ' compuct_album_thumb_height="' + jQuery("#compuct_album_thumb_height").val() + '"';
                tagtext += ' compuct_album_image_column_number="' + jQuery("#compuct_album_image_column_number").val() + '"';
                tagtext += ' compuct_album_images_per_page="' + jQuery("#compuct_album_images_per_page").val() + '"';
                tagtext += ' compuct_album_image_title="' + jQuery("input[name=compuct_album_image_title]:checked").val() + '"';
                tagtext += ' compuct_album_image_thumb_width="' + jQuery("#compuct_album_image_thumb_width").val() + '"';
                tagtext += ' compuct_album_image_thumb_height="' + jQuery("#compuct_album_image_thumb_height").val() + '"';
                tagtext += ' compuct_album_enable_page="' + jQuery("input[name=compuct_album_enable_page]:checked").val() + '"';
                tagtext += ' compuct_album_load_more_image_count="' + jQuery("#compuct_album_load_more_image_count").val() + '"';
                tagtext += ' compuct_albums_per_page_load_more="' + jQuery("#compuct_albums_per_page_load_more").val() + '"';
                tagtext += ' show_tag_box="' + jQuery("input[name=show_tag_box]:checked").val() + '"';
								title = ' gal_title="' + jQuery.trim(jQuery('#album option:selected').text().replace("'", "").replace('"', '')) + '"';
                break;

              }
              case 'album_extended_preview': {
                tagtext += ' album_id="' + jQuery("#album").val() + '"';
                tagtext += ' sort_by="' + jQuery("#sort_by").val() + '"';
                tagtext += ' order_by="' + jQuery("input[name=order_by]:checked").val() + '"';
                tagtext += ' show_search_box="' + jQuery("input[name=show_search_box]:checked").val() + '"';
								tagtext += ' show_sort_images="' + jQuery("input[name=show_sort_images]:checked").val() + '"';
                tagtext += ' search_box_width="' + jQuery("#search_box_width").val() + '"';
                tagtext += ' extended_albums_per_page="' + jQuery("#extended_albums_per_page").val() + '"';
                tagtext += ' extended_album_height="' + jQuery("#extended_album_height").val() + '"';
                tagtext += ' extended_album_description_enable="' + jQuery("input[name=extended_album_description_enable]:checked").val() + '"';
                tagtext += ' extended_album_view_type="' + jQuery("input[name=extended_album_view_type]:checked").val() + '"';
                tagtext += ' extended_album_mosaic_hor_ver="' + jQuery("input[name=extended_album_mosaic_hor_ver]:checked").val() + '"';
                tagtext += ' extended_album_resizable_mosaic="' + jQuery("input[name=extended_album_resizable_mosaic]:checked").val() + '"';
                tagtext += ' extended_album_mosaic_total_width="' + jQuery("#extended_album_mosaic_total_width").val() + '"';
                tagtext += ' extended_album_thumb_width="' + jQuery("#extended_album_thumb_width").val() + '"';
                tagtext += ' extended_album_thumb_height="' + jQuery("#extended_album_thumb_height").val() + '"';
                tagtext += ' extended_album_image_column_number="' + jQuery("#extended_album_image_column_number").val() + '"';
                tagtext += ' extended_album_images_per_page="' + jQuery("#extended_album_images_per_page").val() + '"';
                tagtext += ' extended_album_image_title="' + jQuery("input[name=extended_album_image_title]:checked").val() + '"';
                tagtext += ' extended_album_image_thumb_width="' + jQuery("#extended_album_image_thumb_width").val() + '"';
                tagtext += ' extended_album_image_thumb_height="' + jQuery("#extended_album_image_thumb_height").val() + '"';
                tagtext += ' extended_album_enable_page="' + jQuery("input[name=extended_album_enable_page]:checked").val() + '"';
                tagtext += ' extended_album_load_more_image_count="' + jQuery("#extended_album_load_more_image_count").val() + '"';
                tagtext += ' extended_albums_per_page_load_more="' + jQuery("#extended_albums_per_page_load_more").val() + '"';
                tagtext += ' show_tag_box="' + jQuery("input[name=show_tag_box]:checked").val() + '"';
								title = ' gal_title="' + jQuery.trim(jQuery('#album option:selected').text().replace("'", "").replace('"', '')) + '"';
                break;

              }
            }
            // Lightbox paramteres.
            if (gallery_type != 'slideshow') {
              tagtext += ' thumb_click_action="' + jQuery("input[name=thumb_click_action]:checked").val() + '"';
              tagtext += ' thumb_link_target="' + jQuery("input[name=thumb_link_target]:checked").val() + '"';
              tagtext += ' popup_fullscreen="' + jQuery("input[name=popup_fullscreen]:checked").val() + '"';
              tagtext += ' popup_autoplay="' + jQuery("input[name=popup_autoplay]:checked").val() + '"';			  
              tagtext += ' popup_width="' + jQuery("#popup_width").val() + '"';
              tagtext += ' popup_height="' + jQuery("#popup_height").val() + '"';
              tagtext += ' popup_effect="' + jQuery("#popup_effect").val() + '"';
              tagtext += ' popup_interval="' + jQuery("#popup_interval").val() + '"';
              tagtext += ' popup_enable_filmstrip="' + jQuery("input[name=popup_enable_filmstrip]:checked").val() + '"';
              tagtext += ' popup_filmstrip_height="' + jQuery("#popup_filmstrip_height").val() + '"';
              tagtext += ' popup_enable_ctrl_btn="' + jQuery("input[name=popup_enable_ctrl_btn]:checked").val() + '"';
              tagtext += ' popup_enable_fullscreen="' + jQuery("input[name=popup_enable_fullscreen]:checked").val() + '"';
              tagtext += ' popup_enable_info="' + jQuery("input[name=popup_enable_info]:checked").val() + '"';
              tagtext += ' popup_info_always_show="' + jQuery("input[name=popup_info_always_show]:checked").val() + '"';
              tagtext += ' popup_info_full_width="' + jQuery("input[name=popup_info_full_width]:checked").val() + '"';
              tagtext += ' popup_enable_rate="' + jQuery("input[name=popup_enable_rate]:checked").val() + '"';
              tagtext += ' popup_enable_comment="' + jQuery("input[name=popup_enable_comment]:checked").val() + '"';
              tagtext += ' popup_hit_counter="' + jQuery("input[name=popup_hit_counter]:checked").val() + '"';
              tagtext += ' popup_enable_facebook="' + jQuery("input[name=popup_enable_facebook]:checked").val() + '"';
              tagtext += ' popup_enable_twitter="' + jQuery("input[name=popup_enable_twitter]:checked").val() + '"';
              tagtext += ' popup_enable_google="' + jQuery("input[name=popup_enable_google]:checked").val() + '"';
              tagtext += ' popup_enable_pinterest="' + jQuery("input[name=popup_enable_pinterest]:checked").val() + '"';
              tagtext += ' popup_enable_tumblr="' + jQuery("input[name=popup_enable_tumblr]:checked").val() + '"';
              tagtext += ' show_tag_box="' + jQuery("input[name=show_tag_box]:checked").val() + '"';
            }
            // Watermark parameters.
            tagtext += ' watermark_type="' + jQuery("input[name=watermark_type]:checked").val() + '"';
            tagtext += ' watermark_link="' + encodeURIComponent(jQuery("#watermark_link").val()) + '"';
            if (jQuery("input[name=watermark_type]:checked").val() == 'text') {
              tagtext += ' watermark_text="' + jQuery("#watermark_text").val() + '"';
              tagtext += ' watermark_font_size="' + jQuery("#watermark_font_size").val() + '"';
              tagtext += ' watermark_font="' + jQuery("#watermark_font").val() + '"';
              tagtext += ' watermark_color="' + jQuery("#watermark_color").val() + '"';
              tagtext += ' watermark_opacity="' + jQuery("#watermark_opacity").val() + '"';
              tagtext += ' watermark_position="' + jQuery("input[name=watermark_position]:checked").val() + '"';
            }
            else if (jQuery("input[name=watermark_type]:checked").val() == 'image') {
              tagtext += ' watermark_url="' + jQuery("#watermark_url").val() + '"';
              tagtext += ' watermark_width="' + jQuery("#watermark_width").val() + '"';
              tagtext += ' watermark_height="' + jQuery("#watermark_height").val() + '"';
              tagtext += ' watermark_opacity="' + jQuery("#watermark_opacity").val() + '"';
              tagtext += ' watermark_position="' + jQuery("input[name=watermark_position]:checked").val() + '"';
            }
            short_code += ' id="' + shortcode_id + '"' + title + ']';
            var short_id = ' id="' + shortcode_id + '"' + title;
            short_code = short_code.replace(/\[Best_Wordpress_Gallery([^\]]*)\]/g, function(d, c) {
              return "<img src='<?php 
        echo WD_BWG_URL;
        ?>
/images/bwg_shortcode.png' class='bwg_shortcode mceItem' title='Best_Wordpress_Gallery" + short_id + "' />";
            });
            jQuery("#task").val("save");
            jQuery("#tagtext").val(tagtext);
            jQuery("#currrent_id").val(shortcode_id);
            jQuery("#title").val(title);
            jQuery("#bwg_insert").val((content && !bwg_insert) ? 0 : 1);
            jQuery("#bwg_shortcode_form").submit();
            <?php 
        if (!$from_menu) {
            ?>
            if (window.tinymce.isIE && content) {
              // IE and Update.
              var all_content = tinyMCE.activeEditor.getContent();
              all_content = all_content.replace('<p></p><p>[Best_Wordpress_Gallery', '<p>[Best_Wordpress_Gallery');
              tinyMCE.activeEditor.setContent(all_content.replace(content, '[Best_Wordpress_Gallery id="' + shortcode_id + '"' + title + ']'));
            }
            else {
              window.tinyMCE.execCommand('mceInsertContent', false, short_code);
            }
            tinyMCEPopup.editor.execCommand('mceRepaint');
            <?php 
        } else {
            ?>
            jQuery("#bwg_shortcode").val('[Best_Wordpress_Gallery id="' + shortcode_id + '"' + title + ']');
            <?php 
        }
        ?>
          }
          jQuery(document).ready(function () {
            bwg_loadmore();
          });
        </script>
      </body>
    </html>
    <?php 
        die;
    }
    public function display()
    {
        global $WD_BWG_UPLOAD_DIR;
        $popup_width = (int) (isset($_GET['width']) ? esc_html($_GET['width']) : '800') - 30;
        $image_width = $popup_width - 40;
        $popup_height = (int) (isset($_GET['height']) ? esc_html($_GET['height']) : '500') - 50;
        $image_height = $popup_height - 40;
        $image_id = isset($_GET['image_id']) ? esc_html($_GET['image_id']) : '0';
        ?>
    <div style="display:table; width:100%; height:<?php 
        echo $popup_height;
        ?>
px;">
      <div id='bwg_container_for_media_1' style="display:table-cell; text-align:center; vertical-align:middle;">
        <img id="image_display" src="" style="max-width:<?php 
        echo $image_width;
        ?>
px; max-height:<?php 
        echo $image_height;
        ?>
px;"/>        
      </div>
    </div>
    <script language="javascript" type="text/javascript" src="<?php 
        echo WD_BWG_URL . '/js/bwg_embed.js?ver=' . wd_bwg_version();
        ?>
"></script>
    <script>
      var file_type = window.parent.document.getElementById("input_filetype_<?php 
        echo $image_id;
        ?>
").value;
      
      var is_embed = file_type.indexOf("EMBED_") > -1 ? true : false;
      var is_instagram_post = file_type.indexOf("INSTAGRAM_POST") > -1 ? true : false;
      if (!is_embed) {
        var image_url = "<?php 
        echo site_url() . '/' . $WD_BWG_UPLOAD_DIR;
        ?>
" + window.parent.document.getElementById("image_url_<?php 
        echo $image_id;
        ?>
").value;
        window.document.getElementById("image_display").src = image_url + "?date=<?php 
        echo date('Y-m-y H:i:s');
        ?>
";
      }
      else if(is_embed){
        var embed_id = window.parent.document.getElementById("input_filename_<?php 
        echo $image_id;
        ?>
").value;
        window.document.getElementById("image_display").setAttribute('style', 'display: none;');
        
        if(!is_instagram_post){
          window.document.getElementById("bwg_container_for_media_1").innerHTML = spider_display_embed(file_type, embed_id, {class:"embed_display", width:"<?php 
        echo $image_width;
        ?>
", height:"<?php 
        echo $image_height;
        ?>
", frameborder:"0", allowfullscreen:"allowfullscreen", style:"width:<?php 
        echo $image_width;
        ?>
px; height:<?php 
        echo $image_height;
        ?>
px; vertical-align:middle; text-align: center; margin: 0 auto;" });
        }
        else{
          window.document.getElementById("bwg_container_for_media_1").innerHTML = spider_display_embed(file_type, embed_id, {class:"embed_display", width:"<?php 
        echo $image_height - 88;
        ?>
", height:"<?php 
        echo $image_height;
        ?>
", frameborder:"0", allowfullscreen:"allowfullscreen", style:"width:<?php 
        echo $image_height - 88;
        ?>
px; height:<?php 
        echo $image_height;
        ?>
px; vertical-align:middle; text-align: center; margin: 0 auto;" });
        }
      }
    </script>
    <?php 
        die;
    }
function bwg_front_end_scripts()
{
    $version = wd_bwg_version();
    global $wp_scripts;
    if (isset($wp_scripts->registered['jquery'])) {
        $jquery = $wp_scripts->registered['jquery'];
        if (!isset($jquery->ver) or version_compare($jquery->ver, '1.8.2', '<')) {
            wp_deregister_script('jquery');
            wp_register_script('jquery', FALSE, array('jquery-core', 'jquery-migrate'), '1.10.2');
        }
    }
    wp_enqueue_script('jquery');
    /*wp_enqueue_style('jquery-ui', WD_BWG_FRONT_URL . '/css/jquery-ui-1.10.3.custom.css', array(), $version);*/
    wp_enqueue_script('bwg_frontend', WD_BWG_FRONT_URL . '/js/bwg_frontend.js', array(), $version);
    wp_enqueue_style('bwg_frontend', WD_BWG_FRONT_URL . '/css/bwg_frontend.css', array(), $version);
    wp_enqueue_script('bwg_sumoselect', WD_BWG_FRONT_URL . '/js/jquery.sumoselect.min.js', array(), $version);
    wp_enqueue_style('bwg_sumoselect', WD_BWG_FRONT_URL . '/css/sumoselect.css', array(), $version);
    // Styles/Scripts for popup.
    wp_enqueue_style('bwg_font-awesome', WD_BWG_FRONT_URL . '/css/font-awesome/font-awesome.css', array(), '4.6.3');
    wp_enqueue_script('bwg_jquery_mobile', WD_BWG_FRONT_URL . '/js/jquery.mobile.js', array(), $version);
    wp_enqueue_script('bwg_mCustomScrollbar', WD_BWG_FRONT_URL . '/js/jquery.mCustomScrollbar.concat.min.js', array(), $version);
    wp_enqueue_style('bwg_mCustomScrollbar', WD_BWG_FRONT_URL . '/css/jquery.mCustomScrollbar.css', array(), $version);
    wp_enqueue_script('jquery-fullscreen', WD_BWG_FRONT_URL . '/js/jquery.fullscreen-0.4.1.js', array(), '0.4.1');
    wp_enqueue_script('bwg_gallery_box', WD_BWG_FRONT_URL . '/js/bwg_gallery_box.js', array(), $version);
    wp_localize_script('bwg_gallery_box', 'bwg_objectL10n', array('bwg_field_required' => __('field is required.', 'bwg'), 'bwg_mail_validation' => __('This is not a valid email address.', 'bwg'), 'bwg_search_result' => __('There are no images matching your search.', 'bwg')));
    wp_localize_script('bwg_sumoselect', 'bwg_objectsL10n', array('bwg_select_tag' => __('Select Tag.', 'bwg')));
}
    public function display()
    {
        global $WD_BWG_UPLOAD_DIR;
        require_once WD_BWG_DIR . '/framework/WDWLibraryEmbed.php';
        $tag_id = isset($_GET['tag_id']) ? esc_html($_GET['tag_id']) : 0;
        $gallery_id = WDWLibrary::esc_script('get', 'gallery_id', 0, 'int');
        $bwg = isset($_GET['current_view']) ? esc_html($_GET['current_view']) : 0;
        $current_image_id = WDWLibrary::esc_script('get', 'image_id', 0, 'int');
        $theme_id = isset($_GET['theme_id']) ? esc_html($_GET['theme_id']) : 1;
        $thumb_width = isset($_GET['thumb_width']) ? esc_html($_GET['thumb_width']) : 120;
        $thumb_height = isset($_GET['thumb_height']) ? esc_html($_GET['thumb_height']) : 90;
        $open_with_fullscreen = WDWLibrary::esc_script('get', 'open_with_fullscreen', 0, 'int');
        $open_with_autoplay = WDWLibrary::esc_script('get', 'open_with_autoplay', 0, 'int');
        $image_width = WDWLibrary::esc_script('get', 'image_width', 800, 'int');
        $image_height = WDWLibrary::esc_script('get', 'image_height', 500, 'int');
        $image_effect = WDWLibrary::esc_script('get', 'image_effect', 'fade');
        $sort_by = isset($_GET['wd_sor']) ? esc_html($_GET['wd_sor']) : 'order';
        $order_by = isset($_GET['wd_ord']) ? esc_html($_GET['wd_ord']) : 'asc';
        $enable_image_filmstrip = FALSE;
        $enable_image_fullscreen = isset($_GET['enable_image_fullscreen']) ? esc_html($_GET['enable_image_fullscreen']) : 0;
        $popup_enable_info = isset($_GET['popup_enable_info']) ? esc_html($_GET['popup_enable_info']) : 1;
        $popup_info_always_show = isset($_GET['popup_info_always_show']) ? esc_html($_GET['popup_info_always_show']) : 0;
        $popup_info_full_width = isset($_GET['popup_info_full_width']) ? esc_html($_GET['popup_info_full_width']) : 0;
        $popup_enable_rate = WDWLibrary::esc_script('get', 'popup_enable_rate', 0, 'int');
        $popup_hit_counter = isset($_GET['popup_hit_counter']) ? esc_html($_GET['popup_hit_counter']) : 0;
        $slideshow_effect_duration = isset($_GET['slideshow_effect_duration']) ? (int) $_GET['slideshow_effect_duration'] : 1;
        $slideshow_interval = isset($_GET['slideshow_interval']) ? (int) $_GET['slideshow_interval'] : 5;
        $enable_image_ctrl_btn = isset($_GET['enable_image_ctrl_btn']) ? esc_html($_GET['enable_image_ctrl_btn']) : 0;
        $enable_comment_social = FALSE;
        $enable_image_facebook = FALSE;
        $enable_image_twitter = FALSE;
        $enable_image_google = FALSE;
        $enable_image_pinterest = FALSE;
        $enable_image_tumblr = FALSE;
        $watermark_type = isset($_GET['watermark_type']) ? esc_html($_GET['watermark_type']) : 'none';
        $watermark_text = isset($_GET['watermark_text']) ? esc_html($_GET['watermark_text']) : '';
        $watermark_font_size = isset($_GET['watermark_font_size']) ? esc_html($_GET['watermark_font_size']) : 12;
        $watermark_font = isset($_GET['watermark_font']) ? esc_html($_GET['watermark_font']) : 'Arial';
        $watermark_color = isset($_GET['watermark_color']) ? esc_html($_GET['watermark_color']) : 'FFFFFF';
        $watermark_opacity = isset($_GET['watermark_opacity']) ? esc_html($_GET['watermark_opacity']) : 30;
        $watermark_position = explode('-', isset($_GET['watermark_position']) ? esc_html($_GET['watermark_position']) : 'bottom-right');
        $watermark_link = isset($_GET['watermark_link']) ? esc_html($_GET['watermark_link']) : '';
        $watermark_url = isset($_GET['watermark_url']) ? esc_html($_GET['watermark_url']) : '';
        $watermark_width = isset($_GET['watermark_width']) ? esc_html($_GET['watermark_width']) : 90;
        $watermark_height = isset($_GET['watermark_height']) ? esc_html($_GET['watermark_height']) : 90;
        $theme_row = $this->model->get_theme_row_data($theme_id);
        $option_row = $this->model->get_option_row_data();
        $image_right_click = $option_row->image_right_click;
        $image_filmstrip_height = 0;
        $image_filmstrip_width = 0;
        if ($tag_id != 0) {
            $image_rows = $this->model->get_image_rows_data_tag($tag_id, $sort_by, $order_by);
        } else {
            $image_rows = $this->model->get_image_rows_data($gallery_id, $bwg, $sort_by, $order_by);
        }
        $image_id = isset($_POST['image_id']) ? (int) $_POST['image_id'] : $current_image_id;
        $filmstrip_thumb_margin = $theme_row->lightbox_filmstrip_thumb_margin;
        $margins_split = explode(" ", $filmstrip_thumb_margin);
        $filmstrip_thumb_margin_right = 0;
        $filmstrip_thumb_margin_left = 0;
        if (isset($margins_split[1])) {
            $filmstrip_thumb_margin_right = (int) $margins_split[1];
            if (isset($margins_split[3])) {
                $filmstrip_thumb_margin_left = (int) $margins_split[3];
            } else {
                $filmstrip_thumb_margin_left = $filmstrip_thumb_margin_right;
            }
        } elseif (isset($margins_split[0])) {
            $filmstrip_thumb_margin_right = (int) $margins_split[0];
            $filmstrip_thumb_margin_left = $filmstrip_thumb_margin_right;
        }
        $filmstrip_thumb_margin_hor = $filmstrip_thumb_margin_right + $filmstrip_thumb_margin_left;
        $rgb_bwg_image_info_bg_color = WDWLibrary::spider_hex2rgb($theme_row->lightbox_info_bg_color);
        $rgb_bwg_image_hit_bg_color = WDWLibrary::spider_hex2rgb($theme_row->lightbox_hit_bg_color);
        $rgb_lightbox_ctrl_cont_bg_color = WDWLibrary::spider_hex2rgb($theme_row->lightbox_ctrl_cont_bg_color);
        $lightbox_bg_transparent = isset($theme_row->lightbox_bg_transparent) ? $theme_row->lightbox_bg_transparent : 100;
        $lightbox_bg_color = WDWLibrary::spider_hex2rgb($theme_row->lightbox_bg_color);
        $current_filename = '';
        ?>
    <style>
      .spider_popup_wrap * {
        -moz-box-sizing: border-box;
        -webkit-box-sizing: border-box;
        box-sizing: border-box;
      }
      .spider_popup_wrap {
        background-color: rgba(<?php 
        echo $lightbox_bg_color['red'];
        ?>
, <?php 
        echo $lightbox_bg_color['green'];
        ?>
, <?php 
        echo $lightbox_bg_color['blue'];
        ?>
, <?php 
        echo number_format($lightbox_bg_transparent / 100, 2, ".", "");
        ?>
);
        display: inline-block;
        left: 50%;
        outline: medium none;
        position: fixed;
        text-align: center;
        top: 50%;
        z-index: 100000;
      }
      .bwg_popup_image {
        max-width: <?php 
        echo $image_width;
        ?>
px;
        max-height: <?php 
        echo $image_height - $image_filmstrip_height;
        ?>
px;
        vertical-align: middle;
        display: inline-block;
      }
      .bwg_popup_embed {
        width: <?php 
        echo $image_width;
        ?>
px;
        height: <?php 
        echo $image_height - $image_filmstrip_height;
        ?>
px;
        vertical-align: middle;
        text-align: center;
        display: inline-block;
      }
      .bwg_ctrl_btn {
        color: #<?php 
        echo $theme_row->lightbox_ctrl_btn_color;
        ?>
;
        font-size: <?php 
        echo $theme_row->lightbox_ctrl_btn_height;
        ?>
px;
        margin: <?php 
        echo $theme_row->lightbox_ctrl_btn_margin_top;
        ?>
px <?php 
        echo $theme_row->lightbox_ctrl_btn_margin_left;
        ?>
px;
        opacity: <?php 
        echo number_format($theme_row->lightbox_ctrl_btn_transparent / 100, 2, ".", "");
        ?>
;
        filter: Alpha(opacity=<?php 
        echo $theme_row->lightbox_ctrl_btn_transparent;
        ?>
);
      }
      .bwg_toggle_btn {
        color: #<?php 
        echo $theme_row->lightbox_ctrl_btn_color;
        ?>
;
        font-size: <?php 
        echo $theme_row->lightbox_toggle_btn_height;
        ?>
px;
        margin: 0;
        opacity: <?php 
        echo number_format($theme_row->lightbox_ctrl_btn_transparent / 100, 2, ".", "");
        ?>
;
        filter: Alpha(opacity=<?php 
        echo $theme_row->lightbox_ctrl_btn_transparent;
        ?>
);
        padding: 0;
      }
      .bwg_btn_container {
        bottom: 0;
        left: 0;
        overflow: hidden;
        position: absolute;
        right: 0;
        top: 0;
      }
      .bwg_ctrl_btn_container {
        background-color: rgba(<?php 
        echo $rgb_lightbox_ctrl_cont_bg_color['red'];
        ?>
, <?php 
        echo $rgb_lightbox_ctrl_cont_bg_color['green'];
        ?>
, <?php 
        echo $rgb_lightbox_ctrl_cont_bg_color['blue'];
        ?>
, <?php 
        echo number_format($theme_row->lightbox_ctrl_cont_transparent / 100, 2, ".", "");
        ?>
);
        /*background: none repeat scroll 0 0 #<?php 
        echo $theme_row->lightbox_ctrl_cont_bg_color;
        ?>
;*/
        <?php 
        if ($theme_row->lightbox_ctrl_btn_pos == 'top') {
            ?>
          border-bottom-left-radius: <?php 
            echo $theme_row->lightbox_ctrl_cont_border_radius;
            ?>
px;
          border-bottom-right-radius: <?php 
            echo $theme_row->lightbox_ctrl_cont_border_radius;
            ?>
px;
          <?php 
        } else {
            ?>
          bottom: 0;
          border-top-left-radius: <?php 
            echo $theme_row->lightbox_ctrl_cont_border_radius;
            ?>
px;
          border-top-right-radius: <?php 
            echo $theme_row->lightbox_ctrl_cont_border_radius;
            ?>
px;
          <?php 
        }
        ?>
        height: <?php 
        echo $theme_row->lightbox_ctrl_btn_height + 2 * $theme_row->lightbox_ctrl_btn_margin_top;
        ?>
px;
        position: absolute;
        text-align: <?php 
        echo $theme_row->lightbox_ctrl_btn_align;
        ?>
;
        width: 100%;
        z-index: 10150;
      }
      .bwg_toggle_container {
        background: none repeat scroll 0 0 #<?php 
        echo $theme_row->lightbox_ctrl_cont_bg_color;
        ?>
;
        <?php 
        if ($theme_row->lightbox_ctrl_btn_pos == 'top') {
            ?>
          border-bottom-left-radius: <?php 
            echo $theme_row->lightbox_ctrl_cont_border_radius;
            ?>
px;
          border-bottom-right-radius: <?php 
            echo $theme_row->lightbox_ctrl_cont_border_radius;
            ?>
px;
          /*top: <?php 
            echo $theme_row->lightbox_ctrl_btn_height + 2 * $theme_row->lightbox_ctrl_btn_margin_top;
            ?>
px;*/
          <?php 
        } else {
            ?>
          border-top-left-radius: <?php 
            echo $theme_row->lightbox_ctrl_cont_border_radius;
            ?>
px;
          border-top-right-radius: <?php 
            echo $theme_row->lightbox_ctrl_cont_border_radius;
            ?>
px;
          /*bottom: <?php 
            echo $theme_row->lightbox_ctrl_btn_height + 2 * $theme_row->lightbox_ctrl_btn_margin_top;
            ?>
px;*/
          <?php 
        }
        ?>
        cursor: pointer;
        left: 50%;
        line-height: 0;
        margin-left: -<?php 
        echo $theme_row->lightbox_toggle_btn_width / 2;
        ?>
px;
        opacity: <?php 
        echo number_format($theme_row->lightbox_ctrl_cont_transparent / 100, 2, ".", "");
        ?>
;
        filter: Alpha(opacity=<?php 
        echo $theme_row->lightbox_ctrl_cont_transparent;
        ?>
);
        position: absolute;
        text-align: center;
        width: <?php 
        echo $theme_row->lightbox_toggle_btn_width;
        ?>
px;
        z-index: 10150;
      }
      .bwg_close_btn {
        opacity: <?php 
        echo number_format($theme_row->lightbox_close_btn_transparent / 100, 2, ".", "");
        ?>
;
        filter: Alpha(opacity=<?php 
        echo $theme_row->lightbox_close_btn_transparent;
        ?>
);
      }
      .spider_popup_close {
        background-color: #<?php 
        echo $theme_row->lightbox_close_btn_bg_color;
        ?>
;
        border-radius: <?php 
        echo $theme_row->lightbox_close_btn_border_radius;
        ?>
;
        border: <?php 
        echo $theme_row->lightbox_close_btn_border_width;
        ?>
px <?php 
        echo $theme_row->lightbox_close_btn_border_style;
        ?>
 #<?php 
        echo $theme_row->lightbox_close_btn_border_color;
        ?>
;
        box-shadow: <?php 
        echo $theme_row->lightbox_close_btn_box_shadow;
        ?>
;
        color: #<?php 
        echo $theme_row->lightbox_close_btn_color;
        ?>
;
        height: <?php 
        echo $theme_row->lightbox_close_btn_height;
        ?>
px;
        font-size: <?php 
        echo $theme_row->lightbox_close_btn_size;
        ?>
px;
        right: <?php 
        echo $theme_row->lightbox_close_btn_right;
        ?>
px;
        top: <?php 
        echo $theme_row->lightbox_close_btn_top;
        ?>
px;
        width: <?php 
        echo $theme_row->lightbox_close_btn_width;
        ?>
px;
      }
      .spider_popup_close_fullscreen {
        color: #<?php 
        echo $theme_row->lightbox_close_btn_full_color;
        ?>
;
        font-size: <?php 
        echo $theme_row->lightbox_close_btn_size;
        ?>
px;
        right: 15px;
      }
      .spider_popup_close span,
      #spider_popup_left-ico span,
      #spider_popup_right-ico span {
        display: table-cell;
        text-align: center;
        vertical-align: middle;
      }
      #spider_popup_left-ico,
      #spider_popup_right-ico {
        background-color: #<?php 
        echo $theme_row->lightbox_rl_btn_bg_color;
        ?>
;
        border-radius: <?php 
        echo $theme_row->lightbox_rl_btn_border_radius;
        ?>
;
        border: <?php 
        echo $theme_row->lightbox_rl_btn_border_width;
        ?>
px <?php 
        echo $theme_row->lightbox_rl_btn_border_style;
        ?>
 #<?php 
        echo $theme_row->lightbox_rl_btn_border_color;
        ?>
;
        box-shadow: <?php 
        echo $theme_row->lightbox_rl_btn_box_shadow;
        ?>
;
        color: #<?php 
        echo $theme_row->lightbox_rl_btn_color;
        ?>
;
        height: <?php 
        echo $theme_row->lightbox_rl_btn_height;
        ?>
px;
        font-size: <?php 
        echo $theme_row->lightbox_rl_btn_size;
        ?>
px;
        width: <?php 
        echo $theme_row->lightbox_rl_btn_width;
        ?>
px;
        opacity: <?php 
        echo number_format($theme_row->lightbox_rl_btn_transparent / 100, 2, ".", "");
        ?>
;
        filter: Alpha(opacity=<?php 
        echo $theme_row->lightbox_rl_btn_transparent;
        ?>
);
      }
      <?php 
        if ($option_row->autohide_lightbox_navigation) {
            ?>
      #spider_popup_left-ico{
        left: -9999px;
      }
      #spider_popup_right-ico{
        left: -9999px;
      }      
      <?php 
        } else {
            ?>
        #spider_popup_left-ico {
        left: 20px;
        }
        #spider_popup_right-ico {
          left: auto;
          right: 20px;
        }
      <?php 
        }
        ?>
      .bwg_ctrl_btn:hover,
      .bwg_toggle_btn:hover,
      .spider_popup_close:hover,
      .spider_popup_close_fullscreen:hover,
      #spider_popup_left-ico:hover,
      #spider_popup_right-ico:hover {
        color: #<?php 
        echo $theme_row->lightbox_close_rl_btn_hover_color;
        ?>
;
        cursor: pointer;
      }
      .bwg_image_wrap {
        height: inherit;
        display: table;
        position: absolute;
        text-align: center;
        width: inherit;
      }
      .bwg_image_wrap * {
        -moz-user-select: none;
        -khtml-user-select: none;
        -webkit-user-select: none;
        -ms-user-select: none;
        user-select: none;
      }
      .bwg_comment_wrap {
        bottom: 0;
        left: 0;
        overflow: hidden;
        position: absolute;
        right: 0;
        top: 0;
        z-index: -1;
      }
      .bwg_comment_container {
        -moz-box-sizing: border-box;
        background-color: #<?php 
        echo $theme_row->lightbox_comment_bg_color;
        ?>
;
        color: #<?php 
        echo $theme_row->lightbox_comment_font_color;
        ?>
;
        font-size: <?php 
        echo $theme_row->lightbox_comment_font_size;
        ?>
px;
        font-family: <?php 
        echo $theme_row->lightbox_comment_font_style;
        ?>
;
        height: 100%;
        overflow: hidden;
        position: absolute;
        <?php 
        echo $theme_row->lightbox_comment_pos;
        ?>
: -<?php 
        echo $theme_row->lightbox_comment_width;
        ?>
px;
        top: 0;
        width: <?php 
        echo $theme_row->lightbox_comment_width;
        ?>
px;
        z-index: 10103;
      }
      .bwg_comments {
        bottom: 0;
        font-size: <?php 
        echo $theme_row->lightbox_comment_font_size;
        ?>
px;
        font-family: <?php 
        echo $theme_row->lightbox_comment_font_style;
        ?>
;
        height: 100%;
        left: 0;
        overflow-x: hidden;
        overflow-y: auto;
        position: absolute;
        top: 0;
        width: 100%;
        z-index: 10101;
      }
      .bwg_comments p,
      .bwg_comment_body_p {
        margin: 5px !important;
        text-align: left;
        word-wrap: break-word;
        word-break: break-word;
      }
      .bwg_comments input[type="submit"] {
        background: none repeat scroll 0 0 #<?php 
        echo $theme_row->lightbox_comment_button_bg_color;
        ?>
;
        border: <?php 
        echo $theme_row->lightbox_comment_button_border_width;
        ?>
px <?php 
        echo $theme_row->lightbox_comment_button_border_style;
        ?>
 #<?php 
        echo $theme_row->lightbox_comment_button_border_color;
        ?>
;
        border-radius: <?php 
        echo $theme_row->lightbox_comment_button_border_radius;
        ?>
;
        color: #<?php 
        echo $theme_row->lightbox_comment_font_color;
        ?>
;
        cursor: pointer;
        padding: <?php 
        echo $theme_row->lightbox_comment_button_padding;
        ?>
;
      }
      .bwg_comments input[type="text"],
      .bwg_comments textarea {
        background: none repeat scroll 0 0 #<?php 
        echo $theme_row->lightbox_comment_input_bg_color;
        ?>
;
        border: <?php 
        echo $theme_row->lightbox_comment_input_border_width;
        ?>
px <?php 
        echo $theme_row->lightbox_comment_input_border_style;
        ?>
 #<?php 
        echo $theme_row->lightbox_comment_input_border_color;
        ?>
;
        border-radius: <?php 
        echo $theme_row->lightbox_comment_input_border_radius;
        ?>
;
        color: #<?php 
        echo $theme_row->lightbox_comment_font_color;
        ?>
;
        padding: <?php 
        echo $theme_row->lightbox_comment_input_padding;
        ?>
;
        width: 100%;
      }
      .bwg_comments textarea {
        resize: vertical;
      }
      .bwg_comment_header_p {
        border-top: <?php 
        echo $theme_row->lightbox_comment_separator_width;
        ?>
px <?php 
        echo $theme_row->lightbox_comment_separator_style;
        ?>
 #<?php 
        echo $theme_row->lightbox_comment_separator_color;
        ?>
;
      }
      .bwg_comment_header {
        color: #<?php 
        echo $theme_row->lightbox_comment_font_color;
        ?>
;
        font-size: <?php 
        echo $theme_row->lightbox_comment_author_font_size;
        ?>
px;
      }
      .bwg_comment_date {
        color: #<?php 
        echo $theme_row->lightbox_comment_font_color;
        ?>
;
        float: right;
        font-size: <?php 
        echo $theme_row->lightbox_comment_date_font_size;
        ?>
px;
      }
      .bwg_comment_body {
        color: #<?php 
        echo $theme_row->lightbox_comment_font_color;
        ?>
;
        font-size: <?php 
        echo $theme_row->lightbox_comment_body_font_size;
        ?>
px;
      }
      .bwg_comment_delete_btn {
        color: #FFFFFF;
        cursor: pointer;
        float: right;
        font-size: 14px;
        margin: 2px;
      }
      .bwg_comments_close {
        cursor: pointer;
        line-height: 0;
        position: relative;
        font-size: 13px;
        text-align: <?php 
        echo $theme_row->lightbox_comment_pos == 'left' ? 'right' : 'left';
        ?>
;
        margin: 5px;
        z-index: 10150;
      }
      .bwg_comment_textarea::-webkit-scrollbar {
        width: 4px;
      }
      .bwg_comment_textarea::-webkit-scrollbar-track {
      }
      .bwg_comment_textarea::-webkit-scrollbar-thumb {
        background-color: rgba(255, 255, 255, 0.55);
        border-radius: 2px;
      }  
      .bwg_comment_textarea::-webkit-scrollbar-thumb:hover {
        background-color: #D9D9D9;
      }
      .bwg_ctrl_btn_container a,
      .bwg_ctrl_btn_container a:hover {
        text-decoration: none;
      }
      .bwg_rate:hover {
        color: #<?php 
        echo $theme_row->lightbox_rate_color;
        ?>
;
      }
      .bwg_facebook:hover {
        color: #3B5998;
      }
      .bwg_twitter:hover {
        color: #4099FB;
      }
      .bwg_google:hover {
        color: #DD4B39;
      }
      .bwg_pinterest:hover {
        color: #cb2027;
      }
      .bwg_tumblr:hover {
        color: #2F5070;
      }
      .bwg_facebook,
      .bwg_twitter,
      .bwg_google,
      .bwg_pinterest,
      .bwg_tumblr {
        color: #<?php 
        echo $theme_row->lightbox_comment_share_button_color;
        ?>
;
      }
      .bwg_image_container {
        display: table;
        position: absolute;
        text-align: center;
        <?php 
        echo $theme_row->lightbox_filmstrip_pos;
        ?>
: <?php 
        echo $image_filmstrip_height;
        ?>
px;
        vertical-align: middle;
        width: 100%;
      }      
      .bwg_filmstrip_container {
        display: table;
        height: <?php 
        echo $image_filmstrip_height;
        ?>
px;
        position: absolute;
        width: <?php 
        echo $image_width;
        ?>
px;
        z-index: 10150;
        <?php 
        echo $theme_row->lightbox_filmstrip_pos;
        ?>
: 0;
      }
      .bwg_filmstrip {
        left: 20px;
        overflow: hidden;
        position: absolute;
        width: <?php 
        echo $image_width - 40;
        ?>
px;
        z-index: 10106;
      }
      .bwg_filmstrip_thumbnails {
        height: <?php 
        echo $image_filmstrip_height;
        ?>
px;
        left: 0px;
        margin: 0 auto;
        overflow: hidden;
        position: relative;
        width: <?php 
        echo ($image_filmstrip_width + $filmstrip_thumb_margin_hor) * count($image_rows);
        ?>
px;
      }
      .bwg_filmstrip_thumbnail {
        position: relative;
        background: none;
        border: <?php 
        echo $theme_row->lightbox_filmstrip_thumb_border_width;
        ?>
px <?php 
        echo $theme_row->lightbox_filmstrip_thumb_border_style;
        ?>
 #<?php 
        echo $theme_row->lightbox_filmstrip_thumb_border_color;
        ?>
;
        border-radius: <?php 
        echo $theme_row->lightbox_filmstrip_thumb_border_radius;
        ?>
;
        cursor: pointer;
        float: left;
        height: <?php 
        echo $image_filmstrip_height;
        ?>
px;
        margin: <?php 
        echo $theme_row->lightbox_filmstrip_thumb_margin;
        ?>
;
        width: <?php 
        echo $image_filmstrip_width;
        ?>
px;
        overflow: hidden;
      }
      .bwg_thumb_active {
        opacity: 1;
        filter: Alpha(opacity=100);
        border: <?php 
        echo $theme_row->lightbox_filmstrip_thumb_active_border_width;
        ?>
px solid #<?php 
        echo $theme_row->lightbox_filmstrip_thumb_active_border_color;
        ?>
;
      }
      .bwg_thumb_deactive {
        opacity: <?php 
        echo number_format($theme_row->lightbox_filmstrip_thumb_deactive_transparent / 100, 2, ".", "");
        ?>
;
        filter: Alpha(opacity=<?php 
        echo $theme_row->lightbox_filmstrip_thumb_deactive_transparent;
        ?>
);
      }
      .bwg_filmstrip_thumbnail_img {
        display: block;
        opacity: 1;
        filter: Alpha(opacity=100);
      }
      .bwg_filmstrip_left {
        background-color: #<?php 
        echo $theme_row->lightbox_filmstrip_rl_bg_color;
        ?>
;
        cursor: pointer;
        display: table-cell;
        vertical-align: middle;
        width: 20px;
        z-index: 10106;
        left: 0;
      }
      .bwg_filmstrip_right {
        background-color: #<?php 
        echo $theme_row->lightbox_filmstrip_rl_bg_color;
        ?>
;
        cursor: pointer;
        right: 0;
        width: 20px;
        display: table-cell;
        vertical-align: middle;
        z-index: 10106;
      }
      .bwg_filmstrip_left i,
      .bwg_filmstrip_right i {
        color: #<?php 
        echo $theme_row->lightbox_filmstrip_rl_btn_color;
        ?>
;
        font-size: <?php 
        echo $theme_row->lightbox_filmstrip_rl_btn_size;
        ?>
px;
      }
      .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;
      }
      .bwg_watermark_container {
        display: table-cell;
        margin: 0 auto;
        position: relative;
        vertical-align: middle;
      }
      .bwg_watermark_spun {
        display: table-cell;
        overflow: hidden;
        position: relative;
        text-align: <?php 
        echo $watermark_position[1];
        ?>
;
        vertical-align: <?php 
        echo $watermark_position[0];
        ?>
;
        /*z-index: 10140;*/
      }
      .bwg_watermark_image {
        margin: 4px;
        max-height: <?php 
        echo $watermark_height;
        ?>
px;
        max-width: <?php 
        echo $watermark_width;
        ?>
px;
        opacity: <?php 
        echo number_format($watermark_opacity / 100, 2, ".", "");
        ?>
;
        filter: Alpha(opacity=<?php 
        echo $watermark_opacity;
        ?>
);
        position: relative;
        z-index: 10141;
      }
      .bwg_watermark_text,
      .bwg_watermark_text:hover {
        text-decoration: none;
        margin: 4px;
        font-size: <?php 
        echo $watermark_font_size;
        ?>
px;
        font-family: <?php 
        echo $watermark_font;
        ?>
;
        color: #<?php 
        echo $watermark_color;
        ?>
 !important;
        opacity: <?php 
        echo number_format($watermark_opacity / 100, 2, ".", "");
        ?>
;
        filter: Alpha(opacity=<?php 
        echo $watermark_opacity;
        ?>
);
        position: relative;
        z-index: 10141;
      }
      .bwg_slide_container {
        display: table-cell;
        position: absolute;
        vertical-align: middle;
        width: 100%;
        height: 100%;
      }
      .bwg_slide_bg {
        margin: 0 auto;
        width: inherit;
        height: inherit;
      }
      .bwg_slider {
        height: inherit;
        width: inherit;
      }
      .bwg_popup_image_spun {
        height: inherit;
        display: table-cell;
        filter: Alpha(opacity=100);
        opacity: 1;
        position: absolute;
        vertical-align: middle;
        width: inherit;
        z-index: 2;
      }
      .bwg_popup_image_second_spun {
        width: inherit;
        height: inherit;
        display: table-cell;
        filter: Alpha(opacity=0);
        opacity: 0;
        position: absolute;
        vertical-align: middle;
        z-index: 1;
      }
      .bwg_grid {
        display: none;
        height: 100%;
        overflow: hidden;
        position: absolute;
        width: 100%;
      }
      .bwg_gridlet {
        opacity: 1;
        filter: Alpha(opacity=100);
        position: absolute;
      }
      .bwg_image_info_container1 {
        display: <?php 
        echo $popup_info_always_show ? 'table-cell' : 'none';
        ?>
;
      }
      .bwg_image_hit_container1 {
        display: <?php 
        echo $popup_hit_counter ? 'table-cell' : 'none';
        ?>
;;
      }
      .bwg_image_info_spun {
        text-align: <?php 
        echo $theme_row->lightbox_info_align;
        ?>
;
        vertical-align: <?php 
        echo $theme_row->lightbox_info_pos;
        ?>
;
      }
      .bwg_image_hit_spun {
        text-align: <?php 
        echo $theme_row->lightbox_hit_align;
        ?>
;
        vertical-align: <?php 
        echo $theme_row->lightbox_hit_pos;
        ?>
;
      }
      .bwg_image_hit {
        background: rgba(<?php 
        echo $rgb_bwg_image_hit_bg_color['red'];
        ?>
, <?php 
        echo $rgb_bwg_image_hit_bg_color['green'];
        ?>
, <?php 
        echo $rgb_bwg_image_hit_bg_color['blue'];
        ?>
, <?php 
        echo number_format($theme_row->lightbox_hit_bg_transparent / 100, 2, ".", "");
        ?>
);
        border: <?php 
        echo $theme_row->lightbox_hit_border_width;
        ?>
px <?php 
        echo $theme_row->lightbox_hit_border_style;
        ?>
 #<?php 
        echo $theme_row->lightbox_hit_border_color;
        ?>
;
        border-radius: <?php 
        echo $theme_row->lightbox_info_border_radius;
        ?>
;
        <?php 
        echo (!$enable_image_filmstrip || $theme_row->lightbox_filmstrip_pos != 'bottom') && $theme_row->lightbox_ctrl_btn_pos == 'bottom' && $theme_row->lightbox_hit_pos == 'bottom' ? 'bottom: ' . ($theme_row->lightbox_ctrl_btn_height + 2 * $theme_row->lightbox_ctrl_btn_margin_top) . 'px;' : '';
        ?>
        margin: <?php 
        echo $theme_row->lightbox_hit_margin;
        ?>
;
        padding: <?php 
        echo $theme_row->lightbox_hit_padding;
        ?>
;
        <?php 
        echo (!$enable_image_filmstrip || $theme_row->lightbox_filmstrip_pos != 'top') && $theme_row->lightbox_ctrl_btn_pos == 'top' && $theme_row->lightbox_hit_pos == 'top' ? 'top: ' . ($theme_row->lightbox_ctrl_btn_height + 2 * $theme_row->lightbox_ctrl_btn_margin_top) . 'px;' : '';
        ?>
      }
      .bwg_image_hits,
      .bwg_image_hits * {
        color: #<?php 
        echo $theme_row->lightbox_hit_color;
        ?>
 !important;
        font-family: <?php 
        echo $theme_row->lightbox_hit_font_style;
        ?>
;
        font-size: <?php 
        echo $theme_row->lightbox_hit_font_size;
        ?>
px;
        font-weight: <?php 
        echo $theme_row->lightbox_hit_font_weight;
        ?>
;
      }
      .bwg_image_info {
        background: rgba(<?php 
        echo $rgb_bwg_image_info_bg_color['red'];
        ?>
, <?php 
        echo $rgb_bwg_image_info_bg_color['green'];
        ?>
, <?php 
        echo $rgb_bwg_image_info_bg_color['blue'];
        ?>
, <?php 
        echo number_format($theme_row->lightbox_info_bg_transparent / 100, 2, ".", "");
        ?>
);
        border: <?php 
        echo $theme_row->lightbox_info_border_width;
        ?>
px <?php 
        echo $theme_row->lightbox_info_border_style;
        ?>
 #<?php 
        echo $theme_row->lightbox_info_border_color;
        ?>
;
        border-radius: <?php 
        echo $theme_row->lightbox_info_border_radius;
        ?>
;
        <?php 
        echo (!$enable_image_filmstrip || $theme_row->lightbox_filmstrip_pos != 'bottom') && $theme_row->lightbox_ctrl_btn_pos == 'bottom' && $theme_row->lightbox_info_pos == 'bottom' ? 'bottom: ' . ($theme_row->lightbox_ctrl_btn_height + 2 * $theme_row->lightbox_ctrl_btn_margin_top) . 'px;' : '';
        ?>
        <?php 
        if ($popup_info_full_width) {
            ?>
        width: 100%;
        <?php 
        } else {
            ?>
        width: 33%;
        margin: <?php 
            echo $theme_row->lightbox_info_margin;
            ?>
;
        <?php 
        }
        ?>
        padding: <?php 
        echo $theme_row->lightbox_info_padding;
        ?>
;
        <?php 
        echo (!$enable_image_filmstrip || $theme_row->lightbox_filmstrip_pos != 'top') && $theme_row->lightbox_ctrl_btn_pos == 'top' && $theme_row->lightbox_info_pos == 'top' ? 'top: ' . ($theme_row->lightbox_ctrl_btn_height + 2 * $theme_row->lightbox_ctrl_btn_margin_top) . 'px;' : '';
        ?>
      }
      .bwg_image_title,
      .bwg_image_title * {
        color: #<?php 
        echo $theme_row->lightbox_title_color;
        ?>
 !important;
        font-family: <?php 
        echo $theme_row->lightbox_title_font_style;
        ?>
;
        font-size: <?php 
        echo $theme_row->lightbox_title_font_size;
        ?>
px;
        font-weight: <?php 
        echo $theme_row->lightbox_title_font_weight;
        ?>
;
      }
      .bwg_image_description,
      .bwg_image_description * {
        color: #<?php 
        echo $theme_row->lightbox_description_color;
        ?>
 !important;
        font-family: <?php 
        echo $theme_row->lightbox_description_font_style;
        ?>
;
        font-size: <?php 
        echo $theme_row->lightbox_description_font_size;
        ?>
px;
        font-weight: <?php 
        echo $theme_row->lightbox_description_font_weight;
        ?>
;
      }
      .bwg_image_rate_spun {
        text-align: <?php 
        echo $theme_row->lightbox_rate_align;
        ?>
;
        vertical-align: <?php 
        echo $theme_row->lightbox_rate_pos;
        ?>
;
      }
      .bwg_image_rate {
        <?php 
        echo (!$enable_image_filmstrip || $theme_row->lightbox_filmstrip_pos != 'bottom') && $theme_row->lightbox_ctrl_btn_pos == 'bottom' && $theme_row->lightbox_rate_pos == 'bottom' ? 'bottom: ' . ($theme_row->lightbox_ctrl_btn_height + 2 * $theme_row->lightbox_ctrl_btn_margin_top) . 'px;' : '';
        ?>
        padding: <?php 
        echo $theme_row->lightbox_rate_padding;
        ?>
;
        <?php 
        echo (!$enable_image_filmstrip || $theme_row->lightbox_filmstrip_pos != 'top') && $theme_row->lightbox_ctrl_btn_pos == 'top' && $theme_row->lightbox_rate_pos == 'top' ? 'top: ' . ($theme_row->lightbox_ctrl_btn_height + 2 * $theme_row->lightbox_ctrl_btn_margin_top) . 'px;' : '';
        ?>
      }
      #bwg_rate_form .bwg_hint,
      #bwg_rate_form .fa-<?php 
        echo $theme_row->lightbox_rate_icon;
        ?>
,
      #bwg_rate_form .fa-<?php 
        echo $theme_row->lightbox_rate_icon;
        ?>
-half-o,
      #bwg_rate_form .fa-<?php 
        echo $theme_row->lightbox_rate_icon;
        ?>
-o,
      #bwg_rate_form .fa-minus-square-o {
        color: #<?php 
        echo $theme_row->lightbox_rate_color;
        ?>
;
        font-size: <?php 
        echo $theme_row->lightbox_rate_size;
        ?>
px;
      }
      #bwg_rate_form .bwg_hint {
        margin: 0 5px;
        display: none;
      }
      .bwg_rate_hover {
        color: #<?php 
        echo $theme_row->lightbox_rate_hover_color;
        ?>
 !important;
      }
      .bwg_star {
        display: inline-block;
      }
      .bwg_rated {
        color: #<?php 
        echo $theme_row->lightbox_rate_color;
        ?>
;
        display: none;
        font-size: <?php 
        echo $theme_row->lightbox_rate_size - 2;
        ?>
px;
      }
			@media (max-width: 480px) {
				.bwg_image_count_container {
					display: none;
				}
        .bwg_image_title,
        .bwg_image_title * {
					font-size: 12px;
				}
        .bwg_image_description,
        .bwg_image_description * {
					font-size: 10px;
				}
			}
      .bwg_image_count_container {
        left: 0;
        line-height: 1;
        position: absolute;
        vertical-align: middle;
      }
    </style>
    <script>
      var data = [];
      var event_stack = [];
      <?php 
        $image_id_exist = FALSE;
        foreach ($image_rows as $key => $image_row) {
            if ($image_row->id == $image_id) {
                $current_avg_rating = $image_row->avg_rating;
                $current_rate = $image_row->rate;
                $current_rate_count = $image_row->rate_count;
                $current_image_key = $key;
            }
            if ($image_row->id == $current_image_id) {
                $current_image_alt = $image_row->alt;
                $current_image_hit_count = $image_row->hit_count;
                $current_image_description = str_replace(array("\r\n", "\n", "\r"), esc_html('<br />'), $image_row->description);
                $current_image_url = $image_row->image_url;
                $current_thumb_url = $image_row->thumb_url;
                $current_filetype = $image_row->filetype;
                $current_filename = $image_row->filename;
                $image_id_exist = TRUE;
            }
            ?>
        data["<?php 
            echo $key;
            ?>
"] = [];
        data["<?php 
            echo $key;
            ?>
"]["number"] = <?php 
            echo $key + 1;
            ?>
;
        data["<?php 
            echo $key;
            ?>
"]["id"] = "<?php 
            echo $image_row->id;
            ?>
";
        data["<?php 
            echo $key;
            ?>
"]["alt"] = "<?php 
            echo str_replace(array("\r\n", "\n", "\r"), esc_html('<br />'), $image_row->alt);
            ?>
";
        data["<?php 
            echo $key;
            ?>
"]["description"] = "<?php 
            echo str_replace(array("\r\n", "\n", "\r"), esc_html('<br />'), $image_row->description);
            ?>
";
        <?php 
            $image_resolution = explode(' x ', $image_row->resolution);
            if (is_array($image_resolution)) {
                $instagram_post_width = $image_resolution[0];
                $instagram_post_height = explode(' ', $image_resolution[1]);
                $instagram_post_height = $instagram_post_height[0];
            }
            ?>
        data["<?php 
            echo $key;
            ?>
"]["image_width"] = "<?php 
            echo $instagram_post_width;
            ?>
";
        data["<?php 
            echo $key;
            ?>
"]["image_height"] = "<?php 
            echo $instagram_post_height;
            ?>
";
        data["<?php 
            echo $key;
            ?>
"]["image_url"] = "<?php 
            echo $image_row->image_url;
            ?>
";
        data["<?php 
            echo $key;
            ?>
"]["thumb_url"] = "<?php 
            echo $image_row->thumb_url;
            ?>
";
        data["<?php 
            echo $key;
            ?>
"]["date"] = "<?php 
            echo $image_row->date;
            ?>
";
        data["<?php 
            echo $key;
            ?>
"]["comment_count"] = "<?php 
            echo $image_row->comment_count;
            ?>
";
        data["<?php 
            echo $key;
            ?>
"]["filetype"] = "<?php 
            echo $image_row->filetype;
            ?>
";
        data["<?php 
            echo $key;
            ?>
"]["filename"] = "<?php 
            echo $image_row->filename;
            ?>
";
        data["<?php 
            echo $key;
            ?>
"]["avg_rating"] = "<?php 
            echo $image_row->avg_rating;
            ?>
";
        data["<?php 
            echo $key;
            ?>
"]["rate"] = "<?php 
            echo $image_row->rate;
            ?>
";
        data["<?php 
            echo $key;
            ?>
"]["rate_count"] = "<?php 
            echo $image_row->rate_count;
            ?>
";
        data["<?php 
            echo $key;
            ?>
"]["hit_count"] = "<?php 
            echo $image_row->hit_count;
            ?>
";
        <?php 
        }
        ?>
    </script>
    <?php 
        if (!$image_id_exist) {
            echo WDWLibrary::message(__('The image has been deleted.', 'bwg'), 'wd_error');
            die;
        }
        ?>
    <div class="bwg_image_wrap">
      <?php 
        if ($enable_image_ctrl_btn) {
            ?>
      <div class="bwg_btn_container">
        <div class="bwg_ctrl_btn_container">
					<?php 
            if ($option_row->show_image_counts) {
                ?>
            <span class="bwg_image_count_container bwg_ctrl_btn">
              <span class="bwg_image_count"><?php 
                echo $current_image_key + 1;
                ?>
</span> / 
              <span><?php 
                echo count($image_rows);
                ?>
</span>
            </span>
            <?php 
            }
            ?>
          <i title="<?php 
            echo __('Play', 'bwg');
            ?>
" class="bwg_ctrl_btn bwg_play_pause fa fa-play"></i>
          <?php 
            if ($enable_image_fullscreen) {
                if (!$open_with_fullscreen) {
                    ?>
          <i title="<?php 
                    echo __('Maximize', 'bwg');
                    ?>
" class="bwg_ctrl_btn bwg_resize-full fa fa-resize-full "></i>
          <?php 
                }
                ?>
          <i title="<?php 
                echo __('Fullscreen', 'bwg');
                ?>
" class="bwg_ctrl_btn bwg_fullscreen fa fa-fullscreen"></i>
          <?php 
            }
            if ($popup_enable_info) {
                ?>
          <i title="<?php 
                echo __('Show info', 'bwg');
                ?>
" class="bwg_ctrl_btn bwg_info fa fa-info"></i>
          <?php 
            }
            $is_embed = preg_match('/EMBED/', $current_filetype) == 1 ? TRUE : FALSE;
            if ($option_row->popup_enable_fullsize_image) {
                ?>
            <a id="bwg_fullsize_image" href="<?php 
                echo !$is_embed ? site_url() . '/' . $WD_BWG_UPLOAD_DIR . $current_image_url : $current_image_url;
                ?>
" target="_blank">
              <i title="<?php 
                echo __('Open image in original size.', 'bwg');
                ?>
" class="bwg_ctrl_btn fa fa-external-link"></i>
            </a>
            <?php 
            }
            if ($option_row->popup_enable_download) {
                $style = 'none';
                $current_image_arr = explode('/', $current_image_url);
                if (!$is_embed) {
                    $download_href = site_url() . '/' . $WD_BWG_UPLOAD_DIR . $current_image_url;
                    $style = 'inline-block';
                } elseif (preg_match('/FLICKR/', $current_filetype) == 1) {
                    $download_href = $current_filename;
                    $style = 'inline-block';
                } elseif (preg_match('/INSTAGRAM/', $current_filetype) == 1) {
                    $download_href = substr_replace($current_thumb_url, 'l', -1);
                    $style = 'inline-block';
                }
                ?>
            <a id="bwg_download" href="<?php 
                echo $download_href;
                ?>
" target="_blank" download="<?php 
                echo end($current_image_arr);
                ?>
" style="display: <?php 
                echo $style;
                ?>
;">
              <i title="<?php 
                echo __('Download original image', 'bwg');
                ?>
" class="bwg_ctrl_btn fa fa-download"></i>
            </a>
            <?php 
            }
            ?>
        </div>
        <div class="bwg_toggle_container">
          <i class="bwg_toggle_btn fa <?php 
            echo $theme_row->lightbox_ctrl_btn_pos == 'top' ? 'fa-angle-up' : 'fa-angle-down';
            ?>
"></i>
        </div>
      </div>
      <?php 
        }
        $current_pos = 0;
        ?>
      <?php 
        if ($watermark_type != 'none') {
            ?>
      <div class="bwg_image_container">
        <div class="bwg_watermark_container">
          <div style="display:table; margin:0 auto;">
            <span class="bwg_watermark_spun" id="bwg_watermark_container">
              <?php 
            if ($watermark_type == 'image') {
                ?>
              <a href="<?php 
                echo urldecode($watermark_link);
                ?>
" target="_blank">
                <img class="bwg_watermark_image bwg_watermark" src="<?php 
                echo $watermark_url;
                ?>
" />
              </a>
              <?php 
            } elseif ($watermark_type == 'text') {
                ?>
              <a class="bwg_none_selectable bwg_watermark_text bwg_watermark" target="_blank" href="<?php 
                echo $watermark_link;
                ?>
"><?php 
                echo stripslashes($watermark_text);
                ?>
</a>
              <?php 
            }
            ?>
            </span>
          </div>
        </div>
      </div>
      <?php 
        }
        ?>
      <div id="bwg_image_container" class="bwg_image_container">
        <div class="bwg_image_info_container1">
          <div class="bwg_image_info_container2">
            <span class="bwg_image_info_spun">
              <div class="bwg_image_info" <?php 
        if (trim($current_image_alt) == '' && trim($current_image_description) == '') {
            echo 'style="background:none;"';
        }
        ?>
>
                <div class="bwg_image_title"><?php 
        echo html_entity_decode($current_image_alt);
        ?>
</div>
                <div class="bwg_image_description"><?php 
        echo html_entity_decode($current_image_description);
        ?>
</div>
              </div>
            </span>
          </div>
        </div>
        <div class="bwg_slide_container">
          <div class="bwg_slide_bg">
            <div class="bwg_slider">
          <?php 
        $current_key = -6;
        foreach ($image_rows as $key => $image_row) {
            $is_embed = preg_match('/EMBED/', $image_row->filetype) == 1 ? true : false;
            $is_embed_instagram_post = preg_match('/INSTAGRAM_POST/', $image_row->filetype) == 1 ? true : false;
            if ($image_row->id == $current_image_id) {
                $current_key = $key;
                ?>
              <span class="bwg_popup_image_spun" id="bwg_popup_image" image_id="<?php 
                echo $image_row->id;
                ?>
">
                <span class="bwg_popup_image_spun1" style="display: table; width: inherit; height: inherit;">
                  <span class="bwg_popup_image_spun2" style="display: table-cell; vertical-align: middle; text-align: center;">
                    <?php 
                if (!$is_embed) {
                    ?>
                      <img class="bwg_popup_image bwg_popup_watermark" src="<?php 
                    echo site_url() . '/' . $WD_BWG_UPLOAD_DIR . $image_row->image_url;
                    ?>
" alt="<?php 
                    echo $image_row->alt;
                    ?>
" />
                      <?php 
                } else {
                    /*$is_embed*/
                    ?>
                        <span class="bwg_popup_embed bwg_popup_watermark" style="diplay: table; table-layout: fixed;">
                        <?php 
                    if ($is_embed_instagram_post) {
                        $post_width = $image_width;
                        $post_height = $image_height;
                        if ($post_height < $post_width + 88) {
                            $post_width = $post_height - 88;
                        } else {
                            $post_height = $post_width + 88;
                        }
                        $instagram_post_width = $post_width;
                        $instagram_post_height = $post_height;
                        $image_resolution = explode(' x ', $image_row->resolution);
                        if (is_array($image_resolution)) {
                            $instagram_post_width = $image_resolution[0];
                            $instagram_post_height = explode(' ', $image_resolution[1]);
                            $instagram_post_height = $instagram_post_height[0];
                        }
                        WDWLibraryEmbed::display_embed($image_row->filetype, $image_row->filename, array('class' => "bwg_embed_frame", 'data-width' => $instagram_post_width, 'data-height' => $instagram_post_height, 'frameborder' => "0", 'style' => "width:" . $post_width . "px; height:" . $post_height . "px; vertical-align:middle; display:inline-block; position:relative;"));
                    } else {
                        WDWLibraryEmbed::display_embed($image_row->filetype, $image_row->filename, array('class' => "bwg_embed_frame", 'frameborder' => "0", 'allowfullscreen' => "allowfullscreen", 'style' => "width:inherit; height:inherit; vertical-align:middle; display:table-cell;"));
                    }
                    ?>
                      </span>
                      <?php 
                }
                ?>
                    
                  </span>
                </span>
              </span>
              <span class="bwg_popup_image_second_spun">                
              </span>
              <input type="hidden" id="bwg_current_image_key" value="<?php 
                echo $key;
                ?>
" />
              <?php 
                break;
            }
        }
        ?>
            </div>
          </div>
        </div>
        <a id="spider_popup_left" <?php 
        echo $option_row->enable_loop == 0 && $current_key == 0 ? 'style="display: none;"' : '';
        ?>
><span id="spider_popup_left-ico"><span><i class="bwg_prev_btn fa <?php 
        echo $theme_row->lightbox_rl_btn_style;
        ?>
-left"></i></span></span></a>
        <a id="spider_popup_right" <?php 
        echo $option_row->enable_loop == 0 && $current_key == count($image_rows) - 1 ? 'style="display: none;"' : '';
        ?>
><span id="spider_popup_right-ico"><span><i class="bwg_next_btn fa <?php 
        echo $theme_row->lightbox_rl_btn_style;
        ?>
-right"></i></span></span></a>
      </div>
    </div>
    <a class="spider_popup_close" onclick="spider_destroypopup(1000); return false;" ontouchend="spider_destroypopup(1000); return false;"><span><i class="bwg_close_btn fa fa-times"></i></span></a>
    <script language="javascript" type="text/javascript" src="<?php 
        echo WD_BWG_URL . '/js/bwg_embed.js?ver=' . wd_bwg_version();
        ?>
"></script>
    <script>
      var bwg_trans_in_progress = false;
      var bwg_transition_duration = <?php 
        echo $slideshow_interval < 4 && $slideshow_interval != 0 ? $slideshow_interval * 1000 / 4 : $slideshow_effect_duration * 1000;
        ?>
;
      var bwg_playInterval;
      if ((jQuery("#spider_popup_wrap").width() >= jQuery(window).width()) || (jQuery("#spider_popup_wrap").height() >= jQuery(window).height())) {
        jQuery(".spider_popup_close").attr("class", "bwg_ctrl_btn spider_popup_close_fullscreen");
      }
      /* Stop autoplay.*/
      window.clearInterval(bwg_playInterval);
      /* Set watermark container size.*/
      function bwg_change_watermark_container() {
        jQuery(".bwg_slider").children().each(function() {
          if (jQuery(this).css("zIndex") == 2) {
            /* This may be neither img nor iframe.*/
            var bwg_current_image_span = jQuery(this).find("img");
            if (!bwg_current_image_span.length) {
              bwg_current_image_span = jQuery(this).find("iframe");
            }
            if (!bwg_current_image_span.length) {
              bwg_current_image_span = jQuery(this).find("video");
            }
            /*set timeout for video to get size according to style, and then put watermark*/
            setTimeout(function () {
              var width = bwg_current_image_span.width();
              var height = bwg_current_image_span.height();
          

              jQuery(".bwg_watermark_spun").width(width);
              jQuery(".bwg_watermark_spun").height(height);
              jQuery(".bwg_watermark").css({display: ''});
              /* Set watermark image size.*/
              var comment_container_width = 0;
              if (jQuery(".bwg_comment_container").hasClass("bwg_open")) {
                comment_container_width = <?php 
        echo $theme_row->lightbox_comment_width;
        ?>
;
               }
              if (width <= (jQuery(window).width() - comment_container_width)) {
                jQuery(".bwg_watermark_image").css({
                  width: ((jQuery(".spider_popup_wrap").width() - comment_container_width) * <?php 
        echo $watermark_width / $image_width;
        ?>
)
                });
                jQuery(".bwg_watermark_text, .bwg_watermark_text:hover").css({
                  fontSize: ((jQuery(".spider_popup_wrap").width() - comment_container_width) * <?php 
        echo $watermark_font_size / $image_width;
        ?>
)
                });
              }
            }, 800);
          }
        });
      }
      var bwg_current_key = '<?php 
        echo $current_key;
        ?>
';
      var bwg_current_filmstrip_pos = <?php 
        echo $current_pos;
        ?>
;
      /* Set filmstrip initial position.*/
      function bwg_set_filmstrip_pos(filmStripWidth) {
        var selectedImagePos = -bwg_current_filmstrip_pos - (jQuery(".bwg_filmstrip_thumbnail").outerWidth(true)) / 2;
        var imagesContainerLeft = Math.min(0, Math.max(filmStripWidth - jQuery(".bwg_filmstrip_thumbnails").width(), selectedImagePos + filmStripWidth / 2));
        jQuery(".bwg_filmstrip_thumbnails").animate({
            left: imagesContainerLeft
          }, {
            duration: 500,
            complete: function () { bwg_filmstrip_arrows(); }
          });
      }
      function bwg_move_filmstrip() {
        var image_left = jQuery(".bwg_thumb_active").position().left;
        var image_right = jQuery(".bwg_thumb_active").position().left + jQuery(".bwg_thumb_active").outerWidth(true);
        var bwg_filmstrip_width = jQuery(".bwg_filmstrip").outerWidth(true);
        var bwg_filmstrip_thumbnails_width = jQuery(".bwg_filmstrip_thumbnails").outerWidth(true);
        var long_filmstrip_cont_left = jQuery(".bwg_filmstrip_thumbnails").position().left;
        var long_filmstrip_cont_right = Math.abs(jQuery(".bwg_filmstrip_thumbnails").position().left) + bwg_filmstrip_width;
        if (bwg_filmstrip_width > bwg_filmstrip_thumbnails_width) {
          return;
        }
        if (image_left < Math.abs(long_filmstrip_cont_left)) {
          jQuery(".bwg_filmstrip_thumbnails").animate({
            left: -image_left
          }, {
            duration: 500,
            complete: function () { bwg_filmstrip_arrows(); }
          });
        }
        else if (image_right > long_filmstrip_cont_right) {
          jQuery(".bwg_filmstrip_thumbnails").animate({
            left: -(image_right - bwg_filmstrip_width)
          }, {
            duration: 500,
            complete: function () { bwg_filmstrip_arrows(); }
          });
        }
      }
      /* Show/hide filmstrip arrows.*/
      function bwg_filmstrip_arrows() {
        if (jQuery(".bwg_filmstrip_thumbnails").width() < jQuery(".bwg_filmstrip").width()) {
          jQuery(".bwg_filmstrip_left").hide();
          jQuery(".bwg_filmstrip_right").hide();
        }
        else {
          jQuery(".bwg_filmstrip_left").show();
          jQuery(".bwg_filmstrip_right").show();
        }
      }
      function bwg_testBrowser_cssTransitions() {
        return bwg_testDom('Transition');
      }
      function bwg_testBrowser_cssTransforms3d() {
        return bwg_testDom('Perspective');
      }
      function bwg_testDom(prop) {
        /* Browser vendor CSS prefixes.*/
        var browserVendors = ['', '-webkit-', '-moz-', '-ms-', '-o-', '-khtml-'];
        /* Browser vendor DOM prefixes.*/
        var domPrefixes = ['', 'Webkit', 'Moz', 'ms', 'O', 'Khtml'];
        var i = domPrefixes.length;
        while (i--) {
          if (typeof document.body.style[domPrefixes[i] + prop] !== 'undefined') {
            return true;
          }
        }
        return false;
      }
      function bwg_cube(tz, ntx, nty, nrx, nry, wrx, wry, current_image_class, next_image_class, direction) {
        /* If browser does not support 3d transforms/CSS transitions.*/
        if (!bwg_testBrowser_cssTransitions()) {
          return bwg_fallback(current_image_class, next_image_class, direction);
        }
        if (!bwg_testBrowser_cssTransforms3d()) {
          return bwg_fallback3d(current_image_class, next_image_class, direction);
        }
        bwg_trans_in_progress = true;
        /* Set active thumbnail.*/
        jQuery(".bwg_filmstrip_thumbnail").removeClass("bwg_thumb_active").addClass("bwg_thumb_deactive");
        jQuery("#bwg_filmstrip_thumbnail_" + bwg_current_key).removeClass("bwg_thumb_deactive").addClass("bwg_thumb_active");
        jQuery(".bwg_slide_bg").css('perspective', 1000);
        jQuery(current_image_class).css({
          transform : 'translateZ(' + tz + 'px)',
          backfaceVisibility : 'hidden'
        });
        jQuery(next_image_class).css({
          opacity : 1,
          filter: 'Alpha(opacity=100)',
          backfaceVisibility : 'hidden',
          transform : 'translateY(' + nty + 'px) translateX(' + ntx + 'px) rotateY('+ nry +'deg) rotateX('+ nrx +'deg)'
        });
        jQuery(".bwg_slider").css({
          transform: 'translateZ(-' + tz + 'px)',
          transformStyle: 'preserve-3d'
        });
        /* Execution steps.*/
        setTimeout(function () {
          jQuery(".bwg_slider").css({
            transition: 'all ' + bwg_transition_duration + 'ms ease-in-out',
            transform: 'translateZ(-' + tz + 'px) rotateX('+ wrx +'deg) rotateY('+ wry +'deg)'
          });
        }, 20);
        /* After transition.*/
        jQuery(".bwg_slider").one('webkitTransitionEnd transitionend otransitionend oTransitionEnd mstransitionend', jQuery.proxy(bwg_after_trans));
        function bwg_after_trans() {
          jQuery(current_image_class).removeAttr('style');
          jQuery(next_image_class).removeAttr('style');
          jQuery(".bwg_slider").removeAttr('style');
          jQuery(current_image_class).css({'opacity' : 0, filter: 'Alpha(opacity=0)', 'z-index': 1});
          jQuery(next_image_class).css({'opacity' : 1, filter: 'Alpha(opacity=100)', 'z-index' : 2});
          
          bwg_trans_in_progress = false;
          jQuery(current_image_class).html('');
          if (typeof event_stack !== 'undefined') {
            if (event_stack.length > 0) {
              key = event_stack[0].split("-");
              event_stack.shift();
              bwg_change_image(key[0], key[1], data, true);
            }
          }
          bwg_change_watermark_container();
        }
      }
      function bwg_cubeH(current_image_class, next_image_class, direction) {
        /* Set to half of image width.*/
        var dimension = jQuery(current_image_class).width() / 2;
        if (direction == 'right') {
          bwg_cube(dimension, dimension, 0, 0, 90, 0, -90, current_image_class, next_image_class, direction);
        }
        else if (direction == 'left') {
          bwg_cube(dimension, -dimension, 0, 0, -90, 0, 90, current_image_class, next_image_class, direction);
        }
      }
      /* For browsers that does not support transitions.*/
      function bwg_fallback(current_image_class, next_image_class, direction) {
        bwg_fade(current_image_class, next_image_class, direction);
      }
      /* For browsers that support transitions, but not 3d transforms (only used if primary transition makes use of 3d-transforms).*/
      function bwg_fallback3d(current_image_class, next_image_class, direction) {
        bwg_sliceV(current_image_class, next_image_class, direction);
      }
      function bwg_none(current_image_class, next_image_class, direction) {
        jQuery(current_image_class).css({'opacity' : 0, 'z-index': 1});
        jQuery(next_image_class).css({'opacity' : 1, 'z-index' : 2});
        /* Set active thumbnail.*/
        jQuery(".bwg_filmstrip_thumbnail").removeClass("bwg_thumb_active").addClass("bwg_thumb_deactive");
        jQuery("#bwg_filmstrip_thumbnail_" + bwg_current_key).removeClass("bwg_thumb_deactive").addClass("bwg_thumb_active");
        bwg_trans_in_progress = false; 
        jQuery(current_image_class).html('');
        bwg_change_watermark_container();
      }
      function bwg_fade(current_image_class, next_image_class, direction) {
        /* Set active thumbnail.*/
        jQuery(".bwg_filmstrip_thumbnail").removeClass("bwg_thumb_active").addClass("bwg_thumb_deactive");
        jQuery("#bwg_filmstrip_thumbnail_" + bwg_current_key).removeClass("bwg_thumb_deactive").addClass("bwg_thumb_active");
        if (bwg_testBrowser_cssTransitions()) {
          jQuery(next_image_class).css('transition', 'opacity ' + bwg_transition_duration + 'ms linear');
          jQuery(current_image_class).css({'opacity' : 0, 'z-index': 1});
          jQuery(next_image_class).css({'opacity' : 1, 'z-index' : 2});
          bwg_change_watermark_container();
        }
        else {
          jQuery(current_image_class).animate({'opacity' : 0, 'z-index' : 1}, bwg_transition_duration);
          jQuery(next_image_class).animate({
              'opacity' : 1,
              'z-index': 2
            }, {
              duration: bwg_transition_duration,
              complete: function () { 

                bwg_trans_in_progress = false;  
                jQuery(current_image_class).html('');
                bwg_change_watermark_container(); }
            });
          /* For IE.*/
          jQuery(current_image_class).fadeTo(bwg_transition_duration, 0);
          jQuery(next_image_class).fadeTo(bwg_transition_duration, 1);
        }
      }
      function bwg_grid(cols, rows, ro, tx, ty, sc, op, current_image_class, next_image_class, direction) {
        /* If browser does not support CSS transitions.*/
        if (!bwg_testBrowser_cssTransitions()) {
          return bwg_fallback(current_image_class, next_image_class, direction);
        }
        bwg_trans_in_progress = true;
        /* Set active thumbnail.*/
        jQuery(".bwg_filmstrip_thumbnail").removeClass("bwg_thumb_active").addClass("bwg_thumb_deactive");
        jQuery("#bwg_filmstrip_thumbnail_" + bwg_current_key).removeClass("bwg_thumb_deactive").addClass("bwg_thumb_active");
        /* The time (in ms) added to/subtracted from the delay total for each new gridlet.*/
        var count = (bwg_transition_duration) / (cols + rows);
        /* Gridlet creator (divisions of the image grid, positioned with background-images to replicate the look of an entire slide image when assembled)*/
        function bwg_gridlet(width, height, top, img_top, left, img_left, src, imgWidth, imgHeight, c, r) {
          var delay = (c + r) * count;
          /* Return a gridlet elem with styles for specific transition.*/
          return jQuery('<span class="bwg_gridlet" />').css({
            display : "block",
            width : width,
            height : height,
            top : top,
            left : left,
            backgroundImage : 'url("' + src + '")',
            backgroundColor: jQuery(".spider_popup_wrap").css("background-color"),
            /*backgroundColor: 'rgba(0, 0, 0, 0)',*/
            backgroundRepeat: 'no-repeat',
            backgroundPosition : img_left + 'px ' + img_top + 'px',
            backgroundSize : imgWidth + 'px ' + imgHeight + 'px',
            transition : 'all ' + bwg_transition_duration + 'ms ease-in-out ' + delay + 'ms',
            transform : 'none'
          });
        }
        /* Get the current slide's image.*/
        var cur_img = jQuery(current_image_class).find('img');
        /* Create a grid to hold the gridlets.*/
        var grid = jQuery('<span style="display: block;" />').addClass('bwg_grid');
        /* Prepend the grid to the next slide (i.e. so it's above the slide image).*/
        jQuery(current_image_class).prepend(grid);
        /* Vars to calculate positioning/size of gridlets.*/
        var cont = jQuery(".bwg_slide_bg");
        var imgWidth = cur_img.width();
        var imgHeight = cur_img.height();
        var contWidth = cont.width(),
            contHeight = cont.height(),
            colWidth = Math.floor(contWidth / cols),
            rowHeight = Math.floor(contHeight / rows),
            colRemainder = contWidth - (cols * colWidth),
            colAdd = Math.ceil(colRemainder / cols),
            rowRemainder = contHeight - (rows * rowHeight),
            rowAdd = Math.ceil(rowRemainder / rows),
            leftDist = 0,
            img_leftDist = Math.ceil((jQuery(".bwg_slide_bg").width() - cur_img.width()) / 2);
	var imgSrc = typeof cur_img.attr('src')=='undefined' ? '' :cur_img.attr('src');
        /* tx/ty args can be passed as 'auto'/'min-auto' (meaning use slide width/height or negative slide width/height).*/
        tx = tx === 'auto' ? contWidth : tx;
        tx = tx === 'min-auto' ? - contWidth : tx;
        ty = ty === 'auto' ? contHeight : ty;
        ty = ty === 'min-auto' ? - contHeight : ty;
        /* Loop through cols.*/
        for (var i = 0; i < cols; i++) {
          var topDist = 0,
              img_topDst = Math.floor((jQuery(".bwg_slide_bg").height() - cur_img.height()) / 2),
              newColWidth = colWidth;
          /* If imgWidth (px) does not divide cleanly into the specified number of cols, adjust individual col widths to create correct total.*/
          if (colRemainder > 0) {
            var add = colRemainder >= colAdd ? colAdd : colRemainder;
            newColWidth += add;
            colRemainder -= add;
          }
          /* Nested loop to create row gridlets for each col.*/
          for (var j = 0; j < rows; j++)  {
            var newRowHeight = rowHeight,
                newRowRemainder = rowRemainder;
            /* If contHeight (px) does not divide cleanly into the specified number of rows, adjust individual row heights to create correct total.*/
            if (newRowRemainder > 0) {
              add = newRowRemainder >= rowAdd ? rowAdd : rowRemainder;
              newRowHeight += add;
              newRowRemainder -= add;
            }
            /* Create & append gridlet to grid.*/
            grid.append(bwg_gridlet(newColWidth, newRowHeight, topDist, img_topDst, leftDist, img_leftDist, imgSrc, imgWidth, imgHeight, i, j));
            topDist += newRowHeight;
            img_topDst -= newRowHeight;
          }
          img_leftDist -= newColWidth;
          leftDist += newColWidth;
        }
        /* Set event listener on last gridlet to finish transitioning.*/
        var last_gridlet = grid.children().last();
        /* Show grid & hide the image it replaces.*/
        grid.show();
        cur_img.css('opacity', 0);
        /* Add identifying classes to corner gridlets (useful if applying border radius).*/
        grid.children().first().addClass('rs-top-left');
        grid.children().last().addClass('rs-bottom-right');
        grid.children().eq(rows - 1).addClass('rs-bottom-left');
        grid.children().eq(- rows).addClass('rs-top-right');
        /* Execution steps.*/
        setTimeout(function () {
          grid.children().css({
            opacity: op,
            transform: 'rotate('+ ro +'deg) translateX('+ tx +'px) translateY('+ ty +'px) scale('+ sc +')'
          });
        }, 1);
        jQuery(next_image_class).css('opacity', 1);
        /* After transition.*/
        jQuery(last_gridlet).one('webkitTransitionEnd transitionend otransitionend oTransitionEnd mstransitionend', jQuery.proxy(bwg_after_trans));
        function bwg_after_trans() {
          jQuery(current_image_class).css({'opacity' : 0, 'z-index': 1});
          jQuery(next_image_class).css({'opacity' : 1, 'z-index' : 2});
          cur_img.css('opacity', 1);
          grid.remove();
          bwg_trans_in_progress = false;
          jQuery(current_image_class).html('');
          if (typeof event_stack !== 'undefined') {
            if (event_stack.length > 0) {
              key = event_stack[0].split("-");
              event_stack.shift();
              bwg_change_image(key[0], key[1], data, true);
            }
          }
          bwg_change_watermark_container();
        }
      }
      function bwg_sliceV(current_image_class, next_image_class, direction) {
        if (direction == 'right') {
          var translateY = 'min-auto';
        }
        else if (direction == 'left') {
          var translateY = 'auto';
        }
        bwg_grid(10, 1, 0, 0, translateY, 1, 0, current_image_class, next_image_class, direction);
      }
      function bwg_scaleOut(current_image_class, next_image_class, direction) {
        bwg_grid(1, 1, 0, 0, 0, 1.5, 0, current_image_class, next_image_class, direction);
      }
      function bwg_blindH(current_image_class, next_image_class, direction) {
        bwg_grid(10, 1, 0, 0, 0, .7, 0, current_image_class, next_image_class);
      }
      function bwg_change_image(current_key, key, data, from_effect) {
        jQuery("#spider_popup_left").show();
        jQuery("#spider_popup_right").show();
        if (<?php 
        echo $option_row->enable_loop;
        ?>
 == 0) {
          if (key == (parseInt(data.length) - 1)) {
            jQuery("#spider_popup_right").hide();
          }
          if (key == 0) {
            jQuery("#spider_popup_left").hide();
          }
        }
        /* Pause videos.*/
        jQuery("#bwg_image_container").find("iframe").each(function () {
          jQuery(this)[0].contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}', '*');
          jQuery(this)[0].contentWindow.postMessage('{ "method": "pause" }', "*");
          jQuery(this)[0].contentWindow.postMessage('pause', '*');
        });
        if (typeof data[key] != 'undefined') {
          if (typeof data[current_key] != 'undefined') {
            if (jQuery(".bwg_play_pause").length && !jQuery(".bwg_play_pause").hasClass("fa-play")) {
              bwg_play();
            }
            if (!from_effect) {
              /* Change image key.*/
              jQuery("#bwg_current_image_key").val(key);
              /*if (current_key == '-1') {
                current_key = jQuery(".bwg_thumb_active").children("img").attr("image_key");
              }*/
            }
            if (bwg_trans_in_progress) {
              event_stack.push(current_key + '-' + key);
              return;
            }
            var direction = 'right';
            if (bwg_current_key > key) {
              var direction = 'left';
            }
            else if (bwg_current_key == key) {
              return;
            }
            /*jQuery("#spider_popup_left").hover().css({"display": "inline"});
            jQuery("#spider_popup_right").hover().css({"display": "inline"});*/
            jQuery(".bwg_image_count").html(data[key]["number"]);
            /* Set filmstrip initial position.*/
            jQuery(".bwg_watermark").css({display: 'none'});
            /* Set active thumbnail position.*/
            bwg_current_filmstrip_pos = key * (jQuery(".bwg_filmstrip_thumbnail").width() + 2 + 2 * <?php 
        echo $theme_row->lightbox_filmstrip_thumb_border_width;
        ?>
);
            bwg_current_key = key;
            /* Change image id.*/
            jQuery("#bwg_popup_image").attr('image_id', data[key]["id"]);
            /* Change image title, description.*/
            jQuery(".bwg_image_title").html(jQuery('<span style="display: block;" />').html(data[key]["alt"]).text());
            jQuery(".bwg_image_description").html(jQuery('<span style="display: block;" />').html(data[key]["description"]).text());
            jQuery(".bwg_image_info").removeAttr("style");
            if (data[key]["alt"].trim() == "") {
              if (data[key]["description"].trim() == "") {
                      jQuery(".bwg_image_info").css("background", "none");
              }
            }
          if (jQuery(".bwg_image_info_container1").css("display") != 'none') {
            jQuery(".bwg_image_info_container1").css("display", "table-cell");
          }
          else {
            jQuery(".bwg_image_info_container1").css("display", "none");
          }
          var current_image_class = jQuery(".bwg_popup_image_spun").css("zIndex") == 2 ? ".bwg_popup_image_spun" : ".bwg_popup_image_second_spun";
          var next_image_class = current_image_class == ".bwg_popup_image_second_spun" ? ".bwg_popup_image_spun" : ".bwg_popup_image_second_spun";
          
          var is_embed = data[key]['filetype'].indexOf("EMBED_") > -1 ? true : false;
          var is_embed_instagram_post = data[key]['filetype'].indexOf('INSTAGRAM_POST') > -1 ? true :false;
          var cur_height = jQuery(current_image_class).height();
          var cur_width = jQuery(current_image_class).width();
          var innhtml = '<span class="bwg_popup_image_spun1" style="display: table; width: inherit; height: inherit;"><span class="bwg_popup_image_spun2" style="display: table-cell; vertical-align: middle; text-align: center;">';
          if (!is_embed) {
              innhtml += '<img style="max-height: ' + cur_height + 'px; max-width: ' + cur_width + 'px;" class="bwg_popup_image bwg_popup_watermark" src="<?php 
        echo site_url() . '/' . $WD_BWG_UPLOAD_DIR;
        ?>
' + jQuery('<span style="display: block;" />').html(data[key]["image_url"]).text() + '" alt="' + data[key]["alt"] + '" />';
          }
          else { /*is_embed*/

            innhtml += '<span style="height: ' + cur_height + 'px; width: ' + cur_width + 'px;" class="bwg_popup_embed bwg_popup_watermark">';
            if (is_embed_instagram_post) {
              var post_width = 0;
              var post_height = 0;
              if (cur_height < cur_width + 88) {
                post_height = cur_height;
                post_width = post_height - 88;
              }
              else {
                post_width = cur_width;
                post_height = post_width + 88;
              }
              innhtml += spider_display_embed(data[key]['filetype'], data[key]['filename'], {class:"bwg_embed_frame", 'data-width': data[key]['image_width'], 'data-height': data[key]['image_height'], frameborder: "0", allowfullscreen: "allowfullscreen", style: "width:" + post_width + "px; height:" + post_height + "px; vertical-align:middle; display:inline-block; position:relative;"});
            }
            else{
              innhtml += spider_display_embed(data[key]['filetype'], data[key]['filename'], {class:"bwg_embed_frame", frameborder:"0", allowfullscreen:"allowfullscreen", style:"width:inherit; height:inherit; vertical-align:middle; display:table-cell;" });
            }
            innhtml += "</span>";
          }
          innhtml += '</span></span>';
          jQuery(next_image_class).html(innhtml);
          
          function bwg_afterload() {
            <?php 
        if ($option_row->preload_images) {
            echo 'bwg_preload_images(key);';
        }
        ?>
            bwg_<?php 
        echo $image_effect;
        ?>
(current_image_class, next_image_class, direction);
            jQuery("#bwg_download").show();
            if (!is_embed) {
              jQuery("#bwg_fullsize_image").attr("href", "<?php 
        echo site_url() . '/' . $WD_BWG_UPLOAD_DIR;
        ?>
" + data[key]['image_url']);
              jQuery("#bwg_download").attr("href", "<?php 
        echo site_url() . '/' . $WD_BWG_UPLOAD_DIR;
        ?>
" + data[key]['image_url']);
            }
            else {
              jQuery("#bwg_fullsize_image").attr("href", data[key]['image_url']);
              if (data[key]['filetype'].indexOf("FLICKR_") > -1) {
                jQuery("#bwg_download").attr("href", data[key]['filename']);
              }
              else if (data[key]['filetype'].indexOf("INSTAGRAM_") > -1) {
                jQuery("#bwg_download").attr("href", data[key]['thumb_url'].substring(0, data[key]['thumb_url'].length - 1) + 'l');
              }
              else {
               jQuery("#bwg_download").hide();
              }
            }
            var image_arr = data[key]['image_url'].split("/");
            jQuery("#bwg_download").attr("download", image_arr[image_arr.length - 1]);
            /* Load comments.*/
            if (jQuery(".bwg_comment_container").hasClass("bwg_open")) {
              if (data[key]["comment_count"] == 0) {
                jQuery("#bwg_added_comments").hide();
              }
              else {
                jQuery("#bwg_added_comments").show();
                spider_set_input_value('ajax_task', 'display');
                spider_set_input_value('image_id', jQuery('#bwg_popup_image').attr('image_id'));
                spider_ajax_save('bwg_comment_form');
              }
            }
            /* Update custom scroll.*/
              if (typeof jQuery().mCustomScrollbar !== 'undefined') {
                if (jQuery.isFunction(jQuery().mCustomScrollbar)) {
                  jQuery(".bwg_comments").mCustomScrollbar({
                    advanced:{
                      updateOnContentResize: true
                    }
                  });
                }
              }
            jQuery(".mCSB_scrollTools").hide();
            <?php 
        if ($enable_image_filmstrip) {
            ?>
              bwg_move_filmstrip();
              <?php 
        }
        ?>
            bwg_resize_instagram_post();
          }
          if (!is_embed) {
            var cur_img = jQuery(next_image_class).find('img');
            cur_img.one('load', function() {
              bwg_afterload();
            }).each(function() {
              if(this.complete) jQuery(this).load();
            });
          }
          else {
            bwg_afterload();
            }
          }
        }
      }
      jQuery(document).on('keydown', function (e) {
        if (jQuery("#bwg_name").is(":focus") || jQuery("#bwg_email").is(":focus") || jQuery("#bwg_comment").is(":focus") || jQuery("#bwg_captcha_input").is(":focus")) {
          return;
        }
        if (e.keyCode === 39) { /* Right arrow.*/
          bwg_change_image(parseInt(jQuery('#bwg_current_image_key').val()), parseInt(jQuery('#bwg_current_image_key').val()) + 1, data)
        }
        else if (e.keyCode === 37) { /* Left arrow.*/
          bwg_change_image(parseInt(jQuery('#bwg_current_image_key').val()), parseInt(jQuery('#bwg_current_image_key').val()) - 1, data)
        }
        else if (e.keyCode === 27) { /* Esc.*/
          spider_destroypopup(1000);
        }
        else if (e.keyCode === 32) { /* Space.*/
          jQuery(".bwg_play_pause").trigger('click');
        }
      });
      function bwg_preload_images(key) {
        count = <?php 
        echo (int) $option_row->preload_images_count / 2;
        ?>
;
        var count_all = data.length;
        if (count_all < <?php 
        echo $option_row->preload_images_count;
        ?>
) {
          count = 0;
        }
        if (count != 0) {
          for (var i = key - count; i < key + count; i++) {
            var index = parseInt((i + count_all) % count_all);
            var is_embed = data[index]['filetype'].indexOf("EMBED_") > -1 ? true : false;
            if (typeof data[index] != "undefined") {
              if (!is_embed) {
                jQuery("<img/>").attr("src", '<?php 
        echo site_url() . '/' . $WD_BWG_UPLOAD_DIR;
        ?>
' + jQuery('<span style="display: block;" />').html(data[index]["image_url"]).text());
              }
            }
          }
        }
        else {
          for (var i = 0; i < data.length; i++) {
            var is_embed = data[i]['filetype'].indexOf("EMBED_") > -1 ? true : false;
            if (typeof data[index] != "undefined") {
              if (!is_embed) {
                jQuery("<img/>").attr("src", '<?php 
        echo site_url() . '/' . $WD_BWG_UPLOAD_DIR;
        ?>
' + jQuery('<span style="display: block;" />').html(data[i]["image_url"]).text());
              }
            }
          }
        }
      }
      function bwg_popup_resize() {
        if (typeof jQuery().fullscreen !== 'undefined') {
          if (jQuery.isFunction(jQuery().fullscreen)) {
            if (!jQuery.fullscreen.isFullScreen()) {
              jQuery(".bwg_resize-full").show();
              jQuery(".bwg_resize-full").attr("class", "bwg_ctrl_btn bwg_resize-full fa fa-resize-full");
              jQuery(".bwg_resize-full").attr("title", "<?php 
        echo __('Maximize', 'bwg');
        ?>
");
              jQuery(".bwg_fullscreen").attr("class", "bwg_ctrl_btn bwg_fullscreen fa fa-fullscreen");
              jQuery(".bwg_fullscreen").attr("title", "<?php 
        echo __('Fullscreen', 'bwg');
        ?>
");
            }
          }
        }
        var comment_container_width = 0;
        if (jQuery(".bwg_comment_container").hasClass("bwg_open")) {
          comment_container_width = <?php 
        echo $theme_row->lightbox_comment_width;
        ?>
;
        }
        if (comment_container_width > jQuery(window).width()) {
          comment_container_width = jQuery(window).width();
          jQuery(".bwg_comment_container").css({
            width: comment_container_width
          });
          jQuery(".spider_popup_close_fullscreen").hide();
        }
        else {
          jQuery(".spider_popup_close_fullscreen").show();
        }
        if (!(!(jQuery(window).height() > <?php 
        echo $image_height;
        ?>
) || !(<?php 
        echo $open_with_fullscreen;
        ?>
 != 1))) {
          jQuery("#spider_popup_wrap").css({
            height: <?php 
        echo $image_height;
        ?>
,
            top: '50%',
            marginTop: -<?php 
        echo $image_height / 2;
        ?>
,
            zIndex: 100000
          });
          jQuery(".bwg_image_container").css({height: (<?php 
        echo $image_height - $image_filmstrip_height;
        ?>
)});
          jQuery(".bwg_popup_image").css({
            maxHeight: <?php 
        echo $image_height - $image_filmstrip_height;
        ?>
          });
          jQuery(".bwg_popup_embed").css({
            height: <?php 
        echo $image_height - $image_filmstrip_height;
        ?>
          });
          bwg_popup_current_height = <?php 
        echo $image_height;
        ?>
;
        }
        else {
          jQuery("#spider_popup_wrap").css({
            height: jQuery(window).height(),
            top: 0,
            marginTop: 0,
            zIndex: 100000
          });
          jQuery(".bwg_image_container").css({height: (jQuery(window).height() - <?php 
        echo $image_filmstrip_height;
        ?>
)});
          jQuery(".bwg_popup_image").css({
            maxHeight: jQuery(window).height() - <?php 
        echo $image_filmstrip_height;
        ?>
          });
          jQuery(".bwg_popup_embed").css({
            height: jQuery(window).height() - <?php 
        echo $image_filmstrip_height;
        ?>
          });
          bwg_popup_current_height = jQuery(window).height();
        }
        if (!(!(jQuery(window).width() >= <?php 
        echo $image_width;
        ?>
) || !(<?php 
        echo $open_with_fullscreen;
        ?>
 != 1))) {
          jQuery("#spider_popup_wrap").css({
            width: <?php 
        echo $image_width;
        ?>
,
            left: '50%',
            marginLeft: -<?php 
        echo $image_width / 2;
        ?>
,
            zIndex: 100000
          });
          jQuery(".bwg_image_wrap").css({width: <?php 
        echo $image_width;
        ?>
 - comment_container_width});
          jQuery(".bwg_image_container").css({width: <?php 
        echo $image_width;
        ?>
 - comment_container_width});
          jQuery(".bwg_popup_image").css({
            maxWidth: <?php 
        echo $image_width;
        ?>
 - comment_container_width
          });
          jQuery(".bwg_popup_embed").css({
            width: <?php 
        echo $image_width;
        ?>
 - comment_container_width
          });
          jQuery(".bwg_filmstrip_container").css({width: <?php 
        echo $image_width;
        ?>
 - comment_container_width});
          jQuery(".bwg_filmstrip").css({width: (<?php 
        echo $image_width;
        ?>
  - comment_container_width- 40)});
          bwg_popup_current_width = <?php 
        echo $image_width;
        ?>
;
        }
        else {
          jQuery("#spider_popup_wrap").css({
            width: jQuery(window).width(),
            left: 0,
            marginLeft: 0,
            zIndex: 100000
          });
          jQuery(".bwg_image_wrap").css({width: (jQuery(window).width() - comment_container_width)});
          jQuery(".bwg_image_container").css({width: jQuery(window).width() - comment_container_width});
          jQuery(".bwg_popup_image").css({
            maxWidth: jQuery(window).width() - comment_container_width
          });
          jQuery(".bwg_popup_embed").css({
            width: jQuery(window).width() - comment_container_width
          });
          jQuery(".bwg_filmstrip_container").css({width: (jQuery(window).width() - comment_container_width)});
          jQuery(".bwg_filmstrip").css({width: (jQuery(window).width() - comment_container_width - 40)});
          bwg_popup_current_width = jQuery(window).width();
        }
        /* Set watermark container size.*/
        bwg_resize_instagram_post();
        bwg_change_watermark_container();
        if (!(!(jQuery(window).height() > <?php 
        echo $image_height - 2 * $theme_row->lightbox_close_btn_top;
        ?>
) || !(jQuery(window).width() >= <?php 
        echo $image_width - 2 * $theme_row->lightbox_close_btn_right;
        ?>
) || !(<?php 
        echo $open_with_fullscreen;
        ?>
 != 1))) {
          jQuery(".spider_popup_close_fullscreen").attr("class", "spider_popup_close");
        }
        else {
          if (!(!(jQuery("#spider_popup_wrap").width() < jQuery(window).width()) || !(jQuery("#spider_popup_wrap").height() < jQuery(window).height()))) {
            jQuery(".spider_popup_close").attr("class", "bwg_ctrl_btn spider_popup_close_fullscreen");
          }
        }
        if ( "<?php 
        echo $theme_row->lightbox_ctrl_btn_pos;
        ?>
" == 'bottom') {
          jQuery(".bwg_toggle_container").css("bottom", jQuery(".bwg_ctrl_btn_container").height() + "px");
        }
        if ( "<?php 
        echo $theme_row->lightbox_ctrl_btn_pos;
        ?>
" == 'top') {
          jQuery(".bwg_toggle_container").css("top", jQuery(".bwg_ctrl_btn_container").height() + "px");
        }
      }
      jQuery(window).resize(function() {
        if (typeof jQuery().fullscreen !== 'undefined') {
          if (jQuery.isFunction(jQuery().fullscreen)) {
            if (!jQuery.fullscreen.isFullScreen()) {
              bwg_popup_resize();
            }
          }
        }
      });
      /* Popup current width/height.*/
      var bwg_popup_current_width = <?php 
        echo $image_width;
        ?>
;
      var bwg_popup_current_height = <?php 
        echo $image_height;
        ?>
;
      /* Open/close comments.*/
      function bwg_comment() {
        jQuery(".bwg_watermark").css({display: 'none'});
        if (jQuery(".bwg_comment_container").hasClass("bwg_open")) {
          /* Close comment.*/
          var border_width = parseInt(jQuery(".bwg_comment_container").css('borderRightWidth'));
          if (!border_width) {
            border_width = 0;
          }
          jQuery(".bwg_comment_container").animate({<?php 
        echo $theme_row->lightbox_comment_pos;
        ?>
: -jQuery(".bwg_comment_container").width() - border_width}, 500);
          jQuery(".bwg_image_wrap").animate({
            <?php 
        echo $theme_row->lightbox_comment_pos;
        ?>
: 0,
            width: jQuery("#spider_popup_wrap").width()
          }, 500);
          jQuery(".bwg_popup_image").animate({
              maxWidth: jQuery("#spider_popup_wrap").width()
            }, {
              duration: 500,
              complete: function () { bwg_change_watermark_container(); }
            });
          jQuery(".bwg_popup_embed").animate({
              width: jQuery("#spider_popup_wrap").width()
            }, {
              duration: 500,
              complete: function () { 
                bwg_resize_instagram_post();
                bwg_change_watermark_container(); }
            });
          jQuery(".bwg_filmstrip_container").animate({width: jQuery(".spider_popup_wrap").width()}, 500);
          jQuery(".bwg_filmstrip").animate({width: jQuery(".spider_popup_wrap").width() - 40}, 500);
          /* Set filmstrip initial position.*/
          bwg_set_filmstrip_pos(jQuery(".spider_popup_wrap").width() - 40);
          jQuery(".bwg_comment_container").attr("class", "bwg_comment_container bwg_close");
          jQuery(".bwg_comment").attr("title", "<?php 
        echo __('Show Comments', 'bwg');
        ?>
");
          jQuery(".spider_popup_close_fullscreen").show();
        }
        else {
          /* Open comment.*/
          var comment_container_width = <?php 
        echo $theme_row->lightbox_comment_width;
        ?>
;
          if (comment_container_width > jQuery(window).width()) {
            comment_container_width = jQuery(window).width();
            jQuery(".bwg_comment_container").css({
              width: comment_container_width
            });
            jQuery(".spider_popup_close_fullscreen").hide();
            if (jQuery(".bwg_ctrl_btn").hasClass("fa-pause")) {
              var isMobile = (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()));
              jQuery(".bwg_play_pause").trigger(isMobile ? 'touchend' : 'click');
            }
          }
          else {
            jQuery(".spider_popup_close_fullscreen").show();
          }
          jQuery(".bwg_comment_container").animate({<?php 
        echo $theme_row->lightbox_comment_pos;
        ?>
: 0}, 500);
          jQuery(".bwg_image_wrap").animate({
            <?php 
        echo $theme_row->lightbox_comment_pos;
        ?>
: jQuery(".bwg_comment_container").width(),
            width: jQuery("#spider_popup_wrap").width() - jQuery(".bwg_comment_container").width()}, 500);
          jQuery(".bwg_popup_image").animate({
              maxWidth: jQuery("#spider_popup_wrap").width() - jQuery(".bwg_comment_container").width()
            }, {
              duration: 500,
              complete: function () { bwg_change_watermark_container(); }
            });
          jQuery(".bwg_popup_embed").animate({
              width: jQuery("#spider_popup_wrap").width() - jQuery(".bwg_comment_container").width()
            }, {
              duration: 500,
              complete: function () { 
                bwg_resize_instagram_post();
                bwg_change_watermark_container(); }
            });
          jQuery(".bwg_filmstrip_container").css({width: jQuery("#spider_popup_wrap").width() - jQuery(".bwg_comment_container").width()});
          jQuery(".bwg_filmstrip").animate({width: jQuery(".bwg_filmstrip_container").width() - 40}, 500);
          /* Set filmstrip initial position.*/
          bwg_set_filmstrip_pos(jQuery(".bwg_filmstrip_container").width() - 40);
          jQuery(".bwg_comment_container").attr("class", "bwg_comment_container bwg_open");
          jQuery(".bwg_comment").attr("title", "<?php 
        echo __('Hide Comments', 'bwg');
        ?>
");
          /* Load comments.*/
          var cur_image_key = parseInt(jQuery("#bwg_current_image_key").val());
          if (data[cur_image_key]["comment_count"] != 0) {
            jQuery("#bwg_added_comments").show();
            spider_set_input_value('ajax_task', 'display');
            spider_set_input_value('image_id', jQuery('#bwg_popup_image').attr('image_id'));
            spider_ajax_save('bwg_comment_form');
          }
        }
      }
      function bwg_reset_zoom() {
        var isMobile = (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()));
        var viewportmeta = document.querySelector('meta[name="viewport"]');
        if (isMobile) {
          if (viewportmeta) {
            viewportmeta.content = 'width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=0';
          }
        }
      }
      /* jQuery(document).ready(function () { */
      	<?php 
        if ($image_right_click) {
            ?>
          /* Disable right click.*/
          jQuery(".bwg_image_wrap").bind("contextmenu", function (e) {
            return false;
          });
           jQuery(".bwg_image_wrap").css('webkitTouchCallout','none');
          <?php 
        }
        ?>
        if (typeof jQuery().swiperight !== 'undefined') {
          if (jQuery.isFunction(jQuery().swiperight)) {
            jQuery('#spider_popup_wrap').swiperight(function () {
            bwg_change_image(parseInt(jQuery('#bwg_current_image_key').val()), (parseInt(jQuery('#bwg_current_image_key').val()) + data.length - 1) % data.length, data);
              return false;
            });
          }
        }
        if (typeof jQuery().swipeleft !== 'undefined') {
          if (jQuery.isFunction(jQuery().swipeleft)) {
            jQuery('#spider_popup_wrap').swipeleft(function () {
            bwg_change_image(parseInt(jQuery('#bwg_current_image_key').val()), (parseInt(jQuery('#bwg_current_image_key').val()) + 1) % data.length, data);
              return false;
            });
          }
        }

        bwg_reset_zoom();
        var isMobile = (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()));
        var bwg_click = isMobile ? 'touchend' : 'click';
        jQuery("#spider_popup_left").on(bwg_click, function () {
          bwg_change_image(parseInt(jQuery('#bwg_current_image_key').val()), (parseInt(jQuery('#bwg_current_image_key').val()) + data.length - 1) % data.length, data);
          return false;
        });
        jQuery("#spider_popup_right").on(bwg_click, function () {
          bwg_change_image(parseInt(jQuery('#bwg_current_image_key').val()), (parseInt(jQuery('#bwg_current_image_key').val()) + 1) % data.length, data);
          return false;
        });
        if (navigator.appVersion.indexOf("MSIE 10") != -1 || navigator.appVersion.indexOf("MSIE 9") != -1) {
          setTimeout(function () {
            bwg_popup_resize();
          }, 1);
        }
        else {
          bwg_popup_resize();
        }
        jQuery(".bwg_watermark").css({display: 'none'});
        setTimeout(function () {
          bwg_change_watermark_container();
        }, 500);
        /* If browser doesn't support Fullscreen API.*/
        if (typeof jQuery().fullscreen !== 'undefined') {
          if (jQuery.isFunction(jQuery().fullscreen)) {
            if (!jQuery.fullscreen.isNativelySupported()) {
              jQuery(".bwg_fullscreen").hide();
            }
          }
        }
        /* Set image container height.*/
        jQuery(".bwg_image_container").height(jQuery(".bwg_image_wrap").height() - <?php 
        echo $image_filmstrip_height;
        ?>
);
        /* Change default scrollbar in comments.*/
        if (typeof jQuery().mCustomScrollbar !== 'undefined') {
          if (jQuery.isFunction(jQuery().mCustomScrollbar)) {
            jQuery(".bwg_comments").mCustomScrollbar({scrollInertia: 150});
          }
        }
        var mousewheelevt = (/Firefox/i.test(navigator.userAgent)) ? "DOMMouseScroll" : "mousewheel" /*FF doesn't recognize mousewheel as of FF3.x*/
        jQuery('.bwg_filmstrip').on(mousewheelevt, function(e) {
          var evt = window.event || e; /* Equalize event object.*/
          evt = evt.originalEvent ? evt.originalEvent : evt; /* Convert to originalEvent if possible.*/
          var delta = evt.detail ? evt.detail*(-40) : evt.wheelDelta; /* Check for detail first, because it is used by Opera and FF.*/
          var isMobile = (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()));
          if (delta > 0) {
            /* Scroll up.*/
            jQuery(".bwg_filmstrip_left").trigger(isMobile ? 'touchend' : 'click');
          }
          else {
            /* Scroll down.*/
            jQuery(".bwg_filmstrip_right").trigger(isMobile ? 'touchend' : 'click');
          }
        });
        jQuery(".bwg_filmstrip_right").on(bwg_click, function () {
          jQuery( ".bwg_filmstrip_thumbnails" ).stop(true, false);
          if (jQuery(".bwg_filmstrip_thumbnails").position().left >= -(jQuery(".bwg_filmstrip_thumbnails").width() - jQuery(".bwg_filmstrip").width())) {
            jQuery(".bwg_filmstrip_left").css({opacity: 1, filter: "Alpha(opacity=100)"});
            if (jQuery(".bwg_filmstrip_thumbnails").position().left < -(jQuery(".bwg_filmstrip_thumbnails").width() - jQuery(".bwg_filmstrip").width() - <?php 
        echo $filmstrip_thumb_margin_hor + $image_filmstrip_width;
        ?>
)) {
              jQuery(".bwg_filmstrip_thumbnails").animate({left: -(jQuery(".bwg_filmstrip_thumbnails").width() - jQuery(".bwg_filmstrip").width())}, 500, 'linear');
            }
            else {
              jQuery(".bwg_filmstrip_thumbnails").animate({left: (jQuery(".bwg_filmstrip_thumbnails").position().left - <?php 
        echo $filmstrip_thumb_margin_hor + $image_filmstrip_width;
        ?>
)}, 500, 'linear');
            }
          }
          /* Disable right arrow.*/
          window.setTimeout(function(){
            if (jQuery(".bwg_filmstrip_thumbnails").position().left == -(jQuery(".bwg_filmstrip_thumbnails").width() - jQuery(".bwg_filmstrip").width())) {
              jQuery(".bwg_filmstrip_right").css({opacity: 0.3, filter: "Alpha(opacity=30)"});
            }
          }, 500);
        });
        jQuery(".bwg_filmstrip_left").on(bwg_click, function () {
          jQuery( ".bwg_filmstrip_thumbnails" ).stop(true, false);
          if (jQuery(".bwg_filmstrip_thumbnails").position().left < 0) {
            jQuery(".bwg_filmstrip_right").css({opacity: 1, filter: "Alpha(opacity=100)"});
            if (jQuery(".bwg_filmstrip_thumbnails").position().left > - <?php 
        echo $filmstrip_thumb_margin_hor + $image_filmstrip_width;
        ?>
) {
              jQuery(".bwg_filmstrip_thumbnails").animate({left: 0}, 500, 'linear');
            }
            else {
              jQuery(".bwg_filmstrip_thumbnails").animate({left: (jQuery(".bwg_filmstrip_thumbnails").position().left + <?php 
        echo $image_filmstrip_width + $filmstrip_thumb_margin_hor;
        ?>
)}, 500, 'linear');
            }
          }
          /* Disable left arrow.*/
          window.setTimeout(function(){
            if (jQuery(".bwg_filmstrip_thumbnails").position().left == 0) {
              jQuery(".bwg_filmstrip_left").css({opacity: 0.3, filter: "Alpha(opacity=30)"});
            }
          }, 500);
        });
        /* Set filmstrip initial position.*/
        bwg_set_filmstrip_pos(jQuery(".bwg_filmstrip").width());
        /* Show/hide image title/description.*/
        jQuery(".bwg_info").on(bwg_click, function() {
          if (jQuery(".bwg_image_info_container1").css("display") == 'none') {
            jQuery(".bwg_image_info_container1").css("display", "table-cell");
            jQuery(".bwg_info").attr("title", "<?php 
        echo __('Hide info', 'bwg');
        ?>
");
          }
          else {
            jQuery(".bwg_image_info_container1").css("display", "none");
            jQuery(".bwg_info").attr("title", "<?php 
        echo __('Show info', 'bwg');
        ?>
");
          }
        });
        /* Open/close comments.*/
        jQuery(".bwg_comment, .bwg_comments_close_btn").on(bwg_click, function() { bwg_comment()});
        /* Open/close control buttons.*/
        jQuery(".bwg_toggle_container").on(bwg_click, function () {
          var bwg_open_toggle_btn_class = "<?php 
        echo $theme_row->lightbox_ctrl_btn_pos == 'top' ? 'fa-angle-up' : 'fa-angle-down';
        ?>
";
          var bwg_close_toggle_btn_class = "<?php 
        echo $theme_row->lightbox_ctrl_btn_pos == 'top' ? 'fa-angle-down' : 'fa-angle-up';
        ?>
";
          if (jQuery(".bwg_toggle_container i").hasClass(bwg_open_toggle_btn_class)) {
            /* Close controll buttons.*/
            <?php 
        if ((!$enable_image_filmstrip || $theme_row->lightbox_filmstrip_pos != 'bottom') && $theme_row->lightbox_ctrl_btn_pos == 'bottom' && $theme_row->lightbox_info_pos == 'bottom') {
            ?>
                jQuery(".bwg_image_info").animate({bottom: 0}, 500);
                <?php 
        } elseif ((!$enable_image_filmstrip || $theme_row->lightbox_filmstrip_pos != 'top') && $theme_row->lightbox_ctrl_btn_pos == 'top' && $theme_row->lightbox_info_pos == 'top') {
            ?>
                jQuery(".bwg_image_info").animate({top: 0}, 500);
                <?php 
        }
        ?>
            jQuery(".bwg_ctrl_btn_container").animate({<?php 
        echo $theme_row->lightbox_ctrl_btn_pos;
        ?>
: '-' + jQuery(".bwg_ctrl_btn_container").height()}, 500);
            jQuery(".bwg_toggle_container").animate({
                <?php 
        echo $theme_row->lightbox_ctrl_btn_pos;
        ?>
: 0
              }, {
                duration: 500,
                complete: function () { jQuery(".bwg_toggle_container i").attr("class", "bwg_toggle_btn fa " + bwg_close_toggle_btn_class) }
              });
          }
          else {
            /* Open controll buttons.*/
            <?php 
        if ((!$enable_image_filmstrip || $theme_row->lightbox_filmstrip_pos != 'bottom') && $theme_row->lightbox_ctrl_btn_pos == 'bottom' && $theme_row->lightbox_info_pos == 'bottom') {
            ?>
                jQuery(".bwg_image_info").animate({bottom: jQuery(".bwg_ctrl_btn_container").height()}, 500);
                <?php 
        } elseif ((!$enable_image_filmstrip || $theme_row->lightbox_filmstrip_pos != 'top') && $theme_row->lightbox_ctrl_btn_pos == 'top' && $theme_row->lightbox_info_pos == 'top') {
            ?>
                jQuery(".bwg_image_info").animate({top: jQuery(".bwg_ctrl_btn_container").height()}, 500);
                <?php 
        }
        ?>
            jQuery(".bwg_ctrl_btn_container").animate({<?php 
        echo $theme_row->lightbox_ctrl_btn_pos;
        ?>
: 0}, 500);
            jQuery(".bwg_toggle_container").animate({
                <?php 
        echo $theme_row->lightbox_ctrl_btn_pos;
        ?>
: jQuery(".bwg_ctrl_btn_container").height()
              }, {
                duration: 500,
                complete: function () { jQuery(".bwg_toggle_container i").attr("class", "bwg_toggle_btn fa " + bwg_open_toggle_btn_class) }
              });
          }
        });
        /* Maximize/minimize.*/
        jQuery(".bwg_resize-full").on(bwg_click, function () {
          jQuery(".bwg_watermark").css({display: 'none'});
          var comment_container_width = 0;
          if (jQuery(".bwg_comment_container").hasClass("bwg_open")) {
            comment_container_width = jQuery(".bwg_comment_container").width();
          }
          if (jQuery(".bwg_resize-full").hasClass("fa-resize-small")) {
            if (jQuery(window).width() > <?php 
        echo $image_width;
        ?>
) {
              bwg_popup_current_width = <?php 
        echo $image_width;
        ?>
;
            }
            if (jQuery(window).height() > <?php 
        echo $image_height;
        ?>
) {
              bwg_popup_current_height = <?php 
        echo $image_height;
        ?>
;
            }
            /* Minimize.*/
            jQuery("#spider_popup_wrap").animate({
              width: bwg_popup_current_width,
              height: bwg_popup_current_height,
              left: '50%',
              top: '50%',
              marginLeft: -bwg_popup_current_width / 2,
              marginTop: -bwg_popup_current_height / 2,
              zIndex: 100000
            }, 500);
            jQuery(".bwg_image_wrap").animate({width: bwg_popup_current_width - comment_container_width}, 500);
            jQuery(".bwg_image_container").animate({height: bwg_popup_current_height - <?php 
        echo $image_filmstrip_height;
        ?>
, width: bwg_popup_current_width - comment_container_width}, 500);
            jQuery(".bwg_popup_image").animate({
                maxWidth: bwg_popup_current_width - comment_container_width,
                maxHeight: bwg_popup_current_height - <?php 
        echo $image_filmstrip_height;
        ?>
              }, {
                duration: 500,
                complete: function () {
                  bwg_change_watermark_container();
                  if ((jQuery("#spider_popup_wrap").width() < jQuery(window).width())) {
                    if (jQuery("#spider_popup_wrap").height() < jQuery(window).height()) {
                      jQuery(".spider_popup_close_fullscreen").attr("class", "spider_popup_close");
                    }
                  }
                }
              });
            jQuery(".bwg_popup_embed").animate({
                width: bwg_popup_current_width - comment_container_width,
                height: bwg_popup_current_height - <?php 
        echo $image_filmstrip_height;
        ?>
              }, {
                duration: 500,
                complete: function () {
                  bwg_resize_instagram_post();
                  bwg_change_watermark_container();
                  if (jQuery("#spider_popup_wrap").width() < jQuery(window).width()) {
                    if (jQuery("#spider_popup_wrap").height() < jQuery(window).height()) {
                      jQuery(".spider_popup_close_fullscreen").attr("class", "spider_popup_close");
                    }
                  }
                }
              });
            jQuery(".bwg_filmstrip_container").animate({width: bwg_popup_current_width - comment_container_width}, 500);
            jQuery(".bwg_filmstrip").animate({width: bwg_popup_current_width - comment_container_width - 40}, 500);
            /* Set filmstrip initial position.*/
            bwg_set_filmstrip_pos(bwg_popup_current_width - 40);
            jQuery(".bwg_resize-full").attr("class", "bwg_ctrl_btn bwg_resize-full fa fa-resize-full");
            jQuery(".bwg_resize-full").attr("title", "<?php 
        echo __('Maximize', 'bwg');
        ?>
");
          }
          else {
            bwg_popup_current_width = jQuery(window).width();
            bwg_popup_current_height = jQuery(window).height();
            /* Maximize.*/
            jQuery("#spider_popup_wrap").animate({
              width: jQuery(window).width(),
              height: jQuery(window).height(),
              left: 0,
              top: 0,
              margin: 0,
              zIndex: 100000
            }, 500);
            jQuery(".bwg_image_wrap").animate({width: (jQuery(window).width() - comment_container_width)}, 500);
            jQuery(".bwg_image_container").animate({height: (bwg_popup_current_height - <?php 
        echo $image_filmstrip_height;
        ?>
), width: bwg_popup_current_width - comment_container_width}, 500);
            jQuery(".bwg_popup_image").animate({
                maxWidth: jQuery(window).width() - comment_container_width,
                maxHeight: jQuery(window).height() - <?php 
        echo $image_filmstrip_height;
        ?>
              }, {
                duration: 500,
                complete: function () { bwg_change_watermark_container(); }
              });
            jQuery(".bwg_popup_embed").animate({
                width: jQuery(window).width() - comment_container_width,
                height: jQuery(window).height() - <?php 
        echo $image_filmstrip_height;
        ?>
              }, {
                duration: 500,
                complete: function () { 
                  bwg_resize_instagram_post();
                  bwg_change_watermark_container(); }
              });
            jQuery(".bwg_filmstrip_container").animate({width: jQuery(window).width() - comment_container_width}, 500);
            jQuery(".bwg_filmstrip").animate({width: jQuery(window).width() - comment_container_width - 40}, 500);
            /* Set filmstrip initial position.*/
            bwg_set_filmstrip_pos(jQuery(window).width() - comment_container_width - 40);
            jQuery(".bwg_resize-full").attr("class", "bwg_ctrl_btn bwg_resize-full fa fa-resize-small");
            jQuery(".bwg_resize-full").attr("title", "<?php 
        echo __('Restore', 'bwg');
        ?>
");
            jQuery(".spider_popup_close").attr("class", "bwg_ctrl_btn spider_popup_close_fullscreen");
          }
        });
        /* Fullscreen.*/
        /*Toggle with mouse click*/
        jQuery(".bwg_fullscreen").on(bwg_click, function () {
          jQuery(".bwg_watermark").css({display: 'none'});
          var comment_container_width = 0;
          if (jQuery(".bwg_comment_container").hasClass("bwg_open")) {
            comment_container_width = jQuery(".bwg_comment_container").width();
          }
          function bwg_exit_fullscreen() {
            if (jQuery(window).width() > <?php 
        echo $image_width;
        ?>
) {
              bwg_popup_current_width = <?php 
        echo $image_width;
        ?>
;
            }
            if (jQuery(window).height() > <?php 
        echo $image_height;
        ?>
) {
              bwg_popup_current_height = <?php 
        echo $image_height;
        ?>
;
            }
            <?php 
        /* "Full width lightbox" sets yes.*/
        if ($open_with_fullscreen) {
            ?>
            bwg_popup_current_width = jQuery(window).width();
            bwg_popup_current_height = jQuery(window).height();
              <?php 
        }
        ?>
            jQuery("#spider_popup_wrap").on("fscreenclose", function() {
              jQuery("#spider_popup_wrap").css({
                width: bwg_popup_current_width,
                height: bwg_popup_current_height,
                left: '50%',
                top: '50%',
                marginLeft: -bwg_popup_current_width / 2,
                marginTop: -bwg_popup_current_height / 2,
                zIndex: 100000
              });
              jQuery(".bwg_image_wrap").css({width: bwg_popup_current_width - comment_container_width});
              jQuery(".bwg_image_container").css({height: bwg_popup_current_height - <?php 
        echo $image_filmstrip_height;
        ?>
, width: bwg_popup_current_width - comment_container_width});
              /*jQuery(".bwg_slide_bg").css({height: bwg_popup_current_height - <?php 
        echo $image_filmstrip_height;
        ?>
});
              jQuery(".bwg_popup_image_spun1").css({height: bwg_popup_current_height - <?php 
        echo $image_filmstrip_height;
        ?>
});*/
              jQuery(".bwg_popup_image").css({
                maxWidth: bwg_popup_current_width - comment_container_width,
                maxHeight: bwg_popup_current_height - <?php 
        echo $image_filmstrip_height;
        ?>
              });
              jQuery(".bwg_popup_embed").css({
                width: bwg_popup_current_width - comment_container_width,
                height: bwg_popup_current_height - <?php 
        echo $image_filmstrip_height;
        ?>
              });
              bwg_resize_instagram_post();
              /* Set watermark container size.*/
              bwg_change_watermark_container();
              jQuery(".bwg_filmstrip_container").css({width: bwg_popup_current_width - comment_container_width});
              jQuery(".bwg_filmstrip").css({width: bwg_popup_current_width - comment_container_width- 40});
              /* Set filmstrip initial position.*/
              bwg_set_filmstrip_pos(bwg_popup_current_width - 40);
              jQuery(".bwg_resize-full").show();
              jQuery(".bwg_resize-full").attr("class", "bwg_ctrl_btn bwg_resize-full fa fa-resize-full");
              jQuery(".bwg_resize-full").attr("title", "<?php 
        echo __('Maximize', 'bwg');
        ?>
");
              jQuery(".bwg_fullscreen").attr("class", "bwg_ctrl_btn bwg_fullscreen fa fa-fullscreen");
              jQuery(".bwg_fullscreen").attr("title", "<?php 
        echo __('Fullscreen', 'bwg');
        ?>
");
              if (jQuery("#spider_popup_wrap").width() < jQuery(window).width()) {
                if (jQuery("#spider_popup_wrap").height() < jQuery(window).height()) {
                  jQuery(".spider_popup_close_fullscreen").attr("class", "spider_popup_close");
                }
              }
            });
          }
          if (typeof jQuery().fullscreen !== 'undefined') {
            if (jQuery.isFunction(jQuery().fullscreen)) {
            if (jQuery.fullscreen.isFullScreen()) {
              /* Exit Fullscreen.*/
              jQuery.fullscreen.exit();
              bwg_exit_fullscreen();
            }
            else {
              /* Fullscreen.*/
              jQuery("#spider_popup_wrap").fullscreen();
              /*jQuery("#spider_popup_wrap").on("fscreenopen", function() {
              if (jQuery.fullscreen.isFullScreen()) {*/
                var screen_width = screen.width;
                var screen_height = screen.height;
                jQuery("#spider_popup_wrap").css({
                  width: screen_width,
                  height: screen_height,
                  left: 0,
                  top: 0,
                  margin: 0,
                  zIndex: 100000
                });
                jQuery(".bwg_image_wrap").css({width: screen_width - comment_container_width});
                jQuery(".bwg_image_container").css({height: (screen_height - <?php 
        echo $image_filmstrip_height;
        ?>
), width: screen_width - comment_container_width});
                /* jQuery(".bwg_slide_bg").css({height: screen_height - <?php 
        echo $image_filmstrip_height;
        ?>
});*/
                jQuery(".bwg_popup_image").css({
                  maxWidth: (screen_width - comment_container_width),
                  maxHeight: (screen_height - <?php 
        echo $image_filmstrip_height;
        ?>
)
                });
                jQuery(".bwg_popup_embed").css({
                  width: (screen_width - comment_container_width),
                  height: (screen_height - <?php 
        echo $image_filmstrip_height;
        ?>
)
                });
                bwg_resize_instagram_post();
                /* Set watermark container size.*/
                bwg_change_watermark_container();
                jQuery(".bwg_filmstrip_container").css({width: (screen_width - comment_container_width)});
                jQuery(".bwg_filmstrip").css({width: (screen_width - comment_container_width - 40)});
                /* Set filmstrip initial position.*/
                bwg_set_filmstrip_pos(screen_width - comment_container_width - 40);
                jQuery(".bwg_resize-full").hide();
                jQuery(".bwg_fullscreen").attr("class", "bwg_ctrl_btn bwg_fullscreen fa fa-resize-small");
                jQuery(".bwg_fullscreen").attr("title", "<?php 
        echo __('Exit Fullscreen', 'bwg');
        ?>
");
                jQuery(".spider_popup_close").attr("class", "bwg_ctrl_btn spider_popup_close_fullscreen");
              /*});
              }*/
              }
            }
          }
          return false;
        });
        /* Play/pause.*/
        jQuery(".bwg_play_pause, .bwg_popup_image").on(bwg_click, function () {
          if (jQuery(".bwg_play_pause").length && jQuery(".bwg_play_pause").hasClass("fa-play")) {
            /* Play.*/
            bwg_play();
            jQuery(".bwg_play_pause").attr("title", "<?php 
        echo __('Pause', 'bwg');
        ?>
");
            jQuery(".bwg_play_pause").attr("class", "bwg_ctrl_btn bwg_play_pause fa fa-pause");
          }
          else {
            /* Pause.*/
            window.clearInterval(bwg_playInterval);
            jQuery(".bwg_play_pause").attr("title", "<?php 
        echo __('Play', 'bwg');
        ?>
");
            jQuery(".bwg_play_pause").attr("class", "bwg_ctrl_btn bwg_play_pause fa fa-play");
          }
        });
        /* Open with autoplay.*/
        <?php 
        if ($open_with_autoplay) {
            ?>
          bwg_play();
          jQuery(".bwg_play_pause").attr("title", "<?php 
            echo __('Pause', 'bwg');
            ?>
");
          jQuery(".bwg_play_pause").attr("class", "bwg_ctrl_btn bwg_play_pause fa fa-pause");
          <?php 
        }
        ?>
        /* Open with fullscreen.*/
        <?php 
        if ($open_with_fullscreen) {
            ?>
          bwg_open_with_fullscreen();
          <?php 
        }
        ?>
        <?php 
        if ($option_row->preload_images) {
            echo "bwg_preload_images(parseInt(jQuery('#bwg_current_image_key').val()));";
        }
        ?>
        jQuery(".bwg_popup_image").removeAttr("width");
        jQuery(".bwg_popup_image").removeAttr("height");
     /*  }); */
      /* Open with fullscreen.*/
      function bwg_open_with_fullscreen() {
        jQuery(".bwg_watermark").css({display: 'none'});
        var comment_container_width = 0;
        if (jQuery(".bwg_comment_container").hasClass("bwg_open")) {
          comment_container_width = jQuery(".bwg_comment_container").width();
        }
        bwg_popup_current_width = jQuery(window).width();
        bwg_popup_current_height = jQuery(window).height();
        jQuery("#spider_popup_wrap").css({
          width: jQuery(window).width(),
          height: jQuery(window).height(),
          left: 0,
          top: 0,
          margin: 0,
          zIndex: 100000
        });
        jQuery(".bwg_image_wrap").css({width: (jQuery(window).width() - comment_container_width)});
        jQuery(".bwg_image_container").css({height: (bwg_popup_current_height - <?php 
        echo $image_filmstrip_height;
        ?>
)});
        jQuery(".bwg_popup_image").css({
         maxWidth: jQuery(window).width() - comment_container_width,
         maxHeight: jQuery(window).height() - <?php 
        echo $image_filmstrip_height;
        ?>
        },  {
          complete: function () { bwg_change_watermark_container(); }
         });
        jQuery(".bwg_popup_embed").css({
         width: jQuery(window).width() - comment_container_width,
         height: jQuery(window).height() - <?php 
        echo $image_filmstrip_height;
        ?>
        },  {
          complete: function () { 
            bwg_resize_instagram_post();
            bwg_change_watermark_container(); }
         });
        jQuery(".bwg_filmstrip_container").css({width: jQuery(window).width() - comment_container_width});
        jQuery(".bwg_filmstrip").css({width: jQuery(window).width() - comment_container_width - 40});
        /* Set filmstrip initial position.*/
        bwg_set_filmstrip_pos(jQuery(window).width() - comment_container_width - 40);

        jQuery(".bwg_resize-full").attr("class", "bwg_ctrl_btn bwg_resize-full fa fa-resize-small");
        jQuery(".bwg_resize-full").attr("title", "<?php 
        echo __('Restore', 'bwg');
        ?>
");
        jQuery(".spider_popup_close").attr("class", "bwg_ctrl_btn spider_popup_close_fullscreen");         
      }

      function bwg_resize_instagram_post() {
        if (jQuery('.inner_instagram_iframe_bwg_embed_frame').length) {
          var post_width = jQuery(".bwg_image_container").width();
          var post_height = jQuery(".bwg_image_container").height();
          
          jQuery('.inner_instagram_iframe_bwg_embed_frame').each(function() {
            var parent_container = jQuery(this).parent();
            if (post_height / (parseInt(parent_container.attr('data-height')) + 96) < post_width / parseInt(parent_container.attr('data-width'))) {
              parent_container.height(post_height);
              parent_container.width((parent_container.height() - 96) * parent_container.attr('data-width') / parent_container.attr('data-height') + 16);
            }
            else {
              parent_container.width(post_width);
              parent_container.height((parent_container.width() - 16) * parent_container.attr('data-height') / parent_container.attr('data-width') + 96);
            }
            parent_container.css({top: 0.5 * (post_height - parent_container.height())});
          });
          bwg_change_watermark_container();
        }
      }

      function bwg_play() {
        window.clearInterval(bwg_playInterval);
        bwg_playInterval = setInterval(function () {
          if (!data[parseInt(jQuery('#bwg_current_image_key').val()) + 1]) {
            if (<?php 
        echo $option_row->enable_loop;
        ?>
 == 1) {
              /* Wrap around.*/
              bwg_change_image(parseInt(jQuery('#bwg_current_image_key').val()), 0, data);
            }
            return;
          }
          bwg_change_image(parseInt(jQuery('#bwg_current_image_key').val()), parseInt(jQuery('#bwg_current_image_key').val()) + 1, data)
        }, '<?php 
        echo $slideshow_interval * 1000;
        ?>
');
      }
      jQuery(window).focus(function() {
        /* event_stack = [];*/
          if (jQuery(".bwg_play_pause").length && !jQuery(".bwg_play_pause").hasClass("fa-play")) {
            bwg_play();
          }
        /*var i = 0;
        jQuery(".bwg_slider").children("span").each(function () {
          if (jQuery(this).css('opacity') == 1) {
            jQuery("#bwg_current_image_key").val(i);
          }
          i++;
        });*/
      });
      jQuery(window).blur(function() {
        event_stack = [];
        window.clearInterval(bwg_playInterval);
      });
    </script>
    <?php 
        die;
    }
Exemple #5
0
    public function display()
    {
        if (isset($_GET['filemanager_msg']) && esc_html($_GET['filemanager_msg']) != '') {
            ?>
        <div id="file_manager_message" style="height:40px;">
          <div  style="background-color: #FFEBE8; border: 1px solid #CC0000; margin: 5px 15px 2px; padding: 5px 10px;">
            <strong style="font-size:14px"><?php 
            echo esc_html(stripslashes($_GET['filemanager_msg']));
            ?>
</strong>
          </div>
        </div>
        <?php 
            $_GET['filemanager_msg'] = '';
        }
        $bwg_options = $this->controller->get_options_data();
        $file_manager_data = $this->model->get_file_manager_data();
        $items_view = $file_manager_data['session_data']['items_view'];
        $sort_by = $file_manager_data['session_data']['sort_by'];
        $sort_order = $file_manager_data['session_data']['sort_order'];
        $clipboard_task = $file_manager_data['session_data']['clipboard_task'];
        $clipboard_files = $file_manager_data['session_data']['clipboard_files'];
        $clipboard_src = $file_manager_data['session_data']['clipboard_src'];
        $clipboard_dest = $file_manager_data['session_data']['clipboard_dest'];
        $icons_dir_url = WD_BWG_URL . '/filemanager/images/file_icons';
        $sort_icon = $icons_dir_url . '/' . $sort_order;
        wp_print_scripts('jquery');
        wp_print_scripts('jquery-ui-widget');
        ?>
      <script src="<?php 
        echo WD_BWG_URL;
        ?>
/filemanager/js/jq_uploader/jquery.iframe-transport.js"></script>
      <script src="<?php 
        echo WD_BWG_URL;
        ?>
/filemanager/js/jq_uploader/jquery.fileupload.js"></script>
      <script>
        var DS = "<?php 
        echo addslashes('/');
        ?>
";

        var errorLoadingFile = "<?php 
        echo __('File loading failed', 'bwg_back');
        ?>
";

        var warningRemoveItems = "<?php 
        echo __('Are you sure you want to permanently remove selected items?', 'bwg_back');
        ?>
";
        var warningCancelUploads = "<?php 
        echo __('This will cancel uploads. Continue?', 'bwg_back');
        ?>
";

        var messageEnterDirName = "<?php 
        echo __('Enter directory name', 'bwg_back');
        ?>
";
        var messageEnterNewName = "<?php 
        echo __('Enter new name', 'bwg_back');
        ?>
";
        var messageFilesUploadComplete = "<?php 
        echo __('Processing uploaded files...', 'bwg_back');
        ?>
";

        var root = "<?php 
        echo addslashes($this->controller->get_uploads_dir());
        ?>
";
        var dir = "<?php 
        echo isset($_REQUEST['dir']) ? addslashes(esc_html($_REQUEST['dir'])) : '';
        ?>
";
        var dirUrl = "<?php 
        echo $this->controller->get_uploads_url() . (isset($_REQUEST['dir']) ? esc_html($_REQUEST['dir']) . '/' : '');
        ?>
";
        var callback = "<?php 
        echo isset($_REQUEST['callback']) ? esc_html($_REQUEST['callback']) : '';
        ?>
";
        var sortBy = "<?php 
        echo $sort_by;
        ?>
";
        var sortOrder = "<?php 
        echo $sort_order;
        ?>
";
        jQuery(document).ready(function () {
          jQuery("#search_by_name .search_by_name").on("input keyup", function() {
            var search_by_name = jQuery(this).val();
            jQuery("#explorer_body .explorer_item").each(function() {
            jQuery(this).hide();
            if (jQuery(this).find(".item_name").html().trim().toLowerCase().indexOf(search_by_name) !== -1) {
              jQuery(this).show();
            }
            });
          });
        });
      </script>
      <script src="<?php 
        echo WD_BWG_URL;
        ?>
/filemanager/js/default.js?ver=<?php 
        echo wd_bwg_version();
        ?>
"></script>
      <link href="<?php 
        echo WD_BWG_URL;
        ?>
/filemanager/css/default.css?ver=<?php 
        echo wd_bwg_version();
        ?>
" type="text/css" rel="stylesheet">
      <?php 
        switch ($items_view) {
            case 'list':
                ?>
          <link href="<?php 
                echo WD_BWG_URL;
                ?>
/filemanager/css/default_view_list.css?ver=<?php 
                echo wd_bwg_version();
                ?>
" type="text/css" rel="stylesheet">
          <?php 
                break;
            case 'thumbs':
                ?>
          <link href="<?php 
                echo WD_BWG_URL;
                ?>
/filemanager/css/default_view_thumbs.css?ver=<?php 
                echo wd_bwg_version();
                ?>
" type="text/css" rel="stylesheet">
          <?php 
                break;
        }
        $i = 0;
        ?>

      <form id="adminForm" name="adminForm" action="" method="post">
      <?php 
        wp_nonce_field('', 'bwg_nonce');
        ?>
        <div id="wrapper">
          <div id="opacity_div" style="background-color: rgba(0, 0, 0, 0.2); position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 99998;"></div>
          <div id="loading_div" style="text-align: center; position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 99999;">
            <img src="<?php 
        echo WD_BWG_URL . '/images/ajax_loader.png';
        ?>
" class="spider_ajax_loading" style="margin-top: 200px; width:50px;">
          </div>
          <div id="file_manager">
            <div class="ctrls_bar ctrls_bar_header">
              <div class="ctrls_left">
                <a class="ctrl_bar_btn btn_up" onclick="onBtnUpClick(event, this);" title="<?php 
        echo __('Up', 'bwg_back');
        ?>
"></a>
                <a class="ctrl_bar_btn btn_make_dir" onclick="onBtnMakeDirClick(event, this);" title="<?php 
        echo __('Make a directory', 'bwg_back');
        ?>
"></a>
                <a class="ctrl_bar_btn btn_rename_item" onclick="onBtnRenameItemClick(event, this);" title="<?php 
        echo __('Rename item', 'bwg_back');
        ?>
"></a>
                <span class="ctrl_bar_divider"></span>
                <a class="ctrl_bar_btn btn_copy" onclick="onBtnCopyClick(event, this);" title="<?php 
        echo __('Copy', 'bwg_back');
        ?>
"></a>
                <a class="ctrl_bar_btn btn_cut" onclick="onBtnCutClick(event, this);" title="<?php 
        echo __('Cut', 'bwg_back');
        ?>
"></a>
                <a class="ctrl_bar_btn btn_paste" onclick="onBtnPasteClick(event, this);" title="<?php 
        echo __('Paste', 'bwg_back');
        ?>
"> </a>
                <a class="ctrl_bar_btn btn_remove_items" onclick="onBtnRemoveItemsClick(event, this);" title="<?php 
        echo __('Remove items', 'bwg_back');
        ?>
"></a>
                <span class="ctrl_bar_divider"></span>
                <span class="ctrl_bar_btn btn_primary">
                  <a class="ctrl_bar_btn btn_upload_files" onclick="onBtnShowUploaderClick(event, this);"><?php 
        echo __('Upload files', 'bwg_back');
        ?>
</a>
                </span>
                <?php 
        if ($bwg_options->enable_ML_import) {
            ?>
                <span class="ctrl_bar_divider"></span>
                <span class="ctrl_bar_btn btn_primary">
                  <a class="ctrl_bar_btn btn_import_files" onclick="onBtnShowImportClick(event, this);"><?php 
            echo __('Media library', 'bwg_back');
            ?>
</a>
                </span>
                <?php 
        }
        ?>
		<span class="ctrl_bar_divider"></span>
                <span id="search_by_name" class="ctrl_bar_btn">
                  <input type="search" placeholder="Search" class="ctrl_bar_btn search_by_name">
                </span>
              </div>
              <div class="ctrls_right">
                <a class="ctrl_bar_btn btn_view_thumbs" onclick="onBtnViewThumbsClick(event, this);" title="<?php 
        echo __('View thumbs', 'bwg_back');
        ?>
"></a>
                <a class="ctrl_bar_btn btn_view_list" onclick="onBtnViewListClick(event, this);" title="<?php 
        echo __('View list', 'bwg_back');
        ?>
"></a>
              </div>
            </div>
            <div id="path">
              <?php 
        foreach ($file_manager_data['path_components'] as $key => $path_component) {
            ?>
                <a <?php 
            echo $key == 0 ? 'title="' . __("To change upload directory go to Options page.", 'bwg_back') . '"' : '';
            ?>
 class="path_component path_dir"
                   onclick="onPathComponentClick(event, this, '<?php 
            echo addslashes($path_component['path']);
            ?>
');">
                    <?php 
            echo $path_component['name'];
            ?>
</a>
                <a class="path_component path_separator"><?php 
            echo '/';
            ?>
</a>
                <?php 
        }
        ?>
            </div>
            <div id="explorer">
              <div id="explorer_header_wrapper">
                <div id="explorer_header_container">
                  <div id="explorer_header">
                    <span class="item_numbering">#</span>
                    <span class="item_icon"></span>
                    <span class="item_name">
                      <span class="clickable" onclick="onNameHeaderClick(event, this);">
                          <?php 
        echo 'Name';
        if ($sort_by == 'name') {
            ?>
                            <span class="sort_order_<?php 
            echo $sort_order;
            ?>
"></span>
                            <?php 
        }
        ?>
                      </span>
                    </span>
                    <span class="item_size">
                      <span class="clickable" onclick="onSizeHeaderClick(event, this);">
                        <?php 
        echo 'Size';
        if ($sort_by == 'size') {
            ?>
                          <span class="sort_order_<?php 
            echo $sort_order;
            ?>
"></span>
                          <?php 
        }
        ?>
                      </span>
                    </span>
                    <span class="item_date_modified">
                      <span class="clickable" onclick="onDateModifiedHeaderClick(event, this);">
                        <?php 
        echo 'Date modified';
        if ($sort_by == 'date_modified') {
            ?>
                          <span class="sort_order_<?php 
            echo $sort_order;
            ?>
"></span>
                          <?php 
        }
        ?>
                      </span>
                    </span>
                    <span class="scrollbar_filler"></span>
                  </div>
                </div>
              </div>
              <div id="explorer_body_wrapper">
                <div id="explorer_body_container">
                  <div id="explorer_body">
                    <?php 
        foreach ($file_manager_data['files'] as $file) {
            $file['name'] = esc_html($file['name']);
            $file['filename'] = esc_html($file['filename']);
            $file['thumb'] = esc_html($file['thumb']);
            ?>
                      <div class="explorer_item" draggable="true"
                           name="<?php 
            echo $file['name'];
            ?>
"
                           filename="<?php 
            echo $file['filename'];
            ?>
"
                           filethumb="<?php 
            echo $file['thumb'];
            ?>
"
                           filesize="<?php 
            echo $file['size'];
            ?>
"
                           filetype="<?php 
            echo strtoupper($file['type']);
            ?>
"
                           date_modified="<?php 
            echo $file['date_modified'];
            ?>
"
                           fileresolution="<?php 
            echo $file['resolution'];
            ?>
"
                           fileCredit="<?php 
            echo isset($file['credit']) ? $file['credit'] : '';
            ?>
"
                           fileAperture="<?php 
            echo isset($file['aperture']) ? $file['aperture'] : '';
            ?>
"
                           fileCamera="<?php 
            echo isset($file['camera']) ? $file['camera'] : '';
            ?>
"
                           fileCaption="<?php 
            echo isset($file['caption']) ? $file['caption'] : '';
            ?>
"
                           fileIso="<?php 
            echo isset($file['iso']) ? $file['iso'] : '';
            ?>
"
                           fileOrientation="<?php 
            echo isset($file['orientation']) ? $file['orientation'] : '';
            ?>
"
                           fileCopyright="<?php 
            echo isset($file['copyright']) ? $file['copyright'] : '';
            ?>
"
                           onmouseover="onFileMOver(event, this);"
                           onmouseout="onFileMOut(event, this);"
                           onclick="onFileClick(event, this);"
                           ondblclick="onFileDblClick(event, this);"
                           ondragstart="onFileDragStart(event, this);"
                          <?php 
            if ($file['is_dir'] == true) {
                ?>
                            ondragover="onFileDragOver(event, this);"
                            ondrop="onFileDrop(event, this);"
                            <?php 
            }
            ?>
                            isDir="<?php 
            echo $file['is_dir'] == true ? 'true' : 'false';
            ?>
">
                        <span class="item_numbering"><?php 
            echo ++$i;
            ?>
</span>
                        <span class="item_thumb">
                          <img src="<?php 
            echo $file['thumb'];
            ?>
"/>
                        </span>
                        <span class="item_icon">
                          <img src="<?php 
            echo $file['icon'];
            ?>
"/>
                        </span>
                        <span class="item_name">
                          <?php 
            echo $file['name'];
            ?>
                        </span>
                        <span class="item_size">
                          <?php 
            echo $file['size'];
            ?>
                        </span>
                        <span class="item_date_modified">
                          <?php 
            echo $file['date_modified'];
            ?>
                        </span>
                      </div>
                      <?php 
        }
        ?>
                  </div>
                </div>
              </div>
            </div>
            <div class="ctrls_bar ctrls_bar_footer">
              <div class="ctrls_left">
                <a class="ctrl_bar_btn btn_open btn_primary none_select" onclick="onBtnSelectAllClick();"><?php 
        echo __('Select All', 'bwg_back');
        ?>
</a>
              </div>
              <div class="ctrls_right">
                <span id="file_names_span">
                  <span>
                  </span>
                </span>
                <a class="ctrl_bar_btn btn_open btn_primary none_select" onclick="onBtnOpenClick(event, this);"><?php 
        echo isset($_REQUEST['callback']) && esc_html($_REQUEST['callback']) == 'bwg_add_image' ? __('Add selected images to gallery', 'bwg_back') : __('Add', 'bwg_back');
        ?>
</a>
                <span class="ctrl_bar_empty_devider"></span>
                <a class="ctrl_bar_btn btn_cancel btn_secondary none_select" onclick="onBtnCancelClick(event, this);"><?php 
        echo 'Cancel';
        ?>
</a>
              </div>
            </div>
          </div>
          <div id="importer" style="display: none;">
            <div id="importer_bg"></div>
            <div class="ctrls_bar ctrls_bar_header">
              <div class="ctrls_left upload_thumb">
                <?php 
        echo __("Thumbnail Maximum Dimensions:", 'bwg_back');
        ?>
                <input type="text" class="upload_thumb_dim" name="importer_thumb_width" id="importer_thumb_width" value="<?php 
        echo $bwg_options->upload_thumb_width;
        ?>
" /> x 
                <input type="text" class="upload_thumb_dim" name="importer_thumb_height" id="importer_thumb_height" value="<?php 
        echo $bwg_options->upload_thumb_height;
        ?>
" /> px
              </div>
              <div class="ctrls_right">
                <a class="ctrl_bar_btn btn_back" onclick="onBtnBackClick(event, this);" title="<?php 
        echo __('Back', 'bwg_back');
        ?>
"></a>
              </div>
              <div class="ctrls_right_img upload_thumb">
                <?php 
        echo __("Image Maximum Dimensions:", 'bwg_back');
        ?>
                <input type="text" class="upload_thumb_dim" name="importer_img_width" id="importer_img_width" value="<?php 
        echo $bwg_options->upload_img_width;
        ?>
" /> x 
                <input type="text" class="upload_thumb_dim" name="importer_img_height" id="importer_img_height" value="<?php 
        echo $bwg_options->upload_img_height;
        ?>
" /> px
              </div>
            </div>
            <div id="importer_body_wrapper">
              <div id="importer_body_container">
                <div id="importer_body">
                  <?php 
        foreach ($file_manager_data['media_library_files'] as $file) {
            $file['name'] = esc_html($file['name']);
            $file['filename'] = esc_html($file['filename']);
            $file['thumb'] = esc_html($file['thumb']);
            ?>
                    <div class="importer_item" draggable="true"
                         name="<?php 
            echo $file['name'];
            ?>
"
                         path="<?php 
            echo $file['path'];
            ?>
"
                         filename="<?php 
            echo $file['filename'];
            ?>
"
                         filethumb="<?php 
            echo $file['thumb'];
            ?>
"
                         filesize="<?php 
            echo $file['size'];
            ?>
"
                         filetype="<?php 
            echo strtoupper($file['type']);
            ?>
"
                         date_modified="<?php 
            echo $file['date_modified'];
            ?>
"
                         fileresolution="<?php 
            echo $file['resolution'];
            ?>
"
                         fileCredit="<?php 
            echo $file['credit'];
            ?>
"
                         fileAperture="<?php 
            echo $file['aperture'];
            ?>
"
                         fileCamera="<?php 
            echo $file['camera'];
            ?>
"
                         fileCaption="<?php 
            echo $file['caption'];
            ?>
"
                         fileIso="<?php 
            echo $file['iso'];
            ?>
"
                         fileOrientation="<?php 
            echo $file['orientation'];
            ?>
"
                         fileCopyright="<?php 
            echo $file['copyright'];
            ?>
"
                         onmouseover="onFileMOverML(event, this);"
                         onmouseout="onFileMOutML(event, this);"
                         onclick="onFileClickML(event, this);"
                         ondblclick="onFileDblClickML(event, this);"
                         isDir="<?php 
            echo $file['is_dir'] == true ? 'true' : 'false';
            ?>
">
                      <span class="item_numbering"><?php 
            echo ++$i;
            ?>
</span>
                      <span class="item_thumb">
                        <img src="<?php 
            echo $file['thumb'];
            ?>
"/>
                      </span>
                      <span class="item_icon">
                        <img src="<?php 
            echo $file['icon'];
            ?>
"/>
                      </span>
                      <span class="item_name">
                        <?php 
            echo $file['name'];
            ?>
                      </span>
                      <span class="item_size">
                        <?php 
            echo $file['size'];
            ?>
                      </span>
                      <span class="item_date_modified">
                        <?php 
            echo $file['date_modified'];
            ?>
                      </span>
                    </div>
                    <?php 
        }
        ?>
                </div>
              </div>
            </div>
            <div class="ctrls_bar ctrls_bar_footer">
              <div class="ctrls_left">
                <a class="ctrl_bar_btn btn_open btn_primary none_select" onclick="onBtnSelectAllMediLibraryClick();"><?php 
        echo __('Select All', 'bwg_back');
        ?>
</a>
              </div>
              <div class="ctrls_right">
                <span id="file_names_span">
                  <span>
                  </span>
                </span>
                <a class="ctrl_bar_btn btn_open btn_primary none_select" onclick="onBtnImportClick(event, this);"><?php 
        echo __("Import selected images", 'bwg_back');
        ?>
</a>
              </div>
            </div>
          </div>
          <div id="uploader">
            <div id="uploader_bg"></div>
            <div class="ctrls_bar ctrls_bar_header">
              <div class="ctrls_left upload_thumb">
                <?php 
        echo __("Thumbnail Maximum Dimensions:", 'bwg_back');
        ?>
                <input type="text" class="upload_thumb_dim" name="upload_thumb_width" id="upload_thumb_width" value="<?php 
        echo $bwg_options->upload_thumb_width;
        ?>
" /> x 
                <input type="text" class="upload_thumb_dim" name="upload_thumb_height" id="upload_thumb_height" value="<?php 
        echo $bwg_options->upload_thumb_height;
        ?>
" /> px
              </div>
              <div class="ctrls_right">
                <a class="ctrl_bar_btn btn_back" onclick="onBtnBackClick(event, this);" title="<?php 
        echo __('Back', 'bwg_back');
        ?>
"></a>
              </div>
              <div class="ctrls_right_img upload_thumb">
                <?php 
        echo __("Image Maximum Dimensions:", 'bwg_back');
        ?>
                <input type="text" class="upload_thumb_dim" name="upload_img_width" id="upload_img_width" value="<?php 
        echo $bwg_options->upload_img_width;
        ?>
" /> x 
                <input type="text" class="upload_thumb_dim" name="upload_img_height" id="upload_img_height" value="<?php 
        echo $bwg_options->upload_img_height;
        ?>
" /> px
              </div>
            </div>
            <label for="jQueryUploader">
              <div id="uploader_hitter">
                <div id="drag_message">
                  <span><?php 
        echo __('Drag files here or click the button below', 'bwg_back') . '<br />' . __('to upload files', 'bwg_back');
        ?>
</span>
                </div>
                <div id="btnBrowseContainer">
                <?php 
        $query_url = wp_nonce_url(admin_url('admin-ajax.php'), 'bwg_UploadHandler', 'bwg_nonce');
        $query_url = add_query_arg(array('action' => 'bwg_UploadHandler', 'dir' => $this->controller->get_uploads_dir() . '/' . (isset($_REQUEST['dir']) ? esc_html($_REQUEST['dir']) : '') . '/'), $query_url);
        ?>


                  <input id="jQueryUploader" type="file" name="files[]"
                         data-url="<?php 
        echo $query_url;
        ?>
"
                         multiple>
                </div>
                <script>
                  jQuery("#jQueryUploader").fileupload({
                    dataType: "json",
                    dropZone: jQuery("#uploader_hitter"),
                    submit: function (e, data) {
                      jQuery("#uploader_progress_text").removeClass("uploader_text");
                      isUploading = true;
                      jQuery("#uploader_progress_bar").fadeIn();
                    },
                    progressall: function (e, data) {
                      var progress = parseInt(data.loaded / data.total * 100, 10);
                      jQuery("#uploader_progress_text").text("Progress " + progress + "%");
                      jQuery("#uploader_progress div div").css({width: progress + "%"});
                      if (data.loaded == data.total) {
                        isUploading = false;
                        jQuery("#uploader_progress_bar").fadeOut(function () {
                          jQuery("#uploader_progress_text").text(messageFilesUploadComplete);
                          jQuery("#uploader_progress_text").addClass("uploader_text");
                        });
                        jQuery("#opacity_div").show();
                        jQuery("#loading_div").show();
                      }
                    },
                    stop: function (e, data) {
                      onBtnBackClick();
                    },
                    done: function (e, data) {
                      jQuery.each(data.files, function (index, file) {
                        if (file.error) {
                          alert(errorLoadingFile + ' :: ' + file.error);
                        }
                        if (file.error) {
                          jQuery("#uploaded_files ul").prepend(jQuery("<li class=uploaded_item_failed>" + "<?php 
        echo 'Upload failed';
        ?>
 :: " + file.error + "</li>"));
                        }
                        else {
                          jQuery("#uploaded_files ul").prepend(jQuery("<li class=uploaded_item>" + file.name + " (<?php 
        echo 'Uploaded';
        ?>
)" + "</li>"));
                        }
                      });
                      jQuery("#opacity_div").hide();
                      jQuery("#loading_div").hide();
                    }
                  });
                  jQuery(window).load(function () {
                    jQuery("#opacity_div").hide();
                    jQuery("#loading_div").hide();
                  })
                </script>
              </div>
            </label>
            <div id="uploaded_files">
              <ul></ul>
            </div>
            <div id="uploader_progress">
              <div id="uploader_progress_bar">
                <div></div>
              </div>
              <span id="uploader_progress_text" class="uploader_text">
                <?php 
        echo __('No files to upload', 'bwg_back');
        ?>
              </span>
            </div>
          </div>
        </div>

        <input type="hidden" name="task" value="">
        <input type="hidden" name="extensions" value="<?php 
        echo isset($_REQUEST['extensions']) ? esc_html($_REQUEST['extensions']) : '*';
        ?>
">
        <input type="hidden" name="callback" value="<?php 
        echo isset($_REQUEST['callback']) ? esc_html($_REQUEST['callback']) : '';
        ?>
">
        <input type="hidden" name="sort_by" value="<?php 
        echo $sort_by;
        ?>
">
        <input type="hidden" name="sort_order" value="<?php 
        echo $sort_order;
        ?>
">
        <input type="hidden" name="items_view" value="<?php 
        echo $items_view;
        ?>
">
        <input type="hidden" name="dir" value="<?php 
        echo isset($_REQUEST['dir']) ? esc_html($_REQUEST['dir']) : '';
        ?>
"/>
        <input type="hidden" name="file_names" value=""/>
        <input type="hidden" name="file_namesML" value=""/>
        <input type="hidden" name="file_new_name" value=""/>
        <input type="hidden" name="new_dir_name" value=""/>
        <input type="hidden" name="clipboard_task" value="<?php 
        echo $clipboard_task;
        ?>
"/>
        <input type="hidden" name="clipboard_files" value="<?php 
        echo $clipboard_files;
        ?>
"/>
        <input type="hidden" name="clipboard_src" value="<?php 
        echo $clipboard_src;
        ?>
"/>
        <input type="hidden" name="clipboard_dest" value="<?php 
        echo $clipboard_dest;
        ?>
"/>
      </form>
      <?php 
        die;
    }
    public function display()
    {
        $rows_data = $this->model->get_rows_data();
        $page_nav = $this->model->page_nav();
        $search_value = isset($_POST['search_value']) ? esc_html(stripslashes($_POST['search_value'])) : '';
        $asc_or_desc = isset($_POST['asc_or_desc']) ? esc_html(stripslashes($_POST['asc_or_desc'])) : 'asc';
        $order_by = isset($_POST['order_by']) ? esc_html(stripslashes($_POST['order_by'])) : 'name';
        $image_id = isset($_GET['image_id']) ? esc_html($_GET['image_id']) : (isset($_POST['image_id']) ? esc_html($_POST['image_id']) : '0');
        $order_class = 'manage-column column-title sorted ' . $asc_or_desc;
        $per_page = $this->model->per_page();
        $pager = 0;
        wp_print_scripts('jquery');
        wp_print_styles('admin-bar');
        wp_print_styles('wp-admin');
        wp_print_styles('dashicons');
        wp_print_styles('buttons');
        wp_print_styles('wp-auth-check');
        if (get_bloginfo('version') < '3.9') {
            ?>
    <link media="all" type="text/css" href="<?php 
            echo get_admin_url();
            ?>
css/colors<?php 
            echo get_bloginfo('version') < '3.8' ? '-fresh' : '';
            ?>
.min.css" id="colors-css" rel="stylesheet">
    <?php 
        }
        ?>
    <link media="all" type="text/css" href="<?php 
        echo WD_BWG_URL . '/css/bwg_tables.css?ver=' . wd_bwg_version();
        ?>
" id="bwg_tables-css" rel="stylesheet">
    <script src="<?php 
        echo WD_BWG_URL . '/js/bwg.js?ver=' . wd_bwg_version();
        ?>
" type="text/javascript"></script>
    <form class="wrap wp-core-ui bwg_form" id="tags_form" method="post" action="<?php 
        echo add_query_arg(array('action' => 'addTags', 'width' => '650', 'height' => '500', 'bwg_items_per_page' => $per_page, 'TB_iframe' => '1'), admin_url('admin-ajax.php'));
        ?>
" style="width:99%; margin: 0 auto;">
      <?php 
        wp_nonce_field('addTags', 'bwg_nonce');
        ?>
      <h2 style="width:200px; float:left;"><?php 
        _e("Tags", 'bwg_back');
        ?>
</h2>
      <a href="" class="thickbox thickbox-preview" id="content-add_media" title="Add Tag" onclick="bwg_get_tags('<?php 
        echo $image_id;
        ?>
', event);" style="float:right; padding: 9px 0px 4px 0">
        <div class="wd-btn wd-btn-primary wd-btn-icon wd-btn-add" style="border:none;padding-top:8px !important;">ADD </div>
      </a>
      <div class="tablenav top">
        <?php 
        WDWLibrary::search(__('Name', 'bwg_back'), $search_value, 'tags_form', 'position_search');
        WDWLibrary::html_page_nav($page_nav['total'], $pager++, $page_nav['limit'], 'tags_form', $per_page);
        ?>
      </div>
      <table class="wp-list-table widefat fixed pages">
        <thead>
          <th class="manage-column column-cb check-column table_small_col"><input id="check_all" type="checkbox" style="margin:0;" /></th>
          <th class="sortable table_small_col <?php 
        if ($order_by == 'term_id') {
            echo $order_class;
        }
        ?>
" style="padding-left:15px">
            <a onclick="spider_set_input_value('order_by', 'term_id');
                        spider_set_input_value('asc_or_desc', '<?php 
        echo isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && esc_html(stripslashes($_POST['order_by'])) == 'term_id' && esc_html(stripslashes($_POST['asc_or_desc'])) == 'asc' ? 'desc' : 'asc';
        ?>
');
                        spider_form_submit(event, 'tags_form')" href="">
              <span>ID</span><span class="sorting-indicator"></span></th>
            </a>
          <th class="sortable <?php 
        if ($order_by == 'name') {
            echo $order_class;
        }
        ?>
">
            <a onclick="spider_set_input_value('order_by', 'name');
                        spider_set_input_value('asc_or_desc', '<?php 
        echo isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && esc_html(stripslashes($_POST['order_by'])) == 'name' && esc_html(stripslashes($_POST['asc_or_desc'])) == 'asc' ? 'desc' : 'asc';
        ?>
');
                        spider_form_submit(event, 'tags_form')" href="">
              <span><?php 
        _e("Name", 'bwg_back');
        ?>
</span><span class="sorting-indicator"></span>
            </a>
          </th>
          <th class="sortable <?php 
        if ($order_by == 'slug') {
            echo $order_class;
        }
        ?>
">
            <a onclick="spider_set_input_value('order_by', 'slug');
                        spider_set_input_value('asc_or_desc', '<?php 
        echo isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && esc_html(stripslashes($_POST['order_by'])) == 'slug' && esc_html(stripslashes($_POST['asc_or_desc'])) == 'asc' ? 'desc' : 'asc';
        ?>
');
                        spider_form_submit(event, 'tags_form')" href="">
              <span><?php 
        _e("Slug", 'bwg_back');
        ?>
</span><span class="sorting-indicator"></span>
            </a>
          </th>
        </thead>
        <tbody id="tbody_arr">
          <?php 
        if ($rows_data) {
            foreach ($rows_data as $row_data) {
                $alternate = !isset($alternate) || $alternate == 'class="alternate"' ? '' : 'class="alternate"';
                ?>
              <tr id="tr_<?php 
                echo $row_data->term_id;
                ?>
" <?php 
                echo $alternate;
                ?>
>
                <td class="table_small_col check-column"><input id="check_<?php 
                echo $row_data->term_id;
                ?>
" name="check_<?php 
                echo $row_data->term_id;
                ?>
" type="checkbox" /></td>
                <td class="table_small_col"><?php 
                echo $row_data->term_id;
                ?>
</td>
                <td><a onclick="window.parent.bwg_add_tag('<?php 
                echo $image_id;
                ?>
', ['<?php 
                echo $row_data->term_id;
                ?>
'],['<?php 
                echo htmlspecialchars(addslashes($row_data->name));
                ?>
'])" id="a_<?php 
                echo $row_data->term_id;
                ?>
" style="cursor:pointer;"><?php 
                echo $row_data->name;
                ?>
</a></td> 
                <td id="slug_<?php 
                echo $row_data->term_id;
                ?>
"><?php 
                echo $row_data->slug ? $row_data->slug : '&nbsp;';
                ?>
</td> 
              </tr>
              <?php 
            }
        }
        ?>
        </tbody>
      </table>
      <div class="tablenav bottom">
        <?php 
        WDWLibrary::html_page_nav($page_nav['total'], $pager++, $page_nav['limit'], 'tags_form', $per_page);
        ?>
      </div>
      <input id="asc_or_desc" name="asc_or_desc" type="hidden" value="asc" />
      <input id="order_by" name="order_by" type="hidden" value="<?php 
        echo $order_by;
        ?>
" />
      <input id="image_id" name="image_id" type="hidden" value="<?php 
        echo $image_id;
        ?>
" />
    </form>
    <script src="<?php 
        echo get_admin_url();
        ?>
load-scripts.php?c=1&load%5B%5D=common,admin-bar" type="text/javascript"></script>
    <?php 
        die;
    }
    public function display()
    {
        $album_id = isset($_GET['album_id']) ? esc_html(stripslashes($_GET['album_id'])) : (isset($_POST['album_id']) ? esc_html(stripslashes($_POST['album_id'])) : '');
        $rows_data = $this->model->get_rows_data($album_id);
        $page_nav = $this->model->page_nav($album_id);
        $search_value = isset($_POST['search_value']) ? esc_html(stripslashes($_POST['search_value'])) : '';
        $asc_or_desc = isset($_POST['asc_or_desc']) ? esc_html(stripslashes($_POST['asc_or_desc'])) : 'asc';
        $order_by = isset($_POST['order_by']) ? esc_html(stripslashes($_POST['order_by'])) : 'name';
        $order_class = 'manage-column column-title sorted ' . $asc_or_desc;
        $per_page = $this->model->per_page();
        $pager = 0;
        wp_print_scripts('jquery');
        wp_print_scripts('wp-pointer');
        wp_print_styles('admin-bar');
        wp_print_styles('dashicons');
        wp_print_styles('wp-admin');
        wp_print_styles('buttons');
        wp_print_styles('wp-auth-check');
        wp_print_styles('wp-pointer');
        if (get_bloginfo('version') < '3.9') {
            ?>
    <link media="all" type="text/css" href="<?php 
            echo get_admin_url();
            ?>
css/colors<?php 
            echo get_bloginfo('version') < '3.8' ? '-fresh' : '';
            ?>
.min.css" id="colors-css" rel="stylesheet">
    <?php 
        }
        ?>
    <link media="all" type="text/css" href="<?php 
        echo WD_BWG_URL . '/css/bwg_tables.css?ver=' . wd_bwg_version();
        ?>
" id="spider_audio_player_tables-css" rel="stylesheet">
    <script src="<?php 
        echo WD_BWG_URL . '/js/bwg.js?ver=' . wd_bwg_version();
        ?>
" type="text/javascript"></script>
    <form class="wrap wp-core-ui bwg_form" id="albums_galleries_form" method="post" action="<?php 
        echo add_query_arg(array('action' => 'addAlbumsGalleries', 'width' => '700', 'height' => '550', 'callback' => 'bwg_add_items', 'bwg_items_per_page' => $per_page, 'TB_iframe' => '1'), admin_url('admin-ajax.php'));
        ?>
" style="width:95%; margin: 0 auto;">
      <?php 
        wp_nonce_field('addAlbumsGalleries', 'bwg_nonce');
        ?>
      <h2 style="width:200px;float:left"><?php 
        _e("Albums/Galleries", 'bwg_back');
        ?>
</h2>
      <a href="" class="thickbox thickbox-preview" id="content-add_media" title="Add Album/Gallery" onclick="spider_get_items(event);" style="float:right; padding: 9px 0px 4px 0">
        <img id='add_albums' src="<?php 
        echo WD_BWG_URL . '/images/add_but.png';
        ?>
" style="border:none;" />
      </a>
      <div class="tablenav top">
        <?php 
        WDWLibrary::search(__("Name", 'bwg_back'), $search_value, 'albums_galleries_form');
        WDWLibrary::html_page_nav($page_nav['total'], $pager++, $page_nav['limit'], 'albums_galleries_form', $per_page);
        ?>
      </div>
      <table class="wp-list-table widefat fixed pages">
        <thead>
          <th class="manage-column column-cb check-column table_small_col"><input id="check_all" type="checkbox" style="margin:0;" /></th>
          <th class="table_small_col <?php 
        if ($order_by == 'id') {
            echo $order_class;
        }
        ?>
">
            <a onclick="spider_set_input_value('order_by', 'id');
                        spider_set_input_value('asc_or_desc', '<?php 
        echo isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && esc_html(stripslashes($_POST['order_by'])) == 'id' && esc_html(stripslashes($_POST['asc_or_desc'])) == 'asc' ? 'desc' : 'asc';
        ?>
');
                        spider_form_submit(event, 'albums_galleries_form')" href="">
              <span>ID</span><span class="sorting-indicator"></span>
            </a>
          </th>
          <th class="table_medium_col_uncenter <?php 
        if ($order_by == 'is_album') {
            echo $order_class;
        }
        ?>
">
            <a onclick="spider_set_input_value('task', '');
                        spider_set_input_value('order_by', 'is_album');
                        spider_set_input_value('asc_or_desc', '<?php 
        echo isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && esc_html(stripslashes($_POST['order_by'])) == 'is_album' && esc_html(stripslashes($_POST['asc_or_desc'])) == 'asc' ? 'desc' : 'asc';
        ?>
');
                        spider_form_submit(event, 'albums_galleries_form')" href="">
              <span><?php 
        _e("Type", 'bwg_back');
        ?>
</span><span class="sorting-indicator"></span>
            </a>
          </th>
          <th class="<?php 
        if ($order_by == 'name') {
            echo $order_class;
        }
        ?>
">
            <a onclick="spider_set_input_value('order_by', 'name');
                        spider_set_input_value('asc_or_desc', '<?php 
        echo isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && esc_html(stripslashes($_POST['order_by'])) == 'name' && esc_html(stripslashes($_POST['asc_or_desc'])) == 'asc' ? 'desc' : 'asc';
        ?>
');
                        spider_form_submit(event, 'albums_galleries_form')" href="">
              <span><?php 
        _e("Name", 'bwg_back');
        ?>
</span><span class="sorting-indicator"></span>
            </a>
          </th>          
        </thead>
        <tbody id="tbody_albums_galleries">
          <?php 
        if ($rows_data) {
            $iterator = 0;
            foreach ($rows_data as $row_data) {
                $alternate = !isset($alternate) || $alternate == 'class="alternate"' ? '' : 'class="alternate"';
                ?>
              <tr id="tr_<?php 
                echo $iterator;
                ?>
" <?php 
                echo $alternate;
                ?>
>
                <td class="table_small_col check-column"><input id="check_<?php 
                echo $iterator;
                ?>
" name="check_<?php 
                echo $iterator;
                ?>
" type="checkbox" /></td>
                <td id="id_<?php 
                echo $iterator;
                ?>
" class="table_small_col"><?php 
                echo $row_data->id;
                ?>
</td>
                <td id="url_<?php 
                echo $iterator;
                ?>
" class="table_medium_col_uncenter"><?php 
                echo $row_data->is_album ? __("Album", 'bwg_back') : __("Gallery", 'bwg_back');
                ?>
</td>
                <td>
                  <a onclick="window.parent.bwg_add_items(['<?php 
                echo $row_data->id;
                ?>
'],['<?php 
                echo htmlspecialchars(addslashes($row_data->name));
                ?>
'], ['<?php 
                echo htmlspecialchars(addslashes($row_data->is_album));
                ?>
'])" id="a_<?php 
                echo $iterator;
                ?>
" style="cursor:pointer;">
                    <?php 
                echo $row_data->name;
                ?>
                  </a>
                </td>
              </tr>
              <?php 
                $iterator++;
            }
        }
        ?>
        </tbody>
      </table>
      <div class="tablenav bottom">
        <?php 
        WDWLibrary::html_page_nav($page_nav['total'], $pager++, $page_nav['limit'], 'albums_galleries_form', $per_page);
        ?>
      </div>
      <input id="asc_or_desc" name="asc_or_desc" type="hidden" value="asc" />
      <input id="order_by" name="order_by" type="hidden" value="<?php 
        echo $order_by;
        ?>
" />
      <input id="album_id" name="album_id" type="hidden" value="<?php 
        echo $album_id;
        ?>
" />
    </form>
    <script src="<?php 
        echo get_admin_url();
        ?>
load-scripts.php?c=1&load%5B%5D=common,admin-bar" type="text/javascript"></script>
    <?php 
        include_once WD_BWG_DIR . '/includes/bwg_pointers.php';
        new BWG_pointers();
        die;
    }
    function form($instance, $id_title, $name_title, $id_type, $name_type, $id_show_name, $name_show_name, $id_open_option, $name_open_option, $id_count, $name_count, $id_width, $name_width, $id_height, $name_height, $id_background_transparent, $name_background_transparent, $id_background_color, $name_background_color, $id_text_color, $name_text_color, $id_theme_id, $name_theme_id)
    {
        $defaults = array('title' => 'Photo Gallery Tags Cloud', 'type' => 'text', 'show_name' => 0, 'open_option' => 'page', 'count' => 0, 'width' => 250, 'height' => 250, 'background_transparent' => 1, 'background_color' => '000000', 'text_color' => 'ffffff', 'theme_id' => 0);
        $instance = wp_parse_args((array) $instance, $defaults);
        $theme_rows = $this->model->get_theme_rows_data();
        ?>
    <script>
      function bwg_change_type_tag(event, obj) {
        var div = jQuery(obj).closest("div");
        if(jQuery(jQuery(div).find(".sel_image")[0]).prop("checked")) {
          jQuery(jQuery(div).find("#p_show_name")).css("display", "");
          jQuery(obj).nextAll(".bwg_hidden").first().attr("value", "image");
        }
        else {
          jQuery(jQuery(div).find("#p_show_name")).css("display", "none");
          jQuery(obj).nextAll(".bwg_hidden").first().attr("value", "text");
        }
      }
      
      function bwg_change_bg_transparency(event, obj) {
        var div = jQuery(obj).closest("div");
        if(jQuery(jQuery(div).find(".bg_transparent")[0]).prop("checked")) {
          jQuery(jQuery(div).find("#p_bg_color")).css("display", "none");
          jQuery(obj).nextAll(".bwg_hidden").first().attr("value", "1");
        }
        else {
          jQuery(jQuery(div).find("#p_bg_color")).css("display", "");
          jQuery(obj).nextAll(".bwg_hidden").first().attr("value", "0");
        }
      }
    </script>
    <script src="<?php 
        echo WD_BWG_URL . '/js/jscolor/jscolor.js?ver=' . wd_bwg_version();
        ?>
" type="text/javascript" charset="utf-8"></script>
    <p>
      <label for="<?php 
        echo $id_title;
        ?>
">Title:</label>
      <input class="widefat" id="<?php 
        echo $id_title;
        ?>
" name="<?php 
        echo $name_title;
        ?>
'" type="text" value="<?php 
        echo $instance['title'];
        ?>
"/>
    </p>    
    <p>
      <input type="radio" name="<?php 
        echo $name_type;
        ?>
" id="<?php 
        echo $id_type . "_1";
        ?>
" value="text" class="sel_text" <?php 
        if ($instance['type'] == "text") {
            echo 'checked="checked"';
        }
        ?>
 onclick="bwg_change_type_tag(event, this)" /><label for="<?php 
        echo $id_type . "_1";
        ?>
">Text</label>
      <input type="radio" name="<?php 
        echo $name_type;
        ?>
" id="<?php 
        echo $id_type . "_2";
        ?>
" value="image" class="sel_image" <?php 
        if ($instance['type'] == "image") {
            echo 'checked="checked"';
        }
        ?>
 onclick="bwg_change_type_tag(event, this)" /><label for="<?php 
        echo $id_type . "_2";
        ?>
">Image</label>
      <input type="hidden" name="<?php 
        echo $name_type;
        ?>
" id="<?php 
        echo $id_type;
        ?>
" value="<?php 
        echo $instance['type'];
        ?>
" class="bwg_hidden" />
    </p>
    <p id="p_show_name" style="display:<?php 
        echo $instance['type'] == 'image' ? "" : "none";
        ?>
;">
      <label>Show Tag Names:</label>
      <input type="radio" name="<?php 
        echo $name_show_name;
        ?>
" id="<?php 
        echo $id_show_name . "_1";
        ?>
" value="1" <?php 
        if ($instance['show_name']) {
            echo 'checked="checked"';
        }
        ?>
 onclick='jQuery(this).nextAll(".bwg_hidden").first().attr("value", "1");' /><label for="<?php 
        echo $id_show_name . "_1";
        ?>
">Yes</label>
      <input type="radio" name="<?php 
        echo $name_show_name;
        ?>
" id="<?php 
        echo $id_show_name . "_0";
        ?>
" value="0" <?php 
        if (!$instance['show_name']) {
            echo 'checked="checked"';
        }
        ?>
 onclick='jQuery(this).nextAll(".bwg_hidden").first().attr("value", "0");' /><label for="<?php 
        echo $id_show_name . "_0";
        ?>
">No</label>
      <input type="hidden" name="<?php 
        echo $name_show_name;
        ?>
" id="<?php 
        echo $id_show_name;
        ?>
" value="<?php 
        echo $instance['show_name'];
        ?>
" class="bwg_hidden" />
    </p>
    <p>
      <label>Open in: </label>
      <input type="radio" name="<?php 
        echo $name_open_option;
        ?>
" id="<?php 
        echo $id_open_option . "_1";
        ?>
" value="page" <?php 
        if ($instance['open_option'] == 'page') {
            echo 'checked="checked"';
        }
        ?>
 onclick='jQuery(this).nextAll(".bwg_hidden").first().attr("value", "page");' /><label for="<?php 
        echo $id_open_option . "_1";
        ?>
"> page</label>
      <input type="radio" name="<?php 
        echo $name_open_option;
        ?>
" id="<?php 
        echo $id_open_option . "_0";
        ?>
" value="lightbox" <?php 
        if ($instance['open_option'] == 'lightbox') {
            echo 'checked="checked"';
        }
        ?>
 onclick='jQuery(this).nextAll(".bwg_hidden").first().attr("value", "lightbox");' /><label for="<?php 
        echo $id_open_option . "_0";
        ?>
"> lightbox</label>
      <input type="hidden" name="<?php 
        echo $name_open_option;
        ?>
" id="<?php 
        echo $id_open_option;
        ?>
" value="<?php 
        echo $instance['open_option'];
        ?>
" class="bwg_hidden" />
    </p>
    <p>
      <label for="<?php 
        echo $id_count;
        ?>
">Number (0 for all):</label>
      <input class="widefat" style="width:25%;" id="<?php 
        echo $id_count;
        ?>
" name="<?php 
        echo $name_count;
        ?>
'" type="text" value="<?php 
        echo $instance['count'];
        ?>
"/>
    </p>
    <p>
      <label for="<?php 
        echo $id_width;
        ?>
">Dimensions:</label>
      <input class="widefat" style="width:25%;" id="<?php 
        echo $id_width;
        ?>
" name="<?php 
        echo $name_width;
        ?>
'" type="text" value="<?php 
        echo $instance['width'];
        ?>
"/> x 
      <input class="widefat" style="width:25%;" id="<?php 
        echo $id_height;
        ?>
" name="<?php 
        echo $name_height;
        ?>
'" type="text" value="<?php 
        echo $instance['height'];
        ?>
"/> px
    </p>
    <p>
      <label>Transparent Background:</label>
      <input type="radio" name="<?php 
        echo $name_background_transparent;
        ?>
" id="<?php 
        echo $id_background_transparent . "_1";
        ?>
" value="1" <?php 
        if ($instance['background_transparent']) {
            echo 'checked="checked"';
        }
        ?>
 onclick="bwg_change_bg_transparency(event, this)" class="bg_transparent" /><label for="<?php 
        echo $id_background_transparent . "_1";
        ?>
">Yes</label>
      <input type="radio" name="<?php 
        echo $name_background_transparent;
        ?>
" id="<?php 
        echo $id_background_transparent . "_0";
        ?>
" value="0" <?php 
        if (!$instance['background_transparent']) {
            echo 'checked="checked"';
        }
        ?>
 onclick="bwg_change_bg_transparency(event, this)" /><label for="<?php 
        echo $id_background_transparent . "_0";
        ?>
">No</label>
      <input type="hidden" name="<?php 
        echo $name_background_transparent;
        ?>
" id="<?php 
        echo $id_background_transparent;
        ?>
" value="<?php 
        echo $instance['background_transparent'];
        ?>
" class="bwg_hidden" />
    </p>
    <p id="p_bg_color" style="display:<?php 
        echo !$instance['background_transparent'] ? "" : "none";
        ?>
;">
      <label for="<?php 
        echo $id_background_color;
        ?>
">Background Color:</label>
      <input class="color" style="width:25%;" id="<?php 
        echo $id_background_color;
        ?>
" name="<?php 
        echo $name_background_color;
        ?>
'" type="text" value="<?php 
        echo $instance['background_color'];
        ?>
"/>
    </p> 
    <p>
      <label for="<?php 
        echo $id_text_color;
        ?>
">Text Color:</label>
      <input class="color" style="width:25%;" id="<?php 
        echo $id_text_color;
        ?>
" name="<?php 
        echo $name_text_color;
        ?>
'" type="text" value="<?php 
        echo $instance['text_color'];
        ?>
"/>
    </p> 
    <p>
      <select name="<?php 
        echo $name_theme_id;
        ?>
" id="<?php 
        echo $id_theme_id;
        ?>
" class="widefat">
        <?php 
        foreach ($theme_rows as $theme_row) {
            ?>
          <option value="<?php 
            echo $theme_row->id;
            ?>
" <?php 
            echo $instance['theme_id'] == $theme_row->id || $theme_row->default_theme == 1 ? 'selected="selected"' : '';
            ?>
><?php 
            echo $theme_row->name;
            ?>
</option>
          <?php 
        }
        ?>
      </select>
    </p> 
    <script>
      jscolor.init();
    </script>
    <?php 
    }