function emailValido(email) {
email.val(jQuery.trim(email.val()));
var caracteresInvalidos = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/;
var caracteresValidos = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/;
return (caracteresValidos.test(email.val()) && !caracteresInvalidos.test(email.val()));
}
jQuery.fn.getLabel = function() {
var a;
this.each(function() {	if (this.tagName == 'SELECT') {
var selectElement = this;
a = selectElement.options[selectElement.options.selectedIndex].text;
}	});
return a;	}
function validaFormContatos() {
var houveErros = false;
if (!$("#contato-nome").val()) {
$("#erro-nome").fadeIn("medium");
houveErros = true;
} else $("#erro-nome").fadeOut("medium");
if (!$("#contato-email").val() || !emailValido($("#contato-email"))) {
$("#erro-email").fadeIn("medium");
houveErros = true;
} else $("#erro-email").fadeOut("medium");
if ($("#contato-assunto").val() == '0') {
$("#erro-assunto").fadeIn("medium");
houveErros = true;
} else $("#erro-assunto").fadeOut("medium");
if ($("#contato-mensagem").val() == 0) {
$("#erro-mensagem").fadeIn("medium");
houveErros = true;
} else $("#erro-mensagem").fadeOut("medium");
return !houveErros;
}
function tiraAcentos(value) {
value = value.replace(/[áàâäã]/g, 'a'); value = value.replace(/[ÁÀÂÄÃ]/g, 'A');
value = value.replace(/[éèêë]/g, 'e'); value = value.replace(/[ÉÈÊË]/g, 'E');
value = value.replace(/[íìîï]/g, 'i'); value = value.replace(/[ÍÌÎÏ]/g, 'I');
value = value.replace(/[óòôöõ]/g, 'o'); value = value.replace(/[ÓÒÔÖÕ]/g, 'O');
value = value.replace(/[úùûü]/g, 'u'); value = value.replace(/[ÚÙÛÜ]/g, 'U');
value = value.replace(/ç/g, 'c'); value = value.replace(/Ç/g, 'C');
value = value.replace(/[&]/g, '_');
return value;
}
function validaFormOrcamentos() {
var houveErros = false;
if (!$("#orcamento-nome").val()) {
$("#erro-nome").fadeIn("medium");
houveErros = true;
} else $("#erro-nome").fadeOut("medium");
if (!$("#orcamento-telefone").val()) {
$("#erro-telefone").fadeIn("medium");
houveErros = true;
} else $("#erro-telefone").fadeOut("medium");
var tpServico = $("#orcamento-tiposervico").val();
var idOrigem = $("#orcamento-idiomaorigem").val();
var idDestino = $("#orcamento-idiomadestino").val();
if (tpServico == '0' || idOrigem == '0' || idDestino == '0' || (idOrigem == idDestino)) {
$("#erro-servico").fadeIn("medium");
houveErros = true;
} else $("#erro-servico").fadeOut("medium");
if (tpServico == 4 || tpServico == 5) {
if (!$("#orcamento-email").val() || !emailValido($("#orcamento-email"))) {
$("#erro-email").fadeIn("medium");
houveErros = true;
} else $("#erro-email").fadeOut("medium");
}
return !houveErros;
}
function openNewWindow(url, perguntaUsuario, popUp) {
if (perguntaUsuario) {
var msg = 'ATENÇÃO: A página solicitada está fora de nosso servidor.'+eol()+'Não nos responsabilizamos pelo seu conteúdo!'+eol()+eol()+'Deseja continuar?';
if (!confirm(msg)) return false;
}
if (popUp)
var newWindow = window.open(url,"popup","toobar=no, location=no, menubar=no, scrollbars=no, resizable=no, status=no, width=450, height=500");
else
var newWindow = window.open(url);
newWindow.focus();
return newWindow;
}
function eol() {
return (navigator.platform.indexOf('Mac') > -1) ? "\r" : "\n";
}
$(function(){
$(".link_external").bind("click", function(e) {
openNewWindow(this.href, false, false);
return false;
});
$(".link_popup").bind("click", function(e) {
openNewWindow(this.href, false, true);
return false;
});
$(".botao").hover (
function() {
$(this).css( {"background-image":"url(./images/botao-pressed-bg.png)", "background-repeat":"repeat-x"} );
},
function() {
$(this).css( {"background-image":"url(./images/botao-default-bg.png)", "background-repeat":"repeat-x"} );
}
);
});