// JavaScript source code
var IE

IE = (navigator.appName.indexOf("Microsoft") != -1)
function Alinha(){
	var w 
	
	if (screen.width < 1024) 
	{
		w = "100%"
		//document.getElementById("trcalendario1").style.display = "none"
	}
	else
	{
		w = "1000"
		//document.getElementById("trcalendario1").style.display = ""
	}

	var Obj

	document.getElementById("divprincipal").style.display = ""
	document.getElementById("divprincipal").style.width = w	
}

function inicio(){
	
	Alinha()
	if (IE)
	{
		
		//document.getElementById("flashheader").TPlay("/")
	}
	else
	{	
		//document.flashheader.Alinha()
		//alert('ola')
	}	
	//alert('oo')
}

function limpa(obj)
{
	/*if (obj.value.toLowerCase() == "«texto a pesquisar»")
	{*/
		obj.value = ''
	//}
}

function verifica(obj)
{
	var x = trim(obj.value)
	if (x.length == 0)
	{
		obj.value = "«texto a pesquisar»"
	}
}

function pesquisar()
{
	var d
	
	if (document.getElementById('chkopc0').checked==true && (frm.txtpesq.value.toLowerCase() == '«texto a pesquisar»' || frm.txtpesq.value == ''))
	{
		alert('Indique o texto a pesquisar ou determine um período.')
		return
	}
	else
	{
		
		frm.pesq.value = 1
		frm.action = "default.asp"	
		frm.target = "_top"
		
		d = frm.datadia.value + "/" + frm.datames.value + "/" + frm.dataano.value
		if (document.getElementById('chkopc1').checked == true)
		{
			do
			{			    
				if (isDate(d))
				{
					break;
				}
				else
				{
					frm.datadia.value = parseInt(frm.datadia.value) - 1
					document.getElementById('divdatadia').innerHTML = frm.datadia.value
					d = frm.datadia.value + "/" + frm.datames.value + "/" + frm.dataano.value
				}
			}
			while (true)
			d = "dia=" + frm.datadia.value + "&mes=" + frm.datames.value + "&ano=" + frm.dataano.value
		}
		else
		{
			d = "dia=1" + "&mes=" + frm.mes.value + "&ano=" + frm.ano.value
			//alert('NAO CONTA')
		}
		
		frm.action += "?" + d
	}
	frm.submit()
	
}