﻿

function changeTextSize(size) {
    switch (size) {
        case 0:
            $('#smallA').css("color", "#c2075e");
            $('#mediumA').css("color", "#555");
            $('#bigA').css("color", "#555");          
            $(".page_content p").css("font-size", "10px");
            $(".page_content p").css("line-height", "15px");

            $(".page_content h2").css("font-size", "12px");
            $(".page_content h2").css("line-height", "17px");

            $(".page_content ul").css("font-size", "10px");
            $(".page_content ul").css("line-height", "15px");

            $(".quote p").css("font-size", "14px");
            $(".quote p").css("line-height", "20px");

            $(".quote2 p").css("font-size", "14px");
            $(".quote2 p").css("line-height", "20px");

            $(".quote p.right_two").css("font-size", "11px");

            $(".quote2 p.right_two").css("font-size", "11px");

            $(".ques_ans h3").css("font-size", "10px");


            $(".page_references ol").css("font-size", "10px");
            $(".page_references ol").css("line-height", "15px");

            $(".privacy_content p").css("font-size", "10px");
            $(".privacy_content p").css("line-height", "15px");

            $(".privacy_content p.title").css("font-size", "10px");
            $(".privacy_content p.title").css("line-height", "15px");

            $(".sitemapText ul").css("font-size", "10px");
            $(".sitemapText ul").css("line-height", "15px");

//            $(".Left_callout p").css("font-size", "11px");
//            $(".Left_callout p").css("line-height", "16px");

//            $(".Left_callout h1").css("font-size", "12px");
//            $(".Left_callout h1").css("line-height", "17px");

//            $(".Middle_callout p").css("font-size", "11px");
//            $(".Middle_callout p").css("line-height", "16px");

//            $(".Middle_callout h1").css("font-size", "12px");
//            $(".Middle_callout h1").css("line-height", "17px");

//            $(".Right_callout p").css("font-size", "11px");
//            $(".Right_callout p").css("line-height", "16px");

//            $(".Right_callout h1").css("font-size", "12px");
//            $(".Right_callout h1").css("line-height", "17px");

            $(".Header_title h1").css("font-size", "22px");
            $(".Header_title h1").css("line-height", "28px");

            $(".content h2").css("font-size", "15px");
            $(".content h2").css("line-height", "17px");

            $(".types_HAE").css("background", "url('/images/chart_typesHAE_bk.jpg') no-repeat");
            $(".types_HAE").css("height", "244px");
            
            createCookie("textSize", 0, 1);
            break;

        case 1:
            $('#smallA').css("color", "#555");
            $('#mediumA').css("color", "#c2075e");
            $('#bigA').css("color", "#555");
            $(".page_content p").css("font-size", "12px");
            $(".page_content p").css("line-height", "17px");

            $(".page_content h2").css("font-size", "15px");
            $(".page_content h2").css("line-height", "24px");

            $(".page_content ul").css("font-size", "12px");
            $(".page_content ul").css("line-height", "17px");

            $(".quote p").css("font-size", "18px");
            $(".quote p").css("line-height", "24px");

            $(".quote2 p").css("font-size", "18px");
            $(".quote2 p").css("line-height", "24px");

            $(".quote p.right_two").css("font-size", "14px");

            $(".quote2 p.right_two").css("font-size", "14px");

            $(".ques_ans h3").css("font-size", "12px");

            $(".page_references ol").css("font-size", "12px");
            $(".page_references ol").css("line-height", "17px");

            $(".privacy_content p").css("font-size", "12px");
            $(".privacy_content p").css("line-height", "17px");

            $(".privacy_content p.title").css("font-size", "12px");
            $(".privacy_content p.title").css("line-height", "17px");

            $(".sitemapText ul").css("font-size", "12px");
            $(".sitemapText ul").css("line-height", "17px");

//            $(".Left_callout p").css("font-size", "13px");
//            $(".Left_callout p").css("line-height", "17px");

//            $(".Left_callout h1").css("font-size", "14px");
//            $(".Left_callout h1").css("line-height", "19px");

//            $(".Middle_callout p").css("font-size", "13px");
//            $(".Middle_callout p").css("line-height", "17px");

//            $(".Middle_callout h1").css("font-size", "14px");
//            $(".Middle_callout h1").css("line-height", "19px");

//            $(".Right_callout p").css("font-size", "13px");
//            $(".Right_callout p").css("line-height", "17px");

//            $(".Right_callout h1").css("font-size", "14px");
//            $(".Right_callout h1").css("line-height", "19px");

            $(".Header_title h1").css("font-size", "24px");
            $(".Header_title h1").css("line-height", "30px");

            $(".content h2").css("font-size", "15px");
            $(".content h2").css("line-height", "17px");

            $(".types_HAE").css("background", "url('/images/chart_typesHAE_bk.jpg') no-repeat");
            $(".types_HAE").css("height", "244px");
            
            createCookie("textSize", 1, 1);
            break;

        case 2:
            $('#smallA').css("color", "#555");
            $('#mediumA').css("color", "#555");
            $('#bigA').css("color", "#c2075e");
            $(".page_content p").css("font-size", "14px");
            $(".page_content p").css("line-height", "21px");

            $(".page_content h2").css("font-size", "17px");
            $(".page_content h2").css("line-height", "27px");

            $(".page_content ul").css("font-size", "14px");
            $(".page_content ul").css("line-height", "21px");

            $(".quote p").css("font-size", "20px");
            $(".quote p").css("line-height", "26px");

            $(".quote2 p").css("font-size", "20px");
            $(".quote2 p").css("line-height", "26px");

            $(".quote p.right_two").css("font-size", "16px");

            $(".quote2 p.right_two").css("font-size", "16px");

            $(".ques_ans h3").css("font-size", "14px");

            $(".page_references ol").css("font-size", "14px");
            $(".page_references ol").css("line-height", "21px");

            $(".privacy_content p").css("font-size", "14px");
            $(".privacy_content p").css("line-height", "21px");

            $(".privacy_content p.title").css("font-size", "14px");
            $(".privacy_content p.title").css("line-height", "21px");

            $(".sitemapText ul").css("font-size", "14px");
            $(".sitemapText ul").css("line-height", "21px");

//            $(".Left_callout p").css("font-size", "15px");
//            $(".Left_callout p").css("line-height", "19px");

//            $(".Left_callout h1").css("font-size", "16px");
//            $(".Left_callout h1").css("line-height", "21px");

//            $(".Middle_callout p").css("font-size", "15px");
//            $(".Middle_callout p").css("line-height", "19px");

//            $(".Middle_callout h1").css("font-size", "16px");
//            $(".Middle_callout h1").css("line-height", "21px");

//            $(".Right_callout p").css("font-size", "14px");
//            $(".Right_callout p").css("line-height", "18px");

//            $(".Right_callout h1").css("font-size", "15px");
//            $(".Right_callout h1").css("line-height", "21px");
            
            $(".Header_title h1").css("font-size", "26px");
            $(".Header_title h1").css("line-height", "32px");
            
            $(".content h2").css("font-size", "15px");
            $(".content h2").css("line-height", "17px");

            $(".types_HAE").css("background", "url('/images/chart_typesHAE_large_bk.jpg') no-repeat");
            $(".types_HAE").css("height", "330px");
            
            createCookie("textSize", 2, 1);
            break;
    }
}

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 nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for (var i = 0; i < ca.length; i++) {
        var c = ca[i];
        while (c.charAt(0) == ' ') c = c.substring(1, c.length);
        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
    }
    return null;
}

