/*
	--------------------------------
	Last Updated: 2006.04.03
	--------------------------------
	- Table of Contents -

	1. CONFIGURATION

	2. FUNCTIONS
		- PopUp ( )
		- CenteringPopUp ( )
		- SwapLoc ( )
		- SelectLoc ( )
		- SwapOpenerLoc ( )
	--------------------------------
*/



/* --------------------------------
	1. CONFIGURATION
-------------------------------- */

var _Win = [ ];



/* --------------------------------
	2. FUNCTIONS
-------------------------------- */

function PopUp ( Loc, Name, Left, Top, Width, Height, Mode ) {
	/*
	--------------------------------
	A:	scrollbars + resizable
	B:	status
	C:	menubar
	D:	toolbar
	--------------------------------
	0:				
	1:	A			
	2:	A	B		
	3:	A	B	C	
	4:	A	B		D
	5:	A	B	C	D
	6:	A		C	
	7:	A		C	D
	8:	A			D
	9:		B		
	10:		B	C	
	11:		B		D
	12:		B	C	D
	13:			C	
	14:			C	D
	15:				D
	--------------------------------
	*/
	var Params = [ ];
	Params[ 'scrollbars_resizable' ] = 'no';
	Params[ 'status' ] = 'no';
	Params[ 'menubar' ] = 'no';
	Params[ 'toolbar' ] = 'no';
	if ( Mode == 1 || Mode == 2 || Mode == 3 || Mode == 4 || Mode == 5 || Mode == 6 || Mode == 7 || Mode == 8 )
		{ Params[ 'scrollbars_resizable' ] = 'yes'; }
	if ( Mode == 2 || Mode == 3 || Mode == 4 || Mode == 5 || Mode == 9 || Mode == 10 || Mode == 11 || Mode == 12 )
		{ Params[ 'status' ] = 'yes'; }
	if ( Mode == 3 || Mode == 5 || Mode == 6 || Mode == 7 || Mode == 10 || Mode == 12 || Mode == 13 || Mode == 14 )
		{ Params[ 'menubar' ] = 'yes'; }
	if ( Mode == 4 || Mode == 5 || Mode == 7 || Mode == 8 || Mode == 11 || Mode == 12 || Mode == 14 || Mode == 15 )
		{ Params[ 'toolbar' ] = 'yes'; }

	if ( Params[ 'scrollbars_resizable' ] == 'yes' ) {
		if ( _OS == 'Win' && _WB == 'IE' ) { Width += 17; }// Win IE
		else if ( _OS == 'Win' && _WB == 'Firefox' ) { Width += 19; }// Win Firefox 1.0+
		else if ( _OS == 'Win' && _WB == 'Opera' ) { Width += 17; }// Win Opera 6.x+
		else if ( _OS == 'Win' && _WB == 'Mozilla' ) { Width += 19; }// Win Mozilla 1.7.5+
		else if ( _OS == 'Win' && _DH == 'c' ) { Width += 16; }// Win Netscape 4.x-
		else if ( _OS == 'Mac' && _WB == 'IE' ) { Width -= 1; Height -= 16; }// Mac IE
		else if ( _OS == 'Mac' && _WB == 'Firefox' ) { Width += 15; }// Mac Firefox 1.0+
		else if ( _OS == 'Mac' && _WB == 'Opera' ) { Width += 15; }// Mac Opera 6.x+
		else if ( _OS == 'Mac' && _WB == 'Mozilla' ) { Width +=16; }// Mozilla
		else if ( _OS == 'Mac' && _DH == 'c' ) { if ( Params[ 'status' ] == 'no' ) { Width += 15; } else { Height -= 15; } }// Mac Netscape 4.x-
		else if ( _WB == 'Netscape' && _WB_Ver < 7 ) { Width += 14; }// Netscape 6.x
		else if ( _WB == 'Netscape' && _WB_Ver >= 7 ) { Width += 15; }// Netscape 7.x
		else if ( _WB == 'Safari' ) { Width +=13; }// Safari
	}
	if ( Params[ 'menubar' ] == 'yes' ) {
		if ( _OS == 'Win' && _WB == 'IE' ) { Height -= 19; }// Win IE
		else if ( _OS == 'Win' && _DH == 'c' && Width < 376 ) { Height += 18; }// Win NN 4.x-
	}

	var Props = 'width=' + Width + ',height=' + Height + ',left=' + Left + ',top=' + Top + ',menubar=' + Params[ 'menubar' ] +
		',toolbar=' + Params[ 'toolbar' ] + ',location=no,directories=no,status=' + Params[ 'status' ] +
		',scrollbars=' + Params[ 'scrollbars_resizable' ] + ',resizable=' + Params[ 'scrollbars_resizable' ];

	_Win[ Name ] = window.open ( Loc, Name, Props );
	_Win[ Name ].focus ( );
}

function CenteringPopUp ( Loc, Name, Width, Height, Mode ) {
	var Min_L = 8;
	var Min_T = 8;
	var Max_T = 104;

	var Left = Math.floor ( ( screen.width - Width ) / 2 );
	var Top = Math.floor ( ( screen.height - Height ) / 2 );
	if ( Left < Min_L ) { Left = Min_L; }
	if ( Top < Min_T ) { Top = Min_T; }
	if ( Top > Max_T ) { Top = Max_T; }

	return PopUp ( Loc, Name, Left, Top, Width, Height, Mode );
}

function SwapLoc ( Loc ) {
	location.href = Loc;
}

function SelectLoc ( Obj ) {
	if ( Obj ) { return false; }
	var Loc = Obj.options[ Obj.selectedIndex ].value;
	if ( Loc == '' || Loc == null ) { return false; }
	location.href = Loc;
}

function SwapOpenerLoc ( ) {
	// arguments : ( Loc [, Mode ] )

	var Args = SwapOpenerLoc.arguments;

	var Loc = Args[ 0 ];
	var Mode = ( Args.length > 1 ) ? Args[ 1 ] : 0;

	window.opener.location.href = Loc;
	if ( Mode ) { window.opener.focus ( ); }
	else { window.close ( ); }
}
