$(document).ready(function(){

    function closeLightBox() {
        $("#lightBox").fadeOut("fast");
        $("#shade").fadeOut("fast");
    }
    
    function resize(presBox, sH) {
        
        var lightboxW = presBox.outerWidth();
        var posL = ($(window).width() - lightboxW) / 2;
        
        presBox.css({
           'left': posL + 'px',
           'top': '40px'
        });
    }
    
    $(window).resize(function() {
        var sH = $(window).height();
        var presBox = $('.pres-box:visible');
        resize(presBox, sH);
    });

    $("#pres_slider a").click(function(e){
        e.preventDefault();
        
        var lightbox = $("#lightBox");
        var presBox = lightbox.find($(this).attr('href'));
        var sH = $(document).height();
        
        lightbox.fadeIn('fast');
        presBox.show();

        resize(presBox, sH);

        $("#shade").css({
            height: sH+'px',
            opacity: '0.5'
        }).fadeIn("fast");

        $("#closeBox").click(closeLightBox);
        $("#shade").click(closeLightBox);

    });
    
    $('.sub_menu2 ul li ul li.li_active').parents('li').addClass('li_active');
    
    $('.ir_question_title').click(function() { 
        $(this.getAttribute('href')).slideToggle();
        return false;
    });
    
    $('.ir_home .tab_one a').click(function() {
        var target = this.getAttribute('href');
        var id = this.getAttribute('id');
        
        $('.tab_content').hide();
        $(target).show();
        $('.tab_one').removeClass('tab_active');
        $(this).parent().addClass('tab_active');
        
        $('.tab_left').removeClass('tab_active_left');
        $('.tab_right').removeClass('tab_active_right');
        $('.tab_center').removeClass('tab_active_center');
        
        $('#' + id + ' .tab_left').addClass('tab_active_left');
        $('#' + id + ' .tab_right').addClass('tab_active_right');
        $('#' + id + ' .tab_center').addClass('tab_active_center');  
        
        return false;
    });
    
    $('#report_table tr:odd').css('background', '#f9f9f9');
    $('#report_table tr:last').remove();

});
