/* @(#) popup_window.js
 * @(#) Purpose: Pop up a browser window 
 *          when link is clicked in a main page.
 * @(#) Description: Set window size and placement, 
 * @(#)   minimal window decoration, according to incoming name.
 * ***************************************************************** *
 * ***************************************************************** *
 * To use:
 * ***************************************************************** *
 *   1. In this file - Make keyword(s) for the windownames (see code).
 * ***************************************************************** *
 *   2. In your html page - call this script in the <head> 
 *     <script type="text/javascript" src="/path/to/popup.js"></script>
 * ***************************************************************** *
 *   3. In your html page - Make the link(s) for the popup(s):
 *      <a href="somepage.html"
 *          onClick="return popup(this, 'photo')">blah blah</a>
 *      Replacing:
 *          'somepage.html' with filename you want to link to,
 *          'photo' with unique keyword for popup,
 *          'blah blah' with whatever words or image you want to click on.
 * ***************************************************************** *
 *   4. In the popup file THAT YOU ARE LINKING TO -
 *        to make the window come to front for new click,
 *        if it has gone behind another window:
 *        Add this following the <head>:
 *         <script type="text/javascript">
 *             <!--  // make sure this popup window comes to the front
 *                   //  every time link is clicked:
 *               window.focus();
 *             //-->
 *        </script>
 * ***************************************************************** *
 * ***************************************************************** *
 *
 * Bugs/caveats: 
 *    MSIE: do not put any spaces in the list of properties!
 *    mozilla: status bar shows even if defined as 'no'.
 *    mozilla: onLoad="window.focus()" doesn't work.
 *
 * @(#) Features:  function, window_focus, if/else, variables,
 * @(#)            window options for window.open,
 * @(#)            checking for link, using windowname, type_of.
 *
 * History:
 *   mar 2007 - works: improved directions.
 *   jan 2007 - works: added passing other parameters
 *              wanted for special cases, such as width and height.
 *   nov 2006 - works: betterized comments.
 *   mar 2005 - works: added condition on windowname for different size windows.
 *   oct 2004 - Works good.
 *
 FIX function popup(mylink, windowname, xtra) { 
 */


  // function popup(mylink, windowname, w, h) {
  function popup(mylink, windowname, xtra) {
    // Make window come back to top if it was there from
    //  a previous click but got hidden:
    if (!window.focus) return true;
	
    // Make sure the link is a link:
    var href;
    if (typeof(mylink) == 'string') {
       href = mylink;
    } else {
       href = mylink.href;
    }

   // Now open the window:
   // (bug in MSIE: do not put any spaces in the list of properties!)
   // (Can't seem to put width/height or window params in a variable.)
   if (windowname == 'telephone') {
     window.open(
       href,
       windowname,
       'width=520,height=550,left=20,top=40,resizable=no,scrollbars=yes,status=no,dependent=yes'
     );
  
   } 
	else {
     window.open(
       href,
       windowname,
       'width=520,height=550,left=20,top=20,resizable=yes,scrollbars=yes,status=no,dependent=yes'
      );
    }

    return false;

  }
// eof 
