/* -------------- Zmienne Globalne -------------- */
var newWindow = null;          // New object

/* ----------------- Funkcje -------------------- */
function startWindow(URL, windowName, windowWidth, windowHeight)
    {
	if (arguments.length != 4)
		{
		myError(1,"startWindow()",arguments.length);
		return;
		}
    var xPosition=10;
    var yPosition=10;
    if ((parseInt(navigator.appVersion) >= 4 )) 
        {
        xPosition = (screen.width - windowWidth) / 2;
        yPosition = (screen.height - windowHeight) / 2;
        }
    var functionArguments = 
              "width=" + windowWidth + ","
            + "height=" + windowHeight + ","
            + "resizable=0,"                // Is resizable [0,1]
            + "location=0,"                 // Adress bar Activation [0,1]
            + "menubar=0,"                  // Menu Bar [0,1]
            + "scrollbars=0,"               // Scrollbars ON OFF [0,1]
            + "status=0,"                   // Window status disabled or enabled [0,1]
            + "titlebar=0,"                 // [0,1]
            + "hotkeys=0,"                  // [0,1]
            + "screenx=" + xPosition + ","  // Starting Position For Netscape
            + "screeny=" + yPosition + ","  // Starting Position For Natscape
            + "left=" + xPosition + ","     // Starting Position For IE
            + "top=" + yPosition;           // Starting Position For IE
	 if (newWindow != null && !newWindow.closed)
	   	if (newWindow.name == windowName)
		   {
		   newWindow.focus();
	   	   return;
		   }
    newWindow = window.open(URL, windowName, functionArguments);
    newWindow.focus();
	}

function myError(number,functionName,info)
	{
	var stdOutput = "ERROR: " + number +"\n"
	switch(number)
		{
		case 1:
			stdOutput += "Incorect number of arguments in function: " + functionName 
						+ "\nThis function doesn't takes " + info + " arguments";
		}
	alert(stdOutput);
	}
