function site_url(link){ bse = "http://www.multside.com.br/"+link; return bse; } valida= { email: function(email) { if (email.length == 0 || email.indexOf('@') < 2) { return false; } else { var mail = email.split('@'); if (mail[1].length == 0 || mail[1].indexOf('.') < 2) { return false; } else { ail = mail[1].split('.'); var c = ail.length; for (i=1;i 1; i--) soma += numeros.charAt(10 - i) * i; resultado = soma % 11 < 2 ? 0 : 11 - soma % 11; if (resultado != digitos.charAt(0)) return false; numeros = cpf.substring(0,10); soma = 0; for (i = 11; i > 1; i--) soma += numeros.charAt(11 - i) * i; resultado = soma % 11 < 2 ? 0 : 11 - soma % 11; if (resultado != digitos.charAt(1)) return false; return true; } else return false; }, cnpj: function(cnpj) { var numeros, digitos, soma, i, resultado, pos, tamanho, digitos_iguais; digitos_iguais = 1; if (cnpj.length != 14) return false; for (i = 0; i < cnpj.length - 1; i++) if (cnpj.charAt(i) != cnpj.charAt(i + 1)) { digitos_iguais = 0; break; } if (!digitos_iguais) { tamanho = cnpj.length - 2; numeros = cnpj.substring(0,tamanho); digitos = cnpj.substring(tamanho); soma = 0; pos = tamanho - 7; for (i = tamanho; i >= 1; i--) { soma += numeros.charAt(tamanho - i) * pos--; if (pos < 2) pos = 9; } resultado = soma % 11 < 2 ? 0 : 11 - soma % 11; if (resultado != digitos.charAt(0)) return false; tamanho = tamanho + 1; numeros = cnpj.substring(0,tamanho); soma = 0; pos = tamanho - 7; for (i = tamanho; i >= 1; i--) { soma += numeros.charAt(tamanho - i) * pos--; if (pos < 2) pos = 9; } resultado = soma % 11 < 2 ? 0 : 11 - soma % 11; if (resultado != digitos.charAt(1)) return false; return true; } else return false; } }; $('#body').ready(function(){ var width = screen.width; var left = (width - 990)/2 $("#body").attr('style','position: absolute; top: 0; left: '+left+'; z-index: 1; width: 950px;'); }); $('#txtBusca').ready(function(){ $('#txtBusca').val('busca...'); $('#txtBusca').focus(function(){ if ($('#txtBusca').val() == 'busca...'){ $('#txtBusca').val(''); } }); $('#txtBusca').blur(function(){ if ($('#txtBusca').val() == ''){ $('#txtBusca').val('busca...'); } }); }); $('#txtNomeNewsletter').ready(function(){ $('#txtNomeNewsletter').val('Seu nome'); $('#txtNomeNewsletter').focus(function(){ if ($('#txtNomeNewsletter').val() == 'Seu nome'){ $('#txtNomeNewsletter').val(''); } }); $('#txtNomeNewsletter').blur(function(){ if ($('#txtNomeNewsletter').val() == ''){ $('#txtNomeNewsletter').val('Seu nome'); } }); }); $('#txtEmailNewsletter').ready(function(){ $('#txtEmailNewsletter').val('Seu e-mail'); $('#txtEmailNewsletter').focus(function(){ if ($('#txtEmailNewsletter').val() == 'Seu e-mail'){ $('#txtEmailNewsletter').val(''); } }); $('#txtEmailNewsletter').blur(function(){ if ($('#txtEmailNewsletter').val() == ''){ $('#txtEmailNewsletter').val('Seu e-mail'); } }); }); $('#formulario_contato').ready(function(){ $('#periodoContato').hide(); $('input[type=radio]').click(function(){ if ($("input[type=radio][name=modoContato]:checked").val() == 'telefone'){ $('#periodoContato').hide().show('slow'); $("#botoes_contato").css('top','365px'); $("#caixamsg_contato").css('top','200px'); } else { $('#periodoContato').hide(); $("#botoes_contato").css('top','330px'); $("#caixamsg_contato").css('top','180px'); } }); }); $("#frm_contato").ready(function(){ $("#telefoneContato").mask('(99)9999-9999'); $("#frm_contato").submit(function(){ var nome = $("#nomeContato"); var email = $("#emailContato"); var empresa = $("#empresaContato"); var telefone = $("#telefoneContato"); var produto = $("#produtoContato"); var modo = $("#modoContato"); var periodo = $("#periodoContato"); var msg = $("#msgContato"); var captcha = $("#captcha"); if (nome.val()==''){ $("#resultadoContato").html("Preencha o Campo Nome"); return false; } if (empresa.val()==''){ $("#resultadoContato").html("Preencha o Campo Empresa"); return false; } if (!valida.email(email.val())){ $("#resultadoContato").html("Preencha o Campo E-mail com um e-mail válido"); return false; } if (telefone.val()=='' || telefone.val() == '(__)____-____'){ $("#resultadoContato").html("Preencha o Campo Telefone"); return false; } if (msg.val() == ''){ $("#resultadoContato").html("Preencha o Campo Mensagem"); return false; } if($("input[type=radio][name=modoContato]:checked").val() == 'telefone' && periodo.val() == ''){ $("#resultadoContato").html("Preencha o Melhor Período a Ser Contatado"); return false; } x = 0; if (captcha.val() == ''){ x++; $("#resultadoContato").html("Preencha a validação"); return false; } $.post( site_url('contato/recebe'), { nome: nome.val(), empresa: empresa.val(), email: email.val(), telefone: telefone.val(), produto: produto.val(), //modoContato: modo.val(); periodoContato: periodo.val(), msg: msg.val(), captcha: captcha.val(), img: $("#captcha_img").attr('src') }, function(response){ if (response.status=='erro'){ location.href = site_url('contato/agradecimento/'); return false; } if (response.status=='captcha') { $("#resultadoContato").html("Código de Validação Incorreto"); $("#img_captcha").html(response.img); return false; } if (response.status=='ok') { location.href = site_url('contato/agradecimento/ok'); return false; } return false; }, 'json' ); return false; }); }); $("#fmrNewsletter").ready(function(){ $("#fmrNewsletter").submit(function(){ var nome = $("#txtNomeNewsletter"); var email = $("#txtEmailNewsletter"); if (nome.val() == ''){ $("#infoNewsletter").css('color','red'); $("#infoNewsletter").html('Preencha o nome'); return false; } if (!valida.email(email.val())){ $("#infoNewsletter").css('color','red'); $("#infoNewsletter").html('Preencha um e-mail válido'); return false; } $.post( site_url('inicio/newsletter'), { nome: nome.val(), email: email.val() }, function(response){ if (response.status == 'duplicado'){ $("#infoNewsletter").css('color','red'); $("#infoNewsletter").html('Seu e-mail já consta no nosso cadastro'); return false; } if (response.status == 'ok'){ $("#infoNewsletter").css('color','blue'); $("#infoNewsletter").html('Inscrito. Obrigado '+nome.val()+"."); nome.val(''); email.val(''); return false; } }, 'json' ) return false; }); }); $("#fmrBusca").ready(function(){ function retiraAcento(text) { var let_a = new Array('á','à','ã','â','ä'); var let_e = new Array('é','è','ê','ë'); var let_i = new Array('í','ì','î','ï'); var let_o = new Array('ó','ò','ô','õ','ö'); var let_u = new Array('ú','ù','û','ü'); for(a = 0;a < let_a.length;a++){ eval("text = text.replace(new RegExp('"+let_a[a]+"','gi'),'a')"); } for(e = 0;e < let_e.length;e++){ eval("text = text.replace(new RegExp('"+let_e[e]+"','gi'),'e')"); } for(i = 0;i < let_i.length;i++){ eval("text = text.replace(new RegExp('"+let_i[i]+"','gi'),'i')"); } for(o = 0;o < let_o.length;o++){ eval("text = text.replace(new RegExp('"+let_o[o]+"','gi'),'o')"); } for(u = 0;u < let_u.length;u++){ eval("text = text.replace(new RegExp('"+let_u[u]+"','gi'),'u')"); } text = text.replace(new RegExp('ç','gi'),'c'); while (text.indexOf(')') >= 0){ text = text.replace(')',''); } while (text.indexOf('(') >= 0){ text = text.replace('(',''); } while (text.indexOf('[') >= 0){ text = text.replace('[',''); } while (text.indexOf(']') >= 0){ text = text.replace(']',''); } while (text.indexOf('}') >= 0){ text = text.replace('}',''); } while (text.indexOf('{') >= 0){ text = text.replace('{',''); } text = text.trim(); while (text.indexOf(' ') >= 0){ text = text.replace(' ',' '); } while (text.indexOf(' ') >= 0){ text = text.replace(' ','-'); } /*var text1 = ''; for (i in text){ //alert(text1+" - antes de "+text[i]); if (text[i]!=' '){ //alert(text[i]+" - foi"); text1 += text[i]; } else { //alert(text[i]+" - nem foi"); } //alert(text1+" - depois de "+text[i]); } */ //alert(text); return text; } $("#fmrBusca").submit(function(){ var termo = retiraAcento($("#txtBusca").val()); //alert(termo); location.href = site_url('buscar/'+termo); return false; }); }); // MENUS function index(){ $("#banner").ready(function(){ $("#efeito").css('display','block'); $("#efeito").css('width','71px'); $("#efeito").css('left','14px'); }); } function index_over(){ $("#efeito2").css('display','block'); $("#efeito2").css('width','71px'); $("#efeito2").css('left','14px'); } function quemsomos(){ $("#page_quemsomos").ready(function(){ $("#efeito").css('display','block'); $("#efeito").css('width','135px'); $("#efeito").css('left','86px'); }); } function quemsomos_over(){ $("#efeito2").css('display','block'); $("#efeito2").css('width','135px'); $("#efeito2").css('left','86px'); } function solucoes(){ $("#page_solucoes").ready(function(){ $("#efeito").css('display','block'); $("#efeito").css('width','106px'); $("#efeito").css('left','222px'); }); } function solucoes_over(){ $("#efeito2").css('display','block'); $("#efeito2").css('width','106px'); $("#efeito2").css('left','222px'); } function cases(){ $("#page_cases").ready(function(){ $("#efeito").css('display','block'); $("#efeito").css('width','144px'); $("#efeito").css('left','329px'); }); } function cases_over(){ $("#efeito2").css('display','block'); $("#efeito2").css('width','144px'); $("#efeito2").css('left','329px'); } function contato(){ $("#page_contato").ready(function(){ $("#efeito").css('display','block'); $("#efeito").css('width','105px'); $("#efeito").css('left','474px'); }); } function contato_over(){ $("#efeito2").css('display','block'); $("#efeito2").css('width','105px'); $("#efeito2").css('left','474px'); } function out(){ $("#efeito2").css('display','none'); } function blog(){ var blogt = setTimeout('blog();', 100); $("iframe").ready(function(){ try{ var iframe = 0;//$(".fb_ltr").css('height').replace('px',''); var topf = ($("#itens_blog").height()*1)+(iframe*1)+(200*1); var topfm = (($("#itens_blog").height()*1)+(iframe*1))+20; $("#footer").css('top',topf+"px"); $("#fundo_pagina").attr('height',topfm); $("#marcadores").attr('height',topfm); } catch (e) { } }); }