// Global for brower version branching.
var Nav4 = ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) == 4))
var undefined;
// One object tracks the current modal dialog opened from this window.
var dialogWin = new Object()

//custom dialog window openers
function jsOpenSCIMSQuestion() {
	jsOpenDialogWin("PopSCIMSQuestion.aspx", "SCIMS%20Question:", jsReturnDialog, "<INPUT TYPE='button' VALUE='Close' onClick='parent.jsCloseCancel()'>&nbsp;", 550, 250, "um");
} //jsOpenSCIMSQuestion
function jsOpenFeedback() {
	var sClsBtn      = '<INPUT TYPE="button" id="btnCls" name="btnCls" VALUE="Close"  class="cRegButtons" onClick="parent.jsCloseCancel()">&nbsp;';
	var sSubBtn      = '<INPUT TYPE="button" id="btnSub" name="btnSub" VALUE="Submit" class="cRegButtons" onClick="top.dlogBody.jsCloseMe()" >&nbsp;';  //parent.jsCloseOK()
	var sDefArgs     = jsSetParamStr("OpenStr", "?", sKeySep, sValSep);
	sDefArgs        += jsSetParamStr("PairSep", "=", sKeySep, sValSep);
	sDefArgs        += jsSetParamStr("GroupSep", "&", sKeySep, sValSep);
	var sContentHTML = "";
	var sURL         =  "dialogFS.aspx?windowname=" + "TSP%20Process%20Comments";
	var nWidth       = 550;
	var nHeight      = 300;
	var sContentURL  = "PopFeedback.aspx";
	var sButtonHTML  = "<TABLE border='0' cellpadding='0' cellspacing='0' width='100%'><TR>";
	sButtonHTML     += "<TD class='cDataEntry'>&nbsp;</TD>"
	sButtonHTML     += "<TD class='cDataEntryR'>" + sSubBtn + sClsBtn + "</TD>";
	sButtonHTML     += "</TR></TABLE>";
	var sArgs        = sDefArgs;
	var sScreenLoc   = "uc"; 
	var sWinAttrs    = ",resizable=yes";
	jsOpenDialog(sURL,nWidth,nHeight,jsRetFeedback,sContentHTML,sContentURL,sButtonHTML,sArgs,sScreenLoc,sWinAttrs);
} //jsOpenFeedback
function jsRetFeedback() {
	var sRetVal  = dialogWin.returnedValue.substr(1);
	var sReturn  = "";
	var sTmpInr  = String.fromCharCode(61); //special separator used by modaldialog window instead of sKeySep
	var sTmpOutr = String.fromCharCode(38); //special separator used by modaldialog window instead of sValSep
	if(sRetVal!=null && sRetVal != ""){
		var sReturn = jsGetParamStr("hidBtnClk", sRetVal, sTmpInr, sTmpOutr);
		if (sReturn == "Saved") {
			window.setTimeout("jsFeedbackMsg()", 1000);  //delay calling jsFeedbackMsg() for 1 second
		}
	}
}	//jsRetFeedback
function jsFeedbackMsg() {
  window.alert("You comments have been saved.\n\nThank you.");
} //jsFeedbackMsg

function jsOpenContactUs() {
	var sClsBtn      = '<INPUT TYPE="button" id="btnCls" name="btnCls" VALUE="Close"  class="cRegButtons" onClick="parent.jsCloseCancel()">&nbsp;';
	var sDefArgs     = jsSetParamStr("OpenStr", "?", sKeySep, sValSep);
	sDefArgs        += jsSetParamStr("PairSep", "=", sKeySep, sValSep);
	sDefArgs        += jsSetParamStr("GroupSep", "&", sKeySep, sValSep);
	var sContentHTML = "";
	var sURL         =  "dialogFS.aspx?windowname=" + "TechReg%20Contact%20Information";
	var nWidth       = 425;
	var nHeight      = 450;
	var sContentURL  = "PopContacts.aspx";
	var sButtonHTML  = "<TABLE border='0' cellpadding='0' cellspacing='0' width='100%'><TR>";
	sButtonHTML     += "<TD class='cDataEntry'>&nbsp;</TD>"
	sButtonHTML     += "<TD class='cDataEntryR'>" + sClsBtn + "</TD>";
	sButtonHTML     += "</TR></TABLE>";
	var sArgs        = sDefArgs;
	var sScreenLoc   = "um"; 
	var sWinAttrs    = ",resizable=yes";
	jsOpenDialog(sURL,nWidth,nHeight,jsRetNoRefresh,sContentHTML,sContentURL,sButtonHTML,sArgs,sScreenLoc,sWinAttrs);
} //jsOpenContactUs

