function verBoletim(id){
	window.open('http://www.ceag.com.br/tpl/ver_boletim.php?id='+id,'boletim','width=620,height=550,scrollbars=yes,resizable=no,status=no,toolbar=no,menubar=no,location=no');
}

function trim(string){
	return string.replace(/(^\s*)|(\s*$)/g,'');
}

function writeEmail(nome, provedor, fim) {
	if(fim == null) fim = '.com.br';
	if(fim.charAt(0) != '.') fim = '.' + fim;
	window.document.write('<a href="mailto:');
	window.document.write(nome);
	window.document.write('@');
	window.document.write(provedor);
	window.document.write(fim);
	window.document.write('">');
	window.document.write(nome);
	window.document.write('@');
	window.document.write(provedor);
	window.document.write(fim);
	window.document.write('</a>');
}

function goToURL(url){
	if(url != 0 || url != ''){
		top.location.href = 'http://www.bs2.com.br/'+url;
	}
}

function goToBanco(url){
	if(url != 0 || url != ''){
		out(url);
	}
}

function out(url){
	open(url);
}

var janela = null;

function popupImage(url, title, w, h){
	var property, screenW, screenY, janela, w, h, title;
	
	// stellt die Bildschirmabmessungen fest
	// find window size
	var ns6 = (!document.all && document.getElementById);
	var ie4 = (document.all);
	var ns4 = (document.layers);
	
	if(ns6||ns4) {
		screenW = innerWidth;
		screenY = innerHeight;
	}
	else if(ie4) {
		screenW = document.body.clientWidth;
		screenY = document.body.clientHeight;
	}
	
	x = (screenW-w)/2;
	y = (screenY-h)/2;
	
	property="scrollbars=no,left="+x+",top="+y+",screenX="+x+",screenY="+y+",width="+w+",height="+h+",menubar=no,toolbar=no";
	
	if(janela != undefined) janela.close();
	else var janela = null;

	janela = window.open("","",property);
	janela.focus();
	janela.document.open();
	with (janela) {
	  document.write("<html><head>");
	  // geändert 2004 für Mozilla
	  document.write('<scr' + 'ipt type="text/javascr' + 'ipt" language="JavaScr' + 'ipt">');
	  // bei click  schliessen , on click close
	  document.write("function click() { window.close(); } ");
	  document.write("document.onblur=click ");
	  // geändert 2004 für Mozilla
	  document.write('</scr' + 'ipt>');
//	  document.write('<link href="../css/global.css" rel="stylesheet" type="text/css" />');
	  document.write("<title>"+title+"</title></head>");
	  // bei Focusverlust schliessen, close if window looses focus
	  // Zeile geändert Aug 2003 (Dreamweaver machte Probleme)
	  document.write("<" + "body onblur='window.close()';");
	  document.write("marginwidth='0' marginheight='0' leftmargin='0' topmargin='0' style='background: url("+url+")'>");
//	  document.write("<center>");
//	  document.write("<img src='"+ url +"' border='0'>");
//	  document.write("<center>");
	  document.write("</body></html>");
	  document.close();
	}
}
//===========================================================================
//

function popupWindow(url, w, h) {
    var width  = w;
    var height = h;
    
	var left = parseInt((screen.availWidth/2) - (width/2));
    var top  = parseInt((screen.availHeight/2) - (height/2));
	
    var windowFeatures = "width=" + width + ",height=" + height + 
        ",status=0,resizable=0,left=" + left + ",top=" + top + 
        ",screenX=" + left + ",screenY=" + top;

	if(janela != undefined) janela.close();
	

	janela = window.open(url, "subWind", windowFeatures);
	janela.focus();
}

//===========================================================================
//
function closeWindow() {
	window.close();		
}

function DisplayShowHide(id) {
	var e = document.getElementById(id);
	e.style.display = e.style.display == 'block' ? 'none' : 'block'; 
}




function retiraAcento(obj)
 {
   palavra = String.fromCharCode(event.keyCode);
  
  var caracteresInvalidos = 'àèìòùâêîôûäëïöüáéíóúãõÀÈÌÒÙÂÊÎÔÛÄËÏÖÜÁÉÍÓÚÃÕ';
  var caracteresValidos =   'aeiouaeiouaeiouaeiouaoAEIOUAEIOUAEIOUAEIOUAO';
  var acento = "´`^¨~";
  if(acento.indexOf(palavra)!= -1)
  {
    window.event.keyCode = 0;
  }
 
 if (caracteresInvalidos.indexOf(palavra) == -1) 
  {
       if (caracteresValidos.indexOf(palavra) != -1) {
         window.event.keyCode = 0;
         obj.value = obj.value + palavra;
       }
  } 
  else 
  {
           window.event.keyCode = 0;
           nova = caracteresValidos.charAt(caracteresInvalidos.indexOf(palavra));
           obj.value =  obj.value + nova;
  }
  
}


