/****************************************************************************
 * odyWinImageLib.js - Odyssey's popup window and image manipulation function
 *                     java script library.
 *  Copyright (c) 2006 Odyssey Consulting Corporation.  All rights reserved.
 *
 * To load this library into an HTML page put the following line in the <head>
 * part of the file.  The case of the name is important and the file should be
 * put into the proper directory as specified by the src= specification.
 * In the example the library would be in the same directory as the HTML
 * file.
 *  <script language="JavaScript" type="text/javascript" src="odyWinImageLib.js">
 * If you used   "../odyWinImageLib.js"  then it would be in the
 * directory above the one where the HTML file is.

 * Revision History
 * 02-23-06 - Version 1.1.0 - D Ringo
 *  - For the FP_openNewWindow function - Added the ability to center the
 *    popup and to set the background color.  Added two arguments to the
 *    function to specify these two new features.
 *  - Moved routines out of the HTML pages and put them into this file.
 * 01-01-03 - Version 1.0.0 - S. Ringo
 ****************************************************************************/
<!--
function newWindow(theWidth,theHeight) {
  popup = window.open("","newwin","width=" + theWidth +
                      ",height=" + theHeight + ",menubar=no,status=no,location=no,resizable=no,status=no,scrollbars=no")
  }

// ---------------------------------------------------------------------------
  popup = " " ;

// ---------------------------------------------------------------------------
function checkWin() {
  if (popup.document != null)
    {
    popup.close();
    }
  }

// ---------------------------------------------------------------------------
// FP_openNewWindow - Opens the an existing web page in a popup window based
//                    on the specified arguments.
// w = Width of the popup window in pixels
// h = Height of the popup in pixels
// nav = Show Toolbar (true or false)
// loc = Show the field where a URL can be entered (true or false)
// sts = Show status bar at bottom (true or false)
// menu = Show menu bar (true or false)
// scroll = show scroll bars if popup is too large for screen (true or false)
// resize = user can resize the popup (true or false)
// centered - center the popup (true or false)
// bgClr = Background color of popup 'FFFFFF' = White '000000' = Black, etc.
//         Using '' will use default.
// name = the name of the popup object
// url = the url of the page to open in the popup
// ---------------------------------------------------------------------------
function FP_openNewWindow(w,h,nav,loc,sts,menu,scroll,resize,centered,bgClr,name,url) {
  var windowProperties=''; if(nav==false) windowProperties+='toolbar=no,'; else windowProperties+='toolbar=yes,';
  if(loc==false) windowProperties+='location=no,'; else windowProperties+='location=yes,';
  if(sts==false) windowProperties+='status=no,'; else windowProperties+='status=yes,';
  if(menu==false) windowProperties+='menubar=no,'; else windowProperties+='menubar=yes,';
  if(scroll==false) windowProperties+='scrollbars=no,'; else windowProperties+='scrollbars=yes,';
  if(resize==false) windowProperties+='resizable=no,'; else windowProperties+='resizable=yes,';
  if(w!="") windowProperties+='width='+w+',';
  if(h!="") windowProperties+='height='+h;
  if(windowProperties!="") {
    if( windowProperties.charAt(windowProperties.length-1)==',')
       windowProperties=windowProperties.substring(0,windowProperties.length-1);
  }
 name = window.open(url,name,windowProperties);
 if(bgClr!="") name.document.bgColor=bgClr;
 if(centered==true) {
   var windowX = (screen.width/2)-(w/2);
   var windowY = (screen.height/2)-(h/2);
   name.moveTo(windowX,windowY);
   }
}

// ---------------------------------------------------------------------------
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

// ---------------------------------------------------------------------------
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

// ---------------------------------------------------------------------------
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

// ---------------------------------------------------------------------------
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