function jsOpenCertOrgs() {
	var sClsBtn      = '<INPUT TYPE="button" id="btnCls" name="btnCls" VALUE="Close"  class="cRegButtons" onClick="parent.jsCloseCancel()">&nbsp;';
	var sDefArgs     = jsSetParamStr("OpenStr", "?", sKeySep, sValSep);
	sDefArgs        += jsSetParamStr("PairSep", "=", sKeySep, sValSep);
	sDefArgs        += jsSetParamStr("GroupSep", "&", sKeySep, sValSep);
	var sContentHTML = "";
	var sURL         =  "dialogFS.aspx?windowname=" + "Recommending%20Organizations";
	var nWidth       = 550;
	var nHeight      = 450;
	var sContentURL  = "PopCertOrgList.aspx";
	var sButtonHTML  = "<TABLE border='0' cellpadding='0' cellspacing='0' width='100%'><TR>";
	sButtonHTML     += "<TD class='cDataEntry'>&nbsp;</TD>"
	sButtonHTML     += "<TD class='cDataEntryR'>" + sClsBtn + "</TD>";
	sButtonHTML     += "</TR></TABLE>";
	var sArgs        = sDefArgs;
	var sScreenLoc   = "um"; 
	var sWinAttrs    = ",resizable=yes";
	jsOpenDialog(sURL,nWidth,nHeight,jsRetNoRefresh,sContentHTML,sContentURL,sButtonHTML,sArgs,sScreenLoc,sWinAttrs);
} //jsOpenConta

function jsRetNoRefresh() {
} //jsRetNoRefresh
function jsOpenPopFAQ() {
	var sClsBtn      = '<INPUT TYPE="button" id="btnCls" name="btnCls" VALUE="Close"  class="cRegButtons" onClick="parent.jsCloseCancel()">&nbsp;';
	var sPrtBtn			 = '<INPUT TYPE="button" id="btnPrt" name="btnPrt" VALUE="Print"  class="cRegButtons" onClick="top.dlogBody.focus();top.dlogBody.print();">&nbsp;';
	var sDefArgs     = jsSetParamStr("OpenStr", "?", sKeySep, sValSep);
	sDefArgs        += jsSetParamStr("PairSep", "=", sKeySep, sValSep);
	sDefArgs        += jsSetParamStr("GroupSep", "&", sKeySep, sValSep);
	var sContentHTML = "";
	var sURL         =  "dialogFS.aspx?windowname=" + "TechReg%20FAQ";
	var nWidth			 = (screen.availwidth  * .95) ; 
	var nHeight			 = (screen.availheight * .50); 
	var sContentURL  = "PopFAQ.aspx";
	var sButtonHTML  = "<TABLE border='0' cellpadding='0' cellspacing='0' width='100%'><TR>";
	sButtonHTML     += "<TD class='cDataEntry'>&nbsp;</TD>"
	sButtonHTML     += "<TD class='cDataEntryR'>" + sPrtBtn + sClsBtn + "</TD>";
	sButtonHTML     += "</TR></TABLE>";
	var sArgs        = sDefArgs;
	var sScreenLoc   = "ll"; 
	var sWinAttrs    = ",resizable=yes";
	jsOpenDialog(sURL,nWidth,nHeight,jsRetNoRefresh,sContentHTML,sContentURL,sButtonHTML,sArgs,sScreenLoc,sWinAttrs);
} //jsOpenFAQ

