function SetWait(onoff) { }
function SetNavTab(stxt) { try { banner.navtab.innerHTML = stxt; } catch(e) { setTimeout("SetNavTab('"+stxt+"');",50); } }
function SetPageName(stxt) { try { banner.pagename.innerHTML = stxt; } catch(e) { setTimeout("SetPageName('"+stxt+"');",50); } }
function GetPageName(){ try { return banner.pagename.innerHTML;} catch(e){ } };
function SubmitError(msg) { alert(msg); }
function ErrorMsg(errMsg,cb) { alert("Error: "+errMsg); if (cb) { if (cb != "") { eval(cb+"();"); } } }
var agt=navigator.userAgent.toLowerCase(); var is_major = parseInt(navigator.appVersion); var is_minor = parseFloat(navigator.appVersion);
var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1)); var is_ie3    = (is_ie && (is_major < 4)); var is_ie4    = (is_ie && (is_major == 4) && (agt.indexOf("msie 4")!=-1) ); var is_ie4up  = (is_ie && (is_major >= 4)); var is_ie5    = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) ); var is_ie5_5  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.5") !=-1));
var is_ie5up  = (is_ie && !is_ie3 && !is_ie4); var is_ie5_5up =(is_ie && !is_ie3 && !is_ie4 && !is_ie5); var is_ie6    = (is_ie && (is_major == 4) && (agt.indexOf("msie 6.")!=-1) ); var is_ie6up  = (is_ie && !is_ie3 && !is_ie4 && !is_ie5 && !is_ie5_5);
var is_aol5  = (agt.indexOf("aol 5") != -1); var is_aol6  = (agt.indexOf("aol 6") != -1); var is_ok = (is_ie5_5up || is_aol5 || is_aol6);
var servername = ""; var debug = 0; var MBXClientServer = 0;
var useStatus = 1; var useManualRetry = 1; var CurrentApp;

/* sample topUrl
// place on top of index.html before include js to redirect to ssl site
var topUrl={
 1: {
    'host' : 'tdptest.mindbrix.com',
    'servername' : 'https://tdptest.mindbrix.com',
    'title' : 'TDP Test',
    'port' : ''
  }
}*/

if (is_ok || is_ie5up) {
  var ok=0; var ssl = 1;
  topUrl = top.topUrl;
  for (var el in topUrl){
    if (document.location.host == topUrl[el]['host']){
      servername = topUrl[el]['servername'];
      eval(topMBX).document.title = topUrl[el]['title'];
      ok=1;
      if (topUrl[el]['port'].length > 0) { servername += ":"+topUrl[el]['port']; }
      if(typeof topUrl[el]['ssl'] != 'undefined' && topUrl[el]['ssl'] == 'off'){ ssl = 0; }
    }
  }

  if (servername.length > 0 && top.document.location.href != (servername+"/index.html")) {
    if (typeof top.quicklogin == 'undefined') { top.document.location.replace(servername+"/index.html"); }
  }
  else {
    if (document.location.protocol == 'http:' && ssl && !ok) {
      document.location.replace("https://"+document.location.host+"/index.html");
    } else if (document.location.protocol == 'https' && ok) {
      document.location.replace("http://"+document.location.host+"/index.html");
    } else if (document.location.protocol == 'http' && ok) {
      document.location.replace("http://"+document.location.host+"/index.html");
    }
  }
}

var locateMe = self; var located = "top";
var nTry = 20;
while (nTry > 0 && locateMe.name != top.name) {
  nTry--;
  located += "."+locateMe.name;
  if (self.opener) { locateMe = self.opener; } else { locateMe = self.parent; }  
}

