function showMais(w)
{
    if (w == "lidos") {
        document.getElementById('limaislidos').className = 'on';
        document.getElementById('limaiscomentados').className = '';

        document.getElementById('maislidos').style.display = 'block';
        document.getElementById('maiscomentados').style.display = 'none';
        $("#maislidos ul").css('display', 'none');
        $("#maislidos ul").fadeIn('slow');
    } else if (w == "comentados") {
        document.getElementById('limaislidos').className = '';
        document.getElementById('limaiscomentados').className = 'on';

        document.getElementById('maislidos').style.display = 'none';
        document.getElementById('maiscomentados').style.display = 'block';
        $("#maiscomentados ul").css('display', 'none');
        $("#maiscomentados ul").fadeIn('slow');
    }
}

function showFormComentario()
{
    $('#form_comentario').show('normal');
}

function externalLinks() {
    $('a').each(function () {
        if ($(this).attr('rel') == "external" ||
            ($(this).attr('href') &&
            $(this).attr('href').substring(0, 28) != "http://www.editoraufv.com.br" &&
            $(this).attr('href').substring(0, 24) != "http://editoraufv.com.br" &&
            $(this).attr('href').substring(0, 7) == "http://" &&
            $(this).attr('href').substring(0, 8) != "https://")) {
            $(this).attr('target', '_blank');
        }
    });
}

function menuLinks() {
    $('.menu a').each(function () {
        if ($(this).attr('href') && $(this).attr('href') == "#") {
            if(!$(this).attr('title'))
                $(this).attr('title', 'Escolha uma opção abaixo');
            $(this).css('cursor', 'default');
        }
    });
}

function ligaDesliga(idAlvo){
	if ($("#" + idAlvo).css('display') == 'none') {
        $("#" + idAlvo).show('normal');
	} else {
        $("#" + idAlvo).hide('normal');
	}
}

function showAviso()
{
    $('#aviso_back').fadeIn('normal');
    $('#aviso').fadeIn('normal');
    $('.zonabanner').each(function () {
        $(this).css('visibility', 'hidden');
    });
}

function hideAviso()
{
    $("#aviso").fadeOut("normal");
    $("#aviso_back").fadeOut("normal");
    $('.zonabanner').each(function () {
        $(this).css('visibility', 'visible');
    });
}

function expandirVertical(idAlvo)
{
    $('#' + idAlvo +' .oculto').each(function () {
        if ($(this).css('display') == 'none') {
            $(this).show('normal');
            $('#' + idAlvo +' .bot-expandir').css('background-position', 'center -6px');
	} else {
            $(this).hide('normal');
            $('#' + idAlvo +' .bot-expandir').css('background-position', 'center 2px');
	}
    });
}

function esqueci()
{
    if ($('#e_mail').val() == '') {
        alert("Preencha o campo e-mail!");
    } else {
        location = 'http://www.editoraufv.com.br/action/esqueci-minha-senha.php?em=' + $('#e_mail').val();
    }
}

<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//-->

/*
* ScrollToElement 1.0
* Copyright (c) 2009 Lauri Huovila, Neovica Oy
*  lauri.huovila@neovica.fi
*  http://www.neovica.fi
*  
* Dual licensed under the MIT and GPL licenses.
*/

(function($) {
    $.scrollToElement = function( $element, speed ) {

        speed = speed || 750;

        $("html, body").animate({
            scrollTop: $element.offset().top,
            scrollLeft: $element.offset().left
        }, speed);
        return $element;
    };

    $.fn.scrollTo = function( speed ) {
        speed = speed || "normal";
        return $.scrollToElement( this, speed );
    };
})(jQuery);

function irPara(alvo){
    $('a').each(function () {
        if ($(this).attr('name') == alvo) {
            $(this).scrollTo(900);
        }
    });
}

