(function($) {        
    function confirm(redirect_url, popupType) {
        $(popupType).modal({
            overlayId: 'confirm-modal-overlay',
            containerId: 'confirm-modal-container',
            autoPosition: true,
            opacity: 85,            
            onShow: function(dialog) {
                var modal = this;
                $('.yes_confirm', popupType).click(function(e) {
                    e.preventDefault();
                    $.modal.close();
                    window.open(redirect_url,"");

                });
                $('.closePopNo', popupType).click(function(e) {
                    e.preventDefault();
                    $.modal.close();
                    $('img', '.modal-popup').css('visibility', 'visible');
                });                
            }
        });
    }

    jQuery(function($) {$('<div id="interstitial2" style="height:0;width:0"></div>').appendTo("body");

        var $modalVar1 = $('a.confirm-modal1'),
            $modalVar2 = $('a.confirm-modal2'),			
            $modalVar3 = $('a.confirm-modal3'),
			modal_html1 = '<div class="modal-popup1"><div class="cModal-bg1 noPrint"><div class="cModal-content"><div class="cModal-header"><h3>Please note:</h3><strong>You are about to leave a <br />Bristol-Myers Squibb/Sanofi Pharmaceuticals Partnership site.</strong></div><div class="cModal-con"><p>The Bristol-Myers Squibb/Sanofi Pharmaceuticals Partnership does not review the information on this Web site and/or database for content, accuracy or completeness. Use of and access to this information is subject to the terms, limitations and conditions set by the Web site  and/or database producer.</p><p>The Bristol-Myers Squibb/Sanofi Pharmaceuticals Partnership makes no representation as to the accuracy or any other aspect of the information contained on such Web site and/or database, nor does Bristol-Myers Squibb/Sanofi Pharmaceuticals Partnership necessarily endorse such Web site and/or database.</p><div class="cModal-butt"><a href="javascript:void(0)" class="closePopNo"><img src="/images/buttons/cancel.gif" alt="Cancel" /></a><a href="javascript:void(0)" class="yes_confirm" target="_blank"><img src="/images/buttons/ok.gif" alt="go" /></a></div></div></div></div></div>';
			modal_html2 = '<div class="modal-popup2"><div class="cModal-bg2 noPrint"><div class="cModal-content"><div class="cModal-header"><h3>Please note:</h3><strong>You are about to leave the <br />Bristol-Myers Squibb/Sanofi Pharmaceuticals PLAVIX.com site.</strong></div><div class="cModal-con"><p>You are being redirected to a Bristol-Myers Squibb corporate site. You are linking to any other off-site pages or other sites at your own risk.</p><div class="cModal-butt"><a href="javascript:void(0)" class="closePopNo"><img src="/images/buttons/cancel.gif" alt="Cancel" /></a><a href="javascript:void(0)" class="yes_confirm" target="_blank"><img src="/images/buttons/ok.gif" alt="go" /></a></div></div></div></div></div>',
			modal_html3 = '<div class="modal-popup3"><div class="cModal-bg3 noPrint"><div class="cModal-content"><div class="cModal-header"><h3>Health-care Professional</h3></div><div class="cModal-con"><p>You are about to enter a site intended solely for the use of health care professionals. Please certify that you are a health care professional by clicking the button below marked &quot;I Agree,&quot; or simply click the button marked &quot;I Do Not Agree&quot; to return to the previous page.</p><div class="cModal-butt"><a href="javascript:void(0)" class="yes_confirm" target="_blank"><img src="/images/buttons/agree.gif" alt="I Agree" /></a><a href="javascript:void(0)" class="closePopNo"><img src="/images/buttons/agree_not.gif" alt="I Do Not Agree" /></a></div></div></div></div></div>';
        if ($modalVar1.length) {
            if(jQuery('.modal-popup1').length == 0){                
                jQuery(modal_html1).appendTo('body');
            }
            $modalVar1.click(function(e) {
                e.preventDefault();
                var redirect_url = $(this).attr('href');
                confirm(redirect_url, '.modal-popup1');
            });
        }
        if ($modalVar2.length) {
            if(jQuery('.modal-popup2').length == 0){                
                jQuery(modal_html2).appendTo('body');
            }
            $modalVar2.click(function(e) {
                e.preventDefault();
                var redirect_url = $(this).attr('href');
                confirm(redirect_url, '.modal-popup2');
            });
        }
        if ($modalVar3.length) {
            if(jQuery('.modal-popup3').length == 0){                
                jQuery(modal_html3).appendTo('body');
            }
            $modalVar3.click(function(e) {
                e.preventDefault();
                var redirect_url = $(this).attr('href');
                confirm(redirect_url, '.modal-popup3');
            });
        }        
    });
} (jQuery))

