var currentLink;
$(document).ready(
    function()
    {
        $("a[href^='http']")
            .not(":has(img)")
            .not("a[href^='http:\/\/www.buddssubaru']")
                //.addClass("external")
                //.attr({target: ""})
                .click(function(event) {
                     currentLink = $(this).attr('href');
                     event.preventDefault();
                     $( "#dialog-confirm" ).dialog( "open" );
                 });

        // a workaround for a flaw in the demo system (http://dev.jqueryui.com/ticket/4375), ignore!
        $( "#dialog:ui-dialog" ).dialog( "destroy" );
        $( "#dialog-confirm" ).attr();
        $( "#dialog-confirm" ).dialog({
            resizable: false,
            autoOpen: false,
            height: 270,
            width: 400,
            modal: true,
            buttons: {
                "Proceed to external site": function() {
                    window.open(currentLink);
                    $( this ).dialog( "close" );
                },
                Cancel: function() {
                    $( this ).dialog( "close" );
                }
            }
        });
    }
);

function showDisclaimer( link )
{
    currentLink = link
    $( "#dialog-confirm" ).dialog( "open" );
}