var Waiting=0; var LastRet=1; var ReqNum=0; var ReqCNT=1; var WebReq = new Array;
var wsID; var attempt=0;
var t_html; var t_sub; var t_who; var t_cb; var t_wt;
var MaxTry = 180;
var t_check; var s_check;
var CancelSubmit = 0;
var DBError = 0;
var PauseSubmit = 0; var p_check;
var dcnt = 0; var s_debugscroll;
function debug_msg(mbxsub,rcnt,msg,mbxnum,mbxlen) {
  try {
    if (typeof top.debugW == 'object' && typeof top.debugW.document == 'object' && (top.debug > 7 || mbxsub != 'GetOnlineUsers')){
      var currentTime = new Date()
      var month = currentTime.getMonth() + 1
      var day = currentTime.getDate()
      var year = currentTime.getFullYear()
      var hours = currentTime.getHours()
      var minutes = currentTime.getMinutes()
      var secs = currentTime.getSeconds()
      var milli = currentTime.getMilliseconds()
      if (minutes < 10) { minutes = "0" + minutes }
      var ampm = "AM"; if(hours > 11){ ampm = "PM"; }       
      var now = month+"/"+day+"/"+year+" "+hours+":"+minutes+":"+secs+"."+milli+" "+ampm;          
      var hmmH = self.name ? self.name : 'main' ;
      var tmpH = "<div id=dbg_"+dcnt+" style='font-weight:bold;font-size:11px;width:100%;background-color:#FFEAEA;border-bottom:1px solid #000099;padding:1px;padding-left:3px;color:#333333;'>"+now+" "+hmmH+":"+mbxsub+" ["+rcnt+" "+mbxnum+" of "+mbxlen+"]  - "+msg+"</div>";
      dcnt++;
      eval(topMBX).debugW.document.all.debug_frame.insertAdjacentHTML('beforeEnd',tmpH);
      s_debugscroll = window.setTimeout("try { "+topMBX+".debugW.document.all.debug_frame.scrollTop = "+topMBX+".debugW.document.all.debug_frame.scrollHeight; } catch(e) {}",100);
    }
  } catch (e) { }
}
function WebRequest(twho,tsub,thtml,twhereto,tcallback,twhichmod,twhichserver) { this.twho=twho; this.tsub=tsub; this.thtml=thtml; this.twhereto=twhereto; this.tcallback=tcallback; this.twhichmod=twhichmod; this.twhichserver=twhichserver;}
function RequestDone(i) { DBError=0;WebReq[i].twho=null; WebReq[i].tsub=null; WebReq[i].thtml=null; WebReq[i].twhereto=null; WebReq[i].tcallback=null; WebReq[i].twhichmod=null; WebReq[i].twhichserver=null; }
function RetryRequest(showmsg) {
  if (showmsg) {
    ShowConnStatus("About to Retry..");
  }
  document.frames['cmd'].navigate("/cmd.html");
  LastRet=-1;
  attempt=0;
  if (top.debug > 7) { debug_msg(t_sub,ReqCNT,"Request Timed Out - SendCmd",ReqNum,WebReq.length); }
  s_check = window.setTimeout("SendCmd();",500);
  if (event) { event.returnValue = false; }
}
function RequestCheck() {
  if (CancelSubmit==1) {    
    if (useStatus) { ShowConnStatus("Cancelling Transaction"); }
    if (top.debug > 7) { debug_msg(t_sub,ReqCNT,"Request Check got CancelSubmit",ReqNum,WebReq.length); }
    wsID = window.setTimeout("WebSubmit()",10);
    return;
  }
  attempt++;  
  if (attempt > MaxTry || (attempt > 20 && top.debug > 7)) {
    if (useManualRetry) { 
      if (useStatus) {
        var debugOpts = "<br><br>";
        if (top.debug > 7) {
          debugOpts = " <a href='#' class=s_button onclick='eval(\""+located+"\").CancelSubmit=1;eval(\""+located+"\").RequestCheck()'>Cancel Request</a><br><br>";
        }
        ShowConnStatus("Warning!<br><br>Your Request has timed-out!<br>Please verify you have a working connection to the internet in another window and then click the 'retry now' button to continue.<br><br>Do not close this webpage until your data has been saved.<br><br><a href='#' class=s_button onclick='eval(\""+located+"\").RetryRequest(1);'>Retry Now</a>"+debugOpts); 
      }
    } else {
      if (useStatus) { 
        if (top.debug > 7) { debug_msg(t_sub,ReqCNT,"Request Timed-out - Auto-Retry On - Schedule Retry Request NOW"); }
        ShowConnStatus("Your Request has timed-out! We will Auto-Retry your last request now!"); 
      }
      window.setTimeout("RetryRequest();",500); 
    }
    return;
  } else {
    if (useStatus && attempt>2) { ShowConnStatus("Waiting on Request:"+ReqNum+" of "+WebReq.length+" ["+t_sub+"] - Retry in "+Math.ceil(MaxTry-attempt)+" seconds!"); }
    if (top.debug > 7) { debug_msg(t_sub,ReqCNT,"Waiting on Request - Scheduling Request Check for 1 second out."); }
    t_check = window.setTimeout("RequestCheck()",1000);
  }
  if (event) { event.returnValue = false; }
}
function WebSubmit(twho,tsub,thtml,twhereto,tcallback,twhichmod,twhichserver) {  
  //alert('WebSubmit in MBX_Conn'+'Last Return Value:'+LastRet);
  //window.status = "WS:"+twho+" "+tsub+" "+twhereto+" "+tcallback+" "+twhichmod;
  if (CancelSubmit != 0) {
    clearTimeout(t_check);
    document.frames['cmd'].navigate("/cmd.html");
    LastRet=1; 
    attempt=0;
    if (top.debug > 7) { debug_msg(tsub,ReqCNT,"Cancelled Last Command - Continue with This WebSubmit",ReqNum,WebReq.length); }
  }
  if (LastRet == -1) {
    wsID = window.setTimeout("WebSubmit()",100);
    if (top.debug > 7) { debug_msg(tsub,ReqCNT,"Last Return: -1 - Calling SendCmd Now",ReqNum,WebReq.length); }
    SendCmd();
    return;
  }
  switch (twho) { case "A":twho = "admin";break; case "B":twho = "broker";break; case "V":twho = "vendor";break; case "C":twho = "client";break; case "P":twho = "portal";break; case "U":twho = "secure";break; case "L":twho = "login";break; }
  if (LastRet == 0) {
    if (top.debug > 7) { debug_msg(tsub,ReqCNT,"Last Return: 0",ReqNum,WebReq.length); }
    if (tsub) {
      // added if statement to give up on further online stuff - cjs 2/7/06
      var chat_in_history = 0;
      if (self.name == 'menu' && (tsub == 'GetMessages' || tsub == 'GetOnlineUsers')) {
        // go back to history and make sure only 1 frm each is queueud up.. cancel if more than 1
        for (var i = ReqNum; i < WebReq.length; i++) {
          if (tsub == WebReq[i].tsub) {
            chat_in_history = 1;
          }
        }
      }      
      if (chat_in_history == 1) {
        if (top.debug > 7) { debug_msg(tsub,ReqCNT,"Cancelled Further Requests when Connection Down for Online Chat"); }
        t_check = window.setTimeout("RequestCheck()",1000);
      } else {
        if (top.debug > 7) { debug_msg(tsub,ReqCNT,"Add to Request Queue at:"+WebReq.length,ReqNum,WebReq.length); }
        WebReq[WebReq.length] = new WebRequest(twho,tsub,thtml,twhereto,tcallback,twhichmod,twhichserver);
      }
      return;
    } else {
      // added - when lost connection - this resends it. cjs 2/7/06
      if (top.debug > 7) { debug_msg(tsub,ReqCNT,"Scheduling RequestCheck for 1 Second from Now"); }
      t_check = window.setTimeout("RequestCheck()",1000);
      return;
      // end of added
    }
  }
  if (LastRet == 1) {
    if (CancelSubmit==1) {
      CancelSubmit = 0;
      ReqCNT++;
      if (useStatus) { ShowConnStatus("Cancelled Transaction!",500); }
      if (ReqNum < WebReq.length) {
        if (top.debug > 7) { debug_msg(tsub,ReqCNT,"Scheduling WebSubmit Now"); }
        wsID = window.setTimeout("WebSubmit()",100);
      }
      return;
    }
    if (!(tsub)) {
      twho = WebReq[ReqNum].twho; tsub = WebReq[ReqNum].tsub; thtml = WebReq[ReqNum].thtml; twhereto = WebReq[ReqNum].twhereto; tcallback = WebReq[ReqNum].tcallback; twhichmod = WebReq[ReqNum].twhichmod; twhichserver = WebReq[ReqNum].twhichserver;
      delete WebReq[ReqNum];
      ReqNum++;
      if (top.debug > 7) { debug_msg("Next -->",ReqCNT,"Goto Next Request",ReqNum,WebReq.length); }
    }
    //thtml = '<form name=doit method=POST action=https://'+eval(topMBX).LoginID+':'+eval(topMBX).Password+'@'+document.location.host+'/cgi-bin/'+twho+'/WebSubmit.cgi>'+thtml+'<INPUT type=hidden name=t_load_testing_script value="'+top.t_load_testing_script+'"><INPUT type=hidden name=t_whereto value="'+twhereto+'"><INPUT type=hidden name=t_whichsub value="'+tsub+'"><input type=hidden name=t_SessionID value="'+eval(topMBX).SessionID+'"><INPUT type=hidden name=t_callback value="'+tcallback+'"><INPUT type=hidden name=t_whichmod value="'+twhichmod+'"></form>';
    if (twhichserver && MBXClientServer) {
      if (twhichserver == 'ClientServer') {
        if (twho != 'admin') { twho = 'user'; }
        thtml = '<form name=doit method=POST action='+document.location.protocol+'//'+document.location.host+'/cgi-bin/'+twho+'/WebSubmit.cgi>'+thtml+'<INPUT type=hidden name=t_load_testing_script value="'+top.t_load_testing_script+'"><INPUT type=hidden name=t_whereto value="'+twhereto+'"><INPUT type=hidden name=t_whichsub value="'+tsub+'"><input type=hidden name=t_SessionID value="'+eval(topMBX).SessionID+'"><INPUT type=hidden name=t_callback value="'+tcallback+'"><INPUT type=hidden name=t_whichmod value="'+twhichmod+'"></form>';
      } else {
        thtml = '<form name=doit method=POST action='+document.location.protocol+'//'+document.location.host+'/'+twhichserver+'/cgi-bin/'+twho+'/WebSubmit.cgi>'+thtml+'<INPUT type=hidden name=t_whereto value="'+twhereto+'"><INPUT type=hidden name=t_whichsub value="'+tsub+'"><input type=hidden name=t_SessionID value="'+eval(topMBX).SessionID+'"><INPUT type=hidden name=t_callback value="'+tcallback+'"><INPUT type=hidden name=t_whichmod value="'+twhichmod+'"></form>';
      }
    } else {
      if (MBXClientServer) {
        //default to current app.
        var capp = "propval"; if (CurrentApp == 'M') { capp = "mbx"; } if (CurrentApp == 'T') { capp = "taxdata"; }
        thtml = '<form name=doit method=POST action='+document.location.protocol+'//'+document.location.host+'/'+capp+'/cgi-bin/'+twho+'/WebSubmit.cgi>'+thtml+'<INPUT type=hidden name=t_load_testing_script value="'+top.t_load_testing_script+'"><INPUT type=hidden name=t_whereto value="'+twhereto+'"><INPUT type=hidden name=t_whichsub value="'+tsub+'"><input type=hidden name=t_SessionID value="'+eval(topMBX).SessionID+'"><INPUT type=hidden name=t_callback value="'+tcallback+'"><INPUT type=hidden name=t_whichmod value="'+twhichmod+'"></form>';
      } else {
        //alert("|"+twhichserver+"| |"+MBXClientServer+"|");
        thtml = '<form name=doit method=POST action='+document.location.protocol+'//'+document.location.host+'/cgi-bin/'+twho+'/WebSubmit.cgi>'+thtml+'<INPUT type=hidden name=t_load_testing_script value="'+top.t_load_testing_script+'"><INPUT type=hidden name=t_whereto value="'+twhereto+'"><INPUT type=hidden name=t_whichsub value="'+tsub+'"><input type=hidden name=t_SessionID value="'+eval(topMBX).SessionID+'"><INPUT type=hidden name=t_callback value="'+tcallback+'"><INPUT type=hidden name=t_whichmod value="'+twhichmod+'"></form>';
      }
    }
    if (top.debug > 7) { debug_msg(tsub,ReqCNT,"Call SendCmd - Last Return was 1 - OK",ReqNum,WebReq.length); }
    SendCmd(twho, tsub, thtml, twhereto);
  } else {
    if (ReqNum < WebReq.length) {
      if (top.debug > 7) { debug_msg(tsub,ReqCNT,"Scheduling WebSubmit() on ReqNum"+ReqNum+" of "+WebReq.length,ReqNum,WebReq.length); }
      wsID = window.setTimeout("WebSubmit()",100);
    } else {
      if (top.debug > 7) { debug_msg(tsub,ReqCNT,"Calling SendCmd on last WebReq",ReqNum,WebReq.length); }
      SendCmd();
    }
  }
}

