var gAutoPrint = false; // Flag for whether or not to automatically call the print function

function printSpecial()
{
	if (document.getElementById != null)
	{
		var html = '<HTML>\n<HEAD>\n';

		if (document.getElementsByTagName != null)
		{
			var headTags = document.getElementsByTagName("head");
			if (headTags.length > 0)
				html += headTags[0].innerHTML;
		}
		
		html += '\n<link rel=stylesheet type=text/css href=/css/imprime.css>\n</HE' + 'AD>\n<BODY BGCOLOR=#FFFFFF>\n<table width=100%><tr><td bgcolor=#efefef><img src=/images/logodatafolha.gif>\n</td></tr></table><br><br>\n';
		
		var printReadyElem = document.getElementById("printReady");
		
		if (printReadyElem != null)
		{
				html += printReadyElem.innerHTML;
		}
		else
		{
			alert("Could not find the printReady section in the HTML");
			return;
		}
			
		html += '\n</BO' + 'DY>\n</HT' + 'ML>';
		
		var printWin = window.open("","printSpecial");
		printWin.document.open();
		printWin.document.write(html);
		printWin.document.close();
		if (gAutoPrint)
			printWin.print();
	}
	else
	{
		alert("Desculpe, esta opção só é disponível em navegadores atualizados.");
	}
}

function openform(url) {
var url = url + "?url=" + document.location + "&titulo=" + document.title
	window.open(url,"","scrollbars=no,menubar=no,personalbar=no,width=600,height=400,left=100,top=50");
}

function janela(url) {
	window.open(url,"","scrollbars=yes,menubar=no,personalbar=no,width=600,height=400,left=100,top=50");
}
function topofmind(url) {
	window.open(url,"","scrollbars=no,menubar=no,personalbar=no,width=800,height=600,left=100,top=50");
}
function quest() {
	window.open("http://datafolha.folha.uol.com.br/folha/datafolha/pm/pm_teste/8453_uol.php","","scrollbars=no","menubar=no","personalbar=no","statusbar=no","adderessbar=no","width=620","height=450");
}
function topjanela() {
  	window.open("top2007/top_apres.html","janela1","fullscreen","scrollbars=no","width=800","height=600");
}

function dropmenu(selObj) {
	pagina = selObj.options[selObj.selectedIndex].value;
	window.location.href=pagina
}
function dropmenu_veiculos(selObj) {
	pagina = selObj.options[selObj.selectedIndex].value;
      window.location.href="http://datafolha.folha.uol.com.br/precos/veiculos/teste_veiculos3.php?cod="+pagina;
}

function data_navBar( tableCellRef, hoverFlag, navStyle ) {
if ( hoverFlag ) {
switch ( navStyle ) {
case 1:
tableCellRef.style.backgroundColor = '#278EC0';
break;
default:
tableCellRef.style.backgroundColor = '#AFC6D8';
if ( document.getElementsByTagName ) {
tableCellRef.getElementsByTagName( 'a' )[0].style.color = '#AFC6D8';
}
}
} else {
switch ( navStyle ) {
case 1:
tableCellRef.style.backgroundColor = '#AFC6D8';
break;
default:
if ( document.getElementsByTagName ) {
tableCellRef.getElementsByTagName( 'a' )[0].style.color = '#AFC6D8';
}
}
}
}

function limpatexto(el) {
  if (el.defaultValue==el.value) el.value = ""
}

function VerificacaoIntegridade()
{
var msg, texto, texto2, texto3, erro;
msg = '';
erro=false;

texto = document.busca.texto.value;
if(texto=="" || texto=="Busca no site")
{
msg += ' Insira o texto para busca';
document.busca.texto.focus();
erro=true;
}

if (erro) alert(msg);
return !(erro);
}
