﻿function changeTextSize(size) {
    createCookie("textSize", size, 1);

    if (size == "13px") {
        document.getElementById("smallText").src = "images/topHeader_textSize1on.gif";
        document.getElementById("regularText").src = "images/topHeader_textSize2off.gif";
        document.getElementById("largeText").src = "images/topHeader_textSize3off.gif";
    }
    else if (size == "15px") {
        document.getElementById("smallText").src = "images/topHeader_textSize1off.gif";
        document.getElementById("regularText").src = "images/topHeader_textSize2on.gif";
        document.getElementById("largeText").src = "images/topHeader_textSize3off.gif";
    }
    else if (size == "17px") {
        document.getElementById("smallText").src = "images/topHeader_textSize1off.gif";
        document.getElementById("regularText").src = "images/topHeader_textSize2off.gif";
        document.getElementById("largeText").src = "images/topHeader_textSize3on.gif";
    }
}

function createCookie(name, value, days) {
    if (days) {
        var date = new Date();
        date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
        var expires = "; expires=" + date.toGMTString();
    }
    else var expires = "";
    document.cookie = name + "=" + value + expires + "; path=/";
}

function readCookie(name) {
    var ca = document.cookie.split(';');
    var nameEQ = name + "=";
    for (var i = 0; i < ca.length; i++) {
        var c = ca[i];
        while (c.charAt(0) == ' ') c = c.substring(1, c.length); //delete spaces
        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
    }
    return null;
}

function setTextSize() {
    if (readCookie("textSize") != null) {
        changeTextSize(readCookie("textSize"));
    }
    else {
        changeTextSize("13px");
    }
}

function OffRamp(url, msg) {
    if (msg == '') msg = 'The \"Yes\" link below will take you out of the Abbott Laboratories family of websites.\n\nLinks that take you out of Abbott Laboratories worldwide websites are not under the control of Abbott Laboratories, and Abbott Laboratories is not responsible for the contents of any such site or any further links from such site. Abbott Laboratories is providing these links to you only as a convenience, and the inclusion of any link does not imply endorsement of the linked site by Abbott Laboratories.';

    if (confirm(msg)) {
        var pop = window.open(url, 'ExternalSite');

    }
}

function swapImages()
{
    if (document.getElementById("content-header").innerHTML) 
    {
        //document.getElementById("content-header").innerHTML = "<img src=\"images/approx-copy.jpg\" border=\"0\" alt=\"Treatment for Secondary Hyperparathyroidism a complication of CKD Stages 3, 4 and 5 – www.zemplar.com\" />";
    }

    if (document.getElementById("homepage-content-middle-center").innerHTML)
    {
        document.getElementById("homepage-content-middle-center").innerHTML = "<a href=\"cost-savings.aspx\"><img class=\"five-dollar-image png_bg\" src=\"images/5-dollar.png\" border=\"0\" alt=\"Save Money on Zemplar\" /></a>";
    }
}
