  function do_submit(f,a)
  {
    if (f>'') {
      o=document.getElementById(f);
      if (o) {
        o.action.value=a;
        o.submit();
      } else {
        alert('Formulário '+f+' não localizado');
      }
    }
  }

  function do_close()
  {
    var id=new String('#campo(id)');
    var rnd=Math.random()*1000;
    var s=new String(window.opener.location);
    rnd=Math.round(rnd);

    var p=s.search('rnd=');
    if (p>0)
      s=s.slice(0,p-1);

    p=s.search('#');
    if (p>0)
      s=s.slice(0,p);

    s=s+'&rnd='+rnd;
    s=s+'#'+id;

    window.opener.location.replace(s);
    window.close();
  }

    function getX( oElement )
  {
    var iReturnValue = 0;
    while( oElement != null ) {
      iReturnValue += oElement.offsetLeft;
      oElement = oElement.offsetParent;
    }
    return iReturnValue;
  }

  function getY( oElement )
  {
    var iReturnValue = 0;
    while( oElement != null ) {
      iReturnValue += oElement.offsetTop;
      oElement = oElement.offsetParent;
    }
    return iReturnValue;
  }

  function showWaitIcon(topLeft, bottomRight)
  {
    var tl=document.getElementById(topLeft);
    var br=document.getElementById(bottomRight);
    var x=getX(tl)-8;
    var y=getY(tl)-16;
    var w=getX(br)-x+br.offsetWidth;
    var h=getY(br)-y+br.offsetHeight;

    var waitIcon=document.getElementById('waitIcon');

    waitIcon.style.left=x+'px';
    waitIcon.style.top=y+'px';
    waitIcon.style.width=w+'px';
    waitIcon.style.height=h+'px';
    waitIcon.style.visibility='visible';
  }

  function hideWaitIcon()
  {
    document.getElementById('waitIcon').style.visibility='hidden';
  }


