
function openDialog(url,name,height,width,edge,center,help,resizable,status)
{
	var netscape = (navigator.appName.indexOf('Netscape') >= 0) ? 1 : 0;
	var iexplorer = (document.all) ? 1 : 0;
	var features = '';
	var top = 0;
	var left = 0;

	if ( netscape == 1 ) {
		if ( height < screen.availHeight ) 	{
			top = Math.round( ( screen.availHeight - height ) / 2 );
			}
		if ( width < screen.availWidth )	{
			left = Math.round( ( screen.availWidth - width ) / 2 );
			}
		features = 'height=' + height + ',width=' + width + ',screenY=' + top + ',screenX=' + left + ',scrollbars=' + scrollbars + ',resizable=' + resizable + ',menubar=' + menubar + ',status=' + status + ',toolbar=' + toolbar + ',location=' + location + ',alwaysRaised=' + alwaysraised + ',dependent=' + dependent;
	}
	else if ( iexplorer == 1 )	{
		if ( height < screen.height )	{
			top = Math.round( ( screen.height - height ) / 2 );
			}
		if ( width < screen.width )		{
			left = Math.round( ( screen.width - width ) / 2 );
			}
		features = 'dialogHeight: ' + height + 'px; dialogWidth: ' + width + 'px; dialogTop: ' + top + 'px; dialogLeft=' + left + 'px; edge: sunken; center: Yes; help: No; resizable: No; status: Yes; unadorned: Yes;';
	}
	return (window.showModalDialog(url,name,features));
}

function  openWindow(url,name,height,width,toolbar,location,status,menubar,scrollbars,resizable,alwaysraised,dependent)
 {
	var netscape = (navigator.appName.indexOf('Netscape') >= 0) ? 1 : 0;
	var iexplorer = (document.all) ? 1 : 0;
	var features = '';
	var top = 0;
	var left = 0;

	if ( netscape == 1 ) {
		if ( height < screen.availHeight ) 	{
			top = Math.round( ( screen.availHeight - height ) / 2 );
			}
		if ( width < screen.availWidth )	{
			left = Math.round( ( screen.availWidth - width ) / 2 );
			}
		features = 'height=' + height + ',width=' + width + ',screenY=' + top + ',screenX=' + left + ',scrollbars=' + scrollbars + ',resizable=' + resizable + ',menubar=' + menubar + ',status=' + status + ',toolbar=' + toolbar + ',location=' + location + ',alwaysRaised=' + alwaysraised + ',dependent=' + dependent;
	}
	else if ( iexplorer == 1 )	{
		if ( height < screen.height )	{
			top = Math.round( ( screen.height - height ) / 2 );
			}
		if ( width < screen.width )		{
			left = Math.round( ( screen.width - width ) / 2 );
			}
		if (scrollbars==1) { scrollbars = "auto"; }
		features = 'height=' + height + ',width=' + width + ',top=' + top + ',left=' + left + ',scrollbars=' + scrollbars + ',resizable=' + resizable + ',menubar=' + menubar + ',status=' + status + ',toolbar=' + toolbar + ',location=' + location;
	}
	return open(url,name,features);
}


/*************************************************
Popup DocViewer
- Opens MS Office documents, Adobe Acrobat and Shockwave Flash files
in a popup window with a smart "Loading..." status message
(c) 2003 Glenn G. Vergara
http://www21.brinkster.com/gver/
*************************************************/

function openDoc(filename,target)
{
	//if not IE, open link normally
	if (!document.all){
	location.href = filename;
	return;
	}

	var strWinHandle = target + "_WinOpenDoc"; //to ensure no global variable conflict with other script

	//just focus to the corresponding window if it is already open
	if (window[strWinHandle] && !window[strWinHandle].closed){
	window[strWinHandle].focus();
	return;
	}

	//open blank page
	window[strWinHandle] = window.open('',target,'menubar=1,location=0,toolbar=0,resizable=1,status=0'); //add other window features here

	//create frameset with only one frame
	var strHTML = '<html>\n<head>\n<title>Loading...Please wait.</title>\n</head>\n';
	strHTML += '<frameset onload="window.focus()">\n<frame name="docFrame" src="/private/blank.html">\n</frameset>\n';
	strHTML += '</html>';
	window[strWinHandle].document.write(strHTML);
	window[strWinHandle].document.close();

	//Flash the 'Loading...' message
	strHTML = '<html><body>';
	strHTML += '<table width="100%" height="100%">';
	strHTML += '<tr><td align="center" valign="middle">';
	strHTML += '<font face="Arial" color="red">Loading...Please wait.</font><br><br>';
	//provide link to close window (for browsers with no appropriate plugin for the needed software)
	strHTML += '<font face="Arial" size="1" color="gray">If you may not have the applicable software to launch the document, please <a href="javascript:top.close()">close</a> this window.</font>';
	strHTML += '</td></tr></table>';
	strHTML += '</body></html>';
	var winDocFrame = window[strWinHandle].top.frames['docFrame'];
	winDocFrame.document.write(strHTML);
	winDocFrame.document.close();

	//preload the document
	var doc = new Image();
	doc.onerror = function(){
		//check window if still open, the user might have closed it
		if (window[strWinHandle] && !window[strWinHandle].closed){
		window[strWinHandle].document.title = filename.substring(filename.lastIndexOf("/")+1); //extract just the filename
		//winDocFrame.location.replace(filename); //finally, set frame's location to the document filename
		window[strWinHandle].document.location.replace(filename)
		}
	}
	doc.src = filename; //onerror handler fires since image src is not actually an image
}