var p_who; var p_sub; var p_html; var p_twt;
function SendCmd(twho,tsub,thtml,twt,frompause) {
  if (twho == "_sFROM_PAUSE") {    
    if (PauseSubmit == 1) {
      if (top.debug > 7) { debug_msg(t_sub,ReqCNT,"SendCMD Paused (already)",ReqNum,WebReq.length); }
      p_check = window.setTimeout('SendCmd("_sFROM_PAUSE")',1000);
      return;
    } else {
      if (top.debug > 7) { debug_msg(t_sub,ReqCNT,"SendCMD Was Paused (returning)",ReqNum,WebReq.length); }
      twho  = p_who;  p_who  = '';
      tsub  = p_sub;  p_sub  = '';
      thtml = p_html; p_html = '';
      twt   = p_twt;  p_twt  = '';
    }
  } else {
    if (PauseSubmit == 1) {
      if (top.debug > 7) { debug_msg(t_sub,ReqCNT,"SendCMD Pausing (new)",ReqNum,WebReq.length); }
      p_who  = twho;
      p_sub  = tsub;
      p_html = thtml;
      p_twt  = twt;
      p_check = window.setTimeout('SendCmd("_sFROM_PAUSE")',1000);
      return
    } else {
      if (top.debug > 7) { debug_msg(t_sub,ReqCNT,"SendCMD Executing",ReqNum,WebReq.length); }
    }
  }
  DBError=0;
  if (thtml) { t_html = thtml; } else { thtml = t_html; }
  if (tsub) { t_sub = tsub; } else { tsub = t_sub; }
  if (twho) { t_who = twho; } else { twho = t_who; }
  if (twt) { t_wt = twt; } else { twt = t_wt; }
  if (top.debug > 7) { debug_msg(t_sub,ReqCNT,"SendCMD Executing",ReqNum,WebReq.length); }
  try {
    istate = document.frames['cmd'].document.readyState;
  } catch(e) {
    if (top.debug > 7) { debug_msg(tsub,ReqCNT,"Initializing Engine"); }
    if (useStatus) { ShowConnStatus("Initializing Engine"); }
    document.frames['cmd'].navigate("/cmd.html");
    LastRet=0;
    if (top.debug > 7) { debug_msg(tsub,ReqCNT,"Scheduling WebSubmit 100ms from Now - WHY AM I NOT CALLING SendCMD ? ?"); }
    wsID = window.setTimeout("WebSubmit()",100);
    return;
  }
  if (!(istate)) {
    if (useStatus) { ShowConnStatus("Waiting on Connection"); }
    if (top.debug > 7) { debug_msg(t_sub,ReqCNT,"Waiting - [Invalid Document State] Call SendCMD in 50 MS",ReqNum,WebReq.length); }
    //testing
    LastRet=0;
    s_check = window.setTimeout('SendCmd()',50);
    return;
  } else {
    if ((istate == "undefined") || (istate == "interactive") || (istate == "loading") || (istate == "uninitialized") || (istate == "loaded") ) {
      if (useStatus) { ShowConnStatus("Waiting on Connection"); }
      if (top.debug > 7) { debug_msg(t_sub,ReqCNT,"Waiting - [Document State:"+istate+"] - Call SendCMD in 50 MS",ReqNum,WebReq.length); }
      // testing
      LastRet=0;
      // never scheduled? so call to SendCmd will do last one only?
      s_check = window.setTimeout('SendCmd()',50);
      return;
    }
    try {
      document.frames['cmd'].document.body.innerHTML = thtml;
      var fcmd = document.frames['cmd'].doit;
      LastRet=0;
      attempt=0;
      if (typeof top.debugW == 'object' && typeof top.debugW.document == 'object' && (top.debug > 7 || tsub != 'GetOnlineUsers')) {
        var debug_form = thtml.toString();
        var re; re = /\>\</g; debug_form = debug_form.replace(re, "\>\n\<");
        var hmmH = self.name ? self.name : 'main' ; var hmmC = "color:#888899;"; if (hmmH == 'main') { hmmC = "color:#000066;"; }
        var tmpH = "<div style='cursor:pointer;font-weight:bold;font-size:11px;width:100%;background-color:#FFFFDD;border-bottom:1px solid #000099;padding:1px;padding-left:3px;"+hmmC+"' onclick=\"if(this.nextSibling.style.display=='inline'){this.nextSibling.style.display='none'}else{this.nextSibling.style.display='inline'}\">"+hmmH+":"+tsub+" ["+ReqCNT+":"+ReqNum+"] - Request</div><div style='width:100%;background-color:#FFFFEA;padding-left:4px;display:none;height:150;overflow-Y:auto;border-bottom:1px solid #000066;font-family:vt100;' DATAFORMATAS='text' id=R"+hmmH+ReqCNT+"></div>";
        eval(topMBX).debugW.document.all.debug_frame.insertAdjacentHTML('beforeEnd',tmpH);
        eval(topMBX+".debugW.R"+hmmH+ReqCNT).innerText = debug_form;
        s_debugscroll = window.setTimeout("try { "+topMBX+".debugW.document.all.debug_frame.scrollTop = "+topMBX+".debugW.document.all.debug_frame.scrollHeight; } catch(e) {}",100);
      }
      if (top.debug > 7) { debug_msg(t_sub,ReqCNT,"Submit to Server and Call RequestCheck",ReqNum,WebReq.length); }
      fcmd.submit();
      t_check = window.setTimeout("RequestCheck()",1000);
    } catch(e) {
      if (useStatus) { ShowConnStatus("Re-Initializing Engine"); }
      document.frames['cmd'].navigate("/cmd.html");
      if (top.debug > 7) { debug_msg(t_sub,ReqCNT,"RE-INIT Engine - Call SendCMD",ReqNum,WebReq.length); }
      SendCmd();
    }
  }
}
function SubmitResult(retcode) {
  if (top.debug > 7) { debug_msg(t_sub,ReqCNT,"Submit Result:"+retcode,ReqNum,WebReq.length); }
  if (useStatus) { HideConnStatus("Request Completed"); }
  attempt=0;
  LastRet = retcode;
  try {
    if(typeof top.debugW == 'object' && typeof top.debugW.document == 'object' && (top.debug > 7 || t_sub != 'GetOnlineUsers')){
      var hmmH = self.name ? self.name : 'main' ; var hmmC = "color:#888899;"; if (hmmH == 'main') { hmmC = "color:#000066;"; }
      var tmpH = "<div style='cursor:pointer;font-weight:bold;font-size:11px;width:100%;background-color:#DDDDFF;border-bottom:1px solid #000099;padding:1px;padding-left:3px;"+hmmC+"' onclick=\"if(this.nextSibling.style.display=='inline'){this.nextSibling.style.display='none'}else{this.nextSibling.style.display='inline'}\">"+hmmH+":"+t_sub+" ["+ReqCNT+":"+ReqNum+"] - Response</div><div style='width:100%;background-color:#EAEAFF;padding-left:4px;display:none;height:300;overflow-Y:auto;border-bottom:1px solid #000066;font-family:vt100;' DATAFORMATAS='text' id=S"+hmmH+ReqCNT+"></div>";
      eval(topMBX).debugW.document.all.debug_frame.insertAdjacentHTML('beforeEnd',tmpH);
      eval(topMBX+".debugW.S"+hmmH+ReqCNT).innerText = document.frames['cmd'].document.body.innerHTML;
      s_debugscroll = window.setTimeout("try { "+topMBX+".debugW.document.all.debug_frame.scrollTop = "+topMBX+".debugW.document.all.debug_frame.scrollHeight; } catch(e) {}",100);
    }
    ReqCNT++;
  } catch (e) {}
  if (LastRet == 1) {
    clearTimeout(t_check);
    if (ReqNum < WebReq.length) {
      if (top.debug > 7) { debug_msg(t_sub,ReqCNT,"Last Return OK but More Available - Call WebSubmit [Num:"+ReqNum+" LEN:"+WebReq.length+"]",ReqNum,WebReq.length); }
      wsID = window.setTimeout("WebSubmit()",50);
    }
  }
  if (CancelSubmit==1) {
    if (top.debug > 7) { debug_msg(t_sub,ReqCNT,"Just got a submitresult with a open cancel - aborting teh cancel [Num:"+ReqNum+" LEN:"+WebReq.length+"]",ReqNum,WebReq.length); }
    CancelSubmit=0;
  }
}
function MBXConnRequestStop() { PauseSubmit=1; if (top.debug > 7) { debug_msg(t_sub,ReqCNT,"Application Stopped Requests",ReqNum,WebReq.length); } }
function MBXConnRequestStart() { PauseSubmit=0; if (top.debug > 7) { debug_msg(t_sub,ReqCNT,"Application Started Requests",ReqNum,WebReq.length); } }

