var PopupWindows = new Array();
PopupWindows["standard"] = "width=400,height=550,scrollbars=yes,resizable=yes,status=yes"; 
PopupWindows["poradnik"] = "width=800,height=550,left=20,top=10,scrollbars=yes,resizable=yes,status=yes"; 
PopupWindows["pomoc"] = "width=800,height=550,left=20,top=10,scrollbars=yes,resizable=yes,status=yes"; 
PopupWindows["druk"] = "width=650,height=500,left=20,top=10,scrollbars=yes,resizable=yes,status=yes,menubar=1"; 
PopupWindows["panel"] = "width=760,height=600,left=20,top=10,scrollbars=no,resizable=no,status=yes"; 
PopupWindows["panel2"] = "width=760,height=600,left=20,top=10,scrollbars=yes,resizable=yes,status=yes"; 
PopupWindows["foto"] = "width=654,height=475,scrollbars=yes,resizable=yes,status=yes";
PopupWindows["window2"] = "width=680,height=430,left=20,top=10,scrollbars=yes,resizable=yes,status=yes";  
PopupWindows["window3"] = "width=640,height=260,left=20,top=10,scrollbars=yes,resizable=yes,status=yes";  
PopupWindows["wiadomosc"] = "width=720,height=490,left=20,top=10,scrollbars=yes,resizable=yes,status=yes";
function popup(url, name, parameter) {
  if (name == "" || name == null) {
		name = "standard";
	}
	if (PopupWindows[name] != null) {
		parameter = PopupWindows[name];
	}
	else if (parameter == "" || parameter == null) {
		parameter = PopupWindows["standard"];
	}

	var width, height, left = null, top = null;
	temp = parameter.split(",");
	for (var i = 0; i < temp.length; i++) {
		values = temp[i].split("=");
		if (values[0] == "width") width = parseInt(values[1]);
		if (values[0] == "height") height = parseInt(values[1]);
		if (values[0] == "left") left = parseInt(values[1]);
		if (values[0] == "top") top = parseInt(values[1]);
	}
	if (left == null) {
		left = Math.round((screen.width - width) / 2);
	}
	if (top == null) {
		top = Math.round((screen.height - height) / 3);
	}
	if (left != null) {
		parameter += ",screenX="+left+",left="+left;
	}
	if (top != null) {
		parameter += ",screenY="+top+",top="+top;
	}
//alert(url+ " " +name+ " "+parameter);
	var popuphandler = 	window.open(url, name, parameter);
	if (popuphandler != null) {
		popuphandler.window.focus();
	}	else {
	  alert('Nie można otworzyć wymaganego okna!');
	}
} 