var j = jQuery.noConflict()
j(document).ready(function() {
    j('#works').find('.work').live({
            mouseenter: function() {
                j(this).find('.work_thumb').hide();
                j(this).find('.work_data').show();
            },
            mouseleave: function() {
                j(this).find('.work_data').hide();
                j(this).find('.work_thumb').show();
            }
        });
    j('.work_link').fancybox({
        'padding'	            : 0,
        'scrolling'                 : 'no',
        'autoDimensions'            : true,
        'showCloseButton'           : false,
        'centerOnScroll'            : false
    });

    j('.popup a').fancybox({
        'padding'	            : 0,
        'scrolling'                 : 'no',
        'autoDimensions'            : true,
        'showCloseButton'           : false,
        'centerOnScroll'            : false
    });

    j('#subscribe_to_newsletter').click(function(){
        var serialized_form = j('#subscribe_to_newsletter').parent().serialize();
        j.post('/newsletter/subscription/', serialized_form, function(data) {
            alert(data);
        })
    });

    j('.publications-box img').hover(
            function() {
                j(this).parent().parent().find('p.pub-title').css('background-color', '#ffff00');
            },
            function() {
                j(this).parent().parent().find('p.pub-title').css('background-color', '#ffffff');
            }
    );
    j('.backstage_photo_gallery img').hover(
            function() {
                j(this).parent().parent().find('.gallery_title').css('background-color', '#ffff00');
            },
            function() {
                j(this).parent().parent().find('.gallery_title').css('background-color', '#ffffff');
            }
    );
    j('.first.photo').find('.feature_film_thumb img').hover(
            function() {
                j(this).parent().parent().find('.photo_label .photo_title').css('background-color', '#ffff00');
            },
            function() {
                j(this).parent().parent().find('.photo_label .photo_title').css('background-color', '#ffffff');
            }
    );
    j('.last.photo').find('.feature_film_thumb img').hover(
            function() {
                j(this).parent().parent().find('.photo_label .photo_title').css('background-color', '#ffff00');
            },
            function() {
                j(this).parent().parent().find('.photo_label .photo_title').css('background-color', '#ffffff');
            }
    );
    j('img.music_video_thumb').hover(
            function() {
                j(this).parent().find('li.work_title').css('background-color', '#ffff00');
            },
            function() {
                j(this).parent().find('li.work_title').css('background-color', '#ffffff');
            }
    );

});

