           /* Código para curvas arredondadas nos botões do site.  */
		   
	$(function(){
				$('.botoes').corner('1px');
				$('.msg-erro').corner('3px');
				
				$(".link-faq").click(function(){
					id = $(this).attr('rel');
					$(".box-empresa2").hide();
					$("#box-" + id).show();
				});	

				$(".clear-form").blur(function(){
					r = $(this).attr('rel');
					if(!$(this).val() || $(this).val() == r){
						$(this).val(r);
					}
				});

				$(".clear-form").focus(function(){
					r = $(this).attr('rel');
					if(!$(this).val() || $(this).attr('rel') == r){
						$(this).val('');
					}
				});

				$("#form_perfil_cliente_1").submit(function(){
				});
		
			
			});

		function valida_email(email){
			er = /^[a-zA-Z0-9][a-zA-Z0-9\._-]+@([a-zA-Z0-9\._-]+\.)[a-zA-Z-0-9]{2}/;
			if(er.exec(email)){
				return true;
			} else {
				return false;
			}
		}
	function valida_agente(){ 
			var form_name                 = document.formularioagente
			var nome                      = form_name.agente_nome.value;
			var cpf				          = form_name.agente_cpf.value;
			var nascimento				  = form_name.agente_nascimento.value;
			var orgao				      = form_name.agente_orgao.value;
			var email				      = form_name.agente_email.value;
			var confirme_email		      = form_name.agente_confirme_email.value;
			var telefone		          = form_name.agente_telefone.value;
			var celular		              = form_name.agente_celular.value;
			var cep	                      = form_name.agente_cep.value;
			var endereco	              = form_name.agente_endereco.value;
			var distrito	              = form_name.agente_distrito.value;
			var estado					  = form_name.agente_estado.value;
			var cidade					  = form_name.agente_cidade.value;
			var message                   = 'Erro no envio do formulário, verifique os campos marcados são campos de preenchimento obrigatório';
			

			if(!nome || !cpf || !nascimento || !valida_email(email) || email != confirme_email || !orgao || !telefone || !celular || !cep || !endereco || !distrito || !estado || !cidade){


				
				if(!nome){
					document.getElementById('agente_nome').style.border ='1px solid red';
			
				}else{
					document.getElementById('agente_nome').style.border ='1px solid #000';
				}

				if(!cpf){
					document.getElementById('agente_cpf').style.border ='1px solid red';
				
				}else{
					document.getElementById('agente_cpf').style.border ='1px solid #000';
				}

				if(!nascimento){
					document.getElementById('agente_nascimento').style.border ='1px solid red';
					
				}else{
					document.getElementById('agente_nascimento').style.border ='1px solid #000';
				}

				if(!orgao){
					document.getElementById('agente_orgao').style.border ='1px solid red';
					
				}else{
					document.getElementById('agente_orgao').style.border ='1px solid #000';
				}

				if(!telefone){
					document.getElementById('agente_telefone').style.border ='1px solid red';
					
				}else{
					document.getElementById('agente_telefone').style.border ='1px solid #000';
				}

				if(!celular){
					document.getElementById('agente_celular').style.border ='1px solid red';
					
				}else{
					document.getElementById('agente_celular').style.border ='1px solid #000';
				}

				if(!cep){
					document.getElementById('agente_cep').style.border ='1px solid red';
					
				}else{
					document.getElementById('agente_cep').style.border ='1px solid #000';
					
				}

				if(!endereco){
					document.getElementById('agente_endereco').style.border ='1px solid red';
				
				}else{
					document.getElementById('agente_endereco').style.border ='1px solid #000';
				}

				if(!distrito){
					document.getElementById('agente_distrito').style.border ='1px solid red';
				
				}else{
					document.getElementById('agente_distrito').style.border ='1px solid #000';
				}

				if(!estado){
					document.getElementById('agente_estado').style.border ='1px solid red';
				
				}else{
					document.getElementById('agente_estado').style.border ='1px solid #000';
				}

				if(!cidade){
					document.getElementById('agente_cidade').style.border ='1px solid red';
			
				}else{
					document.getElementById('agente_cidade').style.border ='1px solid #000';
				}

				if(!email || email != confirme_email){
					document.getElementById('agente_email').style.border ='1px solid red';
					document.getElementById('agente_confirme_email').style.border ='1px solid red';
					var message = message + ' - verifique o campo e-mail dados incorretos ou confirmação diferente.'
				}else{
					document.getElementById('agente_email').style.border ='1px solid #000'
					document.getElementById('agente_confirme_email').style.border ='1px solid #000'
				}

				alert(message);
				return false;
			}
			return true;

}

		function valida_adesao(){
			var form_name         = document.formularioadesao
			var tipo              = form_name.adesao_tipo.value;
			var nome              = form_name.adesao_nome.value;
			var cpf		          = form_name.adesao_cpf.value;
			var email		      = form_name.adesao_email.value;
			var telefone		  = form_name.adesao_telefone.value;
			var cidade		      = form_name.adesao_cidade.value;
			var estado		      = form_name.adesao_estado.value;
			var conheceu		  = form_name.adesao_conheceu.value;
		

			if(!tipo || !nome || !cpf || !valida_email(email) || !telefone || !cidade || !estado || !conheceu){
				
				if(!tipo){
					document.getElementById('adesao_tipo').style.border ='1px solid red';
				}else{
					document.getElementById('adesao_tipo').style.border ='1px solid #000';
				}

				if(!nome){
					document.getElementById('adesao_nome').style.border ='1px solid red';
				}else{
					document.getElementById('adesao_nome').style.border ='1px solid #000';
				}

				if(!cpf){
					document.getElementById('adesao_cpf').style.border ='1px solid red';
				}else{
					document.getElementById('adesao_cpf').style.border ='1px solid #000';
				}

				if(!email){
					document.getElementById('adesao_email').style.border ='1px solid red';
				}else{
					document.getElementById('adesao_email').style.border ='1px solid #000';
				}

				if(!telefone){
					document.getElementById('adesao_telefone').style.border ='1px solid red';
				}else{
					document.getElementById('adesao_telefone').style.border ='1px solid #000';
				}

				if(!cidade){
					document.getElementById('adesao_cidade').style.border ='1px solid red';
				}else{
					document.getElementById('adesao_cidade').style.border ='1px solid #000';
				}

				if(!estado){
					document.getElementById('adesao_estado').style.border ='1px solid red';
				}else{
					document.getElementById('adesao_estado').style.border ='1px solid #000';
				}

				if(!conheceu){
					document.getElementById('adesao_conheceu').style.border ='1px solid red';
				}else{
					document.getElementById('adesao_conheceu').style.border ='1px solid #000';
				}

				alert('Os campos marcados são de preenchimento obrigatório!')
				return false;
			}
			return true;

}




			/*	VALIDAÇÃO DO FORMULÁRIO DE CONTATO */

		function validacao(){
			
			/*Validando o campo nome.*/

			if(document.formulariocontato.contato_nome.value=="" || document.formulariocontato.contato_nome.value.length < 3) 
			{
				document.getElementById('campo_contato_nome').style.display = 'block';
				document.formulariocontato.contato_nome.focus();
				return false;
			}else{
				document.getElementById('campo_contato_nome').style.display = 'none';
			}

			/*Validando o campo email.*/
			
			if(document.formulariocontato.contato_email.value=="" || document.formulariocontato.contato_email.value.indexOf('@')== -1 || 
				document.formulariocontato.contato_email.value.indexOf('.')== -1)
			{
				document.getElementById('campo_contato_email').style.display = 'block';
				document.formulariocontato.contato_email.focus();
				return false;
			}else{
				document.getElementById('campo_contato_email').style.display = 'none';
			}


			/*Validando o campo assunto.*/

			if(document.formulariocontato.contato_assunto.value=="" || document.formulariocontato.contato_assunto.value.length < 3) 
			{
				document.getElementById('campo_contato_assunto').style.display = 'block';
				document.formulariocontato.contato_assunto.focus();
				return false;
			}else{
				document.getElementById('campo_contato_assunto').style.display = 'none';
			}

			/*Validando o campo mensagem.*/

			if(document.formulariocontato.contato_mensagem.value=="" || document.formulariocontato.contato_mensagem.value.length < 10) 
			{
				document.getElementById('campo_contato_mensagem').style.display = 'block';
				document.formulariocontato.contato_mensagem.focus();
				return false;
			}else{
				document.getElementById('campo_contato_mensagem').style.display = 'none';
			}

			return true;
}
	/*	VALIDAÇÃO DO FORMULÁRIO DE SATISFAÇÃO*/