function HideConnStatus() {
  if (typeof eval(topMBX).main.dConnStatus == 'object') {
    eval(topMBX).main.dConnStatus.style.display = 'none';    
  }
  if (typeof eval(topMBX).menu.dConnStatus == 'object') {
    eval(topMBX).menu.dConnStatus.style.display = 'none';        
  }
  if (typeof eval(topMBX).banner.dConnStatus == 'object') {
    eval(topMBX).banner.dConnStatus.style.display = 'none';
  }  
}
function ModTConnStatus(title) {
  if (typeof eval(topMBX).main.dConnStatus == 'object') {
    if (typeof eval(topMBX).main.dConnStatusHdr == 'object') {
      eval(topMBX).main.dConnStatusHdr.innerHTML = "<b style='padding-left:2px;font-size:13px;'>MBX Connection Status "+title+"</b>";
    }
  }
}
function ShowConnStatus(msg,hideafter) {
  var title = "MBX Connection Status";
  if (typeof eval(topMBX).menu.dConnStatus != 'object') {
    tmp = "<div id=dConnStatus class='opaque_bg'></div>"; 
    eval(topMBX).menu.document.body.insertAdjacentHTML("beforeEnd",tmp); 
  } 
  eval(topMBX).menu.dConnStatus.style.display = 'inline'; 
  // fix it so when you load the debug bar it leaves the banner open to play with and stops tossing errors
  var bstate = 'undefined';
  try {
    bstate = eval(topMBX).banner.document.readyState;
  } catch(e) { }
  if ((bstate == "undefined") || (bstate == "interactive") || (bstate == "loading") || (bstate == "uninitialized") || (bstate == "loaded")) {
    // debug bar loading banner page
  } else {    
    if (typeof eval(topMBX).banner.dConnStatus != 'object') { 
      tmp = "<div id=dConnStatus class='opaque_bg'></div>"; 
      eval(topMBX).banner.document.body.insertAdjacentHTML("beforeEnd",tmp); 
    }  
    eval(topMBX).banner.dConnStatus.style.display = 'inline';
  }
  if (!eval(topMBX).main.dConnStatus) {    
    tmp = "<div id=dConnStatus style='display:inline;'><div class='opaque_bg' style='z-index:999999998;'></div><div class='s_dmsg_dialog' style='display:inline;z-index:999999998;position:absolute;height:200;width:400;top:expression(document.body.offsetHeight/2-100);left:expression(document.body.offsetWidth/2-200);'><div class='s_dmsg_title' id=dConnStatusHdr><b style='padding-left:2px;font-size:13px;'>"+title+"</b></div><div class='s_dmsg_box' style='padding-bottom:10px;margin:2px;margin-top:0;padding:2px;overflow-y:show;'><table cellpadding=0 cellspacing=0 width=100% height=100%><tr><td align=center valign=middle><table cellpadding=5 cellspacing=0><tr><td class='s_dmsg_txt' id=dConnStatusTxt TABINDEX=1><b style='font-size:13px;'>"+msg+"</b></td></tr></table></td></tr></table></div></div></div>";
    eval(topMBX).main.document.body.insertAdjacentHTML("beforeEnd",tmp);
  } else {    
    eval(topMBX).main.dConnStatusHdr.innerHTML = "<b style='padding-left:2px;font-size:13px;'>"+title+"</b>";
    eval(topMBX).main.dConnStatusTxt.innerHTML = "<b style='font-size:13px;'>"+msg+"</b>";    
    eval(topMBX).main.dConnStatus.style.display = 'inline';        
  }
  if (hideafter) {
    window.setTimeout("HideConnStatus()",hideafter);
  }
  return false;
}

