function OpenNewWindow(szURL)
{
	if (navigator.appName == 'Netscape')
		openDialogWin(szURL, 640, 450);
	else
	{
		window.showModalDialog(szURL, null, "status:no;help:no;scroll:yes;resizable:yes;" +
											"center:yes;dialogHeight:500px;dialogWidth:600px;");
		return;
	}
}

function ShowCourseDescrip(szID)
{
	if (navigator.appName == 'Netscape')
		openDialogWin("CourseDescrip.asp?ID=" + szID, 640, 800);
	else
	{
		window.showModalDialog("CourseDescrip.asp?ID=" + szID, null,
							'dialogHeight:500px; dialogWidth:600px; center:yes; help:no; status:no;');
		return;
	}
}


function ShowCourseSessions(szID)
{
	if (navigator.appName == 'Netscape')
		openDialogWin("CourseDescrip.asp?Type=Session&ID=" + szID, 640, 650);
	else
	{
		window.showModalDialog("CourseDescrip.asp?Type=Session&ID=" + szID, null,
							'dialogHeight:300px; dialogWidth:600px; center:yes; help:no; status:no;');
		return;
	}
}

// Global for brower version branching.
var Nav4 = ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) == 4))
var MozillaRev = GetMozillaRev();

// One object tracks the current modal dialog opened from this window.
var dialogWin = new Object()

function openDialogWin(url, width, height, returnFunc, args) 
{
	if (!dialogWin.win || (dialogWin.win && dialogWin.win.closed))
	{
		// Initialize properties of the modal dialog object.
		dialogWin.returnFunc = returnFunc;
		dialogWin.returnedValue = "";
		dialogWin.args = args;
		dialogWin.url = url;
		dialogWin.width = width;
		dialogWin.height = height;
		// Keep name unique so Navigator doesn't overwrite an existing dialog.
		dialogWin.name = (new Date()).getSeconds().toString();
		// Assemble window attributes and try to center the dialog.
		if (Nav4) 
		{
			// Center on the main window.
			dialogWin.left = window.screenX + 
			   ((window.outerWidth - dialogWin.width) / 2);
			dialogWin.top = window.screenY + 
			   ((window.outerHeight - dialogWin.height) / 2);
			var attr = "screenX=" + dialogWin.left + ",screenY=" + dialogWin.top + ",resizable=no,width=" + 
						dialogWin.width + ",height=" + dialogWin.height;
		} 
		else 
		{
			// The best we can do is center in screen.
			dialogWin.left = (screen.width - dialogWin.width) / 2;
			dialogWin.top = (screen.height - dialogWin.height) / 2;
			var attr = "left=" + dialogWin.left + ",top=" + dialogWin.top + ",resizable=no,width=" + dialogWin.width + 
						",height=" + dialogWin.height;
		}
		
		// Generate the dialog and make sure it has focus.
		dialogWin.win=window.open(dialogWin.url, dialogWin.name, attr);
		dialogWin.win.focus();

	} 
	else
	{
		dialogWin.win.focus();
	}

}
function GetMozillaRev()
{
	var agent = navigator.userAgent.toLowerCase();
	var szSearch = "rv:";
	var szEndSearch = ") gecko";
	var loc = agent.indexOf(szSearch);
	var endloc = agent.indexOf(szEndSearch);
	if(loc < 0)
		return false;
	else
	{
		loc = loc + szSearch.length;
		return agent.substring(loc, endloc);
	}  
}  // end function GetMozillaRev()