
function popup(url, traj){
	window.open(url, traj, 'top=50, left=150, width=150, height=100');

}

var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+',top='+top+',screenX='+left+',screenY='+top+'');
}


function fechajanela() {
	self.close();
	// self.window.close();
	}


function redirect(URLStr) { 
  location = URLStr; 
  }

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_findObj(n, d) { //v4.01
  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=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_jumpMenuGo(selName,targ,restore){ //v3.0
  var selObj = MM_findObj(selName); if (selObj) MM_jumpMenu(targ,selObj,restore);
}

function reload_page(page_name)
  {
		try
		 {
		 caminho = window.opener.document.getElementById(page_name).src;
		 window.opener.document.getElementById(page_name).src = caminho;
	  } 
		catch(e)
		 {
		 caminho = window.opener.document.location.href;
		 window.opener.document.location.href = caminho;
	  };	
		}


function apagaestado(str_url)
{
if (confirm('Isto ira apagar todas as cidades e bairros deste estado. Tem a certeza?'))
  {
  document.excluiest.action = str_url;
  document.excluiest.submit();
  }
}

function apagacidade(str_url)
{
if (confirm('Isto ira apagar todas os bairros desta cidade. Tem a certeza?'))
  {
  document.excluicid.action = str_url;
  document.excluicid.submit();
  }
}

function apagabairro(str_url)
{
if (confirm('Isto ira apagar o bairro selecionado. Tem a certeza?'))
  {
  document.excluibai.action = str_url;
  document.excluibai.submit();
  }
}
  
function ins_estado()
 {
 
 document.altera.id.value = 0;
 document.altera.estado.value = '';
 document.altera.uf.value = '';
 document.altera.estado.focus();
 
 }
 
function ins_cidade()
 {
 document.alteracid.idcid.value = 0;
 document.alteracid.cidade.value = '';
 document.alteracid.cidade.focus();
 } 
 
function ins_bairro()
 {
 document.alterabai.idbai.value = 0;
 document.alterabai.bairro.value = '';
 document.alterabai.bairro.focus();
 }  
 

