// Resituisce Windows o Mac
function GetOS() 
{
	if (navigator.appVersion.indexOf("Mac") != -1) return "Mac";
	else return "Windows";
}

// Restituisce Explorer/Netscape/Safari
function GetBrowser() 
{
	if (navigator.appVersion.indexOf("Safari") != -1) return "Safari";
	else if (navigator.appName.indexOf("Netscape") != -1) return "Netscape";
	else if (navigator.appName.indexOf("Explorer") != -1) return "Explorer";
	else return "";
}

function openCenteredWindow(url, name, width, height, parms) 
{

	if (GetOS() == "Mac") height = height + 20;
	
   var left = Math.floor( (screen.width - width) / 2);
   var top = Math.floor( (screen.height - height) / 2);
   var winParms = "top=" + top + ",left=" + left + ",height=" + height + ",width=" + width;
   if (parms) { winParms += "," + parms; }
   var win = window.open(url, name, winParms);
   if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
   return win;
}