//
// popupWin.js
//
// Cross platform implementation of window.open() function
//
// Usage: <a href="javascript:popupWin(destPage,winName,options)">Example</a>
//   destPage = name of page to open in popup Window
//   winName  = window name
//   options  = window opts (e.g. 'width=400,height=300,resizable,scrollbars')
//

var newWin = null;  // declare global window object
var winUrl = "";
var winParam = "";  // declare global windows URL string

function popupWin() {
  //  check for Version 4 browser, not sure if this is really needed
  /*** START DISABLE ***  disable browser version 4 sniff
  if((!document.all) && (!document.layers)){
    alert("This function requires a version 4 browser");
    return;
  }
  *** END DISABLE ***/

  // check if a previously opened window was closed
  if( (newWin) && (newWin.closed) && (winUrl == arguments[0]) ){ 
    winUrl = ""; // reset window URL
  }
  // check if window is already open
  if(winUrl != arguments[0]) {   // allows multiple windows to be opened by this function
    winUrl = arguments[0];       // set URL parameter for window.open()
    var winName = arguments[1];  // set window name parameter for window.open()
    if(arguments[2]) {           // set windowFeatures parameter for window.open()
      winParam = arguments[2];
      newWin = window.open(winUrl,winName,winParam); // open window with windowFeatures
    }
    else {
      newWin = window.open(winUrl,winName); // open window without windowFeatures
    }
  }
  // set focus onto popup window
  setTimeout('newWin.focus()',100); // timeout function is necessary for possible bug in IE
}

function showDetails( contextRoot, productId, catalogId )
{
  popupWin(contextRoot + 'catalog/browseProductDetail.do?productId=' + productId + '&catalogId=' + catalogId,'zeeWin','width=500,height=400,scrollbars=yes,resizable=yes');
}

