/* ========================================================================
3
4 dbPopWin: db Popup Windows Plugin for JQuery - 04 Jul 08
5
6 HOW TO USE
7
8 Step 1) Ask yourself if you really need a popup Window. If you can't
9 get around the requirement. Proceed.
10
11 Step 2) Copy the JS. Check to options below and use the example as
12 a guide.
13
14 OPTIONS
15
16 .dbPopWin(
17 url: string,
18 {
19 dbPopWinWidth: integer, [default 400], the width of the popup window
20 dbPopWinHeight: integer, [default 400], the height of the popup window
21 dbPopWinY: integer, [default centered], position of the popup window from the left of screen
22 dbPopWinX: integer, [default centered], position of the popup window from the top of screen
23 dbPopWinTarget: string, [default 'dbPopWin'], the name of the popup window
24 dbPopWinScrollbars: string, [default 'yes', 'no'], whether scrollbars are allowed in the popup window
25 dbPopWinResizable: string, [default 'no', 'yes'], whether the popup window is resizable
26 dbPopWinMenuBar: string, [default 'no', 'yes'], whether the popup window has a menu bar
27 dbPopWinAddressBar: string, [default 'yes', 'yes'], whether the popup window has an address bar
28 }
29 );
30
31 EXAMPLE
32
33 <p>Link to the <a href="http://hypertextjunkie.com/" rel="dbPopWin">Hypertext Junkie</a> web site</p>
34
35 <script type="text/javascript" src="jquery-1.2.6.pack.js"></script>
36 <script type="text/javascript" src="jquery.dbPopWin.js"></script>
37
38 <script type="text/javascript">
39 $(document).ready(function()
40 {
41 $('a[rel="dbPopWin"]').click(
42 function()
43 {
44 return $.dbPopWin( $(this).attr('href'), { dbPopWinWidth: 800, dbPopWinHeight: 600 } );
45 }
46 );
47 }
48 );
49 </script>
50
51 Opens website in new 800x600 window in middle of browser screen.
52
53======================================================================== */

jQuery.dbPopWin = function(url, options)
{
	
 options = jQuery.extend(
 {
 /* default options */
 dbPopWinWidth: 400,
 dbPopWinHeight: 400,
  dbPopWinTarget: 'dbPopWin',
 dbPopWinScrollbars: 'yes',
 dbPopWinResizable: 'no',
 dbPopWinMenuBar: 'no',
 dbPopWinAddressBar: 'yes'
 },
 options
 );

 /* center the window by default. */
 if (!options.dbPopWinY)
 {
 options.dbPopWinY = screen.height / 2 - options.dbPopWinHeight / 2;
 };
if (!options.dbPopWinX)
 {
 options.dbPopWinX = screen.width / 2 - options.dbPopWinWidth / 2;
 };

 open(
 url,
 options['dbPopWinTarget'],
 'width= ' + options.dbPopWinWidth +
 ',height=' + options.dbPopWinHeight +
 ',top=' + options.dbPopWinY +
 ',left=' + options.dbPopWinX +
 ',scrollbars=' + options.dbPopWinScrollbars +
 ',resizable=' + options.dbPopWinResizable +
 ',menubar=' + options.dbPopWinMenuBar +
 ',location=' + options.dbPopWinAddressBar
 );

 return false;

}; 
