//
// openReportWindow
//
// Last Revision: 2008/03/07
//
// Defines the function to be used for opening the report window in BISON-M.
//

function openReportWindow(sReportType) {
	var sLocation;

	// if the window is already open, give it focus
	
	if (wReport && !wReport.closed) {
		//alert('report is already open');
		// is the proper report loaded, or is it a different report?
		sLocation = wReport.location.href;
		var iStart = sLocation.indexOf("rtype=") + 6;
		var sWindowReportType = sLocation.substr(iStart, iStart + 2);
		if (sWindowReportType != sReportType) {
			// report is different, reload the report
			sLocation = sLocation.replace(sWindowReportType, sReportType);
			sLocation = sLocation.replace("/reports.aspx?", "/lookupcodes.aspx?");
			wReport.location.assign(sLocation);
		}
	} else {
		// open the report window
		//alert('about to open the report window');
		wReport = window.open('lookupcodes.aspx?rtype=' + sReportType,'reportwin','width=780,height=500,resizable=yes,scrollbars=yes,location=yes');
	}
	
	// give the window focus
	wReport.focus();
	
	return false;
}
