function close_contact() {
    $('.thickform').hide();
    $('.overlay').hide();
    $('#close_contact').hide();
};

function contact() {
    $('.thickform').show();
    $('.overlay').show();
    $('#close_contact').show();
    
    w = ($('html').width() / 2);
    if($.browser.msie && $.browser.version=='6.0') {
        w = ($('html').width() / 2) - 270;
        o = $('.overlay').offset();
        $('.overlay').css('left', '-'+o.left);
        $('.thickform').css('left', w+'px');
    }
    $('#close_contact').css('left', w+'px');
    position();
};

function position() {
    $(".thickform").css({marginLeft: '-' + '270px', width: '540px'});
    $("#close_contact").css('margin-left','-290px');
};

$(function(){
    $('.sub ul').hide();
    $('.sub').hover(
        function(){
            $(this).find('ul').show();
            $(this).find('a:first').addClass('hover');
        },
        function(){
            $(this).find('ul').hide();
            $(this).find('a:first').removeClass('hover');
        }
    );
    $('#logo_revista').hover(
        function(){ $(this).attr('src', '/public/images/footer_logo_a.png'); },
        function(){ $(this).attr('src', '/public/images/footer_logo.png'); }
    );
    $('#logo_sob').hover(
        function(){ $(this).attr('src', '/public/images/footer_logo_sob_a.png'); },
        function(){ $(this).attr('src', '/public/images/footer_logo_sob.png'); }
    );
    $('#but_contact').attr('href', 'javascript:contact()');
    $('#but_contact2').attr('href', 'javascript:contact()');
    
    $("#contact_form").validate({
        errorContainer: $("#error"),
        rules: {
            name: "required",
            phone: "required",
            email: {
                email: true
            },
            text: "required"
        },
        messages: {
            name: " ",
            phone: " ",
            email: " ",
            text: " "
        }
    });
    $('.thickform').hide();
    $('.overlay').hide();
    $('#close_contact').hide();
});

