var longFmtWindow = 0;
var bbagWindow = 0;
var readerWindow = 0;
var helpWindow = 0;
var winavailwidth = screen.availWidth;
var winX = ( winavailwidth - 475 ); 
var popupX = ( winavailwidth - 1050 ); 
var ns4 = (document.layers)? true:false
var ie4 = (document.all)? true:false
var winparams = "";

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  //  alert('linking away ....');
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  var w = window.open(theURL,winName,features);
  }

function popupBBagWindow( url, focusFlag )
{
	if (!bbagWindow.closed && bbagWindow.location) {
		bbagWindow.location.href = url;
	} else {
		bbagWindow=window.open(url, 'bibbookbag', 'scrollbars=yes,location=yes,resizable=yes,width=450,height=400');	
		if (!bbagWindow.opener) bbagWindow.opener = self;
	}
	if (window.focus) {bbagWindow.focus()}
	
}

/***
function popupReader( URLstr, focusFlag ) {
	if (ie4) {
		winparams = 'scrollbars=yes,location=yes,resizable=yes,width=790,height=580,left='+popupX;
	} else {
		winparams = 'scrollbars=yes,location=yes,resizable=yes,width=790,height=580,screenX='+popupX;
	}


	if ( readerWindow && !readerWindow.closed ) {
		if ( focusFlag ) { 
			readerWindow.focus();
		}
	} else {
		readerWindow = window.open( '', "readerwndw", winparams );
		if ( focusFlag ) {   
			readerWindow.focus( );  
		} else {    
			self.focus();
		}
	}

	readerWindow.document.write('<html><body><p>Retrieving reader data, please wait ...</p></body></html>');
	readerWindow.location = URLstr;
}
***/

function popupReader(url, focusflag) {

	if (!readerWindow.closed && readerWindow.location) {
		readerWindow.location.href = url;
	} else {
		readerWindow=window.open(url, 'readerwndw', 'scrollbars=yes,location=yes,resizable=yes,width=790,height=580');	
		if (!readerWindow.opener) readerWindow.opener = self;
	}
	if (window.focus) {readerWindow.focus()}
	//readerWindow.document.write('<html><body><p>Retrieving reader data, please wait ...</p></body></html>');
}

function popupLongFmtWindow( URLstr )
{
  if (ie4)
  {
          winparams = 'scrollbars=yes,location=yes,resizable=yes,width=450,height=600,left='+winX;
  }
  else
  {
          winparams = 'scrollbars=yes,location=yes,resizable=yes,width=450,height=600,screenX='+winX;
  }


  if ( longFmtWindow && !longFmtWindow.closed )
  {
          longFmtWindow.focus();
  }
  else
  {
          longFmtWindow = window.open( '', "longformat", winparams );
          longFmtWindow.focus( );
  }

  longFmtWindow.document.write('<p>Retrieving record in long format, please wait ...</p>');
  longFmtWindow.document.location = URLstr;
}



function popupHelpWindow( URLstr, focusFlag )
{
  if (ie4)
  {
     winparams = 'scrollbars=yes,resizable=yes,width=600,height=500';

  }
  else
  {
	 winparams = 'scrollbars=yes,resizable=yes,width=600,height=500';

  }


    if ( helpWindow && !helpWindow.closed )
    {
        if ( focusFlag )
        {  helpWindow.focus();   }
    }
    else
    {
	helpWindow = window.open( '', "bookbag", winparams );
        if ( focusFlag )
        {      helpWindow.focus( );      }
        else
        {       self.focus();    }
    }

    helpWindow.document.location = URLstr;
}


