function abrir(pagina,largura,altura){
	config="toolbar=no,location=no,width="+largura+",height="+altura+",status=no,menubar=no,scrollbars=no,resible=no,top=10,left=10";
pop=window.open(pagina,"newwindow",config);
}

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 janela(param,w,h,nome)
  {
  var nomearq=param;
  var windowvar = window.open(nomearq,nome,"scrollbars=yes,location=no,directories=no,status=no,menubar=no,resizable=no,toolbar=no,width="+ w + ",height="+h );
  }

function PopupBusca(tela, campo, param)
  {
  parametros = "campoAlvo="+campo+"&"+param;
  OpenPopUp(tela, parametros, 'Busca', 490, 400, 'no', 'yes', 'no', 'no', 'no', 'no');
  }


function APagaImg(php, param)
  {
  var link = "monta_popup.php?t="+php+"&"+param;
  parent.frames['auxFrame'].document.location = link;
  }

function PreencheForm(campo, cod, close, concatena)
  {
  try
    {
    eval('var campo = window.opener.document.'+campo+';');
    }
  catch(erro)
	{
    //nem trata o erro
	}

  if (typeof(campo) == 'object')
    {
    if(concatena)
  	  campo.value = campo.value+" "+cod;
	else
      campo.value = cod;

	if(campo.type != 'hidden')
      campo.focus();
    }

  if (typeof(close)== false)
    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] : "";
 
  if (args[1]=='lg=ptb'){
 
	  url = "montatela.php?t="+args[0]+"&"+args[1]+args[2];
  }else	{
 
  	url = "montatela.php?t="+args[0]+"&"+args[1]+args[2];
  }

  window.open(url, '_self');
  }

function OutroFrame(php, param)
  {
  var link = "montatela.php?t="+php+param;
//    link += "frm="+nomefrm;
//    link += "&cmp="+mudar;
//    link += "&c="+tipo;
//    link += "&todas="+todas;
//    link += "&sel="+selecao;

  parent.frames['auxFrame'].document.location = link;
  }

function disableselect(e){
	return false
}

function reEnable(){
	return true
}

document.onselectstart=new Function ("return false")
if (window.sidebar){
	document.onmousedown=disableselect
	document.onclick=reEnable
}

//Disable right mouse click Script

var message="Cáceres Florestal - Direitos reservados";


function clickIE4(){
if (event.button==2){
alert(message);
//return false;
}
}

function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert(message);
//return false;
}
}
}

if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}

document.oncontextmenu=new Function("alert(message);return false")