// =====================================================
// Signum Systems Co.
// All contents copyright ©. All rights reserved.
// =====================================================
// auxwin.js

//===============
// The shared origin of the aux window.
//===============
wx = (browser.name == 'Microsoft') ? "left=0," : "screenX=0,";
wy = (browser.name == 'Microsoft') ? "top=0,"  : "screenY=0,";  


//==============
// Display only one auxiliary window (AuxWin1) at a time.
//  focus() works in MSIE4 only if URL is local! 
//==============
var AuxWin1 = new Object();

function OpenAuxWin1(content) {
  AuxWin1 = window.open(content, 'AuxWin1Name', 'resizable,scrollbars,toolbar,width=535,height=100,' + wx + wy);
  if (!AuxWin1.opener) { AuxWin1.opener = self; }			// link back (for future use)
  if (browser.name != 'Microsoft' || ie5) { AuxWin1.focus(); }	// MSIE 4 and 5 identify themselves as ver. 4. (stupid!?)-- reject all MSIE browsers, except ie5
}

//===============
// Kill auxiliary window 1.
//===============
function CloseAuxWin1() {
  if (AuxWin1.closed == false) {
    if (window.confirm('Do you want to close the additional window\nyou opened when visiting the current page\?')) { AuxWin1.close(); }
} }

//===============
// Silhouette window (PDF in a dynamic frame problem).
//===============
var AuxWinBare = new Object();

function OpenAuxWinBare(url){
  var features = ""
               + "height=500,"
               + "width=535,"
               + "location=no,"
               + "resizable=yes,"
               + "scrollbars=yes,"
               + "status=no,"
               + "toolbar=no,"
               + wx
               + wy
               + "directories=no,"
               + "menubar=no"
  var replace = true;
  AuxWinBare = window.open(url,"AuxWinName",features,replace);

  try {
    AuxWinBare.focus();
  } catch(err) {
    // txt ="Error description: " + err.description + "\n\n";   alert(txt);
    // existing tabs cause error
  }

}	

//===============
// Kill auxiliary bare window.
//===============
function CloseAuxWinBare() {
  if (AuxWinBare.closed == false) {
    if (window.confirm('Do you want to close the additional window\nyou opened when visiting the current page\?')) { AuxWinBare.close(); }
} }

//===============
// Silhouette window with size control.
// Usage 
//===============
var AuxWinBareSize = new Object();

function OpenAuxWinBareSize(url, w, h){
  w = w + 37;	/* offset for MSIE 6 to deactivate scroll bars */
  h = h + 30;

  var features = ""
               + "height=" + h + ","
               + "width="  + w + ","
               + "location=no,"
               + "resizable=yes,"
               + "scrollbars=yes,"
               + "status=no,"
               + "toolbar=no,"
               + wx
               + wy
               + "directories=no,"
               + "menubar=no"
  var replace = true;
  AuxWinBareSize = window.open(url,"AuxWinBareSizeName",features,replace);
  AuxWinBareSize.focus();
}	

//===============
// Kill auxiliary bare window.
//===============
function CloseAuxWinBareSize() {
  if (AuxWinBareSize.closed == false) {
    if (window.confirm('Do you want to close the additional window\nyou opened when visiting the current page\?')) { AuxWinBareSize.close(); }
} }

//===============
// Popup window with "opener" atribute to communicate back to the opening page.
//===============
var newwindow = '';									// make it always defined
function PopItUp(url) {
	if (!newwindow.closed && newwindow.location) {	// alread open? AND with-a-page-in-it?
		newwindow.location.href = url;				// put your stuff in it
	} else {										// If popup doesn't exist  or has been closed...
		newwindow = window.open(url,"new","width=400,height=130,location=0,menubar=0,personalbar=0,status=0,left=0,top=100,screenX=0,screenY=100'");	// ...then create it. top/left for Netscape 4+, screenX/Y for IE 4+
		if (!newwindow.opener)
			newwindow.opener = self;				// Netscape 2 doesn't supprot "opener", so we make it.
	}
	if (window.focus)
		newwindow.focus();							// put focus on popup if browser supports focus.
	return false;									// in this way, the link user clicked is not followed.
}

function Sesame() {
	opener.location.href = 'http://www.signum.com/cgi-bin/ah/AccountHandler.cgi?action=Create';
	opener.focus();
	self.close();
}

// eof