function lbOn()
{
    $('.lightbox').lightBox({
        overlayBgColor: '#000',
        overlayOpacity: 0.6,
        imageLoading: 'http://www.ultimato.com.br/img/lb/loading.gif',
        imageBtnClose: 'http://www.ultimato.com.br/img/lb/close.gif',
        imageBtnPrev: 'http://www.ultimato.com.br/img/lb/prev.gif',
        imageBtnNext: 'http://www.ultimato.com.br/img/lb/next.gif',
        imageBlank: 'http://www.ultimato.com.br/img/lb/blank.gif',
        containerResizeSpeed: 350,
        txtImage: 'Imagem',
        txtOf: 'de'
    });
}

function showExtra(n)
{
    $('.show_extra').each(function () {$(this).hide();});
    $('#' + n).show('normal');
    $('.link_extra').each(function () {$(this).removeClass('on');});
    $('#link_' + n).addClass('on');
    $('#link_' + n).blur();
}

function showFormLogin()
{
    $("#form_login").slideDown('normal');
    $("#top-faixa-sup .content .link-login").css('background', 'url(img/layout/seta-login-up.gif) no-repeat 44px center');
}

function hideFormLogin()
{
    $("#form_login").slideUp('normal');
    $("#top-faixa-sup .content .link-login").css('background', 'url(img/layout/seta-login.gif) no-repeat 44px center');
    tmrFrmLogin = undefined;
}

function formBuscaLocal(idForm,pg){
    var formAlvo = document.getElementById(idForm);
    location = 'http://www.editoraufv.com.br/action/converteURL.php?url=' + pg +'&onde='+ formAlvo.onde.value +'&busca='+ formAlvo.busca.value;
    return false;
}

$(document).ready(function(){
    var tmrMenuSites;
    var tmrCart;

    $('#link-login').mouseover(function(){
        showFormLogin();
        if (tmrFrmLogin != undefined) {
            clearTimeout(tmrFrmLogin);
            tmrFrmLogin = undefined;
        }
    });
    $('#form_login').mouseover(function(){clearTimeout(tmrFrmLogin);tmrFrmLogin = undefined;});
    $('#link-login').mouseleave(function(){if (!$('#form_login #e_mail').hasClass('focus')) {tmrFrmLogin = setTimeout("hideFormLogin();", 300);}});
    $('#form_login').mouseleave(function(){if (!$('#form_login #e_mail').hasClass('focus')) {tmrFrmLogin = setTimeout("hideFormLogin();", 300);}});
    $('#form_login input').focus(function(){$('#form_login #e_mail').addClass('focus')});
    $('#form_login input').blur(function(){$('#form_login #e_mail').removeClass('focus')});

    $('.menu-sites ul li a').mouseover(function(){clearTimeout(tmrMenuSites);tmrMenuSites = undefined;});
    $(".menu-sites ul li a").mouseleave(function(){tmrMenuSites = setTimeout("showMenu('" + $('#defaultarea').html() + "')", 1000)});
    $('.menu').mouseover(function(){clearTimeout(tmrMenuSites);tmrMenuSites = undefined;});
    $(".menu").mouseleave(function(){tmrMenuSites = setTimeout("showMenu('" + $('#defaultarea').html() + "')", 1000)});

    $('#licarrinho').mouseover(function () {clearTimeout(tmrCart);tmrCart = undefined;$('#miniCarrinho').show('fast');});
    $('#licarrinho').mouseout(function () {tmrCart = setTimeout("$('#miniCarrinho').hide('fast')", 1000);});

    $('#linkcarrinho').mouseover(function () {clearTimeout(tmrCart);tmrCart = undefined;$('#miniCarrinho').show('slow');});
    $('#linkcarrinho').mouseout(function () {tmrCart = setTimeout("$('#miniCarrinho').hide('fast')", 1000);});

    externalLinks();
    menuLinks();
});

function janelaRecibo(url,w,h){
	var t = (screen.height/2)-(h/2);
	var l = (screen.width/2)-(w/2);
	window.open(url,'janela','resizable=yes,scrollbars=yes,menubar=yes,top='+t+',left='+l+',width='+w+',height='+h);
}

