$(document).ready(function() {



    vertical_to_window();

    $(window).resize(function() {

        vertical_to_window();

    });



    var $fancy_active = 0;

    $("a[rel=fancy_group]").fancybox({

        'transitionIn'	:	'fade',

        'transitionOut'	:	'fade',

        'speedIn'	:	600,

        'speedOut'	:       200,

        'width'         :       640,

        'height'        :       480,

        'overlayShow'	:	true,

        'overlayOpacity':       '0.8',

        'overlayColor'  :       '#333',

        'titleShow'     :       false

    });



});


function vertical_to_window(){

    var pw = $(window).height();

    if(pw>$('#main_block').height()){

        var dif = (pw-$('#main_block').height())/2;

        $('#main_block').css('margin-top',dif+'px')

    }

}