function jsLookupSCIMS(dialogUrl,returnUrl) {
	var sClsBtn      = '<INPUT TYPE="button" id="btnCls" name="btnCls" VALUE="Close"  class="cRegButtons" onClick="parent.jsCloseCancel()">&nbsp;';
	var sOKBtn       = '<INPUT TYPE="button" id="btnOK"  name="btnOK"  VALUE="&nbsp;&nbsp;OK&nbsp;&nbsp;" class="cRegButtons" onClick="top.dlogBody.jsCloseMe()" >&nbsp;';  //parent.jsCloseOK()
	var sDefArgs     = jsSetParamStr("OpenStr", "?", sKeySep, sValSep);
	sDefArgs        += jsSetParamStr("PairSep", "=", sKeySep, sValSep);
	sDefArgs        += jsSetParamStr("GroupSep", "&", sKeySep, sValSep);
	var sContentHTML = "";
	var sURL         =  "dialogFS.aspx?windowname=" + "SCIMS%20Lookup";
	var nWidth       = 675;
	var nHeight      = 500;
	var sContentURL  = dialogUrl + '?scimsQueryString=<?xml%20version=\'1.0\'?><SCIMSQuery><SearchParameter%20ParameterType=\'dialogue\'></SearchParameter><ReturnURL>' + returnUrl + '</ReturnURL></SCIMSQuery>';
	var sButtonHTML  = "<TABLE border='0' cellpadding='0' cellspacing='0' width='100%'><TR>";
	sButtonHTML     += "<TD class='cDataEntry'>&nbsp;</TD>"
	sButtonHTML     += "<TD class='cDataEntryR'>" + /*sOKBtn + "&nbsp;" +*/ sClsBtn + "</TD>";
	sButtonHTML     += "</TR></TABLE>";
	var sArgs        = sDefArgs;
	var sScreenLoc   = "uc"; 
	var sWinAttrs    = ",resizable=yes";
	jsOpenDialog(sURL,nWidth,nHeight,jsRetSCIMSLookup,sContentHTML,sContentURL,sButtonHTML,sArgs,sScreenLoc,sWinAttrs);
} //jsLookupSCIMS

function jsRetSCIMSLookup() {
	var sRetVal  = dialogWin.returnedValue.substr(1);
	var sReturn  = "";
	var sTmpInr  = String.fromCharCode(61); //special separator used by modaldialog window instead of sKeySep
	var sTmpOutr = String.fromCharCode(38); //special separator used by modaldialog window instead of sValSep
	if(sRetVal!=null && sRetVal != ""){
//		var sReturn = jsGetParamStr("hidAnswer", sRetVal, sTmpInr, sTmpOutr);
//		if (sReturn == "Yes") {
//			window.setTimeout("jsSubmit()", 1000);  //delay calling (commonfunction.js)jsSubmit() for 1 second
//		}
	}
}	//jsRetSCIMSLookup

function jsOpenCustSurvey() {
	var sClsBtn      = '<INPUT TYPE="button" id="btnCls" name="btnCls" VALUE="Close"  class="cRegButtons" onClick="parent.jsCloseCancel()">&nbsp;';
	var sSavBtn      = '<INPUT TYPE="button" id="btnSav" name="btnSav" VALUE="Save"   class="cRegButtons" onClick="top.dlogBody.jsCloseMe()" >&nbsp;';  //parent.jsCloseOK()
	//var sSavBtn      = '<INPUT TYPE="button" id="btnSav" name="btnSav" VALUE="Save"   class="cRegButtons" onClick="top.dlogBody.jsSelectBtn(\'Save\')" >&nbsp;';  //    top.dlogBody.jsCloseMe()" >&nbsp;';  //parent.jsCloseOK()
	var sDefArgs     = jsSetParamStr("OpenStr", "?", sKeySep, sValSep);
	sDefArgs        += jsSetParamStr("PairSep", "=", sKeySep, sValSep);
	sDefArgs        += jsSetParamStr("GroupSep", "&", sKeySep, sValSep);
	var sContentHTML = "";
	var sURL         = "dialogFS.aspx?windowname=" + "Customer%20Satisfaction%20Survey";
	var nWidth       = 500;
	var nHeight      = 300;
	var sContentURL  = "PopCustSurvey.aspx";
	var sButtonHTML  = '<SPAN style="width:100%;" class="cDataEntryR" >';
	sButtonHTML     += sSavBtn + sClsBtn + '</SPAN>';
	var sArgs        = sDefArgs;
	var sScreenLoc   = "center"; //upper-center
	var sWinAttrs    = ""; // ",resizable=yes";
	jsOpenDialog(sURL,nWidth,nHeight,jsReturnDialog,sContentHTML,sContentURL,sButtonHTML,sArgs,sScreenLoc,sWinAttrs);
} //jsOpenCustSurvey

