// JavaScript Document
function $(elementId)
{
	if(document.getElementById(elementId))	
		return document.getElementById(elementId);
	else {
		alert('Não foi possível identificar pelo id o elemento ' + elementId);
		return false;
	}
}
function logaUser()
{
	var theForm = $("DownloadsLogin");
	if(nonBlank(theForm.Matricula, "O campo Matrícula é requerido", 1) && nonBlank(theForm.Senha, "O campo Senha é requerido", 1) && noErrors())	
	{
		theForm.action = "CentralDownloads_Login_.asp";
		eval(unescape(sendForm("DownloadsLogin")));
		//theForm.submit();
	}
}
function reenviaSenha()
{
	var theForm = $("DownloadsESenha");
	if(goodEMail(theForm.Email, "O campo E-mail é requerido e deve ser preenchido com um e-mail válido"))	
	{
		theForm.action = "CentralDownloads_Senha_.asp";
		eval(unescape(sendForm("DownloadsESenha")));
		//theForm.submit();
	}
}
function logoff()
{
	eval(unescape(sendInfo('CentralDownloads_Logoff_.asp?logoff=1')));	
}
function download(idDownload)
{
	var h = ((screen.height/2) - 200);
	var w = ((screen.width/2) - 250);

	window.open('CentralDownloads_Download.asp?DownloadID='+idDownload+'','DownloadFileWindow','width=500px,height=400px,scrollbars=0,status=0,dir=0,menubars=0,top='+h+'px,left='+w+'px');
}
function searchDownload()
{
	var theForm = $("frmDownloads");
	if(nonBlank(theForm.q, "Informe o termo a ser procurado na área de downloads"))
		window.location = "CentralDownloads_Busca.asp?q=" + theForm.q.value;
	return false;
}
function getPage(intPage)
{
	window.location="CentralDownloads_ListagemCompleta.asp?page=" + intPage;	
}
function getSearchPage(intPage, str)
{
	window.location="CentralDownloads_Busca.asp?q=" + str + "&page=" + intPage;	
}
