$(document).ready(function(){
    
    $('#house .hall').animate({
        opacity: 0.5
    })
    
    $('#house .hall').bind('mouseenter', function(){
        $(this).animate({
            opacity: 1
        })
    })
    
    $('#house .hall').bind('mouseleave', function(){
        $(this).animate({
            opacity: 0.5
        })
    })
    
    $('#house .hall').click(function(){
        $('#house .popup').css('display', 'none');
        var popup=$(this).attr("id");
        var popleft=$(this).css('left');
        var poptop=$(this).css('top');
        $('#house .'+popup).css({
            'top': poptop,
            'left': popleft
        }).fadeIn(600);
        return false;
    })
    
    $('#house .popup').bind('mouseleave', function(){
        $(this).delay(1500).fadeOut(600);
    })
    
    $('#top .c3 #golubId').bind('mouseenter', function(){
        //var active='../images/golub2.png';
        //$('#top .c3').css('backgroundimages', active);
        //alert($(this).css('background'));
        $('#top .c3').addClass("active");
    })
    
    $('#top .c3 #golubId').bind('mouseleave', function(){
        //alert($(this).attr('class'));
        /*alert($(this).css('background'))
        var active='../images/golub.png';
        $('#top .c3').css('background', active);*/
        $('#top .c3').removeClass("active");
    })
    
    $('#top .c1 ul li:first').hover(function(){
      $('#podmenu').show();
    }, function(){
        $('#podmenu').stop(false, true).delay(500).hide();
    })
    
    /*$('#top .c1 ul li:first a').bind('mouseenter',function(){
      $('#podmenu').show();
      return false;
    })*/
    
    $('#podmenu').bind('mouseenter',function(){
      $('#podmenu').stop(false, true).show();
      return false;
    })
    
    $('#top .c1 ul li:first').bind('mouseleave',function(){
      $('#podmenu').stop(false, true).delay(500).hide();
      return false;
    })
    
    $('#podmenu').bind('mouseleave',function(){
      $('#podmenu').stop(false, true).delay(500).hide();
      return false;
    })
    
    $('#menu h3').next('table').slideUp(0);
    $('#menu h3').click(function(){
        //alert($(this).next('table').hasClass('active'));
        if ($(this).next('table').hasClass('active')){
            $('#menu h3').next('table').removeClass('active');
            $(this).next('table').removeClass('active');
        }else{
            $('#menu h3').next('table').removeClass('active');
            $(this).next('table').addClass('active');
        }
        
        
    })
    
})
