function ExibirDetalhes(img)
{
	
	
	document.getElementById("txtCodigo").value = img.COD;	
	document.getElementById("txaChamada").value = img.CHAMADA;
	document.getElementById("txtTitulo").value = img.TITULO;
	document.getElementById("imgLeiaMais").src = img.PATHIMAGELEIAMAIS;	
	document.getElementById("txtArqLeiaMais").value = img.PATHIMAGELEIAMAIS;	
	document.getElementById("imgNoticia").src = img.PATHIMAGE;
	document.getElementById("txtArquivo").value = img.PATHIMAGE;

}

function Novo()
{

	document.getElementById("txtCodigo").value = '';
	document.getElementById("imgLeiaMais").src = '../_image/amsupply.gif';	
	document.getElementById("txaChamada").value = '';
	document.getElementById("txtTitulo").value = '';
	document.getElementById("imgNoticia").src = '../_image/amsupply.gif';	
	document.getElementById("txtArquivo").value ='../_image/amsupply.gif';
	document.getElementById("txtArqLeiaMais").value = '../_image/amsupply.gif';

	return false;
	
}
function Incluir()
{	
	
	strTexto =Trim(document.getElementById("txtTitulo").value);
	if (strTexto.length==0)
	{
		alert('favor inserir um texto para o campo Título!');
		document.getElementById("txtTitulo").focus();
		return false;
	}
	
	strTexto =Trim(document.getElementById("txaChamada").value);
	if (strTexto.length==0)
	{
		alert('favor inserir um texto para o campo Chamada!');
		document.getElementById("txaChamada").focus();
		return false;
	}
	
	strTexto =Trim(document.getElementById("txtArqLeiaMais").value);
	if (strTexto.length==0)
	{
		alert('Favor informar um Arquivo de Notícias!');
		return false;
	}
	
	strTexto =Trim(document.getElementById("txtArquivo").value);
	if (strTexto.length==0)
	{
		alert('Favor informar uma imagem!');
		return false;
	}
	
	return true;
}

function AfterInsert()
{
	Novo();
	/*
	document.getElementById("txtCodigo").value = "";
	document.getElementById("txaDesc").value = "";
	document.getElementById("imgNoticia").src = '../_image/amsupply.gif';
	document.getElementById("txtArquivo").value = '../_image/amsupply.gif';
	*/

}


function Alterar()
{
	strTexto =Trim(document.getElementById("txtCodigo").value);
	if (strTexto.length==0)
	{
		alert('Favor selecionar um item na lista abaixo para poder alterá-lo!');
		return false;
	}
	
	strTexto =Trim(document.getElementById("txtTitulo").value);
	if (strTexto.length==0)
	{
		alert('Favor informar um Título!');
		document.getElementById("txtTitulo").focus();
		return false;
	}
	
	strTexto =Trim(document.getElementById("txaChamada").value);
	if (strTexto.length==0)
	{
		alert('Favor informar uma Chamada!');
		document.getElementById("txaChamada").focus();
		return false;
	}
	
	
	
	return true;
}


/* function responsável por validar e tratar os dados antes
de Excluir no banco.
*/
function Excluir()
{
	var Quant = 0;
	for(i=0; i<Form1.length; i++) 
	{
		if (Form1.elements[i].type == "checkbox") 
		{
			if (Form1.elements[i].checked == true) 
			{							
				Quant= Quant + 1;
			}
		}
	}
	if (Quant > 0 ) return true;
	else{	
		alert('Favor selecionar um item na lista abaixo para ser excluído');
		return false
	 };
}


function Salvar()
{
	/*
	 strIntr =Trim(document.getElementById("txaIntroducao").value);
	if (strIntr.length==0)
	{
		alert('Favor inserir um texto para o campo Introdução!');
		document.getElementById("txaIntroducao").focus();
		return false;
	}
	*/
}

