<!--

var PopupWidth = screen.width - 300;
var PopupHeigh = screen.width - 200;

var oPopupWindow;
var PopupURL = "";
var PopupScrollable = true;
var PopupShowToolbar = false;
var PopupShowMenubar = false;
var PopupShowRGMenubar = false;
var PopupResizable = true;
var ModalWindow = false;
var WindowIsClosing = false;
var PopupIsModal = false;
var sWindowProperties = "";
var sPopupKeyName = "";
var sPopupKeyValue = "";
var sPopupSearchMode = "Select";
var sPopupSelectOption = "0";
var sPopupAction = "";
var iMessageID = "";
var sMessagePadReturnID = "";
var sMessagePadReturnToURL = "";

function jsSubmitPage() {
  var oForm = document.forms[0];
  oForm.submit();
}

function jsSetSearchField(psFieldName,psValue) {
  var oForm = document.forms[0];
  oForm.hdSearchFieldName.value = psFieldName;
  oForm.hdSearchFieldValue.value = psFieldValue;
  return true;
}

function jsThisPageHelp(psAdvisorType,psPageTitle) {
  var oThisForm = document.forms[0];
  var sProductID;
  PopupURL = "/Advisor/fShowAdvisor.asp";
  //PopupWidth = screen.width - 200;
  //PopupHeight = screen.height - 100;
  PopupWidth = 800;
  PopupHeight = 400;
  PopupScrollable = true;
  PopupResizable = true;
  PopupShowToolbar = false;
  PopupShowMenubar = false;
  PopupShowRGMenubar = false;  
  PopupIsModal = false;
  jsSetKeyName("AdvisorType");
  jsSetSelectOption("equals");
  jsSetKeyValue(psAdvisorType + ',' + psPageTitle);
  jsSetPopupMode("Select");
  jsRunPopup();
}

 function jsSaveFields(psFieldNames)
  {
    var oForm = document.forms[0]
    if (jsIsBlank(oForm.hdSavedFields.value))
      oForm.hdSavedFields.value = psFieldNames;
    else
      oForm.hdSavedFields.value = oForm.hdSavedFields.value + ',' + psFieldNames;
  }

  function jsSetSearchMode(psSearchMode) 
  {
    var oForm = document.forms[0]
    oForm.hdSearchMode.value = psSearchMode;
  }
  function jsSortField(psSortField) 
  {
    var oForm = document.forms[0]
    oForm.hdSortField.value = psSortField;
    oForm.submit();
  }
  function jsSetURL(psURL) 
  {
    var oForm = document.forms[0]
    oForm.action = psURL;
  }
  function jsGetAction() 
  {
    var oForm = document.forms[0]
    return oForm.hdAction.value;
  }
  function jsSetAction(psAction) 
  {
    var oForm = document.forms[0]
    oForm.hdAction.value = psAction;
  }
  function jsSetNewRecord() 
  {
    var oForm = document.forms[0]
    oForm.hdAction.value = "New";
  }
  function jsSetDeleteRecord() 
  {
    var oForm = document.forms[0]
    oForm.hdAction.value = "Delete";
  }
  function jsSetSelectRecord() 
  {
    var oForm = document.forms[0]
    oForm.hdAction.value = "Selected";
  }
  function jsSetCancel() 
  {
    var oForm = document.forms[0]
    oForm.hdAction.value = "Cancel";
  }
  function jsSubmit() 
  {
    var oForm = document.forms[0]
    oForm.submit();
  }
  function jsGetMode() 
  {
    var oForm = document.forms[0]
    return oForm.hdMode.value;
  }
  function jsSetMode(psMode) 
  {
    var oForm = document.forms[0]
    oForm.hdMode.value = psMode
  }
  function jsSetNewMode() 
  {
    var oForm = document.forms[0]
    oForm.hdMode.value = "New"
  }
  function jsSetChangeMode() 
  {
    var oForm = document.forms[0]
    oForm.hdMode.value = "Change"
  }
  function jsIsNewMode() 
  {
    var oForm = document.forms[0]
    return (oForm.hdMode.value == "New")
  }
  
  function jsSetSelect(oField) 
  {
    if(oField != null && !oField.disabled)
    {
      oField.focus();
      oField.select();
    }
  }
  function jsSetFocus(oField) 
  {
      oField.focus();
  }
  
  function jsExecuteMenuTask(psReportGroupName,psURL)
  {
    var oForm = document.forms[0]
    oForm.hdAction.value = ''
    oForm.hdPageName.value = ''
    oForm.hdURL.value = ''
    oForm.hdCallerPageName.value = ''
    oForm.hdCallerURL.value = ''
    oForm.hdSavedFields.value = ''
    oForm.hdSearchMode.value = ''
    oForm.hdXMLRGData.value = ''
    oForm.hdReportGroupName.value = psReportGroupName
    oForm.action = psURL
    oForm.submit()
  }

  function jsLogout() {
    var oForm = document.forms[0]
    //oForm.hdUID.value = ''
    //oForm.hdPwd.value = ''
    //oForm.hdAction.value = ''
    //oForm.hdPageName.value = ''
    //oForm.hdURL.value = ''
    //oForm.hdCallerPageName.value = ''
    //oForm.hdCallerURL.value = ''
    //oForm.hdSavedFields.value = ''
    //oForm.hdSearchMode.value = ''
    //oForm.hdXMLRGData.value = ''
    parent.frames(0).jsLoggedOut();
    oForm.action = '/Router.asp?Action=/HOME/fLogin.asp&hdClientName=&hdPageName=&hdURL=&hdUID=&hdPwd=&hdUserName=&hdSearchMode=&hdCallerPageName=&hdCallerURL=&hdClientURL=&hdClientID=';
    oForm.submit();
  }

  function jsOpenWindow(psURL, psName, piWidth, piHeight, pbScroll) {
    var oForm = document.forms[0]
    var iWindowLeftPosition = (screen.width - piWidth) / 2;
    var iWindowTopPosition = (screen.height - piHeight) / 2;
    sWindowProperties = 'height='+piHeight+',width='+piWidth+',top='+iWindowTopPosition+',left='+iWindowLeftPosition+',scrollbars='+pbScroll+',resizable'
    oWindow = window.open(psURL, psName, sWindowProperties)
    if (parseInt(navigator.appVersion) >= 4) { oWindow.window.focus(); }
  }

  function jsOpenWindowToolbar(psURL, psName, piWidth, piHeight, pbScroll) {
    var oForm = document.forms[0]
    var iWindowLeftPosition = (screen.width - piWidth) / 2;
    var iWindowTopPosition = (screen.height - piHeight) / 2;
    sWindowProperties = 'toolbar=yes,height='+piHeight+',width='+piWidth+',top='+iWindowTopPosition+',left='+iWindowLeftPosition+',scrollbars='+pbScroll+',resizable'
    oWindow = window.open(psURL, psName, sWindowProperties)
    if (parseInt(navigator.appVersion) >= 4) { oWindow.window.focus(); }
  }
  
  function jsIsPopup() {
    var oForm = document.forms[0];
    return (!(jsIsBlank(oForm.hdIsPopup.value)));
  }

