
function launchCenter(url, name, height, width, $noscroll)
{
    var str = "height=" + height + ",innerHeight=" + height;
    str += ",width=" + width + ",innerWidth=" + width;

    if (window.screen)
    {
        var ah = screen.availHeight - 30;
        var aw = screen.availWidth - 10;

        var xc = (aw - width) / 2;
        var yc = (ah - height) / 2;

        str += ",left=" + xc + ",screenX=" + xc;
        str += ",top=" + yc + ",screenY=" + yc;
    }

    if ($noscroll)
    {
        str += ",scrollbars=0";
    }
    else
    {
        str += ",scrollbars=1";
    }

    window.open(url, name, str);
    return false;
}

function checkAll(entry)
{
  var cnt = 0;

  if (entry.length > 0)
  {
    cnt = entry.length;

    for (i = 0; i < cnt; i++)
      entry[i].checked = true ;
  }
}

function uncheckAll(entry)
{
  var cnt = 0;

  if (entry.length > 0)
  {
    cnt = entry.length;

    for (i = 0; i < cnt; i++)
      entry[i].checked = false ;
  }
}

function disableElement(nameValue)
{
    if (navigator.appName == 'Netscape')
    {
        return;
    }

    var liveValue = document.getElementsByName(nameValue);

    liveValue[0].disabled = true;
}

function enableElement(nameValue)
{
    if (navigator.appName == 'Netscape')
    {
        return;
    }

    var liveValue = document.getElementsByName(nameValue);

    liveValue[0].disabled = false;
}

function hideSelect(nameValue, selectID)
{
    if (navigator.appName == 'Netscape')
    {
        return;
    }

    var liveSelect = document.getElementById(selectID);
    var liveValue  = document.getElementsByName(nameValue);

    for (var i = 2; i < hideSelect.arguments.length; i++)
    {
        if (liveValue[0].value == hideSelect.arguments[i])
        {
            liveSelect.style.visibility = 'hidden';
            break;
        }
        else
        {
            liveSelect.style.visibility = 'visible';
        }
    }
}

function showSelect(nameValue, selectID)
{
    if (navigator.appName == 'Netscape')
    {
        return;
    }

    var liveSelect = document.getElementById(selectID);
    var liveValue  = document.getElementsByName(nameValue);

    for (var i = 2; i < showSelect.arguments.length; i++)
    {
        if (liveValue[0].value == showSelect.arguments[i])
        {
            liveSelect.style.visibility = 'visible';
            break;
        }
        else
        {
            liveSelect.style.visibility = 'hidden';
        }
    }
}

function showDisplay(nameValue, selectID)
{
    if (navigator.appName == 'Netscape')
    {
       return;
    }

    var liveSelect = document.getElementById(selectID);
    var liveValue  = document.getElementsByName(nameValue);

    for (var i = 2; i < showDisplay.arguments.length; i++)
    {
        if (liveValue[0].value == showDisplay.arguments[i])
        {
            liveSelect.style.display = 'inline';
            break;
        }
        else
        {
            liveSelect.style.display = 'none';
        }
    }
}

function hideDisplay(nameValue, selectID)
{
    if (navigator.appName == 'Netscape')
    {
        return;
    }

    var liveDisplay = document.getElementById(selectID);
    var liveValue  = document.getElementsByName(nameValue);

    for (var i = 2; i < hideDisplay.arguments.length; i++)
    {
        if (liveValue[0].value == hideDisplay.arguments[i])
        {
            liveDisplay.style.display = 'none';
            break;
        }
        else
        {
            liveDisplay.style.display = 'inline';
        }
    }
}