function jsOpenConfirmSubmission() {
	var sNoBtn  = '<INPUT TYPE="button" id="btnNo"  name="btnNo"  VALUE="No"  class="cRegButtons" onClick="parent.jsCloseCancel()">&nbsp;';
	var sYesBtn = '<INPUT TYPE="button" id="btnYes" name="btnYes" VALUE="Yes" class="cRegButtons" onClick="top.dlogBody.jsCloseMe()" >&nbsp;';
	var sDefArgs= jsSetParamStr("OpenStr", "?", sKeySep, sValSep);
	sDefArgs   += jsSetParamStr("PairSep", "=", sKeySep, sValSep);
	sDefArgs   += jsSetParamStr("GroupSep", "&", sKeySep, sValSep);
	var sContentHTML = "";
	var sURL         =  "dialogFS.aspx?windowname=" + "Confirm%20Submission";
	var nWidth       = 450;
	var nHeight      = 225;
	var sContentURL  = "PopConfirmSubmission.aspx";
	var sButtonHTML  = "<TABLE border='0' cellpadding='0' cellspacing='0' width='100%'><TR>";
	sButtonHTML     += "<TD class='cDataEntry'>&nbsp;</TD>"
	sButtonHTML     += "<TD class='cDataEntryR'>" + sYesBtn + "&nbsp;" + sNoBtn + "</TD>";
	sButtonHTML     += "</TR></TABLE>";
	var sArgs        = sDefArgs;
	var sScreenLoc   = "center"; //center
	var sWinAttrs    = ",resizable=no";
	jsOpenDialog(sURL,nWidth,nHeight,jsRetConfirmSubmission,sContentHTML,sContentURL,sButtonHTML,sArgs,sScreenLoc,sWinAttrs);
} //jsOpenConfirmSubmission

function jsRetConfirmSubmission() {
	var sRetVal  = dialogWin.returnedValue.substr(1);
	var sReturn  = "";
	var sTmpInr  = String.fromCharCode(61); //special separator used by modaldialog window instead of sKeySep
	var sTmpOutr = String.fromCharCode(38); //special separator used by modaldialog window instead of sValSep
	if(sRetVal!=null && sRetVal != ""){
		var sReturn = jsGetParamStr("hidAnswer", sRetVal, sTmpInr, sTmpOutr);
		if (sReturn == "Yes") {
			window.setTimeout("jsSubmit()", 1000);  //delay calling (commonfunction.js)jsSubmit() for 1 second
		}
	}	
} //jsRetConfirmSubmission


//Generic dialog window opener
function jsOpenDialogWin(sContentURL, sWinTitle, oRetFunc, sBtnHTML, nWidth, nHeight, sScreenLoc, sWinAttrs, oDefFunc) 
{
	var sURL        = "dialogFS.aspx";
	if (sWinTitle  != undefined) sURL      += "?windowname=" + sWinTitle;
	if (nWidth     == undefined) nWidth     = 550;
	if (nHeight    == undefined) nHeight    = 250;
	if (oRetFunc   == undefined) oRetFunc   = jsReturnDialog;
	if (sScreenLoc == undefined) sScreenLoc = "center"; 
	if (sWinAttrs  == undefined) sAttrs     = ""; //" resizable";
	sContentHTML    = "";
	var sButtonHTML = "";
	sButtonHTML    += '<SPAN style="width:100%;" class="cDataEntryR" >';
	if (sBtnHTML   == undefined) {
		sButtonHTML  += '<INPUT TYPE="button" id="btnOK"  name="btnOK"  class="cRegButtons" VALUE="&nbsp;&nbsp;OK&nbsp;&nbsp;" onClick="top.dlogBody.jsCloseMe()" >&nbsp;';  //parent.jsCloseOK()  
		sButtonHTML  += '<INPUT TYPE="button" id="btnCls" name="btnCls" class="cRegButtons" VALUE="Close" onClick="parent.jsCloseCancel()">&nbsp;';
	} else {
		sButtonHTML  += sBtnHTML;
	}
	sButtonHTML    += '</SPAN>';
	var sArgs       = jsSetParamStr("OpenStr", "?", sKeySep, sValSep);
	sArgs          += jsSetParamStr("PairSep", "=", sKeySep, sValSep);
	sArgs          += jsSetParamStr("GroupSep", "&", sKeySep, sValSep);
	jsOpenDialog(sURL,nWidth,nHeight,oRetFunc,sContentHTML,sContentURL,sButtonHTML,sArgs,sScreenLoc,sWinAttrs,oDefFunc); 
} //jsOpenDialogWin

function jsReturnDialog() {
	var sRetVal  = dialogWin.returnedValue.substr(1);
	var sReturn  = "";
	var sTmpInr  = String.fromCharCode(61); //special separator used by modaldialog window instead of sKeySep
	var sTmpOutr = String.fromCharCode(38); //special separator used by modaldialog window instead of sValSep
	if(sRetVal!=null && sRetVal != ""){
	}
} //jsReturnDialog


