This is about TINYBOX, one of the most interesting sleek JavaScript popup boxes available in the net. Tinybox was originally developed by Michel and the older version is available here.

But this original version has some deficiencies. It can popup a box with html content loaded from a page you specify. e.g.-

TINY.box.show('advanced.html',1,300,150,1,3);

will show a new box with dimensions 300x150 and show advanced.html inside the box. This is fine if we want to show say a zoomed picture as a popup or something similar. But many a times, we want to show some html file with javascript in it. This does not work in the original version. Javascript inside the html file will not execute at all. e.g. of such usage would be to load a form with fields populated based on existing contents in the page. Say the main page has a checkbox and tinybox is supposed to show a form with some field contents depending on this checkbox. If you have javascript inside the form which is loaded by tinybox, the javascript won't run.

This shortcoming is addressed here by adding support to pass in a function name and optional arguments. There are two functions show1 and show2 which are extensions of the show function which accepts a function name and two optional arguments in addition to the arguments accepted by show.

1. show1

<script type="text/javascript">function myfunction(arg1, arg2) {
    ......
   } 
</script>
    .......
<script type="text/javascript">
  TINY.box.show1('advanced.html',1,300,150,1,3,'myfunction','arg1', 'arg2');
</script>

This will get and load the contents of advanced.html in a new popup and once loaded will call a function named 'myfunction'. So if your form has a field with a certain id and myfunction adds value to fields with that id, once myfunction runs, the field in the popup will have the correct value.

2. show2

show2 is similar to show1 in terms of arguments, but can be used in places where we need some popup OK/Done message box after doing some operations in the server without the main page getting refreshed.
e.g. Suppose you have a page where you have kept a subsribe link. Now you can use show2 function here by calling it using the subscribe url. From the server, you can send back an OK/Done html page. Now when user clicks on the subscribe link, tinybox popup will showup with a busy icon and will display the OK/Done message. The button can have onclick="javascript:TINY.box.hide();" which will just hide the box away when the user clicks on the Ok button.

The new script is just 4.1Kb. You can download the new tinybox here.
It has both the compressed and readable versions.