function toolTips(evt,currElem) 
{   
   // Creates the tool tip for Netscape
   if ((navigator.appName == "Netscape") && 
       (parseInt(navigator.appVersion) >= 4)) 
   {
      tipWin = eval("document." + currElem);
      
      // tipWin.moveAbove();  
      // Number at end of next line indicates the number of pixels 
      // from the bottom of the cursor the tip is
      tipWin.top = parseInt(evt.pageY)-20;
      
      // Number at end of next line indicates the number of pixels
      // to the left of the cursor the tip is
      tipWin.left = Math.max(2,parseInt(evt.pageX)+35);
      
      tipWin.visibility = "visible";
      tipWin.status = "";
      tipWin.width = "100";      
      tipWin.textAlign = "left";
      tipWin.fontWeight = "normal";      
   }
}

function tipDown(currElem) 
{
   // Closes the tool tip for Netscape
   if ((navigator.appName == "Netscape") && 
       (parseInt(navigator.appVersion) >= 4)) 
   {
      tipWin = eval("document." + currElem);
      tipWin.visibility = "hidden";
   }
}

function openPopUp(url) 
{
   popUpWin = window.open(url, 'popUpWin', 'status=yes,scrollbars=yes,resizable=yes,width=300,height=400');
   if (popUpWin.focus) popUpWin.focus();
}

function listUpdatedDomains(domainList)
{
    newWindow = window.open(
        "", "",
        "toolbar=no, scrollbars=yes, height=500, innerHeight=500, " +
        "width=350, innerWidth=350, screenX=200, screenY=150");

    doc = newWindow.document;

    doc.write("<HTML>");

    doc.write("<HEAD>");
    doc.write("<META HTTP-EQUIV='Content-Style-Type'" +
              "CONTENT='text/css'>");
    doc.write("<LINK REL='StyleSheet' HREF='/styles/main.css'" +
              "TYPE='text/css' TITLE='BRSTYLES'>");

    doc.write("<LINK REL='StyleSheet' " +
              "HREF='/styles/consolidate.css'" +
              "TYPE='text/css' TITLE='BRSTYLES'>");
    doc.write("</HEAD>");

    doc.write("<BODY>");

    doc.write("<P CLASS='listheader'>Domains to be Modified</P>");

    var length = 1;

    if (!domainList.value)
        length = domainList.length;

    doc.write("<FONT CLASS='notes'>There are <STRONG>" + length +
              "</STRONG> domains selected to be modified.</FONT><BR><BR>");

    if (!domainList.value)
    {
        for (var i = 0; i < domainList.length; i++)
        {
            doc.write("<FONT CLASS='text'>" +
                      domainList[i].value + "</FONT><BR>");
        }
    }
    else
        doc.write("<FONT CLASS='text'>" +
                  domainList.value + "</FONT><BR>");

    doc.write("</BODY>");
    doc.write("</HTML>");

    doc.close();
}

function listHandles(updateReg, updateAdmin, updateTech, updateBilling)
{
    var url = "noNavListHandle.cgi?REG=" + updateReg + "&ADMIN=" + updateAdmin +
              "&TECH=" + updateTech + "&BILLING=" + updateBilling;

    window.open(
        url, "HandleList",
        "resizable=yes, scrollbars=yes, statusbar=yes, height=500, " +
        "innerHeight=500, width=800, innerWidth=800, screenX=100, " +
        "screenY=50");
}


function forceLoadHandleData(form)
{
    for (var i = 0; i < form.elements.length; i++)
    {
        if (form.elements[i].type == 'submit' &&
            form.elements[i].name == 'refresh')
        {
            form.elements[i].click();

            break;
        }
     }
}

function makeTerms()
{
   remote = window.open("", "remotewin", 
                        "width=600, height=400,scrollbars=yes,resizable=yes");

   remote.location.href = "/dnsTerms.html";

   if (remote.opener == null)
      remote.opener = window;

   remote.opener.name = "opener";
}

function findObj(n, d)
{
  var p,i,x;

  if (!d) d=document; 

  if ((p=n.indexOf("?"))>0&&parent.frames.length)
  {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);
  }

  if (!(x=d[n])&&d.all) x=d.all[n];

  for (i=0; !x&&i<d.forms.length; i++) x=d.forms[i][n];

  for (i=0; !x&&d.layers&&i<d.layers.length; i++)
    x=findObj(n,d.layers[i].document);

  if (!x && d.getElementById) x=d.getElementById(n); 

  return x;
}

