function ToggleTabBusinessSignup(tabName) {
    var overviewTab = document.getElementById("OverviewTab");
    var certificationTab = document.getElementById("CertificationTab");
    var pricingTab = document.getElementById("PricingTab");
    var getStartedTab = document.getElementById("GetStartedTab");

    var overview = document.getElementById("BusinessSignupOverview");
    var certification = document.getElementById("BusinessSignupCertification");
    var pricing = document.getElementById("BusinessSignupPricing");
    var getStarted = document.getElementById("BusinessSignupGetStarted");

    if (tabName == "Overview") {
        overview.setAttribute("class", "OverviewTabGfx");
        overview.setAttribute("className", "OverviewTabGfx");
        certification.setAttribute("class", "CertificationTabGfxHidden");
        certification.setAttribute("className", "CertificationTabGfxHidden");
        pricing.setAttribute("class", "PricingTabGfxHidden");
        pricing.setAttribute("className", "PricingTabGfxHidden");
        getStarted.setAttribute("class", "GetStartedTabGfxHidden");
        getStarted.setAttribute("className", "GetStartedTabGfxHidden");

        overviewTab.style.display = "block";
        certificationTab.style.display = "none";
        pricingTab.style.display = "none";
        getStartedTab.style.display = "none";
    }
    else if (tabName == "Certification") {
        overview.setAttribute("class", "OverviewTabGfxHidden");
        overview.setAttribute("className", "OverviewTabGfxHidden");
        certification.setAttribute("class", "CertificationTabGfx");
        certification.setAttribute("className", "CertificationTabGfx");
        pricing.setAttribute("class", "PricingTabGfxHidden");
        pricing.setAttribute("className", "PricingTabGfxHidden");
        getStarted.setAttribute("class", "GetStartedTabGfxHidden");
        getStarted.setAttribute("className", "GetStartedTabGfxHidden");

        overviewTab.style.display = "none";
        certificationTab.style.display = "block";
        pricingTab.style.display = "none";
        getStartedTab.style.display = "none";
    }
    else if (tabName == "Pricing") {
        overview.setAttribute("class", "OverviewTabGfxHidden");
        overview.setAttribute("className", "OverviewTabGfxHidden");
        certification.setAttribute("class", "CertificationTabGfxHidden");
        certification.setAttribute("className", "CertificationTabGfxHidden");
        pricing.setAttribute("class", "PricingTabGfx");
        pricing.setAttribute("className", "PricingTabGfx");
        getStarted.setAttribute("class", "GetStartedTabGfxHidden");
        getStarted.setAttribute("className", "GetStartedTabGfxHidden");

        overviewTab.style.display = "none";
        certificationTab.style.display = "none";
        pricingTab.style.display = "block";
        getStartedTab.style.display = "none";
    }
    else if (tabName == "GetStarted") {
        overview.setAttribute("class", "OverviewTabGfxHidden");
        overview.setAttribute("className", "OverviewTabGfxHidden");
        certification.setAttribute("class", "CertificationTabGfxHidden");
        certification.setAttribute("className", "CertificationTabGfxHidden");
        pricing.setAttribute("class", "PricingTabGfxHidden");
        pricing.setAttribute("className", "PricingTabGfxHidden");
        getStarted.setAttribute("class", "GetStartedTabGfx");
        getStarted.setAttribute("className", "GetStartedTabGfx");

        overviewTab.style.display = "none";
        certificationTab.style.display = "none";
        pricingTab.style.display = "none";
        getStartedTab.style.display = "block";
    }
}

function setActiveBusinessSignupTab() {
    var view = getQueryString()["View"];
    if (view == "Overview" || view == null || view == "") {
        ToggleTabBusinessSignup('Overview');
    } else if (view == "Certification") {
        ToggleTabBusinessSignup('Certification');
    } else if (view == "Pricing") {
        ToggleTabBusinessSignup('Pricing');
    } else if (view == "GetStarted") {
        ToggleTabBusinessSignup('GetStarted');
    }
}

