function insertObject(str) {
	document.write(str);
}

function flashBanners(idioma) {
    insertObject('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" id="swfBanner" name="swfBanner" width="960" height="150">');
    insertObject('<PARAM NAME=movie VALUE="'+raiz+'swf/banners_'+idioma+'.swf">');
    insertObject('<PARAM name="wmode" value="transparent" />');
    insertObject('<param name="quality" value="high"><embed src="'+raiz+'swf/banners_'+idioma+'.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="960" height="150" wmode="transparent"></embed>');
    insertObject('</object>');
}

function validarEmail(email){
    var reEmail = /^[\w!#$%&'*+\/=?^`{|}~-]+(\.[\w!#$%&'*+\/=?^`{|}~-]+)*@(([\w-]+\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/;
    if(reEmail.test(email))
        return false;
    else
        return true;
}

function abrirNovaJanela(url){
    var height = screen.availHeight;
    var width = screen.availWidth;
    var fullscreen = (document.all) ? "no" : "yes";
    var resizable = "no";
    var toolbar = "no";
    var status = "no";
    var left = 0;
    var top = 0;
    //set window properties
    props = "toolbar=no" +
    ",fullscreen=" + fullscreen +
    ",status=no" +
    ",resizable=no" +
    ",scrollbars=yes" +
    ",menubar=no" +
    ",location=no" + ",";
    dims = "width="+ width +
    ",height="+ height +
    ",left="+ left +
    ",top=" + top;

    var win = window.open(url, name, props + dims);
    win.resizeTo(width, height);
    
    trace('erro');
}

function validarFormContato() {
    if($("#txt_nome").val() == "" || $("#txt_nome").val() == "Nome Completo (obrigatório)") {
        alert("Informe seu nome!");
        $("#txt_nome").focus();
    }else if($("#txt_email").val() == "" || $("#txt_email").val() == "E-mail (obrigatório)") {
        alert("Informe seu e-mail!");
        $("#txt_email").focus();
    }else if(validarEmail($("#txt_email").val())) {
        alert("Informe corretamente seu e-mail!");
        $("#txt_email").focus();
    }else if($("#txt_assunto").val() == "" || $("#txt_assunto").val() == "Assunto (obrigatório)") {
        alert("Informe o Assunto!");
        $("#txt_assunto").focus();
    }else if($("#txt_msg").val() == "" || $("#txt_msg").val() == "Mensagem (obrigatório)") {
        alert("Informe a Mensagem!");
        $("#txt_msg").focus();
    } else {
        setTimeout(function(){$('#frmContato').submit();}, 100);
    }
}

function validarFormAmigo() {
    if($("#txt_amigo_nome").val() == "" || $("#txt_amigo_nome").val() == "Nome do seu amigo*") {
        alert("Informe seu nome!");
        $("#txt_amigo_nome").focus();
    }else if($("#txt_amigo_email").val() == "" || $("#txt_amigo_email").val() == "E-mail do seu amigo*") {
        alert("Informe seu e-mail!");
        $("#txt_amigo_email").focus();
    }else if(validarEmail($("#txt_amigo_email").val())) {
        alert("Informe corretamente seu e-mail!");
        $("#txt_amigo_email").focus();
    }else if($("#txt_seu_nome").val() == "" || $("#txt_seu_nome").val() == "Seu nome*") {
        alert("Informe seu nome!");
        $("#txt_seu_nome").focus();
    }else if($("#txt_seu_email").val() == "" || $("#txt_seu_email").val() == "Seu e-mail*") {
        alert("Informe seu e-mail!");
        $("#txt_seu_email").focus();
    }else if(validarEmail($("#txt_seu_email").val())) {
        alert("Informe corretamente seu e-mail!");
        $("#txt_seu_email").focus();
    } else {
        setTimeout(function(){$('#frmAmigo').submit();}, 100);
    }
}

function limparCampoTexto(valorPadrao, id_campo) {
    if(valorPadrao == $('#'+id_campo).val()) {
        $('#'+id_campo).val("");
    }else if($('#'+id_campo).val() == "") {
        $('#'+id_campo).val(valorPadrao);
    }
}

function limparCampoSenha(divLabel, divTxt, txt) {
    $('#'+divLabel).css('display', 'none');
    $('#'+divTxt).css('display', '');
    $('#'+txt).focus();
}
function limparCampoSenhaVoltar(divLabel, divTxt, txt) {
    if($('#'+txt).val() == '') {
        $('#'+divLabel).css('display', '');
        $('#'+divTxt).css('display', 'none');
    }
}

function enterPesquisarTopo(e){
    if(e.keyCode == 13)
        location.href=raiz+'pesquisar/'+$('#txt_topo_pesquisar').val();
}

function fontZoomMais(){
    var obj = document.getElementById("texto_zoom");
    if (obj.style.fontSize==""){obj.style.fontSize="11px"};
    if (obj.style.fontSize=="10px"){obj.style.fontSize = "11px";}
    else if (obj.style.fontSize=="11px"){obj.style.fontSize = "13px";}
    else if (obj.style.fontSize=="13px"){obj.style.fontSize = "15px";}
    else if (obj.style.fontSize=="15px"){obj.style.fontSize = "17px";}
    else if (obj.style.fontSize=="17px"){obj.style.fontSize = "19px";}
}

function fontZoomMenos(){
    var obj = document.getElementById("texto_zoom");
    if (obj.style.fontSize==""){obj.style.fontSize="11px"};
    if (obj.style.fontSize=="19px"){obj.style.fontSize = "17px";}
    else if (obj.style.fontSize=="17px"){obj.style.fontSize = "15px";}
    else if (obj.style.fontSize=="15px"){obj.style.fontSize = "13px";}
    else if (obj.style.fontSize=="13px"){obj.style.fontSize = "11px";}
    else if (obj.style.fontSize=="11px"){obj.style.fontSize = "11px";}
}

function perguntasFrequentes(id) {
    $('#'+id).stop().animate({height: ['toggle', 'swing'], opacity: 'toggle'},'fast');
}

function esqueceuSenha(){
    $("#bt_arearestrita_login").css("display", "none");
    $("#bt_arearestrita_recuperar").css("display", "inline");
    alert("Informe seu Usuário e clique no botăo Enviar.\nSua nova senha será enviada para seu e-mail cadastrado.");
    $("#txt_arearestrita_usuario").focus();
}

function enviarNovaSenha(){
    if($("#txt_arearestrita_usuario").val() == "" || $("#txt_arearestrita_usuario").val() == "Usuário") {
        alert("Informe seu Usuário e clique no botăo Enviar.\nSua nova senha será enviada para seu e-mail cadastrado.");
        $("#txt_arearestrita_usuario").focus();
    }else {
        location.href = raiz + 'esqueceu_senha/' + $("#txt_arearestrita_usuario").val();
    }
}
