<!--
/************************************************************************************************************
	Popup Script
	
	This popup script should be used with a standard Cascading stylesheet, or the styles 
	described near the end of this file.
	
	See the bottom of this file for an example of the usage of this script.
************************************************************************************************************
*/

/************************************************************************************************************
* GLOBAL VARIABLES
************************************************************************************************************
*/

// Return Values
var jsOK = 1;
var jsCancel = 2;
var jsAbort = 3;
var jsRetry = 4;
var jsIgnore = 5;
var jsYes = 6;
var jsNo = 7;
		
// Input values		
var jsOKOnly			= 0;	// Display OK button only. 
var jsOKCancel			= 1;	// Display OK and Cancel buttons. 
var jsAbortRetryIgnore	= 2;	// Display Abort, Retry, and Ignore buttons. 
var jsYesNoCancel		= 3;	// Display Yes, No, and Cancel buttons. 
var jsYesNo				= 4;	// Display Yes and No buttons. 
var jsRetryCancel		= 5;	// Display Retry and Cancel buttons. 
var jsOKInfo   			= 6;	// Display OK and More Info buttons
var jsCritical			= 16;	// Display Critical Message icon.  
var jsQuestion			= 32;	// Display Warning Query icon. 
var jsExclamation		= 48;	// Display Warning Message icon. 
var jsInformation		= 64;	// Display Information Message icon. 
var jsDefaultButton1	= 0;	// First button is default. 
var jsDefaultButton2	= 256;	// Second button is default. 
var jsDefaultButton3	= 512;	// Third button is default. 
var jsDefaultButton4	= 768;	// Fourth button is default. 
		
// Standard button text		
//var defbutton = String('<input class="clsStandardButton" id="btn%BTNTYPE%" name="btn%BTNTYPE%" type="button" value="%BTNTEXT%" onclick="%ONCLICK%">');
var defbutton = String('<button class="clsStandardButton" id="btn%BTNTYPE%" name="btn%BTNTYPE%" onclick="%ONCLICK%">%BTNTEXT%</button>');

// ShowPopup(prompt[, buttons][, title][, helpfile, context, moreInfoXML])

// Default values
var defaultTitle = "Toothology Popup";
var defaultButtons = jsOKOnly;

/***********************************************************************************************************
 * EXTERNAL FUNCTIONS
 ***********************************************************************************************************
 */
 
/**********************************************************************
 * ShowPopup is used to show the popup and return the chosen value
   See the documentation for the VB MsgBox for details on its behavior,
   since the ShowPopup is modeled after the message boiox in VBScript.
 **********************************************************************
 */

function HTMLize(sVal)
{
	var newString = String(sVal);
	var relt = /</g;
	var regt = />/g;
	var reamp = /\&/g;
	var requot = /\"/g;
	var renl2 = /\n\n/g;
	var renl1 = /\n/g;
	
	newString = newString.replace(relt, '&lt;');
	newString = newString.replace(regt, '&gt;');
	newString = newString.replace(requot, '&quot;');
	newString = newString.replace(renl2, '<P>');
	newString = newString.replace(renl1, '<BR>');
	
	return newString

}

function ShowPopup(prompt, buttons, title, helpurl, context, moreInfo)
{
	var vRetVal;
	var args = new Array();
	args[0] = prompt;
	
	if (ShowPopup.arguments.length < 2)
		args[1] = defaultButtons;
	else
		args[1] = buttons;
		
	if (ShowPopup.arguments.length < 3)
		args[2] = HTMLize(defaultTitle);
	else
		args[2] = title;
	
	if (ShowPopup.arguments.length >= 4)
	{
		args[3] = helpurl;
		if (ShowPopup.arguments.length >= 5)
		{
			args[4] = helpurl;
		}
		if (ShowPopup.arguments.length >= 6)
		{
			args[5] = moreInfo;
		}
	}

	var sOptions = "center:yes;status:no;dialogHeight:150px;dialogWidth:400px;resizable:no;";
	
	vRetVal = window.showModalDialog("/tools/popup/popup.htm", args, sOptions);	
	
	return vRetVal;
	
}
/*************************************************************************************************************
*
* STYLESHEET
*
*

<style>
.clsStandardButton
{
    COLOR: black;
    FONT-FAMILY: 'Times New Roman';
    FONT-SIZE: 10pt;
    FONT-STYLE: normal;
    FONT-VARIANT: normal;
    HEIGHT: 25px;
    TEXT-DECORATION: none;
    WIDTH: 75px
}
.clsPopupWindow
{
    BACKGROUND-COLOR: #d5ccbb;
    COLOR: black;
    FONT-FAMILY: 'Times New Roman';
    FONT-SIZE: 10pt;
    FONT-STYLE: normal;
    FONT-VARIANT: normal;
    OVERFLOW: hidden;
    TEXT-DECORATION: none
}
</style>
************************************************************************************************************
*/
/*****************************************************************************************************
*
* EXAMPLE USAGE
*
*
<INPUT type="button" value="Critical Popup" id=btnModalPopup name=btnModalPopup 
 onclick="ShowPopup('This is a test',jsYesNoCancel | jsCritical | jsDefaultButton2,'Making Noise');">
 
 ********************************************************************************************************
*/

//-->
