$(document).ready(setup);
function setup()
{
    $('#consult-main-nav:first').children().hoverIntent(
    function(){
        $('ul', this).css('left', '0px').width($(this).width());
    },
    function(){
        $('ul', this).css('left', '-999em');
    }
    );

    $('#header-search').example('Search');

    $('#confirm').jqm({overlay: 88, modal: true, trigger: false, toTop: true});

    // trigger a confirm whenever links of class alert are pressed.
    $('a[href^="mailto"]').click(function() {
        confirm('About to visit: '+this.href+' !',this.href);
        return false;
    });
};

function confirm(msg,callback) {
    $('#confirm')
    .jqmShow()
    .find(':submit:visible').unbind('click')
    .click(function(){
        if(this.value == 'Continue')
        (typeof callback == 'string') ?
        window.location.href = callback :
        callback();
        $('#confirm').jqmHide();
    });
}