window.onload = function() {
    switch (readCookie("textSize")) {
        case "0":
            $(".page_content p").css("font-size", "10px");
            $(".page_content p").css("line-height", "15px");

            $(".page_content h2").css("font-size", "12px");
            $(".page_content h2").css("line-height", "17px");

            $(".page_content ul").css("font-size", "10px");
            $(".page_content ul").css("line-height", "15px");

            $(".quote p").css("font-size", "14px");
            $(".quote p").css("line-height", "20px");

            $(".quote2 p").css("font-size", "14px");
            $(".quote2 p").css("line-height", "20px");

            $(".quote p.right_two").css("font-size", "11px");

            $(".quote2 p.right_two").css("font-size", "11px");

            $(".ques_ans h3").css("font-size", "10px");

            $(".page_references ol").css("font-size", "10px");
            $(".page_references ol").css("line-height", "15px");

            $(".privacy_content p").css("font-size", "10px");
            $(".privacy_content p").css("line-height", "15px");

            $(".privacy_content p.title").css("font-size", "10px");
            $(".privacy_content p.title").css("line-height", "15px");

            $(".sitemapText ul").css("font-size", "10px");
            $(".sitemapText ul").css("line-height", "15px");

//            $(".Left_callout p").css("font-size", "11px");
//            $(".Left_callout p").css("line-height", "16px");

//            $(".Left_callout h1").css("font-size", "12px");
//            $(".Left_callout h1").css("line-height", "17px");

//            $(".Middle_callout p").css("font-size", "11px");
//            $(".Middle_callout p").css("line-height", "16px");

//            $(".Middle_callout h1").css("font-size", "12px");
//            $(".Middle_callout h1").css("line-height", "17px");

//            $(".Right_callout p").css("font-size", "11px");
//            $(".Right_callout p").css("line-height", "16px");

//            $(".Right_callout h1").css("font-size", "12px");
//            $(".Right_callout h1").css("line-height", "17px");

            $(".Header_title h1").css("font-size", "22px");
            $(".Header_title h1").css("line-height", "28px");

            $(".content h2").css("font-size", "15px");
            $(".content h2").css("line-height", "17px");
            break;

        case "1":
            $(".page_content p").css("font-size", "12px");
            $(".page_content p").css("line-height", "17px");

            $(".page_content h2").css("font-size", "15px");
            $(".page_content h2").css("line-height", "24px");

            $(".page_content ul").css("font-size", "12px");
            $(".page_content ul").css("line-height", "17px");

            $(".quote p").css("font-size", "18px");
            $(".quote p").css("line-height", "24px");

            $(".quote2 p").css("font-size", "18px");
            $(".quote2 p").css("line-height", "24px");

            $(".quote p.right_two").css("font-size", "14px");

            $(".quote2 p.right_two").css("font-size", "14px");

            $(".ques_ans h3").css("font-size", "12px");

            $(".page_references ol").css("font-size", "12px");
            $(".page_references ol").css("line-height", "17px");

            $(".privacy_content p").css("font-size", "12px");
            $(".privacy_content p").css("line-height", "17px");

            $(".privacy_content p.title").css("font-size", "12px");
            $(".privacy_content p.title").css("line-height", "17px");

            $(".sitemapText ul").css("font-size", "12px");
            $(".sitemapText ul").css("line-height", "17px");

//            $(".Left_callout p").css("font-size", "13px");
//            $(".Left_callout p").css("line-height", "17px");

//            $(".Left_callout h1").css("font-size", "14px");
//            $(".Left_callout h1").css("line-height", "19px");

//            $(".Middle_callout p").css("font-size", "13px");
//            $(".Middle_callout p").css("line-height", "17px");

//            $(".Middle_callout h1").css("font-size", "14px");
//            $(".Middle_callout h1").css("line-height", "19px");

//            $(".Right_callout p").css("font-size", "13px");
//            $(".Right_callout p").css("line-height", "17px");

//            $(".Right_callout h1").css("font-size", "14px");
//            $(".Right_callout h1").css("line-height", "19px");

            $(".Header_title h1").css("font-size", "24px");
            $(".Header_title h1").css("line-height", "30px");

            $(".content h2").css("font-size", "15px");
            $(".content h2").css("line-height", "17px");   
            break;

        case "2":
            $(".page_content p").css("font-size", "14px");
            $(".page_content p").css("line-height", "21px");

            $(".page_content h2").css("font-size", "17px");
            $(".page_content h2").css("line-height", "27px");

            $(".page_content ul").css("font-size", "14px");
            $(".page_content ul").css("line-height", "21px");

            $(".quote p").css("font-size", "20px");
            $(".quote p").css("line-height", "26px");

            $(".quote2 p").css("font-size", "20px");
            $(".quote2 p").css("line-height", "26px");

            $(".quote p.right_two").css("font-size", "16px");

            $(".quote2 p.right_two").css("font-size", "16px");

            $(".ques_ans h3").css("font-size", "14px");

            $(".page_references ol").css("font-size", "14px");
            $(".page_references ol").css("line-height", "21px");

            $(".privacy_content p").css("font-size", "14px");
            $(".privacy_content p").css("line-height", "21px");

            $(".privacy_content p.title").css("font-size", "14px");
            $(".privacy_content p.title").css("line-height", "21px");

            $(".sitemapText ul").css("font-size", "14px");
            $(".sitemapText ul").css("line-height", "21px");

//            $(".Left_callout p").css("font-size", "15px");
//            $(".Left_callout p").css("line-height", "19px");

//            $(".Left_callout h1").css("font-size", "16px");
//            $(".Left_callout h1").css("line-height", "21px");

//            $(".Middle_callout p").css("font-size", "15px");
//            $(".Middle_callout p").css("line-height", "19px");

//            $(".Middle_callout h1").css("font-size", "16px");
//            $(".Middle_callout h1").css("line-height", "21px");

//            $(".Right_callout p").css("font-size", "14px");
//            $(".Right_callout p").css("line-height", "18px");

//            $(".Right_callout h1").css("font-size", "15px");
//            $(".Right_callout h1").css("line-height", "21px");

            $(".Header_title h1").css("font-size", "26px");
            $(".Header_title h1").css("line-height", "32px");

            $(".content h2").css("font-size", "15px");
            $(".content h2").css("line-height", "17px");
            break;
    }
};