function jsRunPopup() {

  if (jsIsBlank(PopupURL)) {
    alert("A valid URL is expected in order for the popup window to work.")
    return false;
  }
  var oForm = document.forms[0];
  var sResizable,sToolbar,sMenubar;
  var iWindowLeftPosition = (screen.width - PopupWidth) / 2;
  var iWindowTopPosition = (screen.height - PopupHeight) / 2;
  var sPopupShowToolbar, sPopupShowMenubar;

  if (PopupResizable) 
    sResizable = 'yes';
  else
    sResizable = 'no';
    
  if (PopupShowToolbar) 
    sToolbar = 'yes';
  else
    sToolbar = 'no';
    
  if (PopupShowMenubar)
    sMenubar = 'yes';
  else
    sMenubar = 'no';
    
  if (PopupScrollable)
    sScrollable = 'yes';
  else
    sScrollable = 'no';

 sWindowProperties = 'toolbar='+sToolbar+',menubar='+sMenubar+',height='+PopupHeight+
                      ',width='+PopupWidth+',top='+iWindowTopPosition+',left='+
                     iWindowLeftPosition+',scrollbars='+sScrollable+',resizable='+sResizable; 

 oPopupWindow = window.open('','',sWindowProperties)
 
 oPopupWindow.document.write('<html><head><title>Window Is Openning...</title></head>\n');
 oPopupWindow.document.write('<body><form method="POST" name="NewForm" action="' + PopupURL + '">\n');
 oPopupWindow.document.write('<input type="hidden" name="hdUID" value="' + oForm.hdUID.value + '">\n');
 oPopupWindow.document.write('<input type="hidden" name="hdClientName" value="' + oForm.hdClientName.value + '">\n');
 oPopupWindow.document.write('<input type="hidden" name="hdClientID" value="' + oForm.hdClientID.value + '">\n');
 oPopupWindow.document.write('<input type="hidden" name="hdDBName" value="' + oForm.hdDBName.value + '">\n');
 oPopupWindow.document.write('<input type="hidden" name="hdSessionID" value="' + oForm.hdSessionID.value + '">\n');
 oPopupWindow.document.write('<input type="hidden" name="hdDateFormat" value="' + oForm.hdDateFormat.value + '">\n');
 oPopupWindow.document.write('<input type="hidden" name="hdIsPopup" value="' + "true" + '">\n');
 oPopupWindow.document.write('<input type="hidden" name="hdCallerPageName" value="' + oForm.hdPageName.value + '">\n');
 oPopupWindow.document.write('<input type="hidden" name="hdCallerURL" value="' + oForm.hdCallerURL.value + '">\n');
 oPopupWindow.document.write('<input type="hidden" name="hdPageName" value="' + oForm.hdPageName.value + '">\n');
 oPopupWindow.document.write('<input type="hidden" name="SelectBy" value="' + sPopupKeyName + '">\n');
 oPopupWindow.document.write('<input type="hidden" name="SelectOption" value="' + sPopupSelectOption + '">\n');
 oPopupWindow.document.write('<input type="hidden" name="SearchString" value="' + sPopupKeyValue + '">\n');
 oPopupWindow.document.write('<input type="hidden" name="hdSearchMode" value="' + sPopupSearchMode + '">\n');
 oPopupWindow.document.write('<input type="hidden" name="hdSortField" value="' + sPopupKeyName + '">\n');
 oPopupWindow.document.write('<input type="hidden" name="SortBy" value="' + sPopupKeyName + '">\n');
 oPopupWindow.document.write('<input type="hidden" name="MessageID" value="' + iMessageID + '">\n');
 if (PopupIsModal) 
   oPopupWindow.document.write('<input type="hidden" name="ModalWindow" value="' + "1" + '">\n');
 else
   oPopupWindow.document.write('<input type="hidden" name="ModalWindow" value="' + "0" + '">\n');
 PopupIsModal = false;
 if (!PopupShowRGMenubar) oPopupWindow.document.write('<input type="hidden" name="hdDisableMenu" value="' + "1" + '">\n');
 oPopupWindow.document.write("</form></body></html>");
 
 oPopupWindow.document.write('<script language="JavaScript">');
 oPopupWindow.document.write('document.NewForm.submit();');
 oPopupWindow.document.write('</script>');
 PopupIsModal = false;
 //InitializePopup();
}