// Generate a modal dialog.
// Parameters:
//    url -- URL of the page/frameset to be loaded into dialog
//    width -- pixel width of the dialog window
//    height -- pixel height of the dialog window
//    returnFunc -- reference to the function (on this page)
//                  that is to act on the data returned from the dialog
//    contentHTML -- [optional] content for dialog window
//    contentURL  -- [optional] URL for content section of dialog window
//    buttonHTML  -- [optional] HTML for dialog window buttons
//    args -- [optional] any data you need to pass to the dialog
//    screenLoc -- [optional] position on screen for window
//    sWinAttrs -- [optional] Screen attributes other than position, height, & width
//    defaultFunc - [optional] reference to function with default behavior
function jsOpenDialog(url, width, height, returnFunc, contentHTML, contentURL, buttonHTML, args, screenLoc, sWinAttrs, defaultFunc) {
  if (!dialogWin.win || (dialogWin.win && dialogWin.win.closed)) {
    // Initialize properties of the modal dialog object.
    dialogWin.returnFunc    = returnFunc
    dialogWin.defaultFunc   = defaultFunc
    dialogWin.returnedValue = ""
    dialogWin.contentHTML   = contentHTML
    dialogWin.contentURL    = contentURL
    dialogWin.buttonHTML    = buttonHTML
    dialogWin.args          = args
    dialogWin.url           = url
    dialogWin.width         = width
    dialogWin.height        = height
    dialogWin.name          = (new Date()).getSeconds().toString(); //create unique name
    
    if (screenLoc == "" || screenLoc == undefined) screenLoc = "center";
    screenLoc = screenLoc.toLowerCase();
    switch (screenLoc) {
			case "ul":
				dialogWin.left = 5;
				dialogWin.top  = 5;
			break;
			case "um":
			  dialogWin.left = Nav4? window.screenX + ((window.outerWidth - dialogWin.width) / 2): ((screen.width - dialogWin.width) / 2);
			  dialogWin.top  = 5;
			break;
			case "ur":
				dialogWin.left = Nav4? window.screenX + (window.outerWidth - dialogWin.width) : (screen.width - dialogWin.width);
				dialogWin.left -= 9;
				dialogWin.top  = 5;
			break;
			case "cl":
				dialogWin.left = 5;
				dialogWin.top  = Nav4? window.screenY + ((window.outerHeight - dialogWin.height) / 2): ((screen.height - dialogWin.height) / 2);
			break;
			case "cr":
				dialogWin.left = Nav4? window.screenX + (window.outerWidth - dialogWin.width) : (screen.width - dialogWin.width);
				dialogWin.left -= 10;
				dialogWin.top  = Nav4? window.screenY + ((window.outerHeight - dialogWin.height) / 2): ((screen.height - dialogWin.height) / 2);
			break;
			case "ll":
				dialogWin.left  = 5;
				dialogWin.top   = Nav4? window.screenY + (window.outerHeight - dialogWin.height) : (screen.height - dialogWin.height);
				dialogWin.top  -= 56;
			break;
			case "lm":
				dialogWin.left = Nav4? dialogWin.left = window.screenX + ((window.outerWidth - dialogWin.width) / 2): ((screen.width - dialogWin.width) / 2);
				dialogWin.top  = Nav4? window.screenY + (window.outerHeight - dialogWin.height) : (screen.height - dialogWin.height);
				dialogWin.top  -= 56;
			break;
			case "lr":
				dialogWin.left = Nav4? window.screenX + (window.outerWidth - dialogWin.width) : (screen.width - dialogWin.width);
				dialogWin.left -= 9;
				dialogWin.top  = Nav4? window.screenY + (window.outerHeight - dialogWin.height) : (screen.height - dialogWin.height);
				dialogWin.top  -= 56;
			break;
			default: //case "center":
				dialogWin.left = Nav4? dialogWin.left = window.screenX + ((window.outerWidth - dialogWin.width) / 2): ((screen.width - dialogWin.width) / 2);
				dialogWin.top  = Nav4? window.screenY + ((window.outerHeight - dialogWin.height) / 2): ((screen.height - dialogWin.height) / 2);
				dialogWin.top  -= 50;
			break;
    } //switch
    dialogWin.left = parseInt(dialogWin.left);
    dialogWin.top  = parseInt(dialogWin.top);
    // Assemble window attributes and position the dialog.
    var lLbl = (Nav4)? "screenX=":  "left=";
    var tLbl = (Nav4)? ",screenY=": ",top=";
    dialogWin.attr = lLbl + dialogWin.left + tLbl + dialogWin.top + ",width=" + dialogWin.width + ",height="  + dialogWin.height;
    if (sWinAttrs != undefined && sWinAttrs != "") {
			if (sWinAttrs.substr(0,1) != ',') dialogWin.attr += ',';
			dialogWin.attr += sWinAttrs;
    } else {
			dialogWin.attr += ",resizable=no";
    }
    // Generate the dialog and make sure it has focus.
    dialogWin.win=window.open(dialogWin.url, dialogWin.name, dialogWin.attr)
    dialogWin.win.focus()
  } else {
    dialogWin.win.focus()
  }
}

