<!DOCTYPE html>
<script src = jquery.js></script>
<script src = jqueryui/js/jquery-ui-1.8.16.custom.min.js></script>

<link rel=stylesheet type=text/css
      href=jqueryui/css/smoothness/jquery-ui-1.8.16.custom.css />

<div id="dialog" title="Window title">
  <p> Content of the dialog box</p>
</div>

<input id=open type=button value=Open>
<input id=close type=button value=Close>

<script>

$("div#dialog").dialog ({
  autoOpen : false
});

$("#open").click (function (event)    // Open button Treatment
{
  if ($("#dialog").dialog ("isOpen")) alert ("Already open !");
  else $("#dialog").dialog ("open");
});

$("#close").click (function (event)   // Close button Treatment
{
  if (!$("#dialog").dialog ("isOpen")) alert ("Already closed !");
  else $("#dialog").dialog ("close");
});

</script>