You can use my JS library
http://www.cristianizzo.com/DEV/Qpass/index.php?r=JS&v=modal
here an example
<!-- Button trigger modal -->
<a href="#" modal="Modal" modal-Id="modalDialog">Modal Standard</a>
<!-- Modal -->
<div id="modalDialog" class="modal_hidden"> //content </div>
You can pass a callback function or extend the modal pushing an other content
<!-- Button trigger modal -->
<a href="#" modal="Modal" modal-Id="modalFunction" modal-Size="small" modal-Fn="fnTest">Modal Fn</a>
<!-- Modal -->
<div id="modalFunction" class="modal_hidden">
//Content
<a href="#" onclick="Modal.extendModal('idDiv', fnName); return false;"></a>
</div>
<!-- Second Modal -->
<div id="idDiv" class="modal_hidden">
//Content
</div>
<!-- JS -->
function fnTest(){
alert('execute new function');
}
<!-- JS -->
function fnName(){
alert('execute new function');
}