// Event handler to inhibit Navigator form element
// and IE link activity when dialog window is active.
function deadend() {
  if (dialogWin.win && !dialogWin.win.closed) {
    dialogWin.win.focus()
    return false
  }
}

// Since links in IE4 cannot be disabled, preserve
// IE link onclick event handlers while they're "disabled."
// Restore when re-enabling the main window.
var IELinkClicks

// Disable form elements and links in all frames for IE.
function disableForms() {
  IELinkClicks = new Array()
  for (var h = 0; h < frames.length; h++) {
    for (var i = 0; i < frames[h].document.forms.length; i++) {
      for (var j = 0; j < frames[h].document.forms[i].elements.length; j++) {
        frames[h].document.forms[i].elements[j].disabled = true
      }
    }
    IELinkClicks[h] = new Array()
    for (i = 0; i < frames[h].document.links.length; i++) {
      IELinkClicks[h][i] = frames[h].document.links[i].onclick
      frames[h].document.links[i].onclick = deadend
    }
  }
}

// Restore IE form elements and links to normal behavior.
function enableForms() {
  for (var h = 0; h < frames.length; h++) {
    for (var i = 0; i < frames[h].document.forms.length; i++) {
      for (var j = 0; j < frames[h].document.forms[i].elements.length; j++) {
        frames[h].document.forms[i].elements[j].disabled = false
      }
    }
    for (i = 0; i < frames[h].document.links.length; i++) {
      frames[h].document.links[i].onclick = IELinkClicks[h][i]
    }
  }
}

// Grab all Navigator events that might get through to form
// elements while dialog is open. For IE, disable form elements.
function blockEvents() {
  if (Nav4) {
    window.captureEvents(Event.CLICK | Event.MOUSEDOWN | Event.MOUSEUP | Event.FOCUS)
    window.onclick = deadend
  } else {
    disableForms()
  }
  window.onfocus = checkModal
}
// As dialog closes, restore the main window's original
// event mechanisms.
function unblockEvents() {
  if (Nav4) {
    window.releaseEvents(Event.CLICK | Event.MOUSEDOWN | Event.MOUSEUP | Event.FOCUS)
    window.onclick = null
    window.onfocus = null
  } else {
    enableForms()
  }
}

// Invoked by onFocus event handler of EVERY frame,
// return focus to dialog window if it's open.
function checkModal() {
  if (dialogWin.win && !dialogWin.win.closed) {
    dialogWin.win.focus()
  }
}
//-----dialog content functions

