function OpenPopUpFull(targetUrl, paramentros ,windowName)
  {
  if (document.all) 
    {
    var w = screen.availWidth-10;
    var h = screen.availHeight-200;
    }
  else if (document.layers||document.getElementById) 
    {
    if (top.window.outerHeight<screen.availHeight||top.window.outerWidth<screen.availWidth) 
      {
      var h = screen.availHeight-200;
      var w = screen.availWidth-10;
      }
    }
  var windowFeatures = "width=" + w + ", height=" + h + ", top=0, left=0, resizable=yes, scrollbars=yes, toolbar=no, location=no, menubar=no, status=no";
//  alert(targetUrl);
  windowFull = window.open('popup.php?t='+targetUrl+'&'+paramentros, windowName, windowFeatures);
  windowFull.focus();
  }

function OpenPopUp(targetUrl, targetParam, windowName, x, y, escala, scroll, tool, localiz, barramenu, barstatus)
  {
  var windowFeatures = "width=" + x + ", height=" + y + ", top=100, left=130, resizable=" + escala + ", scrollbars=" + scroll + ", toolbar=" + tool + ", location=" + localiz + ", menubar=" + barramenu + ", status=no";
  windowPesquisa = window.open('monta_popup.php?t='+targetUrl+'&'+targetParam, windowName, windowFeatures);
  windowPesquisa.focus();
  }

function PopupBusca(tela, campo, param)
  {
  parametros = "campoAlvo="+campo+"&"+param;
  OpenPopUp(tela, parametros, '_blank', 490, 400, 'no', 'yes', 'no', 'no', 'no', 'no');
  }

function PreencheForm(campo, cod, close)
  {
  try
    {
    eval('var campo = window.opener.document.'+campo+';');
    }
  catch(erro)
	{
    //nem trata o erro
	}

  if (typeof(campo) == 'object')
    {
    campo.value = cod;
    campo.focus();
    }

  if (typeof(close) =='undefined') 
    window.close();
  }

  function SendUrl()
  {
  var args = SendUrl.arguments;

  args[1] = (args[1] != null && args[1] != '') ? args[1] : "";
  args[2] = (args[2] != null && args[2] != '') ? "#"+args[2] : "";

  url = "montatela.php?t="+args[0]+"&"+args[1]+args[2];

  window.open(url, '_self');
  }