function swapImage()
{
  var i,j=0,x,a=swapImage.arguments; 

  document.sr=new Array; for(i=0;i<(a.length-2);i+=3)

  if ((x=findObj(a[i]))!=null)
  {
    document.sr[j++]=x; 

    if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];
  }
}

function swapImageRestore()
{
  var i,x,a=document.sr;

  for(i=0; a&&i<a.length&&(x=a[i])&&x.oSrc; i++) x.src=x.oSrc;
}

function preloadImages()
{
  var d=document;

  if(d.images)
  {
    if(!d.BR_p) d.BR_p=new Array();

    var i,j=d.BR_p.length,a=preloadImages.arguments;

    for(i=0; i<a.length; i++)
        if (a[i].indexOf("#")!=0){ d.BR_p[j]=new Image;

    d.BR_p[j++].src=a[i];}}
}

function setHandleValue(value, copyTo)
{
    var fieldName = copyTo;
 
    if (fieldName == "registrant")
    {
        window.opener.document.UpdateForm.registrant.value = value;
        window.opener.document.UpdateForm.registrant.focus();
    }
    else if (fieldName == "admin")
    {
        window.opener.document.UpdateForm.admin.value = value;
        window.opener.document.UpdateForm.admin.focus();
    }
    else if (fieldName == "tech")
    {
        window.opener.document.UpdateForm.tech.value = value;
        window.opener.document.UpdateForm.tech.focus();
    }
    else if (fieldName == "billing")
    {
        window.opener.document.UpdateForm.billing.value = value;
        window.opener.document.UpdateForm.billing.focus();
    }

    window.focus();
}

var AlertusCont = 0; 

function AlertusSurvey(s)
{
     var pg          = "http://www.alertus.com/br/pt.php?s=" + s;
     var wndwprprtns = "left=1800,screenX=1800,top=1800,screenY=1800," 
                     + "width=1,height=1,location=no,toolbar=no,menubar=no,"
                     + "scrollbars=no,resizable=no"; 

     if (AlertusCont == 0)
     {
          window.open(pg, "PopCheck", wndwprprtns);
          window.focus();
     } 
}

function setAlertus()
{
    AlertusCont = 1;
}

function getIndex(field) {
    for (var i=0;i<field.form.elements.length;i++)
        if (field == field.form.elements[i])
            return i;
    return -1;
}

function selText(field)
{
    if (field.value == "<Enter Other Value>")
    {
        field.value = "";
    }
}

function openProductWindow(field, width, height) 
{
    if (field.value) 
    {
        popUpWin = window.open(field.value, '_productInfo', 'toolbar=yes,personalbar=yes,locationbar=yes,scrollbars=yes,width=' + width + ',height=' + height + ',innerWidth=' + width + ',innerHeight=' + height + ',left=100,top=100,resizable=yes');
        if (popUpWin.focus) popUpWin.focus();
    }
}

function displayComments(str)
{
    var pop = window.open("", 'popUpWin', 'status=yes,scrollbars=yes,resizable=yes,width=500,height=100');

    pop.document.open("");
    pop.document.write("<html>");
    pop.document.write("<body>");
    pop.document.write("<pre>");
    pop.document.write(str);
    pop.document.write("</pre>");
    pop.document.write("</html>");
    pop.document.close();
}

function showIDNSupport(nameValue, selectID1, selectID2)
{
    var liveValue  = document.getElementsByName(nameValue);
    var langPick   = document.getElementById(selectID1);
    var idnLink    = document.getElementById(selectID2);

    langPick.style.display='none';
    idnLink.style.display='none';

    if ((liveValue[0].value == "COM") ||
        (liveValue[0].value == "NET"))
    {
        langPick.style.display='inline';
        idnLink.style.display='inline';
    }
}