// Generic function converts form element name-value pairs
// into a URL search string.
function jsParseReturn(form) {
  var sRetOpenStr;
  var sPairSep;
  var sGroupSep;

  if (top.opener && !top.opener.closed) {
    var sArgs       = top.opener.dialogWin.args;
    if ( sArgs == undefined ) {
      sArgs = "";
    }
    var sRetOpenStr = jsGetParamStr("OpenStr", sArgs, sKeySep, sValSep);
    var sPairSep    = jsGetParamStr("PairSep", sArgs, sKeySep, sValSep);
    var sGroupSep   = jsGetParamStr("GroupSep", sArgs, sKeySep, sValSep);

  }
  if (sRetOpenStr == "" || sRetOpenStr == undefined) sRetOpenStr = "?";
  if (sPairSep    == "" || sPairSep    == undefined) sPairSep    = "=";
  if (sGroupSep   == "" || sGroupSep   == undefined) sGroupSep   = "&";
  var sReturn = sRetOpenStr;
  var onePair;
  // Harvest values for each type of form element
  for (var i = 0; i < form.elements.length; i++) {
    if (sReturn != sRetOpenStr) sReturn += sGroupSep;
		if (form.elements[i].type == "text") {
      onePair  = escape(form.elements[i].name) + sPairSep;
      onePair += escape(form.elements[i].value);
    } else if (form.elements[i].type == "hidden" &&
			form.elements[i].name.substr(0,2) != "__") 
    { //06/13/02 new option
      onePair  = escape(form.elements[i].name) + sPairSep;
	    onePair += escape(form.elements[i].value);
    } else if (form.elements[i].type.indexOf("select") != -1) {
			if (form.elements[i].selectedIndex > -1) {
				onePair  = escape(form.elements[i].name) + sPairSep;
				onePair += escape(form.elements[i].options[form.elements[i].selectedIndex].value);
			}	
    } else if (form.elements[i].type == "radio") {
      onePair  = escape(form.elements[i].name) + sPairSep;
      onePair += escape(form.elements[i].checked);
    } else if (form.elements[i].type == "checkbox") {
      onePair  = escape(form.elements[i].name) + sPairSep;
      onePair += escape(form.elements[i].checked);
    } else continue
    sReturn += onePair; // + "&";
  }
  return sReturn
}  //jsParseReturn

function jsGetContent() {
  var sContent = "";
  if (top.opener && !top.opener.closed) {
    sContent = top.opener.dialogWin.contentHTML;
  }
  if (sContent == "") {
    sContent = "Sorry, browser passed no data to dialog window.";
  }
  return sContent;
} //jsGetContent

// Send gathered data to the dialog window object's returnedValue property
function jsTransferData() {
  if (top.opener && !top.opener.closed) {
    top.opener.dialogWin.returnedValue = jsParseReturn(document.dialogForm);
  }
} //jsTransferData

//-----frameset functions
function jsCloseWin() {
//  if ( typeof opener.dialogWin.defaultFunc != undefined) {
  //   opener.dialogWin.defaultFunc();
//   }
  window.close();
} //jsCloseWin()

// Handle click of OK button
function jsCloseOK() {
  if (opener && !opener.closed) {
    top.dlogBody.jsTransferData();
    if ( typeof opener.dialogWin.returnFunc != undefined) {
      opener.dialogWin.returnFunc();
    }
  } else {
    window.alert("You have closed the main window.\n\nNo action will be taken on the choices in this dialog box.");
  }
  jsCloseWin();
  return false;
} //jsCloseOK

// Handle click of Cancel button
function jsCloseCancel() {
  jsCloseWin();
  return false;
} //jsCloseCancel
  function jsGetFrameContent(sButtonHeight) {
  var sReturn = "";
  if (sButtonHeight == undefined) {
		nButtonHeight = 35;
	} else {
		nButtonHeight = sButtonHeight - 0;
	}
  sReturn    += '<FRAMESET FRAMEBORDER=no FRAMESPACING=0 ROWS="*,' + nButtonHeight + '" BORDER=0 ';
  sReturn    += 'onLoad="if (opener) opener.blockEvents()" onUnload="if (opener) opener.unblockEvents()">';
  sReturn    += '<FRAME NAME="dlogBody" ID="dlogBody"    SRC="';
  var sURL    = "";
  if (top.opener && !top.opener.closed)  sURL = top.opener.dialogWin.contentURL;
  if (sURL   == "" || sURL == undefined) sURL = "dialogContent.aspx";
  sReturn    +=  sURL + '" FRAMEBORDER=no>';
  sReturn    += '<FRAME NAME="dlogButtons" ID="dlogButtons" SRC="dialogButtons.aspx" FRAMEBORDER=no SCROLLING=no>';
  sReturn    += '</FRAMESET>';
  return sReturn;
} //jsGetFrameContent

/**
  * jsGetButtons returns an HTML string to make the button bar
  *
  * <br><br>
  * @author Robert E. Hoch <br>
  * @version January 26, 2002 <br>
  * @param   none<br>
  * @return  <B>sReturn</B> <I>String</I> HTML String to make the buttons for dialog window.<br>
  */