function ToggleHowItWorksTab(tabName) {
    var certification = document.getElementById("HowItWorksCertification");
    var performance = document.getElementById("HowItWorksPerformance");
    var personal = document.getElementById("HowItWorksPersonal");
    var privacy = document.getElementById("HowItWorksPrivacy");
    var transparency = document.getElementById("HowItWorksTransparency");

    var certificationTab = document.getElementById("CertificationTab");
    var performanceTab = document.getElementById("PerformanceTab");
    var personalTab = document.getElementById("PersonalTab");
    var privacyTab = document.getElementById("PrivacyTab");
    var transparencyTab = document.getElementById("TransparencyTab");

    if (tabName == "Certification") {
        certification.setAttribute("class", "CertificationTabGraphics");
        certification.setAttribute("className", "CertificationTabGraphics");

        performance.setAttribute("class", "PerformanceTabGraphics Hidden");
        performance.setAttribute("className", "PerformanceTabGraphics Hidden");

        personal.setAttribute("class", "PersonalTabGraphics Hidden");
        personal.setAttribute("className", "PersonalTabGraphics Hidden");

        privacy.setAttribute("class", "PrivacyTabGraphics Hidden");
        privacy.setAttribute("className", "PrivacyTabGraphics Hidden");

        transparency.setAttribute("class", "TransparencyTabGraphics Hidden");
        transparency.setAttribute("className", "TransparencyTabGraphics Hidden");

        certificationTab.style.display = "block";
        performanceTab.style.display = "none";
        personalTab.style.display = "none";
        privacyTab.style.display = "none";
        transparencyTab.style.display = "none";
    }
    else if (tabName == "Performance") {
        certification.setAttribute("class", "CertificationTabGraphics Hidden");
        certification.setAttribute("className", "CertificationTabGraphics Hidden");

        performance.setAttribute("class", "PerformanceTabGraphics");
        performance.setAttribute("className", "PerformanceTabGraphics");

        personal.setAttribute("class", "PersonalTabGraphics Hidden");
        personal.setAttribute("className", "PersonalTabGraphics Hidden");

        privacy.setAttribute("class", "PrivacyTabGraphics Hidden");
        privacy.setAttribute("className", "PrivacyTabGraphics Hidden");

        transparency.setAttribute("class", "TransparencyTabGraphics Hidden");
        transparency.setAttribute("className", "TransparencyTabGraphics Hidden");

        certificationTab.style.display = "none";
        performanceTab.style.display = "block";
        personalTab.style.display = "none";
        privacyTab.style.display = "none";
        transparencyTab.style.display = "none";
    }
    else if (tabName == "Personal") {
        certification.setAttribute("class", "CertificationTabGraphics Hidden");
        certification.setAttribute("className", "CertificationTabGraphics Hidden");

        performance.setAttribute("class", "PerformanceTabGraphics Hidden");
        performance.setAttribute("className", "PerformanceTabGraphics Hidden");

        personal.setAttribute("class", "PersonalTabGraphics");
        personal.setAttribute("className", "PersonalTabGraphics");

        privacy.setAttribute("class", "PrivacyTabGraphics Hidden");
        privacy.setAttribute("className", "PrivacyTabGraphics Hidden");

        transparency.setAttribute("class", "TransparencyTabGraphics Hidden");
        transparency.setAttribute("className", "TransparencyTabGraphics Hidden");

        certificationTab.style.display = "none";
        performanceTab.style.display = "none";
        personalTab.style.display = "block";
        privacyTab.style.display = "none";
        transparencyTab.style.display = "none";
    }
    else if (tabName == "Privacy") {
        certification.setAttribute("class", "CertificationTabGraphics Hidden");
        certification.setAttribute("className", "CertificationTabGraphics Hidden");

        performance.setAttribute("class", "PerformanceTabGraphics Hidden");
        performance.setAttribute("className", "PerformanceTabGraphics Hidden");

        personal.setAttribute("class", "PersonalTabGraphics Hidden");
        personal.setAttribute("className", "PersonalTabGraphics Hidden");

        privacy.setAttribute("class", "PrivacyTabGraphics");
        privacy.setAttribute("className", "PrivacyTabGraphics");

        transparency.setAttribute("class", "TransparencyTabGraphics Hidden");
        transparency.setAttribute("className", "TransparencyTabGraphics Hidden");

        certificationTab.style.display = "none";
        performanceTab.style.display = "none";
        personalTab.style.display = "none";
        privacyTab.style.display = "block";
        transparencyTab.style.display = "none";
    }
    else if (tabName == "Transparency") {
        certification.setAttribute("class", "CertificationTabGraphics Hidden");
        certification.setAttribute("className", "CertificationTabGraphics Hidden");

        performance.setAttribute("class", "PerformanceTabGraphics Hidden");
        performance.setAttribute("className", "PerformanceTabGraphics Hidden");

        personal.setAttribute("class", "PersonalTabGraphics Hidden");
        personal.setAttribute("className", "PersonalTabGraphics Hidden");

        privacy.setAttribute("class", "PrivacyTabGraphics Hidden");
        privacy.setAttribute("className", "PrivacyTabGraphics Hidden");

        transparency.setAttribute("class", "TransparencyTabGraphics");
        transparency.setAttribute("className", "TransparencyTabGraphics");

        certificationTab.style.display = "none";
        performanceTab.style.display = "none";
        personalTab.style.display = "none";
        privacyTab.style.display = "none";
        transparencyTab.style.display = "block";
    }
}

function ImageGallery_DeletePhoto() {
    var galleria = Galleria.get(0);
    if (galleria != null) {
        var activeImage = galleria.getActiveImage();
        DeletePhotoFromServer(activeImage.src, null);
        alert('The photo has been queued for deletion. Please allow up to 20 minutes for the operation to be completed across all datacenters.');
        window.location = document.URL;
    }
}

function setActiveHowItWorksTab() {
    var view = getQueryString()["View"];
    if (view == "Certification" || view == null || view == "") {
        ToggleHowItWorksTab('Certification');
    } else if (view == "Performance") {
        ToggleHowItWorksTab('Performance');
    } else if (view == "Personal") {
        ToggleHowItWorksTab('Personal');
    } else if (view == "Privacy") {
        ToggleHowItWorksTab('Privacy');
    } else if (view == "Transparency") {
        ToggleHowItWorksTab('Transparency');
    }
}

function getQueryString() {
    var result = {}, queryString = location.search.substring(1), re = /([^&=]+)=([^&]*)/g, m;

    while (m = re.exec(queryString)) {
        result[decodeURIComponent(m[1])] = decodeURIComponent(m[2]);
    }

    return result;
}

function setActiveInput(id) {
    var activeInput = document.getElementById(id);
    if (activeInput.style.color == "rgb(153, 153, 153)") {
        activeInput.value = "";
        activeInput.style.color = "black";
    }
}
