/*
| -------------------------------------------------------------------
| CÓDIGOS PADRÃO DOS SITES
| -------------------------------------------------------------------
| Se for copiar esse código mantenha os créditos
| Obrigado
| marlon@marlonrenan.com | StudioA Design & Web » www.studioaweb.com.br
|
|*/

$(document).ready(function(){

    // HACK CSS CROSS BROWSER
    $.each($.browser, function(i, val){
        $('html').addClass(i);
        return false;
    });

    // verificando se o usuário esta utilizando o ie6
    if($.browser.msie && $.browser.version=="6.0"){

        var html = '<div id="box-ie">';
        html+='<div id="box-ie-text">';
        html+='<h1>ATENÇÃO<br/> <span>Seu browser esta desatualizado</span></h1>';
        html+='Você esta usando o Internet Explorer 6. Este é um navegador muito antigo que não oferece suporte para websites modernos.';
        html+=' Para ter melhor experiência em nosso website (e muitos outros), por favor atualize para o Internet Explorer 8, ou migre para um outro alternativo, como Firefox, Chrome ou Safari.';
        html+='</div>';
        html+='<div id="box-ie-icones">';
        html+='<a href="http://br.mozdev.org/download/" target="_blank" id="firefox">Firefox</a>';
        html+='<a href="http://www.google.com/chrome/index.html?hl=pt-BR&brand=CHMB&utm_campaign=pt-BR&utm_source=pt-BR-ha-latam-br-sk&utm_medium=ha" target="_blank" id="chrome">Google Chrome</a>';
        html+='<a href="http://www.apple.com/safari/download/" target="_blank" id="safari">Safari</a>';
        html+='<a href="http://www.microsoft.com/brasil/windows/internet-explorer/?WT.mc_id=1579" target="_blank" id="ie8">IE8<!-- fix bug --></a>';
        html+='</div>';
        html+='<div id="box-ie-close">Fechar</div>';
        html+='</div>';
        $('body').prepend(html);
        $('#box-ie').fadeIn('slow', function(){
            $('#box-ie-close').click(function(){
                $('#box-ie').fadeOut('slow');
            });
        });
    }

    function vemail(obj){
        var Email = $(obj).val();
        var reEmail = /^[\w-]+(\.[\w-]+)*@(([A-Za-z\d][A-Za-z\d-]{0,61}[A-Za-z\d]\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/;
        if (!reEmail.test(Email) || Email == "" || Email == null) {
            return false;
        } else {
            return true;
        }

    }

    
    
/*
| -------------------------------------------------------------------
| CONFIGURAÇÕES DO SITE
| -------------------------------------------------------------------
|*/

    // ==============================================================
    // VERIFICANDO SE DEVE EXIBIR INFORMAÇÃO DE RETORNO
    if($('#box-retorno').html()){
        
        $('#mascara').css('opacity',0.5);
        $('#mascara').css('height',$(document).height()+'px');

        //POSICIONA NO CENTRO
        var meioh = ($(window).width()/2)-($("#box-retorno").width()/2);
        var meiov = ($(window).height()/2)-($("#box-retorno").height()/2);
        $("#box-retorno").css({
            'margin-top':+meiov,
            'margin-left':+meioh
        });

        $('#mascara').fadeIn('fast', function(){            
            $('#box-retorno').fadeIn('fast', function(){
                setTimeout(function(){
                    $('#box-retorno').fadeOut('fast',function(){
                        $('#mascara').fadeOut('fast');
                    })
                }, 2000);
            });
        });
    }
    

});
