/*
 * SimpleModal Confirm Modal Dialog
 * http://www.ericmmartin.com/projects/simplemodal/
 * http://code.google.com/p/simplemodal/
 *
 * Copyright (c) 2008 Eric Martin - http://ericmmartin.com
 *
 * Licensed under the MIT license:
 *   http://www.opensource.org/licenses/mit-license.php
 *
 * Revision: $Id: confirm.js 132 2008-05-23 16:05:17Z emartin24 $
 *
 */

/// <reference path="jquery-1.2.6-vsdoc.js">



$(document).ready(function() {
    var cookie = readCookie("isHCP");
    if (cookie == null) {
        confirm("The information contained in this section of the site is intended for U.S. healthcare professionals only. Click \"OK\" if you are a healthcare professional.", function() {
            //window.location.href = 'http://www.ericmmartin.com/projects/simplemodal/';
            $.modal.close();
        });
        
    }
});

function confirm(message, callback) {
    $('#confirm').modal({
        close: false,
        overlayId: 'confirmModalOverlay',
        containerId: 'confirmModalContainer',
        onShow: function(dialog) {
            dialog.data.find('.message').append(message);

            // if the user clicks "yes"
            dialog.data.find('.yes').click(function() {
                // call the callback
                if ($.isFunction(callback)) {
                    callback.apply();
                }
                // close the dialog
                createCookie("isHCP", true);
                $.modal.close();
            });

            dialog.data.find('.no').click(function() {
                window.location.href = 'http://www.cephalon.com/';

            });

        }
    });
}