function validacao_satisfacao(){
			
			/*Validando o campo nome.*/

			if(document.form_satisfacao.nome.value=="" || document.form_satisfacao.nome.value.length < 3) 
			{
				var message = "&nbsp;&nbsp;&nbsp;&nbsp;Preencha o campo 'nome' corretamente, necessário mais de 3 caracteres";
				document.getElementById('msg_campo_nome').innerHTML = (message);
				document.getElementById('nome').style.background = 'url("/sitefuturaonline/images/input-contato-hover.jpg") no-repeat center right';
				document.form_satisfacao.nome.focus();
				return false;

			}else{
				document.getElementById('msg_campo_nome').innerHTML = '';
				document.getElementById('nome').style.background = 'url("/sitefuturaonline/images/input-contato.jpg") no-repeat center right';
			}


			/*Validando o campo email.*/

			if(document.form_satisfacao.email.value=="" || document.form_satisfacao.email.value.indexOf('@')== -1 || 
				document.form_satisfacao.email.value.indexOf('.')== -1)
			{
				var message = "&nbsp;&nbsp;&nbsp;&nbsp;E-mail inválido, ou campo não preenchido";
				document.getElementById('msg_campo_email').innerHTML = (message);
				document.getElementById('email').style.background = 'url("/sitefuturaonline/images/input-contato-hover.jpg") no-repeat center right';
				document.form_satisfacao.email.focus();
			return false;

			}else{
				document.getElementById('msg_campo_email').innerHTML = '';
				document.getElementById('email').style.background = 'url("/sitefuturaonline/images/input-contato.jpg") no-repeat center right';
			}



			
			return true;

}


	function validacao_trabalhe_conosco(){
			
			/*Validando o campo nome.*/

			if(document.formulariotrabalhe.trabalhe_nome.value=="" || document.formulariotrabalhe.trabalhe_nome.value.length < 3) 
			{
				document.getElementById('campo_trabalhe_nome').style.display = 'block';
				document.formulariotrabalhe.trabalhe_nome.focus();
				return false;
			}else{
				document.getElementById('campo_trabalhe_nome').style.display = 'none';
			}

			/* FIM */

			/*Validando o campo E-mail.*/

			if(document.formulariotrabalhe.trabalhe_email.value=="" || document.formulariotrabalhe.trabalhe_email.value.indexOf('@')== -1 || 
				document.formulariotrabalhe.trabalhe_email.value.indexOf('.')== -1)
			{
				document.getElementById('campo_trabalhe_email').style.display = 'block';
				document.formulariotrabalhe.trabalhe_email.focus();
				return false;
			}else{
				document.getElementById('campo_trabalhe_email').style.display = 'none';
			}

			/* FIM */

			/*Validando o campo Telefone.*/

			if(document.formulariotrabalhe.trabalhe_telefone.value==""){
				
				document.getElementById('campo_trabalhe_telefone').style.display = 'block';
				document.formulariotrabalhe.trabalhe_telefone.focus();
				return false;
			}else{
				document.getElementById('campo_trabalhe_telefone').style.display = 'none';
			}
			/* FIM */


			/*Validando o campo Cargo.*/

			if(document.formulariotrabalhe.trabalhe_cargo.value=="") 
			{
				document.getElementById('campo_trabalhe_cargo').style.display = 'block';
				document.formulariotrabalhe.trabalhe_cargo.focus();
				return false;
			}else{
				document.getElementById('campo_trabalhe_cargo').style.display = 'none';
			}
			return true;
		}




