dojo.require('pepper.util.OnLeave');

dojo.addOnLoad(function() {
    // US
    var usLinkMessage = ([
        '<p><strong>The product-specific Internet site that you have requested is intended for residents of the United States.</strong></p>',
        '<p>As a result, the site may contain information on pharmaceuticals, medical devices, and other products or uses of those products that are not approved in other countries or regions. If you are a resident of a country other than the United States, please return to Abbott.com or contact your local Abbott affiliate to obtain the appropriate product information for your country of residence.</p>',
        '<p>Do you wish to continue to this product-specific site?</p>',
        '<div style="border-top: 1px solid #F30; width: 100%"></div>',
        '<div class="absolute-wrapper">',
            '<div id="docID_wrapper" class="confirmation-doc-id">',
                '<div class="docID left">',
                    'DOC19079_Rev-A 06/09',
                '</div>',
                '<div class="docID right">',
                    '2 of 27',
                '</div>',
            '</div>',
        '</div>'
    ]).join('');
    
    var baseURL = 'http://' + document.domain + '/';

    // Set up the normal on-leave dialog
    olg = new pepper.util.OnLeave({
        content: usLinkMessage,
        pathContains: ['US-home.html'],
        title: 'Freestyle Navigator&reg; - Warning',
        type: 'popup',
        baseClass: 'gateway',
        width: 440,
        height: 360,
        stay: '<img src="' + (dojo.isIE && dojo.isIE < 8 ? baseURL : '') + '/static/images/btn-popup-no.gif"/>',
        go: '<img src="' + (dojo.isIE && dojo.isIE < 8 ? baseURL : '') + '/static/images/btn-popup-yes.gif"/>'
    });

    // International
    var internationalLinkMessage = ([
        '<p><strong>The product-specific Internet site that you have requested is intended for residents of countries other than the United States.</strong></p>',
        '<p>As a result, the site may contain information on pharmaceuticals, medical devices, and other products or uses of those products that are not approved in other countries or regions. If you are a resident of the United States or Japan, please return to Abbott.com or contact your local Abbott affiliate to obtain the appropriate product information for your country of residence.</p>',
        '<p>Do you wish to continue to this product-specific site?</p>',
        '<div class="absolute-wrapper">',
            '<div id="docID_wrapper" class="confirmation-doc-id">',
                '<div class="docID left">',
                    'DOC19079_Rev-A 06/09',
                '</div>',
                '<div class="docID right">',
                    '3 of 27',
                '</div>',
            '</div>',
        '</div>'
    ]).join('');
    
    // Set up the normal on-leave dialog
    olg2 = new pepper.util.OnLeave({
        content: internationalLinkMessage,
        hostContains: ['abbottdiabetescare.co.uk'],
        title: 'Freestyle Navigator&reg; - Warning',
        type: 'popup',
        baseClass: 'gateway',
        width: 440,
        height: 360,
        stay: '<img src="' + (dojo.isIE && dojo.isIE < 8 ? baseURL : '') + '/static/images/btn-popup-no.gif"/>',
        go: '<img src="' + (dojo.isIE && dojo.isIE < 8 ? baseURL : '') + '/static/images/btn-popup-yes.gif"/>'
    });
});

