﻿
function showconfirm() {
    var confirmMessage = 'By clicking \"OK\" to enter this site, you hereby confirm that you are a healthcare professional and that you reside and practice outside the United States.'
+ '\nYou further acknowledge that the information on this site is not country-specific, and may not be consistent with the approved indication where you practice or the product (SPRYCEL) may not be approved in the country where you reside or practice.';
    if (confirm(confirmMessage)) {
        setCookie();
    }
}



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;
}

function setCookie() {

    var x = createCookie('NONUSHCP', 'YES', 0);
    //change this page url to the proper current page url

    if (readCookie('NONUSHCPURL') == null) {
        var x = createCookie('NONUSHCPURL', 'index.aspx', 0);
    }

    if (readCookie('NONUSHCPURL') != '') {
        document.location.href = readCookie('NONUSHCPURL');
    }

}

function checkCookie() {

    var sPage = window.location.pathname;

    var x = createCookie('NONUSHCPURL', sPage, 0);

    if (readCookie('NONUSHCP') != 'YES') {
        document.location.href = '/splitter.aspx';
    }

}