/******************Leaving the Site – Off Ramp*************************/
function offRampMessage(confirm, href) {
    //alert('hello');
    //var targetUrl = $(this).attr("href");
    $.confirm({
        'title': 'You are now leaving Cinryze.com.',
        'message': 'You are now leaving the CINRYZE<sup>®</sup> (C1 esterase inhibitor [human]) website. ViroPharma does not control, review, or endorse third-party websites, and you agree that ViroPharma is not responsible for the content of the website you are about to enter.',
        'buttons': {
            'Ok': {
                'class': 'blue',
                'action': function() {
                    window.open(href, 'open_window', 'menubar, toolbar, location, directories, status, scrollbars, resizable, dependent, width=700, height=500, left=0, top=0');
                }
            },
            'Cancel': {
                'class': 'gray',
                'action': function() { } // Nothing to do in this case. You can as well omit the action property.
            }
        }
    });
}



function message_HCP(confirmHcp, href) {
    //alert('hello');
    //var targetUrl = $(this).attr("href");
    $.confirmHcp({
    'message': 'Are you a Healthcare Professional licensed in the United States and its territories?',
        'buttons': {
        'YES &nbsp;&nbsp;&#62;': {
                'class': 'blue',
                'action': function() {
                    window.open(href, '_self', 'menubar, toolbar, location, directories, status, scrollbars, resizable, dependent, width=700, height=500, left=0, top=0');
                }
            },
            'NO &nbsp;&nbsp;&#62;': {
                'class': 'gray',
                'action': function() { } // Nothing to do in this case. You can as well omit the action property.
            }
        }
    });
}