function str_replace(search, replace, subject, count) {
    // Replaces all occurrences of search in haystack with replace  
    // 
    // version: 1103.1210
    // discuss at: http://phpjs.org/functions/str_replace    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: Gabriel Paderni
    // +   improved by: Philip Peterson
    // +   improved by: Simon Willison (http://simonwillison.net)
    // +    revised by: Jonas Raoni Soares Silva (http://www.jsfromhell.com)    // +   bugfixed by: Anton Ongson
    // +      input by: Onno Marsman
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +    tweaked by: Onno Marsman
    // +      input by: Brett Zamir (http://brett-zamir.me)    // +   bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   input by: Oleg Eremeev
    // +   improved by: Brett Zamir (http://brett-zamir.me)
    // +   bugfixed by: Oleg Eremeev
    // %          note 1: The count parameter must be passed as a string in order    // %          note 1:  to find a global variable in which the result will be given
    // *     example 1: str_replace(' ', '.', 'Kevin van Zonneveld');
    // *     returns 1: 'Kevin.van.Zonneveld'
    // *     example 2: str_replace(['{name}', 'l'], ['hello', 'm'], '{name}, lars');
    // *     returns 2: 'hemmo, mars'    var i = 0,
        j = 0,
        temp = '',
        repl = '',
        sl = 0,        fl = 0,
        f = [].concat(search),
        r = [].concat(replace),
        s = subject,
        ra = r instanceof Array,        sa = s instanceof Array;
    s = [].concat(s);
    if (count) {
        this.window[count] = 0;
    } 
    for (i = 0, sl = s.length; i < sl; i++) {
        if (s[i] === '') {
            continue;
        }        for (j = 0, fl = f.length; j < fl; j++) {
            temp = s[i] + '';
            repl = ra ? (r[j] !== undefined ? r[j] : '') : r[0];
            s[i] = (temp).split(f[j]).join(repl);
            if (count && s[i] !== temp) {                this.window[count] += (temp.length - s[i].length) / f[j].length;
            }
        }
    }
    return sa ? s : s[0];}



function is_email(email){
  er = /^[a-zA-Z0-9][a-zA-Z0-9\._-]+@([a-zA-Z0-9\._-]+\.)[a-zA-Z-0-9]{2}/;
  if(er.exec(email))
		{
		  return true;
		} else {
		  return false;
		}
}


function valida_checkbox(classe) {
	var valida = "";
	$('.' + classe).each(function(i){
		if ($(this).is(':checked')) {
			valida = $(this).val();
		}
	});
	if(valida == ""){ return false;} else {return true}
}

	function validar_perfil(){
		
		if(!$("#nome").val() || !is_email($("#email").val()) || !valida_checkbox('p1')  || !valida_checkbox('p2')  || !valida_checkbox('p3')  || !valida_checkbox('p4')  || !valida_checkbox('p5')  || !valida_checkbox('p6')  || !valida_checkbox('p7')  || !valida_checkbox('p8')  || !valida_checkbox('p9')  || !valida_checkbox('p10')  || !valida_checkbox('p11') || !valida_checkbox('p12') || !valida_checkbox('p13') || !valida_checkbox('p14')){
			$('.msg-erro').show();
			location.hash ="#msg-erro";
			return false;							
		}
	}


