var tam = 12;

function FontChange( tipo )
{
  if( tipo == 'maior' )
  {
    if( tam < 16 ) tam += 2 ;    			 
  }
  else
  {
    if( tam > 10 ) tam -= 2 ;
  }
  if( document.getElementById('quadro_noticia') )
    FRec(document.getElementById( 'quadro_noticia') ) ;
}

function FRec(domElement)
{		
  if(domElement.style)
    domElement.style.fontSize = tam+'px';
}
//** shazan.

function busca_data()
{
  var x=document.getElementById("dt_consulta").selectedIndex;
  var dt = document.getElementsByTagName("option")[x].value;
  
  return ajax('gerador.php?pg=listarNoticias&dt_consulta='+dt);

}


function popupwin(endereco, w, h, titulo, top, left) {
	window.open(endereco, titulo, 'status=yes,scrollbars=yes,location=no,toolbar=no,left='+left+',top='+top+',height='+h+',width='+w);
}

// AJAX - criado por Maginot Jr. - Inmetro/sc - maginot.junior@gmail.com
function antiCacheRand(aurl){
    //Adiciona um parametro randomico � querystring. By Micox (micoxjcgATyahooPONTOcomPONTObr).
    var dt = new Date();
    if(aurl.indexOf("?")>=0){// j� tem parametros
        return aurl + "&" + encodeURI(Math.random() + "_" + dt.getTime());
    }else{ return aurl + "?" + encodeURI(Math.random() + "_" + dt.getTime());}
}

var xmlhttp;

function ajax(url)
{
var url = antiCacheRand(url);
xmlhttp=null;
// code for Mozilla, etc.
if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest();
  }
// code for IE
else if (window.ActiveXObject)
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
  	var img_loading = "<div align='center'>Carregando conteudo...<br /><img src='imgs/loading.gif' /></div>";
	document.getElementById('ajax').innerHTML = img_loading;
if (xmlhttp!=null)
  {
  xmlhttp.onreadystatechange = function() { state_Change(xmlhttp); };
  xmlhttp.open("GET",url,true);
  xmlhttp.setRequestHeader("Cache-Control", "no-cache");
  xmlhttp.setRequestHeader("Content-type", "text/html; chasert=utf-8");
  xmlhttp.setRequestHeader("Pragma", "no-cache");
  xmlhttp.send(null);
  }
else
  {
  alert("Your browser does not support XMLHTTP.");
  }
}

function state_Change(xmlhttp)
{
// if xmlhttp shows "loaded"
if (xmlhttp.readyState==4)
  {
  // if "OK"
  if (xmlhttp.status==200)
    {
    	/** Efeito legal de transicao */
		/*fadeOut();    	*/
		document.getElementById('ajax').innerHTML = xmlhttp.responseText;
		
		/** Efeito */

    }
  else
    {
    alert("Problem retrieving XML data");
    }
  }
}