    $(document).ready(function() {
    
      var top = ( $.browser.mozilla ) ? $("#popup_window").css('marginTop').slice(0,-2) : $("#popup_window").offset().top;
		  var topPadding = ($(window).height()-$("#popup_window").height())/2-100;
		  $(window).scroll(function() {
			/*if ($(window).scrollTop() > offset.top) {*/
				$("#popup_window").stop().animate({marginTop: $(window).scrollTop() - top + topPadding});
			/*}
			else {$("#popup_window").stop().animate({marginTop: 0});};*/
		  });
		
        var colsWidth = (($('#col_1').width() - 65) / 280).toFixed(0);
        var colsWidth = (100 / colsWidth).toFixed(0);
        var colsWidth = colsWidth - 5;
        $('div.catalog_item').width(colsWidth+"%");
        //$('#test').html(colsWidth+"%");

        $('div.corner').corner('20px');

        $("#text_cut_link a").click(
        function()
          {
              $("#text_cut_link").empty();
              var text = $('#text_cut').html();
              $("#text_cut").remove();
              $("#text_cut_link").hide();
              $("#text_cut_link").append(text);
              $("#text_cut_link").slideDown('fast');
              return false;
          });


        var param='';
        $("div.catalog_item").each(function(){
            if($(this).height()>param)
                param=$(this).height();
        });

        $("div.catalog_item").height(param);

        $(window).resize(function(){
            var colsWidth = (($('#col_1').width() - 65) / 280).toFixed(0);
            var colsWidth = (100 / colsWidth).toFixed(0);
            var colsWidth = colsWidth - 5;
            $('div.catalog_item').width(colsWidth+"%");
        });

    });
