﻿//||===========================================================================
//|| MODULE: drcBase.js
//||
//||  PURPOSE: 
//||           
//||
//||
//||===========================================================================
//module identifier
var cMod = "drcBase";

//-< Constants: General
var gcSpace = " ";
var gcNullString = "";
var gcStart = "START:";
var gcEnd = "FINISH:";
// JScript File

function popUp(URL) 
{
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=460,height=500,left = 312,top = 134');");
}



//||==========================================================================
//||  METHOD: jsWinPrint()
//||
//|| PURPOSE: 
//||==========================================================================
function jsWinPrint()
{
var cFunc = "jsWinPrint()";
var cDebug = 0;

	try
	{
		if (cDebug > 0) DebugWrite(cMod, cFunc, "Printing window...");
		this.window.print();
	}
	catch(oErr)	
	{ 
		if (cDebug > 0) DebugWrite(cMod, cFunc, "An Error Occurred.");
		if (cDebug > 0) DebugWrite(cMod, cFunc, "oErr.number      = " + oErr.number);
		if (cDebug > 0) DebugWrite(cMod, cFunc, "oErr.description = " + oErr.description);
	}
}

//||==========================================================================
//||  METHOD: jsWinClose()
//||
//|| PURPOSE: 
//||==========================================================================
function jsWinClose()
{
var cFunc = "jsWinClose()";
var cDebug = 0;

	try
	{
		if (cDebug > 0) DebugWrite(cMod, cFunc, "Closing window...");
		this.window.close();
	}
	catch(oErr)	
	{ 
		if (cDebug > 0) DebugWrite(cMod, cFunc, "An Error Occurred.");
		if (cDebug > 0) DebugWrite(cMod, cFunc, "oErr.number      = " + oErr.number);
		if (cDebug > 0) DebugWrite(cMod, cFunc, "oErr.description = " + oErr.description);
	}
}


//||==========================================================================
//||  METHOD: jsPopup()
//||
//|| PURPOSE: 
//||==========================================================================
function jsPopup(pPageUrl, pPopupWidth, pPopupHeight)
{
var cFunc = "jsPopup()";
var cDebug = 0;

var sPageURL = gcNullString;


	try
	{
		if (cDebug > 1) DebugWrite(cMod, cFunc, "Start...");
		if (cDebug > 2) DebugWrite(cMod, cFunc, "pPageUrl = " + pPageUrl);
			
		//|move focus off the button so we don't see text-edit cursor
		this.window.focus();
		
		sPageURL =  pPageUrl;
		if (cDebug > 1) DebugWrite(cMod, cFunc, "sPageURL = " + sPageURL);

		//|open the window
		if (cDebug > 0) DebugWrite(cMod, cFunc, "Opening window...");
		window.open(sPageURL, "_blank",  jsPopupFeatures(pPopupWidth, pPopupHeight));
	}
	catch(oErr)	
	{ 
		if (cDebug > 0) DebugWrite(cMod, cFunc, "An Error Occurred.");
		if (cDebug > 0) DebugWrite(cMod, cFunc, "oErr.number      = " + oErr.number);
		if (cDebug > 0) DebugWrite(cMod, cFunc, "oErr.description = " + oErr.description);
	}
}

//||==========================================================================
//||  METHOD: jsPopupFeatures()
//||
//|| PURPOSE: 
//||==========================================================================
function jsPopupFeatures(pPopupWidth, pPopupHeight)
{
	var cFunc = "jsPopupFeatures()";
	var cDebug = 0;

	var cComma = ", ";
	var cNo = "no";
	var cYes = "yes";
	var cType = "";

	var iHeight = 500;
	var iWidth = 600;
	var iLeft = 10;
	var iTop = 10;
	var sRetCode = gcNullString;

	try 
	{
		if (pPopupWidth)
		{
			if (pPopupWidth > 0) {iWidth = pPopupWidth;}
			if (cDebug > 2) DebugWrite(cMod, cFunc, "MARK: " + 1);
			if (cDebug > 2) DebugWrite(cMod, cFunc, "iWidth = " + iWidth);
		}
		else
		{
			//nothing to do
		}

		if (pPopupHeight)
		{
			if (pPopupHeight > 0) {iHeight = pPopupHeight;}
			if (cDebug > 2) DebugWrite(cMod, cFunc, "MARK: " + 3);
			if (cDebug > 2) DebugWrite(cMod, cFunc, "iHeight = " + iHeight);
		}
		else
		{
			//nothing to do
		}
		sRetCode += "height     =" + iHeight + cComma;
		sRetCode += "width      =" + iWidth + cComma;
		sRetCode += "left       =" + iLeft + cComma;
		sRetCode += "top        =" + iTop + cComma;
		sRetCode += "titlebar   =" + cNo + cComma;
		sRetCode += "status     =" + cNo + cComma;
		sRetCode += "toolbar    =" + cNo + cComma;
		sRetCode += "menubar    =" + cNo + cComma;
		sRetCode += "scrollbars =" + cYes + cComma;
		//sRetCode += "scrollbars =" + cYes + cComma;
		sRetCode += "resizable  =" + cYes;
		if (cDebug > 0) DebugWrite(cMod, cFunc, "sRetCode = " + sRetCode);
	}
	catch(oErr)	
	{ 
		if (cDebug > 0) DebugWrite(cMod, cFunc, "An Error Occurred.");
		if (cDebug > 0) DebugWrite(cMod, cFunc, "oErr.number      = " + oErr.number);
		if (cDebug > 0) DebugWrite(cMod, cFunc, "oErr.description = " + oErr.description);
	}
	return sRetCode;
}

