function verificapalavra() 
{
	if (document.fpesquisa.palavra.value == "") 
	{
		alert("A palavra chave é obrigatória!");
		document.fpesquisa.palavra.focus();
		return;
	}
	document.fpesquisa.submit();
}

function validafaixacd()
{
	if (document.cad_faixacd.titulo.value == "")
	{
		alert("Entre com o título da Faixa do CD!")
		document.cad_faixacd.titulo.focus();
		return;
	}
	document.cad_faixacd.submit();	
}

function validacd()
{
	if (document.cad_cd.titulo.value == "")
	{
		alert("Entre com o título do CD!")
		document.cad_cd.titulo.focus();
		return;
	}
	document.cad_cd.submit();
	
}

function validalivro()
{
	if (document.cad_livro.titulo.value == "")
	{
		alert("Entre com o título do Livro!")
		document.cad_livro.titulo.focus();
		return;
	}
	document.cad_livro.submit();
	
}

function validafornecedor()
{
	if (document.cad_fornecedor.nome.value == "")
	{
		alert("Entre com o nome do Fornecedor!")
		document.cad_fornecedor.nome.focus();
		return;
	}
	document.cad_fornecedor.submit();
	
}

function validaartista()
{
	if (document.cad_artista.nome.value == "")
	{
		alert("Entre com o nome do Artista!")
		document.cad_artista.nome.focus();
		return;
	}
	document.cad_artista.submit();
}

function validaautor()
{
	if (document.cad_autor.nome.value == "")
	{
		alert("Entre com o nome do Autor!")
		document.cad_autor.nome.focus();
		return;
	}
	document.cad_autor.submit();
}

function validagrav()
{
	if (document.cad_gravadora.nome.value == "")
	{
		alert("Entre com o nome da Gravadora!")
		document.cad_gravadora.nome.focus();
		return;
	}
	document.cad_gravadora.submit();
}

function integer()
{
  tecla= event.keyCode;
  char= String.fromCharCode(tecla);
  er= /^[0-9]$/;
  if (!er.test(char))
	event.returnValue=false;
}

function validadados() 
{
	if (document.fcadastro.nome.value.length == 0) {
		alert("O NOME é um campo obrigatório!");
		document.fcadastro.nome.focus();
		return false;
	}
	
	if (document.fcadastro.cpf.value.length == 0) {
		alert("O CPF é um campo obrigatório!");
		document.fcadastro.cpf.focus();
		return false;
	}

	if (document.fcadastro.email.value.length == 0) {
		alert("O E-MAIL é um campo obrigatório!");
		document.fcadastro.email.focus();
		return false;
	}

	if (document.fcadastro.senha.value.length == 0) {
		alert("A SENHA é um campo obrigatório!");
		document.fcadastro.senha.focus();
		return false;
	}
	
	if (document.fcadastro.senha2.value.length == 0) {
		alert("Você precisa redigitar a senha!");
		document.fcadastro.senha2.focus();
		return false;
	}

	if (document.fcadastro.senha.value != document.fcadastro.senha2.value) {
		alert("Sua senha não confere. Digite novamente!");
		document.fcadastro.senha1.focus();
		return false;
	}

	if (document.fcadastro.foneres.value.length == 0) {
		alert("O FONE RESIDENCIAL é um campo obrigatório!");
		document.fcadastro.foneres.focus();
		return false;
	}	

	if (document.fcadastro.logradouro.value.length == 0) {
		alert("O ENDEREÇO é um campo obrigatório!");
		document.fcadastro.logradouro.focus();
		return false;
	}
	
	if (document.fcadastro.cep.value.length == 0) {
		alert("A CEP é um campo obrigatório!");
		document.fcadastro.cep.focus();
		return false;
	}

	if (document.fcadastro.num.value.length == 0) {
		alert("O NÚMERO é um campo obrigatório!");
		document.fcadastro.num.focus();
		return false;
	}

	if (document.fcadastro.cidade.value.length == 0) {
		alert("A CIDADE é um campo obrigatório!");
		document.fcadastro.cidade.focus();
		return false;
	}
	document.fcadastro.submit();
	return true;
}	

function validaident() 
{
	if (document.fident.email.value.length == 0) {
		alert("Preencha seu e-mail!");
		document.fident.email.focus();
		return;
	}
	
	if (document.fident.senha.value.length == 0) {
		alert("Preencha sua senha!");
		document.fident.senha.focus();
		return;
	}
	document.fident.submit();
	return true;
}	

function validadadoscartao(mesatual, anoatual) {
	if (document.fcartao.numcartao.value.length == 0) {
		alert("O número do cartão é obrigatório!");
		document.fcartao.numcartao.focus();
		return false;
	}
	
	if (document.fcartao.nomecartao.value.length == 0) {
		alert("O nome no cartão é obrigatório !");
		document.fcartao.nomecartao.focus();
		return false;
	}
	
	if (document.fcartao.ano.value < anoatual) {
		alert("O ano não é válido!");
		document.fcartao.ano.focus();
		return false;
	}

	if (document.fcartao.ano.value == anoatual) {
		if (document.fcartao.mes.value < mesatual) {
			alert("Data de validade inválida!");
			document.fcartao.mes.focus();
			return false;
		}	
	}
	
	if (document.fcartao.tipocartao[1].checked == true || document.fcartao.tipocartao[2].checked == true) {
		if (document.fcartao.digitoseg.value.length ==0) {
			alert("Os dígitos de segurança são obrigatórios!");
			document.fcartao.digitoseg.focus();
			return false;
		}
	}	
	document.fcartao.submit();
	return true;
}

function validapagamento()
{
	document.fpag.submit();
}