function InitializePopup() {
  PopupURL = "";
  PopupScrollable = true;
  PopupShowToolbar = false;
  PopupShowMenubar = false;
  PopupShowRGMenubar = false;
  PopupResizable = true;
  sWindowProperties = "";
  sPopupAction = "";
  sPopupKeyName = "";
  sPopupKeyValue = "";
  sPopupSearchMode = "Select";
  sPopupSelectOption = "0"
  PopupIsModal = false;
}

function jsSetKey(psKeyName, psKeyValue) {
  sPopupKeyName = psKeyName;
  sPopupKeyValue = psKeyValue;
}
function jsSetKeyName(psKeyName) { sPopupKeyName = psKeyName;}
function jsSetKeyValue(psKeyValue) { sPopupKeyValue = psKeyValue;}
function jsGetKeyName() {return sPopupKeyName;}
function jsGetKeyValue() {return sPopupKeyValue;}
function jsSetMessageID(psMessageID) { iMessageID = psMessageID;}
function jsGetMessageID() {return iMessageID;}
function jsSetMessagePadReturnID(psReturnID) { sMessagePadReturnID = psReturnID;}
function jsGetMessagePadReturnID() {return sMessagePadReturnID;}
function jsSetMessagePadReturnToURL(psReturnToURL) { sMessagePadReturnToURL = psReturnToURL;}
function jsGetMessagePadReturnToURL() {return sMessagePadReturnToURL;}

  
function jsSetPopupMode(psMode) {
  //psMode can have values: "Select" or "Edit"
  switch (psMode.toUpperCase()) {
    case "SELECT":
      sPopupSearchMode = "Select";
      break;
    case "EDIT":
      sPopupSearchMode = "Edit";
      break;
    case "ADD":
      sPopupSearchMode = "ADD";
      break;
    default:
      sPopupSearchMode = "Select";
      break 
  } //switch
}

