//REDIRECIONA O PRODUTO PARA UMA PÁGINA ESPECIFICA EM TODAS AS LISTAGENS EXCETO A PÁGINA DE DETALHE
jQuery(function(){
	jQuery('#cont_secao,#box_lancamentos').find('a').each(function(){
		if(jQuery(this).attr('href') == 'http://www.yendis.com.br/products-page/geral/boas-prticas-de-enfermagem/'){
			jQuery(this).click(function(){
				location.href = 'http://www.boaspraticasdeenfermagem.com.br/';
				return false;
			});			
		}
	});
	jQuery('#descricao').find('#product_153_submit_button').click(function(){
		location.href = 'http://www.boaspraticasdeenfermagem.com.br/';
		return false;
	});
	
})

function validateEmail(email) {
	var at = email.lastIndexOf("@");

	if (at < 1 || (at + 1) === email.length) return false;
	if (/(\.{2,})/.test(email)) return false;

	var local = email.substring(0, at);
	var domain = email.substring(at + 1);

	if (local.length < 1 || local.length > 64 || domain.length < 4 || domain.length > 255) return false;
	if (/(^\.|\.$)/.test(local) || /(^\.|\.$)/.test(domain)) return false;
	if (!/^"(.+)"$/.test(local))
		if (!/^[-a-zA-Z0-9!#$%*\/?|^{}`~&'+=_\.]*$/.test(local)) return false;
	if (!/^[-a-zA-Z0-9\.]*$/.test(domain) || domain.indexOf(".") === -1) return false;	

	return true;
}

function retornaMsg(msg){
	if(msg){
		jQuery('#usermessage3a').show('slow');
		jQuery('#cadas_erros').html(msg);
		return false;
	}else
		return true;
}

function validaCadas(){
	var msg = '';
	if(jQuery('#user_login').val().length == 0) msg += '<li><a href="#user_login">Usu&aacute;rio >></a></li>';
	if(jQuery('#user_email').val().length == 0) msg += '<li><a href="#user_email">E-mail >></a></li>';
	if(jQuery('#cimy_uef_19').val().length == 0) msg += '<li><a href="#cimy_uef_19">Nome >></a></li>';
	else if(jQuery('#cimy_uef_19').val().indexOf(' ') == -1) msg += '<li><a href="#cimy_uef_19">Voc&ecirc; deve informar seu nome e sobrenome >></a></li>';
	if(jQuery('#cimy_uef_6').val().length == 0) msg += '<li><a href="#cimy_uef_6">CPF >></a></li>';
	if(jQuery('#cimy_uef_7').val().length == 0) msg += '<li><a href="#cimy_uef_7">RG >></a></li>';
	if(jQuery('#cimy_uef_8').val().length == 0) msg += '<li><a href="#cimy_uef_8">Data de nascimento >></a></li>';
	if(jQuery('#cimy_uef_9').val().length == 0) msg += '<li><a href="#cimy_uef_9">Telefone residencial >></a></li>';
		
	return retornaMsg(msg);
}


function validaEnder(){
	var msg = '';
	if(jQuery('#cep').val().length == 0) msg += '<li><a href="#cep">CEP >></a></li>';
	if(jQuery('#estado').val().length == 0) msg += '<li><a href="#estado">Estado >></a></li>';
	if(jQuery('#cidade').val().length == 0) msg += '<li><a href="#cidade">Cidade >></a></li>';
	if(jQuery('#rua').val().length == 0) msg += '<li><a href="#rua">Rua >></a></li>';
	if(jQuery('#numero').val().length == 0) msg += '<li><a href="#numero">N&uacute;mero >></a></li>';
	if(jQuery('#bairro').val().length == 0) msg += '<li><a href="#bairro">Bairro >></a></li>';
	if(jQuery('#telefone').val().length == 0) msg += '<li><a href="#telefone">Telefone >></a></li>';
		
	return retornaMsg(msg);
}
