jQuery( function () {
  jQuery( '#email-dialog' )
    .dialog({
      autoOpen: false,
      modal: true,
      height: 362,
      width: 412,
      buttons : { 'Ok' : function () { 
          jQuery( '#email-dialog' ).dialog( 'close' ); 
      } },
      close : function () { 
        document.location.href = jQuery( '#email-link' ).attr( 'href' );
      } 
    });
  jQuery( '#email-link' ).click( function ( event ) {
    event.preventDefault();
    jQuery( '#email-dialog' ).dialog( 'open' );
  });
});

