﻿/* PRICING & WHY UPGRADE PAGES (+/-) TOGGLE BTN */
function ToggleElement(id) {
    var elem = document.getElementById(id);
    var elemImg = document.getElementById(id + "Img");
    if (!elem || elem == null)
        return;
    if (!elemImg || elemImg == null)
        return;
    if (elem.style.display == 'none') {
        elem.style.display = '';
        elemImg.src = '../App_Themes/NewStyle/Images/Misc/expanderIcon_close.gif';
    } else {
        elem.style.display = 'none';
        elemImg.src = '../App_Themes/NewStyle/Images/Misc/expanderIcon_open.gif';
    }
}
/* PORTAL KB ARTICLE POPUP */
function DoOpenKB(page) {
    window.open(page, "billingFAQ", "location=1,resizable=1,scrollbars=1,height=570,width=820");
    return false;
}
/* POPUP WINDOW FOR PRODUCT VIDEOS */
function videoWin(url) {
    window.open(url, "_blank", "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=800, height=600, top=100, left=100");
}
/* POPUP WINDOW FOR KEYTERMS, DOWNLOAD PAGES, AND SUPPORT PAGES */
var popupStatus = 0;
function loadWin(elm) {
    if (popupStatus == 0) {
        $("#popBg").css({
            "opacity": "0.7"
        });
        $("#popBg").fadeIn("fast");
        $("#" + elm).fadeIn("fast", function() {
            if (jQuery.browser.msie) {
                $(this).get(0).style.removeAttribute('filter');
            }
        });
        popupStatus = 1;
    }
}
function closeWin() {
    if (popupStatus == 1) {
        $("#popBg").fadeOut("fast");
        $(".popup").fadeOut("fast");
        popupStatus = 0;
    }
}
function centerWin(elm) {
    var popupWidth = $("#" + elm).width();
    var popupHeight = $("#" + elm).height();
    $("#" + elm).css({
        "top": "50%",
        "left": "50%",
        "margin-left": popupWidth / -2,
        "margin-top": popupHeight / -2
    });
    $("#popBg").css({
        "width": "100%",
        "height": "100%"
    });
}
function expandObj(id) {
    var panel = document.getElementById(id);
    var btn = document.getElementById(id + "Btn");
    if (panel.style.display == "none") {
        panel.style.display = "";
        $(btn).css({
            "background": "url(../App_Themes/NewStyle/Images/Misc/expanderIcon.gif) 0 -12px no-repeat"
        });
    } else {
        panel.style.display = "none";
        $(btn).css({
            "background": "url(../App_Themes/NewStyle/Images/Misc/expanderIcon.gif) 0 0 no-repeat"
        });
    }
} 
/* JQUERY ON PAGE LOAD */
$(document).ready(function() {
    var item = "";
    $(".openpop").click(function() {
        item = this.rel;
        centerWin(item);
        loadWin(item);
    });
    $(".exp").click(function() {
        item = this.rel;
        expandObj(item);
    });
    $(".closepop").click(function() {
        closeWin();
    });
    $("#popBg").click(function() {
        closeWin();
    });
});