<html>
   <head>

      <style type="text/css">
      ul#tabs { list-style-type: none; margin: 30px 0 0 0; padding: 0 0 0.3em 0; }
      ul#tabs li { display: inline; }
      ul#tabs li a { color: #42454a; background-color: #dedbde; border: 1px solid #c9c3ba; border-bottom: none; padding: 0.3em; text-decoration: none; }
      ul#tabs li a:hover { background-color: #f1f0ee; }
      ul#tabs li a.selected { color: #000; background-color: #f1f0ee; font-weight: bold; padding: 0.7em 0.3em 0.38em 0.3em; }
      div.tabContent { border: 1px solid #c9c3ba; padding: 0.5em; background-color: #f1f0ee; }
      div.tabContent.hide { display: none; }
      </style>

      <meta HTTP-EQUIV='Pragma' CONTENT='no-cache'>
      <link rel="stylesheet" href='stylemain.css' type='text/css'>
      <link rel="stylesheet" href='colors.css' type='text/css'>
      <script language="javascript" src="util.js"></script>

<script language="javascript">
/////////////////////////
// BEGINING OF JAVASCRIPT
/////////////////////////

///////////////////////
// Initialize variables
///////////////////////

var numVoiceButtonSets = 1;

/* Retrieve variables from CGI - %ejGetVoice()% is replaced by cgiGetVarVoice()
 * in httpd before file is sent to the remote browser
 */
var voiceRunning = '<%ejGetVoice(voiceStatus)%>';
var numSipClients = '<%ejGetVoice(numSipClients)%>'
var numFxs        = '<%ejGetVoice(numFxs)%>';
var sessionKey='<%ejGetOther(sessionKey)%>';
var sipDomain    = '<%ejGetVoice(sipDomain)%>';
var codecs = '<%ejGetVoice(prefCodecList)%>';
var ipFamily = '<%ejGetVoice(ipAddrFamily)%>';
var confOptionList = '<%ejGetVoice(confOptionList)%>';
var confOption = '<%ejGetVoice(confOption)%>';
var confUri = '<%ejGetVoice(confUri)%>';
var transportOptionList = '<%ejGetVoice(transportList)%>';
var transportOption = '<%ejGetVoice(transportOption)%>';
var sipUriForTls = '<%ejGetVoice(sipUriForTls)%>';
var backToPrimModeList = '<%ejGetVoice(backToPrimList)%>';
var backToPrimMode = '<%ejGetVoice(backToPrimMode)%>';
var failoverEnbl = '<%ejGetVoice(failoverEnbl)%>';
var sipOptionsEnbl = '<%ejGetVoice(sipOptionsEnbl)%>';
var tmppa = '<%ejGetVoice(proxyAddr)%>';
var tmppp = '<%ejGetVoice(proxyPort)%>';
var tmpoa = '<%ejGetVoice(obProxyAddr)%>';
var tmpop = '<%ejGetVoice(obProxyPort)%>';
var tmpra = '<%ejGetVoice(regAddr)%>';
var tmprp = '<%ejGetVoice(regPort)%>';
var tmpre = '<%ejGetVoice(regExp)%>';
var tmprr = '<%ejGetVoice(regRetry)%>';
var tmpsd = '<%ejGetVoice(secDomain)%>';
var tmpspa = '<%ejGetVoice(secProxyAddr)%>';
var tmpspp = '<%ejGetVoice(secProxyPort)%>';
var tmpsoa = '<%ejGetVoice(secObProxyAddr)%>';
var tmpsop = '<%ejGetVoice(secObProxyPort)%>';
var tmpsra = '<%ejGetVoice(secRegistrarAddr)%>';
var tmpsrp = '<%ejGetVoice(secRegistrarPort)%>';
var dialplan = '<%ejGetVoice(dialPlan)%>';

// Initialize dynamic variables
for (var i = 1; i <= numSipClients; i++)
{
   eval( "var aen" + i + " \= \"\" " );
   eval( "var ast" + i + " \= \"\" " );
   eval( "var un" + i + " \= \"\" " );
   eval( "var dn" + i + " \= \"\" " );
   eval( "var an" + i + " \= \"\" " );
   eval( "var pw" + i + " \= \"\" " );
   eval( "var t38" + i + " \= \"\" " );
}

// Retrieve string list for dynamic variables (list based, eg. "item1=x item2=y ...")
var lst_aen = '<%ejGetVoice(accntEnable)%>';
var lst_ast = '<%ejGetVoice(accntStatus)%>';
var lst_un = '<%ejGetVoice(accntUsername)%>';
var lst_dn = '<%ejGetVoice(accntDispName)%>';
var lst_an = '<%ejGetVoice(accntAuthName)%>';
var lst_pw = '<%ejGetVoice(accntPassword)%>';
var lst_t38en = '<%ejGetVoice(t38Enable)%>';

// Convert string list to dynamic variables
if ( lst_aen.search("ejGetVoice") < 0 ) {
   eval( lst_aen );
}
if ( lst_ast.search("ejGetVoice") < 0 ) {
   eval( lst_ast );
}
if ( lst_un.search("ejGetVoice") < 0 ) {
   eval( lst_un );
}
if ( lst_dn.search("ejGetVoice") < 0 ) {
   eval( lst_dn );
}
if ( lst_an.search("ejGetVoice") < 0 ) {
   eval( lst_an );
}
if ( lst_pw.search("ejGetVoice") < 0 ) {
   eval( lst_pw );
}
if ( lst_t38en.search("ejGetVoice") < 0 ) {
   eval( lst_t38en );
}


////////////
// Functions
////////////

function btnStartSip() {
   var loc = 'voicesipstart.cmd?';

   loc += addParamsToQuery( loc, "srvprov" );

   //Stripping quotes and spaces
   loc = loc.replace(/['" ]/g,'');

   loc += '&sessionKey=' + sessionKey;
   var code = 'location="' + loc + '"';
   eval(code);
}

function btnStopSip() {
   var loc = 'voicesipstop.cmd?';

   loc += addParamsToQuery( loc, "srvprov" );

   //Stripping quotes and spaces
   loc = loc.replace(/['" ]/g,'');

   loc += '&sessionKey=' + sessionKey;
   var code = 'location="' + loc + '"';

   eval(code);
}

function btnDefaultSip() {
   var loc = 'voicesipsetdefault.cmd?';

   loc += addParamsToQuery( loc, "srvprov" );

   //Stripping quotes and spaces
   loc = loc.replace(/['" ]/g,'');

   loc += '&sessionKey=' + sessionKey;
   var code = 'location="' + loc + '"';

   eval(code);
}

function btnApplySip() {
   var loc = 'voicesipapply.cmd?';

   loc += addParamsToQuery( loc, "srvprov" );

   //Stripping quotes and spaces
   loc = loc.replace(/['" ]/g,'');

   loc += '&sessionKey=' + sessionKey;

   var code = 'location="' + loc + '"';
   eval(code);
}

// Adds parameters to the query passed to the http server
function addParamsToQuery( loc_init, current_view) {
   var loc = loc_init;

   with ( document.forms[0] ) {
      loc += 'currentview=' + current_view;

      loc += '&sipDomain=' + document.getElementById("domainName").value;
      loc += '&dialPlan=' + encodeUrl(document.getElementById("dialPlan").value.replace(/['" ]/g,''));

      if (document.getElementById("enblProxy").checked == true)
      {
         loc += '&proxyAddr=' + document.getElementById("proxyAddr").value;
         loc += '&proxyPort=' + document.getElementById("proxyPort").value;
      }

      if (document.getElementById("enblOutbound").checked == true)
      {
         loc += '&obProxyAddr=' + document.getElementById("obProxyAddr").value;
         loc += '&obProxyPort=' + document.getElementById("obProxyPort").value;
      }

      if (document.getElementById("enblReg").checked == true)
      {
         loc += '&regAddr=' + document.getElementById("regAddr").value;
         loc += '&regPort=' + document.getElementById("regPort").value;
         loc += '&regExp=' + document.getElementById("regExp").value;
         loc += '&regRetry=' + document.getElementById("regRetry").value;
      }

      loc += '&prefCodecList=' + document.getElementById("codecList").value;

      if (document.getElementById("enblFailover").checked == true)
      {
         loc += '&failoverEnbl=Yes';
         loc += '&secDomain=' + document.getElementById("secDomain").value;
         loc += '&secProxyAddr=' + document.getElementById("secProxyAddr").value;
         loc += '&secProxyPort=' + document.getElementById("secProxyPort").value;
         loc += '&secObProxyAddr=' + document.getElementById("secObProxyAddr").value;
         loc += '&secObProxyPort=' + document.getElementById("secObProxyPort").value;
         loc += '&secRegistrarAddr=' + document.getElementById("secRegistrarAddr").value;
         loc += '&secRegistrarPort=' + document.getElementById("secRegistrarPort").value;
         loc += '&backToPrimMode=' + document.getElementById("failOpt").value;
         if (document.getElementById("enblSipOptions").checked == true)
         {
            loc += '&sipOptionsEnbl=Yes';
         }
         else
         {
            loc += '&sipOptionsEnbl=No';
         }
      }
      else
      {
         loc += '&failoverEnbl=No';
      }

      loc += '&transportOption=' + document.getElementById("tlsOpt").value;
      if (document.getElementById("sipForTls").checked == true)
      {
         loc += '&sipUriForTls=Yes';
      }
      else
      {
         loc += '&sipUriForTls=No';
      }

      loc += '&confOption=' + document.getElementById("confOpt").value;
      loc += '&confUri=' + document.getElementById("confURI").value;

      for (var i = 1; i <= numSipClients; i++)
      {
         loc += "\'&accntEnable" + i + "=\'" + document.getElementById("accntEn"+i).checked;
         loc += "\'&accntUsername" + i + "=\'" + document.getElementById("userName"+i).value;
         loc += "\'&accntDispName" + i + "=\'" + document.getElementById("dispName"+i).value;
         loc += "\'&accntAuthName" + i + "=\'" + document.getElementById("authName"+i).value;
         loc += "\'&accntPassword" + i + "=\'" + document.getElementById("passwd"+i).value;
         loc += "\'&t38Enable" + i + "=\'" + document.getElementById("t38En"+i).checked;
      }
   }

   return loc;
}

function frmLoad(current_view) {

   init();

   with ( document.forms[0] ) {

      /* Initialize SIP parameters */
      document.getElementById("domainName").value = sipDomain;
      document.getElementById("dialPlan").value = dialplan;

      document.getElementById("enblProxy").checked = true;
      document.getElementById("enblOutbound").checked = true;
      document.getElementById("enblReg").checked = true;

      if (failoverEnbl == "Yes")
      {
         document.getElementById("enblFailover").checked = true;
         hideFailoverInfo(0);
      }
      else
      {
         document.getElementById("enblFailover").checked = false;
         hideFailoverInfo(1);
      }
      if (sipOptionsEnbl == "Yes")
      {
         document.getElementById("enblSipOptions").checked = true;
      }
      else
      {
         document.getElementById("enblSipOptions").checked = false;
      }

      if(tmppa == "")
      {
         document.getElementById("proxyAddr").value = "0.0.0.0";
      }
      else
      {
         document.getElementById("proxyAddr").value = tmppa;
      }

      if(tmppp == "")
      {
         document.getElementById("proxyPort").value = "5060";
      }
      else
      {
         document.getElementById("proxyPort").value = tmppp;
      }

      if(tmpoa == "")
      {
         document.getElementById("obProxyAddr").value = "0.0.0.0";
      }
      else
      {
         document.getElementById("obProxyAddr").value = tmpoa;
      }

      if(tmpop == "")
      {
         document.getElementById("obProxyPort").value = "5060";
      }
      else
      {
         document.getElementById("obProxyPort").value = tmpop;
      }

      if(tmpra == "")
      {
         document.getElementById("regAddr").value = "0.0.0.0";
      }
      else
      {
         document.getElementById("regAddr").value = tmpra;
      }

      if(tmprp == "")
      {
         document.getElementById("regPort").value = "5060";
      }
      else
      {
         document.getElementById("regPort").value = tmprp;
      }

      document.getElementById("codecList").value = codecs;

      if(tmpre == "")
      {
         document.getElementById("regExp").value = "3600";
      }
      else
      {
         document.getElementById("regExp").value = tmpre;
      }

      if(tmprr == "")
      {
         document.getElementById("regRetry").value = "20";
      }
      else
      {
         document.getElementById("regRetry").value = tmprr;
      }

      document.getElementById("secDomain").value = tmpsd;

      if(tmpspa == "")
      {
         document.getElementById("secProxyAddr").value = "0.0.0.0";
      }
      else
      {
         document.getElementById("secProxyAddr").value = tmpspa;
      }

      if(tmpspp == "")
      {
         document.getElementById("secProxyPort").value = "5060";
      }
      else
      {
         document.getElementById("secProxyPort").value = tmpspp;
      }

      if(tmpsoa == "")
      {
         document.getElementById("secObProxyAddr").value = "0.0.0.0";
      }
      else
      {
         document.getElementById("secObProxyAddr").value = tmpsoa;
      }

      if(tmpsop == "")
      {
         document.getElementById("secObProxyPort").value = "5060";
      }
      else
      {
         document.getElementById("secObProxyPort").value = tmpsop;
      }

      if(tmpsra == "")
      {
         document.getElementById("secRegistrarAddr").value = "0.0.0.0";
      }
      else
      {
         document.getElementById("secRegistrarAddr").value = tmpsra;
      }

      if(tmpsrp == "")
      {
         document.getElementById("secRegistrarPort").value = "5060";
      }
      else
      {
         document.getElementById("secRegistrarPort").value = tmpsrp;
      }

      document.getElementById("failOpt").value = backToPrimMode;
      document.getElementById("tlsOpt").value = transportOption;
      if (sipUriForTls == "Yes")
      {
         document.getElementById("sipForTls").checked = true;
      }
      else
      {
         document.getElementById("sipForTls").checked = false;
      }
      document.getElementById("confOpt").value = confOption;
      document.getElementById("confURI").value = confUri;

      for (var i = 1; i <= numSipClients; i++)
      {
         if(eval("aen"+i) == "Yes")
         {
            document.getElementById("accntEn"+i).checked = true;
         }
         else
         {
            document.getElementById("accntEn"+i).checked = false;
         }
         eval("accntSt"  + i + ".value = ast"+i);
         eval("userName" + i + ".value = un"+i);
         eval("dispName" + i + ".value = dn"+i);
         eval("authName" + i + ".value = an"+i);
         eval("passwd"   + i + ".value = pw"+i);
         if(eval("t38en"+i) == "Yes")
         {
            document.getElementById("t38En"+i).checked = true;
         }
         else
         {
            document.getElementById("t38En"+i).checked = false;
         }
      }
   }
}

function printConfOptionListBox(){
   var tokConfOptionList = confOptionList.split(" ");

   for(i = 0; i < tokConfOptionList.length; i++)
   {
      document.writeln("<option value=\"" + tokConfOptionList[i] + "\" selected>");
      document.writeln(tokConfOptionList[i]);
   }
}

function printTlsOptionListBox(){
   var tokTransportOptionList = transportOptionList.split(" ");

   for(i = 0; i < tokTransportOptionList.length; i++)
   {
      document.writeln("<option value=\"" + tokTransportOptionList[i] + "\" selected>");
      document.writeln(tokTransportOptionList[i]);
   }
}

function printBackToPrimListBox(){
   var tokBackToPrimList = backToPrimModeList.split(" ");

   for(i = 0; i < tokBackToPrimList.length; i++)
   {
      document.writeln("<option value=\"" + tokBackToPrimList[i] + "\" selected>");
      document.writeln(tokBackToPrimList[i]);
   }
}

function enableVoiceButtons(index)
{
   var buttonStart = document.getElementById( "StartButton" + index );
   var buttonStop = document.getElementById( "StopButton" + index );
   var buttonApply = document.getElementById( "ApplyButton" + index );
   var buttonDefault = document.getElementById( "DefaultButton" + index );

   if ( voiceRunning == 1 ) {
      buttonStart.disabled = true;
      buttonStop.disabled = false;
      buttonApply.disabled = false;
      buttonDefault.disabled = false;
   } else {
      buttonStart.disabled = false;
      buttonStop.disabled = true;
      buttonApply.disabled = false;
      buttonDefault.disabled = false;
   }
}

var tabLinks = new Array();
var contentDivs = new Array();
var selectedTab;

function init() {

  // Grab the tab links and content divs from the page
  var tabListItems = document.getElementById('tabs').childNodes;
  for ( var i = 0; i < tabListItems.length; i++ ) {
    if ( tabListItems[i].nodeName == "LI" ) {
      var tabLink = getFirstChildWithTagName( tabListItems[i], 'A' );
      var id = getHash( tabLink.getAttribute('href') );
      tabLinks[id] = tabLink;
      contentDivs[id] = document.getElementById( id );
    }
  }

  // Assign onclick events to the tab links, and
  // highlight the first tab
  var i = 0;
  selectedTab = 0;

  for ( var id in tabLinks ) {
    tabLinks[id].onclick = showTab;
    tabLinks[id].onfocus = function() { this.blur() };
    if ( i == 0 ) tabLinks[id].className = 'selected';
    i++;
  }

  // Hide all content divs except the first
  var i = 0;

  for ( var id in contentDivs ) {
    if ( i != 0 ) contentDivs[id].className = 'tabContent hide';
    i++;
  }
}


function showTab() {
  var selectedId = getHash( this.getAttribute('href') );

  // Highlight the selected tab, and dim all others.
  // Also show the selected content div, and hide all others.
  for ( var id in contentDivs ) {
    if ( id == selectedId ) {
      selectedTab = selectedId;
      tabLinks[id].className = 'selected';
      contentDivs[id].className = 'tabContent';
    } else {
      tabLinks[id].className = '';
      contentDivs[id].className = 'tabContent hide';
    }
  }

  // Stop the browser following the link
  return false;
}

function getFirstChildWithTagName( element, tagName ) {
  for ( var i = 0; i < element.childNodes.length; i++ ) {
    if ( element.childNodes[i].nodeName == tagName ) return element.childNodes[i];
  }
}

function getHash( url ) {
  var hashPos = url.lastIndexOf ( '#' );
  return url.substring( hashPos + 1 );
}

function hideProxyInfo(hide) {
   var status = 'visible';

   if ( hide == 1 )
      status = 'hidden';
   if (document.getElementById) {  // DOM3 = IE5, NS6
      var idName = "proxyInfo";
      document.getElementById( idName ).style.visibility = status;
   }
   else {
      if (document.layers == false) // IE4
         eval("document.all.proxyInfo.style.visibility = status");
   }
}
function ProxyCbClick(cb) {
   if ( cb.checked == true )
      hideProxyInfo(0);
   else
      hideProxyInfo(1);
}
function hideOutboundInfo(hide) {
   var status = 'visible';

   if ( hide == 1 )
      status = 'hidden';
   if (document.getElementById) {  // DOM3 = IE5, NS6
      var idName = "outboundInfo";
      document.getElementById( idName ).style.visibility = status;
   }
   else {
      if (document.layers == false) // IE4
         eval("document.all.outboundInfo.style.visibility = status");
   }
}
function OutboundCbClick(cb) {
   if ( cb.checked == true )
      hideOutboundInfo(0);
   else
      hideOutboundInfo(1);
}
function hideRegInfo(hide) {
   var status = 'visible';

   if ( hide == 1 )
      status = 'hidden';
   if (document.getElementById) {  // DOM3 = IE5, NS6
      var idName = "regInfo";
      document.getElementById( idName ).style.visibility = status;
   }
   else {
      if (document.layers == false) // IE4
         eval("document.all.regInfo.style.visibility = status");
   }
}
function RegCbClick(cb) {
   if ( cb.checked == true )
      hideRegInfo(0);
   else
      hideRegInfo(1);
}

function hideFailoverInfo(hide) {
   var status = 'visible';

   if ( hide == 1 )
      status = 'hidden';
   if (document.getElementById) {  // DOM3 = IE5, NS6
      var idName = "failoverInfo";
      document.getElementById( idName ).style.visibility = status;
   }
   else {
      if (document.layers == false) // IE4
         eval("document.all.regInfo.style.visibility = status");
   }
}
function FailoverClick(cb) {
   if ( cb.checked == true )
      hideFailoverInfo(0);
   else
      hideFailoverInfo(1);
}

function createLinesTable() {

   document.writeln("<table id='linesTable' border='1'><tbody id='linesTbody'>");

   document.writeln("<tr>");
   document.writeln("<td class='hd' width='100'>SIP Account<\/td>");
   for (var line = 1; line <= numSipClients; line++)
   {
      document.writeln("<td align=center>" + line + "</td>");
   }
   document.writeln("</tr>");

   /* First row */
   document.writeln("<tr>");
   document.writeln("<td class='hd' width='100'>Account Enabled<\/td>");
   for (var line = 1; line <= numSipClients; line++)
   {
      document.writeln("<td align=center><input type='checkbox' size=10 id='accntEn" + line + "'></td>");
   }
   document.writeln("</tr>");

   /* Second row */
   document.writeln("<tr>");
   document.writeln("<td class='hd' width='100'>Account Status<\/td>");
   for (var line = 1; line <= numSipClients; line++)
   {
      document.writeln("<td><input type='text' id='accntSt" + line + "' name='accntSt" + line + "' disabled></td>");
   }
   document.writeln("</tr>");

   /* Third row */
   document.writeln("<tr>");
   document.writeln("<td class='hd' maxlength=64 width='100'>Extension<\/td>");
   for (var line = 1; line <= numSipClients; line++)
   {
      document.writeln("<td><input type='text' id='userName" + line + "' name='userName" + line + "'></td>");
   }
   document.writeln("</tr>");

   document.writeln("<tr>");
   document.writeln("<td class='hd' maxlength=128 width='100'>Display Name<\/td>");
   for (var line = 1; line <= numSipClients; line++)
   {
      document.writeln("<td><input type='text' id='dispName" + line + "' name='dispName" + line + "'></td>");
   }
   document.writeln("</tr>");

   document.writeln("<tr>");
   document.writeln("<td class='hd' maxlength=128 width='100'>Authentication Name<\/td>");
   for (var line = 1; line <= numSipClients; line++)
   {
      document.writeln("<td><input type='text' id='authName" + line + "' name='authName" + line + "'></td>");
   }
   document.writeln("</tr>");

   document.writeln("<tr>");
   document.writeln("<td class='hd' maxlength=128 width='100'>Password<\/td>");
   for (var line = 1; line <= numSipClients; line++)
   {
      document.writeln("<td><input type='text' id='passwd" + line + "' name='passwd" + line + "'></td>");
   }
   document.writeln("</tr>");

   document.writeln("<tr>");
   document.writeln("<td class='hd' maxlength=20 width='100'>T.38 Enabled<\/td>");
   for (var line = 1; line <= numSipClients; line++)
   {
      document.writeln("<td align=center><input type='checkbox' size=10 id='t38En" + line + "'></td>");
   }
   document.writeln("</tr>");

   document.writeln("</tbody></table>");
}

function createTabs() {
  document.writeln("<ul id='tabs'>");
  document.writeln("<li><a href='#" + 0 + "'>SIP - RFC3261 Mode</a></li>");
}

function createSip() {
   document.writeln("<div class='tabContent' id='0'>");
   document.writeln("<div>");
   document.writeln("   <br>");

   document.writeln("   <table border='0' cellpadding='0' cellspacing='0'>");
   document.writeln("      <tr>");
   document.writeln("         <td class='txt' width='210'>SIP domain name:</td>");
   document.writeln("         <td><input type='text' id='domainName'></td>");
   document.writeln("      </tr>");
   document.writeln("   </table>");
   document.writeln("   <br>");
   document.writeln("   <div id='digitMap'>");
   document.writeln("      <table border='0' cellpadding='0' cellspacing='0' ID='Table0'>");
   document.writeln("      <tr>");
   document.writeln("         <td class='txt' width='210'>Voip Dialplan Setting:</td>");
   document.writeln("         <td><input type='text' id='dialPlan'></td>");
   document.writeln("      </tr>");
   document.writeln("      </table>");
   document.writeln("   </div>");
   document.writeln("   <br>");
   document.writeln("   <td class='txt' valign='middle' align='center' colspan='2' width='30' height='30'><input type='checkbox' id='enblProxy' onClick='ProxyCbClick(this)'></td>");
   document.writeln("   <td class='txt' colspan='2'>");
   document.writeln("   Use SIP Proxy");
   document.writeln("   <br>");
   document.writeln("   <div id='proxyInfo'>");
   document.writeln("      <table border='0' cellpadding='0' cellspacing='0' ID='Table0'>");
   document.writeln("         <tr>");
   document.writeln("            <td class='txt' width='210'>SIP Proxy:</td>");
   document.writeln("            <td><input type='text' id='proxyAddr'></td>");
   document.writeln("         </tr>");
   document.writeln("         <tr>");
   document.writeln("            <td class='txt'>SIP Proxy port:</td>");
   document.writeln("            <td><input type='text' id='proxyPort'></td>");
   document.writeln("         </tr>");
   document.writeln("      </table>");
   document.writeln("   </div>");
   document.writeln("   <br>");
   document.writeln("   <td class='txt' valign='middle' align='center' colspan='2' width='30' height='30'><input type='checkbox' id='enblOutbound' onClick='OutboundCbClick(this)'></td>");
   document.writeln("   <td class='txt' colspan='2'>");
   document.writeln("   Use SIP Outbound Proxy");
   document.writeln("   <br>");
   document.writeln("   <div id='outboundInfo'>");
   document.writeln("      <table border='0' cellpadding='0' cellspacing='0' ID='Table0'>");
   document.writeln("         <tr>");
   document.writeln("            <td class='txt' width='210'>SIP Outbound Proxy:</td>");
   document.writeln("            <td><input type='text' id='obProxyAddr'></td>");
   document.writeln("            <td class='txt' width='450'><b>&nbsp&nbsp(Note: If failover is enabled, this value determines the failover mode)</b></td>");
   document.writeln("         </tr>");
   document.writeln("         <tr>");
   document.writeln("            <td class='txt' >SIP Outbound Proxy port:</td>");
   document.writeln("            <td><input type='text' id='obProxyPort'></td>");
   document.writeln("         </tr>");
   document.writeln("      </table>");
   document.writeln("   </div>");
   document.writeln("   <br>");
   document.writeln("   <td class='txt' valign='middle' align='center' colspan='2' width='30' height='30'><input type='checkbox' id='enblReg' onClick='RegCbClick(this)'></td>");
   document.writeln("   <td class='txt' colspan='2'>");
   document.writeln("   Use SIP Registrar");
   document.writeln("   <br>");
   document.writeln("   <div id='regInfo'>");
   document.writeln("      <table border='0' cellpadding='0' cellspacing='0' ID='Table0'>");
   document.writeln("         <tr>");
   document.writeln("            <td class='txt'  width='210'>SIP Registrar:</td>");
   document.writeln("            <td><input type='text' id='regAddr'></td>");
   document.writeln("         </tr>");
   document.writeln("         <tr>");
   document.writeln("            <td class='txt' width='210'>SIP Registrar port:</td>");
   document.writeln("            <td><input type='text' id='regPort'></td>");
   document.writeln("         </tr>");
   document.writeln("      </table>");
   document.writeln("   </div>");
   document.writeln("   <br>");
   document.writeln("   <div id='regExpInfo'>");
   document.writeln("      <table border='0' cellpadding='0' cellspacing='0' ID='Table0'>");
   document.writeln("         <tr>");
   document.writeln("            <td class='txt' width='210'>Registration Expiry:</td>");
   document.writeln("            <td><input type='text' id='regExp'></td>");
   document.writeln("         </tr>");
   document.writeln("         <tr>");
   document.writeln("            <td class='txt' width='210'>Registration Retry:</td>");
   document.writeln("            <td><input type='text' id='regRetry'></td>");
   document.writeln("         </tr>");
   document.writeln("      </table>");
   document.writeln("   </div>");
   document.writeln("   <br>");
   document.writeln("   <div id='prefCodecs'>");
   document.writeln("      <table border='0' cellpadding='0' cellspacing='0' ID='Table0'>");
   document.writeln("      <tr>");
   document.writeln("         <td class='txt' width='210'>Codec List (in order of preference):</td>");
   document.writeln("         <td><input type='text' size=50 id='codecList'></td>");
   document.writeln("      </tr>");
   document.writeln("      </table>");
   document.writeln("   </div>");
   document.writeln("   <br>");
   document.writeln("   <br>");
                        createLinesTable();
   document.writeln("   <br>");
   document.writeln("   <br>");
   document.writeln("   <td class='txt' valign='middle' align='center' colspan='2' width='30' height='30'><input type='checkbox' id='enblFailover' onClick='FailoverClick(this)'></td>");
   document.writeln("   <td class='txt' colspan='2'>");
   document.writeln("   Enable Failover");
   document.writeln("   <br>");
   document.writeln("   <br>");
   document.writeln("   <div id='failoverInfo'>");
   document.writeln("      <div id='backToPrimDiv'>");
   document.writeln("         <table border='0' cellpadding='0' cellspacing='0' ID='Table00'>");
   document.writeln("            <tr>");
   document.writeln("               <td class='txt' width='210'>Back-To-Primary Mode:</td>");
   document.writeln("               <td><select id='failOpt' size='1'>");
                                    printBackToPrimListBox()
   document.writeln("               </select></td>");
   document.writeln("            </tr>");
   document.writeln("         </table>");
   document.writeln("      </div>");
   document.writeln("      <br>");
   document.writeln("      <div id='secDomainDiv'>");
   document.writeln("         <table border='0' cellpadding='0' cellspacing='0' ID='Table01'>");
   document.writeln("            <tr>");
   document.writeln("               <td class='txt'  width='210'>Secondary SIP Domain Name:</td>");
   document.writeln("               <td><input type='text' id='secDomain'></td>");
   document.writeln("            </tr>");
   document.writeln("         </table>");
   document.writeln("      </div>");
   document.writeln("      <br>");
   document.writeln("      <div id='secProxyDiv'>");
   document.writeln("         <table border='0' cellpadding='0' cellspacing='0' ID='Table02'>");
   document.writeln("            <tr>");
   document.writeln("               <td class='txt'  width='210'>Secondary SIP Proxy:</td>");
   document.writeln("               <td><input type='text' id='secProxyAddr'></td>");
   document.writeln("            </tr>");
   document.writeln("            <tr>");
   document.writeln("               <td class='txt' width='210'>Secondary SIP Proxy port:</td>");
   document.writeln("               <td><input type='text' id='secProxyPort'></td>");
   document.writeln("            </tr>");
   document.writeln("         </table>");
   document.writeln("      </div>");
   document.writeln("      <br>");
   document.writeln("      <div id='secObProxyDiv'>");
   document.writeln("         <table border='0' cellpadding='0' cellspacing='0' ID='Table03'>");
   document.writeln("            <tr>");
   document.writeln("               <td class='txt'  width='210'>Secondary Outbound Proxy IP:</td>");
   document.writeln("               <td><input type='text' id='secObProxyAddr'></td>");
   document.writeln("            </tr>");
   document.writeln("            <tr>");
   document.writeln("               <td class='txt' width='210'>Secondary Outbound Proxy port:</td>");
   document.writeln("               <td><input type='text' id='secObProxyPort'></td>");
   document.writeln("            </tr>");
   document.writeln("         </table>");
   document.writeln("      </div>");
   document.writeln("      <br>");
   document.writeln("      <div id='secRegistrarDiv'>");
   document.writeln("         <table border='0' cellpadding='0' cellspacing='0' ID='Table04'>");
   document.writeln("            <tr>");
   document.writeln("               <td class='txt'  width='210'>Secondary SIP Registrar:</td>");
   document.writeln("               <td><input type='text' id='secRegistrarAddr'></td>");
   document.writeln("            </tr>");
   document.writeln("            <tr>");
   document.writeln("               <td class='txt' width='210'>Secondary SIP Registrar port:</td>");
   document.writeln("               <td><input type='text' id='secRegistrarPort'></td>");
   document.writeln("            </tr>");
   document.writeln("         </table>");
   document.writeln("      </div>");
   document.writeln("      <br>");
   document.writeln("      <td class='txt' valign='middle' align='center' colspan='2' width='30' height='30'><input type='checkbox' id='enblSipOptions'></td>");
   document.writeln("      <td class='txt' colspan='2'>");
   document.writeln("      Enable SIP Options ping");
   document.writeln("      <br>");
   document.writeln("   </div>");

   document.writeln("   <br>");

   document.writeln("<table border='0' cellpadding='0' cellspacing='0' ID='Table1'>");
   document.writeln("<tr>");
   document.writeln("<td class='txt' width='210'>Transport Option:<\/td>");
   document.writeln("<td><select id='tlsOpt' size='1'>");
                    printTlsOptionListBox()
   document.writeln("</select></td>");
   document.writeln("</tr>");
   document.writeln("<tr>");
   document.writeln("<td class='txt' width='210'>Unsecured SIP URI for TLS:<\/td>");
   document.writeln("<td class='txt' valign='middle' align='left' colspan='2' width='30' height='30'><input type='checkbox' id='sipForTls'></td>");
   document.writeln("</tr>");
   document.writeln("</table>");

   document.writeln("   <br>");

   document.writeln("<table border='0' cellpadding='0' cellspacing='0' ID='Table2'>");
   document.writeln("<tr>");
   document.writeln("<td class='txt' width='210'>Conferencing Option:<\/td>");
   document.writeln("<td><select id='confOpt' size='1'>");
                    printConfOptionListBox()
   document.writeln("</select></td>");
   document.writeln("</tr>");
   document.writeln("<tr>");
   document.writeln("<td class='txt' width='210'>Conferencing URI:</td>");
   document.writeln("<td><input type='text' id='confURI'></td>");
   document.writeln("</tr>");
   document.writeln("</table>");

   document.writeln("   <br>");
   document.writeln("   <br>");
   document.writeln("   <center>");
   document.writeln("       <input type='button' onClick='btnStartSip()' value='Start SIP client' id='StartButton" + 0 + "' disabled=true>");
   document.writeln("       <br>");
   document.writeln("       <br>");
   document.writeln("       <input type='button' onClick='btnStopSip()' value='Stop SIP client' id='StopButton" + 0 + "' disabled=true>");
   document.writeln("       <br>");
   document.writeln("       <br>");
   document.writeln("       <input type='button' onClick='btnDefaultSip()' value='Restore default setting' id='DefaultButton" + 0 + "' disabled=true>");
   document.writeln("       <br>");
   document.writeln("       <br>");
   document.writeln("       <input type='button' onClick='btnApplySip()' value='Apply' id='ApplyButton" + 0 + "' disabled=true>");
   document.writeln("       <br>");
   document.writeln("    </center>");
   document.writeln("    <br>");
   document.writeln("</div>");
   document.writeln("</div>");
}

////////////////////
// END OF JAVASCRIPT
////////////////////

</script>
</head>

<body onLoad="frmLoad('srvprov')">
   <blockquote>
      <form>
      <script TYPE="text/javascript">
        createTabs();
        createSip();

       for (var i = 0; i < numVoiceButtonSets; i++) {
           enableVoiceButtons(i);
        }

     </script>

      </form>
   </blockquote>
</body>
</html>
