var errorLog;


$(document).ready(function(){
    try{
        $.Lightbox.construct({text:{image:"Imagem",of:"de",close:" Fechar X ",closeInfo:"Clique aqui para fechar",download:"Download da imagem",help:{close:"Clique aqui para fechar",interact:"Passe o mouse sobre a imagem para interagir"},about:{text:"",title:"",link:""}},keys:{close:"c",prev:"a",next:"p"}});
    }catch(e){
        errorLog +='Erro no $.Lightbox.construct';
    }
    $("a[@rel=external]").attr('target','_blank');
    $(".acesso_rapido .full ul li:nth-child(3n), #B .box_compre_sem_sair_de_casa .list a:nth-child(7n)").css("margin-right", 0);
    if($('#slideshow .slides').size()){
      $('#slideshow .slides').cycle({
          timeout: 5000,
          speed: 300,
          cleartype: 1,
          fx: 'fade',
          pager:  '#slideshow .ancoras',
          before: function(currSlideElement, nextSlideElement, options, forwardFlag) {
            if( $('#slideshow .slides').height()< $(nextSlideElement).height())
                $('#slideshow .slides').css('height',$(nextSlideElement).height());
          }
      });

    }

    $(".compartilhe").mouseover(function(){
        return addthis_open(this, '', '[URL]', '[TITLE]');
    }).mouseout(function(){
        addthis_close();
    }).click(function(){
        return addthis_sendto();
    });

    $('.box_empresas a:last').css('margin-right',0);

    if($("#idTabs, #menu_destaques, #tabs_busca").size()){
        $("#idTabs, #menu_destaques, #tabs_busca").idTabs();
        //Modificão no IdTabs Por Causa de Bug Ie6(Classes)
        $("#idTabs a, #menu_destaques a, #tabs_busca a").click(function(){
            $(this).parent('li').parent('ul').children('li').removeClass('selected');
            $(this).parent('li').addClass('selected');
        });
    }

    $('#q, .noDefaultValue').focus(function(){
        if(this.defaultValue == $(this).val())  $(this).val('');
    }).blur(function(){
        if(!$(this).val().length) $(this).val(this.defaultValue);
    });
    if($('.listModel6 .type3').size())
        $('.listModel6 .type3:nth-child(4n)').addClass('last').after('<li class="clearFull"><!-- --></li>');
    //Correção Bug  Ie7 margin-bottom float dentro de float
    $('#B').append('<span class="clearFull"><!-- --></span>');
    var timeOutRef;
    $('.box_atalhos > li > ul > li > a').hover(
    function(){
       var ancora = this;
       var subMenu = $(this).nextAll('.subMenu');
        if(subMenu.is(':hidden')) { $('.subMenu').hide('slow'); $('.box_atalhos li a.bot').removeClass('active'); }
        timeOutRef = window.setTimeout(
        function(){
           $(ancora).addClass('active');
           subMenu.show('slow');
       }, 500);
    },function(){
       var parent = $(this).parent();
       var subMenu = $(this).nextAll('.subMenu');
       var ancora = $(this);
       window.clearTimeout(timeOutRef);
        parent.find('*').mousemove(function(){
        parent.attr('temp','true');
        ancora.addClass('active');
       }).mouseout(function(){
        parent.attr('temp','false');
        window.setTimeout(function(){ if(parent.attr('temp')=='false'){ subMenu.hide('slow', function(){ $('.box_atalhos li a.bot').removeClass('active'); });  } }, 200);
       });
    }
    );
});