function jsSetSelectOption(psOption) {
  //psOption can have values: "Begins", "Ends", "Equals", or "Contains"
  switch (psOption.toUpperCase()) {
    case "BEGINS":
      sPopupSelectOption = "0";
      break;  
    case "ENDS":
      sPopupSelectOption = "1";
      break;  
    case "EQUALS":
      sPopupSelectOption = "2";
      break;  
    case "CONTAINS":
      sPopupSelectOption = "3";
      break;  
    default:
      sPopupSelectOption = "0";
      break;  
   } // switch
}

function jsSetPopupAction(psAction) {opener.sPopupAction = psAction;}
function jsGetPopupAction() {return sPopupAction;}

function jsNotifyPopupCaller(psKeyValue) {
  WindowIsClosing = true;
  opener.jsSetKeyValue(psKeyValue);
  opener.jsHandlePopupSelection();
  self.close();
}

function jsClosePopup() {
  opener.jsHandlePopupSelection();
  self.close();
}

function IsModalWindow() {
  var oThisForm = document.forms[0];
  return (oThisForm.ModalWindow.value == "1");
}

function jsClosePopupWindow() {
  if (oPopupWindow != null) {
    if ((oPopupWindow.closed) || (oPopupWindow.WindowIsClosing)) {
      oPopupWindow = null;
      return;
    }
    
    if (oPopupWindow.IsModalWindow()) {
      oPopupWindow.focus();
      return;
    }
    else {
      if (oPopupWindow.closed == false)
        oPopupWindow.close();    
        oPopupWindow = null;
    }
  }
}

 InitializePopup();
 
function jsPendingMessage() {
  var oThisForm = document.forms[0];
  PopupURL = "/Message/fPendingMessage.asp";
  //PopupWidth = screen.width - 400;
  //PopupHeight = screen.height - 200;
  PopupWidth = 800;
  PopupHeight = 400;
  PopupScrollable = true;
  PopupResizable = true;
  PopupShowToolbar = false;
  PopupShowMenubar = false;
  PopupShowRGMenubar = false;
  //jsSetKeyName("MessageID");
  //jsSetSelectOption("equals");
  //jsSetKeyValue(oThisForm.MessagePadReturnID.value);
  jsSetPopupMode("Select");
  jsRunPopup();
}

function jsMessageSend() {
  var oThisForm = document.forms[0];
  PopupURL = "/Message/fMessageSend.asp";
  //PopupWidth = screen.width - 400;
  //PopupHeight = screen.height - 200;
  PopupWidth = 800;
  PopupHeight = 400;
  PopupScrollable = true;
  PopupResizable = true;
  PopupShowToolbar = false;
  PopupShowMenubar = false;
  PopupShowRGMenubar = false;
  jsSetKeyName("MessageID");
  jsSetSelectOption("equals");
  jsSetMessageID(oThisForm.MessageID.value);
  jsSetPopupMode("Edit");
  jsRunPopup();
}

function jsSetMessagePadValue(psMessageID,psReturnID,psReturnToURL) {
  var oThisForm = document.forms[0];
  WindowIsClosing = true;
  opener.jsSetMessageID(psMessageID);
  opener.jsSetMessagePadReturnID(psReturnID);
  opener.jsSetMessagePadReturnToURL(psReturnToURL);
  opener.jsSetMessagePadValue2();
  self.close();
}

function jsSetMessagePadValue2() {
  var oThisForm = document.forms[0];
  oThisForm.MessageID.value = jsGetMessageID();
  oThisForm.MessagePadReturnID.value = jsGetMessagePadReturnID();
  oThisForm.MessagePadReturnToURL.value = jsGetMessagePadReturnToURL();
  jsSetURL(jsGetMessagePadReturnToURL());
  jsSubmit();
}


//-->


