$(function(){
    //$('#menu a.noSec').mouseover(function() {
    //    //var id = $(this).attr('id');
    //    $(this).css('background-image', 'url(/images/podsvetka.png)');
    //    //if ($(this).attr('rel') != 'work') {
    //    //    $(this).effect('bounce', {distance: 5, times: 3}, 300, callback(id));
    //    //    $(this).attr('rel', 'work');
    //    //}
    //
    //})
    //.mouseout(function() {
    //    $(this).css('background-image', 'none');
    //});
    
    function callback(id) {
        setTimeout(function(){
            //alert(id);
            $('#menu a[id='+id+']').attr('rel', 'nowork');
            //$('#menu a[id='+id+']').mouseout(function() {
            //    $(this).css('background-image', 'none');
            //});
        }, 900);
        setTimeout(function(){
            if( $('#menu a[id='+id+']').attr('rel') != 'work' ) {
                $('#menu a[id='+id+']').css('background-image', 'none');
            }
        }, 1000);
    };
    
    $('#menu ul.first').mouseover(function() {
        $(this).children('li').children('a').attr('rel', '');
        //$(this).children('li').children('a').css('background-image', 'url(/images/podsvetka.png)');
        $(this).children('li').children('ul').css('display', 'block');
        //$(this).children('li').children('ul').effect('blind', {}, 300);
    })
    .mouseout(function() {
        var id = $(this).attr('id');
        $(this).children('li').children('a').attr('rel', 'act');
        setTimeout(function(){
            if ($('#'+id).children('li').children('a').attr('rel') == 'act') {
                if ($('#'+id).children('li').children('a').attr('class') !=  'activeMenu') {
                    //$('#'+id).children('li').children('a').css('background-image', 'none');
                }
                $('#'+id).children('li').children('ul').css('display', 'none');
                $('#'+id).children('li').children('a.noSec').attr('id', '');
            }
        }, 200);
    });
    
    $("a[rel='gallery']").colorbox({transition:"elastic", contentCurrent:"{current} / {total}"});

});

