//
// global variables
//

var newWindow;      // used for "is there an open window?" detection

//
// global functions
//

// opens a popup window
// comments on params following soon
//
// params
// 1	-	filename
// 2	-	get parameters
// 3	-	scrollbars
// 4	-	windowWidth
// 5	-	windowHeight
// 6	-	offsetX
// 7	-	offsetY
// 8	-	resizable
//
function popupWindow(fileName)
{
	var resizable = false;
	var scrollbar = false;
	var windowWidth = 300;
	var windowHeight = 220;
	var offsetX = 0;
	var offsetY = 0;
	var getParams = '';
	
	switch(arguments.length)
	{
		case 8: resizable = arguments[7];
		case 7: offsetY = arguments[6];
		case 6: offsetX = arguments[5];
		case 5: windowHeight = arguments[4];
		case 4: windowWidth = arguments[3];
		case 3:	scrollbar = arguments[2];
		case 2: getParams = arguments[1];
		default: break;
	}
	
	if(screen.width>=800)
        offsetX=(screen.width-windowWidth)/2;
    if(screen.height>=600)
        offsetY=(screen.height-windowHeight)/2;
    
	
    if(scrollbar)
	{
		scrollbar = 'yes';
	}
	else
	{
		scrollbar = 'no';
	}
    
	if(resizable)
	{
		resizable = 'yes';
	}
	else
	{
		resizable = 'no';
	}

	if(newWindow != null)
    {
        newWindow.close();
    }
    newWindow = window.open('/'+fileName+'?'+getParams, 'popup', 'resizable='+resizable+', location=no, menubar=no, status=no, toolbar=no, scrollbars='+scrollbar+', height='+windowHeight+', width='+windowWidth+', left='+offsetX+', top='+offsetY+', dependent=yes');
}