function jsGetButtons( ) {
  var sReturn = "";
  if (top.opener && !top.opener.closed) sReturn = top.opener.dialogWin.buttonHTML;
  if ( sReturn == "" || sReturn == undefined) {
		//default buttons
		sReturn  = '<SPAN style="width:100%; text-align:right; vertical-align:center;" >';
    sReturn += '<INPUT TYPE="button" VALUE="Cancel" onClick="parent.jsCloseCancel()">';
    sReturn += '&nbsp;';
    sReturn += '<INPUT TYPE="button" VALUE="&nbsp;&nbsp;OK&nbsp;&nbsp;" onClick="parent.jsCloseOK()">';
    sReturn += '&nbsp;';
    sReturn += '</SPAN>';
  }
  return sReturn;
}  // jsGetButtons

function jsSubmit(jsForm) {
 // document.forms[0].submit();
 jsSubmitForm(jsForm);
} //jsSubmit

function jsCloseMe() {
	//parent.jsCloseOK();
  jsSubmitWindow("Save");
}

function jsCloseDelete() {
  jsSubmitWindow("Delete");
} //jsCloseDelete

function jsSubmitWindow(sMode, nFormNum) {
	var oMode = jsGetObjectRef("hidPageMode");
	if (typeof oMode == "object") {
		oMode.value = sMode;
		var bOK = true;
		if (sMode == "Delete") {
			bOK = window.confirm("Are you sure you want to delete this record?");
		}
		if (bOK) {
			jsSubmitForm(nFormNum);
		}
	}
} //jsSubmitPopup

function jsPopBodyLoad() {
	var oMode = jsGetObjectRef("hidPageMode");
	if (typeof oMode == "object") {
		if (oMode.value == "Close") { //jsCloseMe();
			parent.jsCloseOK();
		}	
	}	
} //jsBodyLoad

 function jsCatOptRpt() {
		var sPrintBtn = '<INPUT TYPE="button" id="btnPrint" name="btnPrint" class="cRegButtons" VALUE="Print" onClick="parent.cFSwBody.focus();parent.cFSwBody.print()" >&nbsp;';
		var sClsBtn = '<INPUT TYPE="button" id="btnCls" name="btnCls" class="cRegButtons" VALUE="Close"  onClick="parent.jsCloseCancel()">&nbsp;';
		var nWidth   = (screen.availwidth  * .80) ; 
		var nHeight  = (screen.availheight * .80); 
		var sButtonHTML  = '<TABLE border="0" cellpadding="0" cellspacing="0" width=100%" class="c120"><TR><TD class="cDataEntryR">';
		var sCURL    = "RptCategory.aspx";
		sButtonHTML     += sPrintBtn;
		sButtonHTML     += sClsBtn;
		sButtonHTML     += '</TD></TR></TABLE>';
		var sAttrs       = " resizable, menubar";
		jsOpenChildWin(sCURL,'Technical%20Services%20Categories%20and%20Options', nWidth, nHeight, 'center', sButtonHTML, sAttrs);
	}
function jsOpenCatOptRpt() {
	var sClsBtn      = '<INPUT TYPE="button" id="btnCls" name="btnCls" VALUE="Close"  class="cRegButtons" onClick="parent.jsCloseCancel()">&nbsp;';
	var sPrtBtn			 = '<INPUT TYPE="button" id="btnPrt" name="btnPrt" VALUE="Print"  class="cRegButtons" onClick="top.dlogBody.focus();top.dlogBody.print();">&nbsp;';
	var sDefArgs     = jsSetParamStr("OpenStr", "?", sKeySep, sValSep);
	sDefArgs        += jsSetParamStr("PairSep", "=", sKeySep, sValSep);
	sDefArgs        += jsSetParamStr("GroupSep", "&", sKeySep, sValSep);
	var sContentHTML = "";
	var sURL         =  "dialogFS.aspx?windowname=" + "Certification%20Categories";
	var nWidth			 = (screen.availwidth  * .95) ; 
	var nHeight			 = (screen.availheight * .50); 
	var sContentURL  = "RptCategory.aspx";
	var sButtonHTML  = "<TABLE border='0' cellpadding='0' cellspacing='0' width='100%'><TR>";
	sButtonHTML     += "<TD class='cDataEntry'>&nbsp;</TD>"
	sButtonHTML     += "<TD class='cDataEntryR'>" + sPrtBtn + sClsBtn + "</TD>";
	sButtonHTML     += "</TR></TABLE>";
	var sArgs        = sDefArgs;
	var sScreenLoc   = "ll"; 
	var sWinAttrs    = ",resizable=yes";
	jsOpenDialog(sURL,nWidth,nHeight,jsRetNoRefresh,sContentHTML,sContentURL,sButtonHTML,sArgs,sScreenLoc,sWinAttrs);
} //jsOpenContactUs
