function appendRow(tblName,text)
{
  var tbl = document.getElementById(tblName);
  var newRow = tbl.insertRow(tbl.rows.length);
  var newCell = newRow.insertCell(0);
  newCell.innerHTML = text;
}

function deleteLastRow(tblName)
{
  var tbl = document.getElementById(tblName);
  if (tbl.rows.length > 0) tbl.deleteRow(tbl.rows.length - 1);
}

function handleExtInfoResponse(status,content,contentType)
{
  deleteLastRow('ext_info');
  appendRow('ext_info', content);
  //  if(content.indexOf('avail_dom') > 0)
  //  {
  //    var domain = content.substr(4,content.indexOf('-->')-4);
  //    getURL("/domainAvail.php?domain=" + domain + "&cols=1&concise=1&max=8",handleAvailableDomainResponse);
  //  }
}

function handleAvailableDomainResponse(status,content,contentType)
{
  deleteLastRow('avail_dom');
  appendRow('avail_dom', content);
}

function handlePremiumDomainResponse(status,content,contentType)
{
  split = content.split('|||');

  if(typeof split[0] != 'undefined')
  {
      deleteLastRow('prem_dom');
      appendRow('prem_dom', split[0]);
  }
  if((typeof split[1] != 'undefined') && (el = document.getElementById('prem_preview')))
  {
      replaceText('prem_preview', split[1]);
  }
}

function replaceText(sId, sText)
{
  var el;
  if (document.getElementById && (el = document.getElementById(sId)))
  {
    while (el.hasChildNodes())
      el.removeChild(el.lastChild);
    el.innerHTML = sText;
  }
}

