<?php 
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
$pro_url = "https://go.premio.io/?edd_action=add_to_cart&download_id=13&edd_options[price_id]=" ?>
<div class="key-table">
    <div class="modal-upgrade upgrade-block" id="folder-modal">
        <div class="easy-modal-inner">
            <div class="container">
                <div class="pricing-table">
                    <div class="price-title"><?php esc_html_e('Unlock All Features', 'stars-testimonials-with-slider-and-masonry-grid'); ?></div>
                    <div class="pricing-table-header">
                        <div class="pricing-table-body">
                            <div class="pricing-table-content first active" data-option="1_year">
                                <div class="year-col"><?php esc_html_e('1 Year', 'stars-testimonials-with-slider-and-masonry-grid'); ?></div>
                                <div class="update-col"><?php esc_html_e('Updates', 'stars-testimonials-with-slider-and-masonry-grid'); ?> &amp; <?php esc_html_e('Support', 'stars-testimonials-with-slider-and-masonry-grid'); ?></div>
                                <div class="pricing-discount-col"></div>
                            </div>
                            <div class="pricing-table-content second" data-option="2_year">
                                <div class="year-col"><?php esc_html_e('2 Years', 'stars-testimonials-with-slider-and-masonry-grid'); ?></div>
                                <div class="update-col"><?php esc_html_e('Updates', 'stars-testimonials-with-slider-and-masonry-grid'); ?> &amp; <?php esc_html_e('Support', 'stars-testimonials-with-slider-and-masonry-grid'); ?></div>
                                <div class="pricing-discount-col"><span><?php esc_html_e('32% off', 'stars-testimonials-with-slider-and-masonry-grid'); ?> &#128526;</span></div>
                            </div>
                            <div class="pricing-table-content third" data-option="lifetime">
                                <div class="year-col"><?php esc_html_e('Lifetime', 'stars-testimonials-with-slider-and-masonry-grid'); ?></div>
                                <div class="update-col"><?php esc_html_e('Updates', 'stars-testimonials-with-slider-and-masonry-grid'); ?> &amp; <?php esc_html_e('Support', 'stars-testimonials-with-slider-and-masonry-grid'); ?></div>
                                <div class="pricing-discount-col"><span><?php esc_html_e('63% off', 'stars-testimonials-with-slider-and-masonry-grid'); ?> &#129395;</span></div>
                            </div>
                        </div>
                    </div>
                    <div class="price-tables">
                        <div class="row">
                            <div class="col-md-4 col-sm-12">
                                <div class="price-table basic-feature">
                                    <div class="price-table-top">
                                        <div class="price-head">
                                            <div class="plan-name"><?php esc_html_e('Basic', 'stars-testimonials-with-slider-and-masonry-grid'); ?></div>
                                            <div class="plan-price"><?php esc_html_e('$25', 'stars-testimonials-with-slider-and-masonry-grid'); ?><span><?php esc_html_e('/year', 'stars-testimonials-with-slider-and-masonry-grid'); ?></span></div>
                                        </div>
                                        <div class="plan-center">
                                            <div class="price-permonth">Less than <b>$2.5</b>/mo <span class="full-width-bold">Billed Yearly</span></div>
                                            <!--div class="price-websites">For small website owners</div-->
                                            <div class="price-offer"><?php esc_html_e('Renewals for 25% off', 'stars-testimonials-with-slider-and-masonry-grid'); ?></div>
                                        </div>
                                    </div>
                                    <div class="price-table-middle">
                                        <ul>
                                            <li><a href="javascript:;" class="cus-tooltip"><?php esc_html_e('1 website', 'stars-testimonials-with-slider-and-masonry-grid'); ?> <span class="has-tooltip">*</span><span class="tooltip__content"><?php esc_html_e('Use Stars Testimonials on 1 domain', 'stars-testimonials-with-slider-and-masonry-grid'); ?></span></a></li>
                                            <li><a href="javascript:;" class="cus-tooltip"><?php esc_html_e('All styles', 'stars-testimonials-with-slider-and-masonry-grid'); ?> <span class="has-tooltip">*</span><span class="tooltip__content"><?php esc_html_e('All testimonials templates will be available for you', 'stars-testimonials-with-slider-and-masonry-grid'); ?></span></a></li>
                                            <li><a href="javascript:;" class="cus-tooltip"><?php esc_html_e('All colors', 'stars-testimonials-with-slider-and-masonry-grid'); ?> <span class="has-tooltip">*</span><span class="tooltip__content"><?php esc_html_e('You will be able to change the colors of the testimonials components, including using HEX code', 'stars-testimonials-with-slider-and-masonry-grid'); ?></span></a></li>
                                            <li><a href="javascript:;" class="cus-tooltip"><?php esc_html_e('Slider & Wall', 'stars-testimonials-with-slider-and-masonry-grid'); ?> <span class="has-tooltip">*</span><span class="tooltip__content"><?php esc_html_e('You can change the way the testimonials will be displayed', 'stars-testimonials-with-slider-and-masonry-grid'); ?></span></a></li>
											<li class="on-screen-pos"><a href="javascript:;" class="cus-tooltip"><?php esc_html_e('Collect testimonials', 'stars-testimonials-with-slider-and-masonry-grid'); ?> <span class="has-tooltip">*</span><span class="tooltip__content"><?php esc_html_e('Collect testimonials from your website  visitors by showing a button under your testimonials widget. Your testimonials will be added once you approve them. You can also create a direct link to your clients so they can submit their testimonials.', 'stars-testimonials-with-slider-and-masonry-grid'); ?></span></a></li>
                                            <li><a href="javascript:;" class="cus-tooltip"><?php esc_html_e('Rating Schema support for Google search pages', 'stars-testimonials-with-slider-and-masonry-grid'); ?> <span class="has-tooltip">*</span><span class="tooltip__content"><?php esc_html_e('Add rating schema to your WordPress pages where you use Stars Testimonial shortcode. Google search results would show up with the ratings where you have enabled the feature', 'stars-testimonials-with-slider-and-masonry-grid'); ?></span></a></li>
                                        </ul>
                                    </div>
                                    <div class="price-table-bottom">
                                        <div class="custom-dd">
                                            <select class="multiple-options">
                                                <option data-per-month="2.5" data-option="1_year" data-header="Renewals for 25% off" data-price="25" value="<?php echo esc_url($pro_url."22") ?>">
                                                    <?php esc_html_e("Updates & support for 1 year", 'stars-testimonials-with-slider-and-masonry-grid') ?>
                                                </option>
                                                <option data-per-month="2" data-option="2_year" data-header="For 2 years" data-price="39" value="<?php echo esc_url($pro_url."23") ?>">
                                                    <?php esc_html_e("Updates & support for 2 years", 'stars-testimonials-with-slider-and-masonry-grid') ?>
                                                </option>
                                                <option data-per-month="" data-option="lifetime" data-header="For lifetime" data-price="79" value="<?php echo esc_url($pro_url."24") ?>">
                                                    <?php esc_html_e("Updates & support for lifetime", 'stars-testimonials-with-slider-and-masonry-grid') ?>
                                                </option>
                                            </select>
                                        </div>
                                        <a class="cart-link" target="_blank" href="<?php echo esc_url($pro_url."22") ?>"><?php esc_html_e('Buy now', 'stars-testimonials-with-slider-and-masonry-grid'); ?></a>
                                    </div>
                                    <div class="bottom-position"></div>
                                </div>
                            </div>
                            <div class="col-md-4 col-sm-12">
                                <div class="price-table plus-feature">
                                    <div class="price-table-top">
                                        <div class="price-head">
                                            <div class="plan-name"><?php esc_html_e('Plus', 'stars-testimonials-with-slider-and-masonry-grid'); ?></div>
                                            <div class="plan-price"><?php esc_html_e('$59', 'stars-testimonials-with-slider-and-masonry-grid'); ?><span><?php esc_html_e('/year', 'stars-testimonials-with-slider-and-masonry-grid'); ?></span></div>
                                        </div>
                                        <div class="plan-center">
                                            <div class="price-permonth">Less than <b>$5</b>/mo <span class="full-width-bold">Billed Yearly</span></div>
                                            <div class="price-offer"><?php esc_html_e('Renewals for 25% off', 'stars-testimonials-with-slider-and-masonry-grid'); ?></div>
                                        </div>
                                    </div>
                                    <div class="price-table-middle">
                                        <ul>
                                            <li><a href="javascript:;" class="cus-tooltip"><?php esc_html_e('5 websites', 'stars-testimonials-with-slider-and-masonry-grid'); ?> <span class="has-tooltip">*</span><span class="tooltip__content"><?php esc_html_e('Use Stars Testimonials on 5 domains', 'stars-testimonials-with-slider-and-masonry-grid'); ?></span></a></li>
                                            <li><a href="javascript:;" class="cus-tooltip"><?php esc_html_e('All styles', 'stars-testimonials-with-slider-and-masonry-grid'); ?> <span class="has-tooltip">*</span><span class="tooltip__content"><?php esc_html_e('All testimonials templates will be available for you', 'stars-testimonials-with-slider-and-masonry-grid'); ?></span></a></li>
                                            <li><a href="javascript:;" class="cus-tooltip"><?php esc_html_e('All colors', 'stars-testimonials-with-slider-and-masonry-grid'); ?> <span class="has-tooltip">*</span><span class="tooltip__content"><?php esc_html_e('You will be able to change the colors of the testimonials components, including using HEX code', 'stars-testimonials-with-slider-and-masonry-grid'); ?></span></a></li>
                                            <li><a href="javascript:;" class="cus-tooltip"><?php esc_html_e('Slider & Wall', 'stars-testimonials-with-slider-and-masonry-grid'); ?> <span class="has-tooltip">*</span><span class="tooltip__content"><?php esc_html_e('You can change the way the testimonials will be displayed', 'stars-testimonials-with-slider-and-masonry-grid'); ?></span></a></li>
											<li class="on-screen-pos"><a href="javascript:;" class="cus-tooltip"><?php esc_html_e('Collect testimonials', 'stars-testimonials-with-slider-and-masonry-grid'); ?> <span class="has-tooltip">*</span><span class="tooltip__content"><?php esc_html_e('Collect testimonials from your websites visitors by showing a button under your testimonials widget. Your testimonials will be added once you approve them. You can also create a direct link to your clients so they can submit their testimonials.', 'stars-testimonials-with-slider-and-masonry-grid'); ?></span></a></li>
                                            <li><a href="javascript:;" class="cus-tooltip"><?php esc_html_e('Rating Schema support for Google search pages', 'stars-testimonials-with-slider-and-masonry-grid'); ?> <span class="has-tooltip">*</span><span class="tooltip__content"><?php esc_html_e('Add rating schema to your WordPress pages where you use Stars Testimonial shortcode. Google search results would show up with the ratings where you have enabled the feature', 'stars-testimonials-with-slider-and-masonry-grid'); ?></span></a></li>
                                        </ul>
                                    </div>
                                    <div class="price-table-bottom">
                                        <div class="custom-dd">
                                            <select class="multiple-options">
                                                <option data-per-month="5" data-option="1_year" data-header="Renewals for 25% off" data-price="59" value="<?php echo esc_url($pro_url."25") ?>">
                                                    <?php esc_html_e("Updates & support for 1 year", 'stars-testimonials-with-slider-and-masonry-grid') ?>
                                                </option>
                                                <option data-per-month="4" data-option="2_year" data-header="For 2 years" data-price="89" value="<?php echo esc_url($pro_url."26") ?>">
                                                    <?php esc_html_e("Updates & support for 2 years", 'stars-testimonials-with-slider-and-masonry-grid') ?>
                                                </option>
                                                <option data-per-month="6.5" data-option="lifetime" data-header="For lifetime" data-price="149" value="<?php echo esc_url($pro_url."27") ?>">
                                                    <?php esc_html_e("Updates & support for lifetime", 'stars-testimonials-with-slider-and-masonry-grid') ?>
                                                </option>
                                            </select>
                                        </div>
                                        <a class="cart-link" target="_blank" href="<?php echo esc_url($pro_url."25") ?>"><?php esc_html_e('Buy now', 'stars-testimonials-with-slider-and-masonry-grid'); ?></a>
                                    </div>
                                    <div class="bottom-position"></div>
                                </div>
                            </div>
                            <div class="col-md-4 col-sm-12">
                                <div class="price-table agency-feature">
                                    <div class="price-table-top">
                                        <div class="price-head">
                                            <div class="plan-name"><?php esc_html_e('Agency', 'stars-testimonials-with-slider-and-masonry-grid'); ?></div>
                                            <div class="plan-price"><?php esc_html_e('$99', 'stars-testimonials-with-slider-and-masonry-grid'); ?><span><?php esc_html_e('/year', 'stars-testimonials-with-slider-and-masonry-grid'); ?></span></div>
                                        </div>
                                        <div class="plan-center">
                                            <div class="price-permonth">Less than <b>$8.5</b>/mo <span class="full-width-bold">Billed Yearly</span></div>
                                            <!--div class="price-websites">For agencies who manage clients</div-->
                                            <div class="price-offer"><?php esc_html_e('Renewals for 25% off', 'stars-testimonials-with-slider-and-masonry-grid'); ?></div>
                                        </div>
                                    </div>
                                    <div class="price-table-middle">
                                        <ul>
                                            <li>
                                                <div class="website-package">
                                                    <select class="multiple-web-options">
                                                        <option value="50_websites"><?php esc_html_e('50 websites', 'stars-testimonials-with-slider-and-masonry-grid'); ?></option>
                                                        <option value="500_websites"><?php esc_html_e('500 websites', 'stars-testimonials-with-slider-and-masonry-grid'); ?></option>
                                                        <option value="1000_websites"><?php esc_html_e('1000 websites', 'stars-testimonials-with-slider-and-masonry-grid'); ?></option>
                                                    </select>
                                                </div>
                                            </li>
                                            <li><a href="javascript:;" class="cus-tooltip"><?php esc_html_e('All styles', 'stars-testimonials-with-slider-and-masonry-grid'); ?> <span class="has-tooltip">*</span><span class="tooltip__content"><?php esc_html_e('All testimonials templates will be available for you', 'stars-testimonials-with-slider-and-masonry-grid'); ?></span></a></li>
                                            <li><a href="javascript:;" class="cus-tooltip"><?php esc_html_e('All colors', 'stars-testimonials-with-slider-and-masonry-grid'); ?> <span class="has-tooltip">*</span><span class="tooltip__content"><?php esc_html_e('You will be able to change the colors of the testimonials components, including using HEX code', 'stars-testimonials-with-slider-and-masonry-grid'); ?></span></a></li>
                                            <li><a href="javascript:;" class="cus-tooltip"><?php esc_html_e('Slider & Wall', 'stars-testimonials-with-slider-and-masonry-grid'); ?> <span class="has-tooltip">*</span><span class="tooltip__content"><?php esc_html_e('You can change the way the testimonials will be displayed', 'stars-testimonials-with-slider-and-masonry-grid'); ?></span></a></li>
											<li class="on-screen-pos"><a href="javascript:;" class="cus-tooltip"><?php esc_html_e('Collect testimonials', 'stars-testimonials-with-slider-and-masonry-grid'); ?> <span class="has-tooltip">*</span><span class="tooltip__content"><?php esc_html_e('Collect testimonials from your websites visitors by showing a button under your testimonials widget. Your testimonials will be added once you approve them. You can also create a direct link to your clients so they can submit their testimonials.', 'stars-testimonials-with-slider-and-masonry-grid'); ?></span></a></li>
                                            <li><a href="javascript:;" class="cus-tooltip"><?php esc_html_e('Rating Schema support for Google search pages', 'stars-testimonials-with-slider-and-masonry-grid'); ?> <span class="has-tooltip">*</span><span class="tooltip__content"><?php esc_html_e('Add rating schema to your WordPress pages where you use Stars Testimonial shortcode. Google search results would show up with the ratings where you have enabled the feature', 'stars-testimonials-with-slider-and-masonry-grid'); ?></span></a></li>
                                        </ul>
                                    </div>
                                    <div class="price-table-bottom">
                                        <div class="custom-dd">
                                            <select class="multiple-options has-multiple-websites">
                                                <option data-per-month="8.5" data-option="1_year" data-header="Renewals for 25% off" data-price="99" value="<?php echo esc_url($pro_url."28") ?>">
                                                    <?php esc_html_e("Updates & support for 1 year", 'stars-testimonials-with-slider-and-masonry-grid') ?>
                                                </option>
                                                <option data-per-month="6.5" data-option="2_year" data-header="For 2 years" data-price="149" value="<?php echo esc_url($pro_url."29") ?>">
                                                    <?php esc_html_e("Updates & support for 2 years", 'stars-testimonials-with-slider-and-masonry-grid') ?>
                                                </option>
                                                <option data-per-month="" data-option="lifetime" data-header="For lifetime" data-price="249" value="<?php echo esc_url($pro_url."30") ?>">
                                                    <?php esc_html_e("Updates & support for lifetime", 'stars-testimonials-with-slider-and-masonry-grid') ?>
                                                </option>
                                            </select>
                                        </div>
                                        <a class="cart-link" target="_blank" href="<?php echo esc_url($pro_url."28") ?>"><?php esc_html_e('Buy now', 'stars-testimonials-with-slider-and-masonry-grid'); ?></a>
                                    </div>
                                    <div class="bottom-position"></div>
                                </div>
                            </div>
                        </div>
                        <div class="clearfix"></div>
                    </div>
                </div>
                <div class="text-center price-after">
                    <p class="money-guaranteed"><span class="dashicons dashicons-yes"></span>
                        <?php esc_html_e("30 days money back guaranteed", 'stars-testimonials-with-slider-and-masonry-grid'); ?>
                    </p>
                    <p class="money-guaranteed"><span class="dashicons dashicons-yes"></span>
                        <?php esc_html_e("The plugin will always keep working even if you don't renew your license", 'stars-testimonials-with-slider-and-masonry-grid'); ?>
                    </p>
                    <div class="payments">
                        <img src="<?php echo esc_url( plugins_url('/images/admin/payment.png', __FILE__) ) ?>" alt="<?php echo esc_attr__( 'Payment', 'stars-testimonials-with-slider-and-masonry-grid' ); ?>" class="payment-img" />
                    </div>
                </div>
                <div class="folder-testimonial-list">
                    <div class="folder-testimonial">
                        <div class="testimonial-image"> <img src="<?php echo esc_url( plugins_url('/images/admin/client-image.jpg', __FILE__) ) ?>" alt="<?php echo esc_attr__( 'Client image', 'stars-testimonials-with-slider-and-masonry-grid' ); ?>"> </div>
                        <div class="testimonial-data">
                            <div class="testimonial-desc"><?php esc_html_e('This plugin is used in my website, it is perfect in the All. Support is great, very fast answer & action! Recommendable!', 'stars-testimonials-with-slider-and-masonry-grid'); ?></div>
                            <div class="testimonial-author"><?php esc_html_e('- Biljana Bili Wechsler, ', 'stars-testimonials-with-slider-and-masonry-grid'); ?><small><?php esc_html_e('Bilifotos', 'stars-testimonials-with-slider-and-masonry-grid'); ?></small></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    (function (factory) {
        "use strict";
        if (typeof define === 'function' && define.amd) {
            define(['jquery'], factory);
        }
        else if(typeof module !== 'undefined' && module.exports) {
            module.exports = factory(require('jquery'));
        }
        else {
            factory(jQuery);
        }
    }(function ($, undefined) {
        var priceOptions = {
            "50_websites": {
                "1_year": {
                    "price": 99,
                    "per_month":8.5,
                    "link": "https://go.premio.io/?edd_action=add_to_cart&download_id=13&edd_options[price_id]=28"
                },
                "2_year": {
                    "price": 149,
                    "per_month":6.5,
                    "link": "https://go.premio.io/?edd_action=add_to_cart&download_id=13&edd_options[price_id]=29"
                },
                "lifetime": {
                    "price": 249,
                    "link": "https://go.premio.io/?edd_action=add_to_cart&download_id=13&edd_options[price_id]=30"
                }
            },
            "500_websites": {
                "1_year": {
                    "price": 179,
                    "per_month":15,
                    "link": "https://go.premio.io/?edd_action=add_to_cart&download_id=13&edd_options[price_id]=31"
                },
                "2_year": {
                    "price": 269,
                    "per_month":11.5,
                    "link": "https://go.premio.io/?edd_action=add_to_cart&download_id=13&edd_options[price_id]=32"
                },
                "lifetime": {
                    "price": 499,
                    "link": "https://go.premio.io/?edd_action=add_to_cart&download_id=13&edd_options[price_id]=33"
                }
            },
            "1000_websites": {
                "1_year": {
                    "price": 249,
                    "per_month":21,
                    "link": "https://go.premio.io/?edd_action=add_to_cart&download_id=13&edd_options[price_id]=34"
                },
                "2_year": {
                    "price": 375,
                    "per_month":16,
                    "link": "https://go.premio.io/?edd_action=add_to_cart&download_id=13&edd_options[price_id]=35"
                },
                "lifetime": {
                    "price": 619,
                    "link": "https://go.premio.io/?edd_action=add_to_cart&download_id=13&edd_options[price_id]=36"
                }
            }
        };
        $(document).on('ready', function(){
            if($(".multiple-options").length) {
                $(".multiple-options").select2({
                    minimumResultsForSearch: -1
                });
            }
            if($(".multiple-web-options").length) {
                $(".multiple-web-options").select2({
                    minimumResultsForSearch: -1
                });
            }
            $(document).on("click", ".pricing-table-content", function(){
                if(!$(this).hasClass("active")) {
                    $(".pricing-table-content").removeClass("active");
                    $(this).addClass("active");
                    var datFor = $(this).data("option");
                    $(".multiple-options").each(function(){
                        $(this).find("option").prop("selected", false);
                        $(this).find("option[data-option='"+datFor+"']").prop("selected", true);
                        $(this).trigger("change");
                    })
                }
            });
            $(document).on("change", ".multiple-options", function(){
                priceText = $(this).find("option:selected").attr("data-header");
                thisValue = $(this).val();
                thisPrice = $(this).find("option:selected").attr("data-price");
                thisperMonth = $(this).find("option:selected").attr("data-per-month");
                if(!$(this).hasClass("has-multiple-websites")) {
                    $(this).closest(".price-table").find("a.cart-link").attr("href", thisValue);
                    $(this).closest(".price-table").find(".plan-price").text("$" + thisPrice);
                } else {
                    var webOption = $(".multiple-web-options").val();
                    var priceSettings = priceOptions[webOption];
                    var yearPlan = $(".multiple-options.has-multiple-websites option:selected").attr("data-option");
                    if(priceSettings[yearPlan] != undefined) {
                        priceSettings = priceSettings[yearPlan];
                        thisValue = priceSettings.link;
                        thisPrice = priceSettings.price;
                        thisperMonth = priceSettings.per_month;
                    }
                }
                thisOption = $(this).find("option:selected").attr("data-option");
                if(thisOption == "1_year") {
                    thisPrice = thisPrice+"<span>/year</span>";
                    per_month = "Less than <b>$" + thisperMonth + "</b>/mo <span class='full-width-bold'>Billed Yearly</span>";
                    priceText = "Renewals for <b>25% off</b>";
                } else if(thisOption == "2_year") {
                    thisPrice = thisPrice+"<span>/2 years</span>";
                    per_month = "Less than <b>$" + thisperMonth + "</b>/mo <span class='full-width-bold'>Billed Yearly after 2 Years</span>";
                    priceText = "Renewals for <b>25% off</b>";
                } else {
                    thisPrice = thisPrice+"<span>/lifetime</span>";
                    per_month = "<span class='full-width-bold'>Best value</span>";
                    priceText = "For lifetime";
                }
                $(this).closest(".price-table").find("a.cart-link").attr("href", thisValue);
                $(this).closest(".price-table").find(".plan-price").html("$" + thisPrice);
                $(this).closest(".price-table").find(".price-permonth").html(per_month);
                if ( per_month == '' ) {
                    $(this).closest(".price-table").find(".price-permonth").hide();
                } else {
                    $(this).closest(".price-table").find(".price-permonth").show();
                }
                $(this).closest(".price-table").find(".price-offer").html(priceText);
            });
    
            $(document).on("change", ".multiple-web-options", function(){
                $(".multiple-options.has-multiple-websites").trigger("change");
            });
    
            if($(".multiple-options.has-multiple-websites").length) {
                $(".multiple-options.has-multiple-websites").trigger("change");
            }

            checkForPricingPos();
        });

        $(window).on("scroll", function(){
            checkForPricingPos();
        });

        $(window).on("resize", function(){
            checkForPricingPos();
        });

        function checkForPricingPos() {
            $(".bottom-position").each(function(){
                if($(this).closest(".price-table").find(".on-screen-pos").length) {
                    var toolPos = $(this).closest(".price-table").find(".on-screen-pos").offset().top - $(window).scrollTop() - $(window).height();
                    if(toolPos < 0) {
                        if ($(this).offset().top - $(window).scrollTop() - $(window).height() < -3) {
                            $(this).closest(".price-table").removeClass("is-fixed");
                            $(this).closest(".price-table").find(".price-table-bottom").prop("style", "");
                        } else {
                            $(this).closest(".price-table").addClass("is-fixed");
                            $(this).closest(".price-table").find(".price-table-bottom").css("top", ($(window).height() - 125) + "px");
                            $(this).closest(".price-table").find(".price-table-bottom").css("left", $(this).offset().left + "px");
                            $(this).closest(".price-table").find(".price-table-bottom").outerWidth($(this).closest(".price-table").width());
                        }
                    } else {
                        $(this).closest(".price-table").removeClass("is-fixed");
                        $(this).closest(".price-table").find(".price-table-bottom").prop("style", "");
                    }
                }
            });
            setTooltipPosition();
        }

        function setTooltipPosition() {
            if($(".html-tooltip:not(.no-position)").length) {
                $(".html-tooltip:not(.no-position)").each(function(){
                    if($(this).offset().top - $(window).scrollTop() > 540) {
                        $(this).addClass("top").removeClass("side").removeClass("bottom");
                        $(this).find(".tooltip-text").attr("style","");
                        $(this).find(".tooltip-text").removeClass("hide-arrow");
                    } else if($(window).height() - ($(this).offset().top - $(window).scrollTop()) > 460) {
                        $(this).addClass("bottom").removeClass("top").removeClass("side");
                        $(this).find(".tooltip-text").attr("style","");
                        $(this).find(".tooltip-text").removeClass("hide-arrow");
                    } else {
                        $(this).addClass("side").removeClass("top").removeClass("bottom");
                        if($(this).find(".tooltip-text").length) {
                            $(this).find(".tooltip-text").attr("style","");
                            $(this).find(".tooltip-text").removeClass("hide-arrow");

                            if($(this).find(".tooltip-text").offset().top - $(window).scrollTop() - 50 < 0) {
                                $(this).find(".tooltip-text").css("margin-top", Math.abs($(this).find(".tooltip-text").offset().top - $(window).scrollTop() - 50)+"px");
                                $(this).find(".tooltip-text").addClass("hide-arrow");
                            } else {
                                $(this).find(".tooltip-text").attr("style","");
                                if(($(this).find(".tooltip-text").offset().top + parseInt($(this).find(".tooltip-text").outerHeight()) - $(window).scrollTop() - $(window).height()) > 0) {
                                    $(this).find(".tooltip-text").css("margin-top", ((-1)*Math.abs($(this).find(".tooltip-text").offset().top + parseInt($(this).find(".tooltip-text").outerHeight()) - $(window).scrollTop() - $(window).height()) - 10)+"px");
                                    $(this).find(".tooltip-text").addClass("hide-arrow");
                                }
                            }
                        }
                    }
                });
            }
        }
    }));
</script>
