//make sure jquery lib is loaded before this.

//set up external links and hook in the interstital to non-csl sites
//$(document).ready(function () {
//    externalLinks();

//    $('a.interstital').click(function () {
//        $("#interstitialYes").attr("href", $(this).attr("href"));
//        $("#interstitial").dialog({ modal: true, width: 500 });
//        return false;
//    });

//    $(".references").colorTip({ color: 'corifact' });
//});

//set up external links and hook in the interstital to non-csl sites
$(document).ready(function () {
    externalLinks();

    $('a.interstital').click(function () {
        $("#interstitialMessage").html("The site you are accessing is maintained by a third party over whom CSL Behring has no control. CSL Behring does not review, approve, or necessarily endorse viewpoints, inferences, or conclusions stated in or implied by the content of this site. CSL Behring is not responsible for third-party content or the consequences of your use thereof.");
        $("#interstitialYes").attr("href", $(this).attr("href"));
        $("#interstitial").dialog({ modal: true, width: 500 });

        return false;
    });
    $('a.intrastital').click(function () {
        $("#interstitialMessage").html("You are accessing a CSL Behring site containing information about products marketed by the company.");
        $("#interstitialYes").attr("href", $(this).attr("href"));
        $("#interstitial").dialog({ modal: true, width: 500 });
        return false;
    });

//    $(".references").colorTip({ color: 'corifact' });

//    $("tr:odd").addClass('alt');
//    $("tr:last").addClass('lastrow');


});


//attach the target=_blank to new window links
//attach the interstital class to the non-csl links (.interstital)
//function externalLinks() {
//    if (!document.getElementsByTagName) return;
//    var anchors = document.getElementsByTagName("a");
//    for (var i = 0; i < anchors.length; i++) {
//        var anchor = anchors[i];
//        if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") {
//            anchor.target = "_blank";
//           if(anchor.getAttribute("onclick") ==  "return OffRamp();")
//               anchor.className = "interstital";
//        }

//    }
//}

function externalLinks() {

    if (!document.getElementsByTagName) return;
    var anchors = document.getElementsByTagName("a");
    for (var i = 0; i < anchors.length; i++) {
        var anchor = anchors[i];
        if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") {
            anchor.target = "_blank";

            if (anchor.getAttribute("onclick")) {
                var oc = anchor.getAttribute("onclick").toString();
                if (oc.search("OffRamp") > -1)
                    anchor.className = "interstital";
            }
        }

    }

    /* Adding a colortip to any tag with a glossary class: */
    //$(".glossary").colorTip({ color: 'corifact' });

}

function OffRamp()
{
    return false; //handled by interstital
}



function confirmation() {
    return confirm("You are accessing a Web site maintained by a third party over whom CSL Behring has no control.\nCSL Behring is not responsible for, and accepts no liability for, information contained in any third-party Web site.\n\nDo you wish to continue?")
}






  
