/*
 *	Open window functions by Alexandre Nevski. October 2000. v2.1
 *
 *	wcopen(url) opens a new centered window containing the 
 *  document at url that has nothing 
 *	but a status bar with dimensions 740 by 425. 
 *
 *	wcopen2 opens a new centered window and closes the parent
 *
 *	legalopen opens the window containing the legal statement
 *
 *	popupopen opens the popup in the collections
 *
 *  teaseropen(url) opens a teaser window 
 *
 *	wgopen(url, style, posX, posY) opens a new window at
 *	position (posX,posY) containing the document at url
 *  with style specified by the style string. 
 */


function wcopen( uri, width, height )
{
	var winName = 'win' + Math.floor( Math.random()*1000 )
	var realWidth = width ? width : 550
	var realHeight = height ? height : 565

	var left = Math.round( (screen.width-realWidth)/2 )
	var top =  Math.round( (screen.height-realHeight)/2 ) - 35

	var winOptions = 'status=yes,menubar=no,toolbar=no'
	winOptions += ',resizable=no,scrollbars=yes,location=no'
	winOptions += ',width='  + realWidth
	winOptions += ',height=' + realHeight
	winOptions += ',left='   + left
	winOptions += ',top='    + top

	var win = window.open( uri, winName, winOptions )
	win.focus()

//	return win
}


function old_wcopen(url)
{
	var wf = "";	
	wf = wf + "width=" + 820;
	wf = wf + ",height=" + 621;
	wf = wf + ",resizable=" + (false ? "yes" : "no");
	wf = wf + ",scrollbars=" + (false ? "yes" : "yes");
	wf = wf + ",menubar=" + (false ? "yes" : "no");
	wf = wf + ",toolbar=" + (false ? "yes" : "no");
	wf = wf + ",directories=" + (false ? "yes" : "no");
	wf = wf + ",location=" + (false ? "yes" : "no");
	wf = wf + ",status=" + (false ? "yes" : "no");		
		
	
	//var saw=screen.availWidth;
	//var sah=screen.availHeight;
var saw=screen.width;
var sah=screen.height;			

	var newwidth=830; 
	var newheight=640;
//alert(saw);
	var positionleft=(saw-newwidth)/2;
	var positiontop=(sah-newheight)/2;
	if (document.layers) { positiontop += 10; }
	NewWin=window.open(url,"NewWin",wf); 
   	NewWin.moveTo(positionleft,positiontop);
    setTimeout('NewWin.focus()',100);
}

function wcopen2(url)
{
	wcopen(url);
	self.close();
}

function legalopen(url)
{
	wcopen(url);
}

function teaseropen(url)
{
	var newwidth=310; 
	var newheight=180;

	var wf = "";	
	wf = wf + "width=" + newwidth;
	wf = wf + ",height=" + newheight;
	wf = wf + ",resizable=" + (false ? "yes" : "no");
	wf = wf + ",scrollbars=" + (false ? "yes" : "no");
	wf = wf + ",menubar=" + (false ? "yes" : "no");
	wf = wf + ",toolbar=" + (false ? "yes" : "no");
	wf = wf + ",directories=" + (false ? "yes" : "no");
	wf = wf + ",location=" + (false ? "yes" : "no");
	wf = wf + ",status=" + (false ? "yes" : "no");		

	var saw=screen.availWidth;
	var sah=screen.availHeight;		
	var positionleft=(saw-newwidth)/2;
	var positiontop=(sah-newheight)/2-15;

	NewWin=window.open(url,"_blank",wf); 
   	NewWin.moveTo(positionleft,positiontop);
  	NewWin.focus();
}

function popupopen(url)
{
	var wf = "";	
	wf = wf + "width=" + 530;
	wf = wf + ",height=" + 170;
	wf = wf + ",resizable=" + (false ? "yes" : "no");
	wf = wf + ",scrollbars=" + (false ? "yes" : "no");
	wf = wf + ",menubar=" + (false ? "yes" : "no");
	wf = wf + ",toolbar=" + (false ? "yes" : "no");
	wf = wf + ",directories=" + (false ? "yes" : "no");
	wf = wf + ",location=" + (false ? "yes" : "no");
	wf = wf + ",status=" + (false ? "yes" : "no");		
		

	var saw=screen.availWidth;
	var sah=screen.availHeight;		

	var newwidth=530; 
	var newheight=170;

	var positionleft=(saw-newwidth)/2;
	var positiontop=(sah-newheight)/2-15;

	NewWin=window.open(url,"_blank",wf); 

   	NewWin.moveTo(positionleft,positiontop);
		
   	NewWin.focus();
}

function wgopen(url, style, posX, posY)
{
	NewWin=window.open(url,"_blank",style); 

   	NewWin.moveTo(posX,posY);
		
   	NewWin.focus();
}


