$(document).ready(function(){
        if ($.browser.msie) {
          //код только для ИЕ любой версии - изменения стилей, фиксируем баги ИЕ здесь!
          $("#main .ld").css("left","-32px");
          $("#main .ld").css("top","24px");
          $("#main .rd").css("left","576px");
          $("#main .rd").css("top","25px");
          $("#news .ld").css("top","24px");
          $("#news .rd").css("top","25px");
          $("#news .rd").css("left","256px");
        }
      });
$(document).ready(function(){
    $('#raiting_form').click(function() {
        $.get(
            '/cgi-bin/raiting_progect.py',
            $(this).serialize()
            //,function(data) {alert(data) }
        );
    });
});
window.onload=function() {
  if ($('#price_div').length) {
      $('#price_div table tr:odd').addClass('price_odd');
      $('#price_div table tr:even').addClass('price_even');
  }
  
  
  if ($('.foto_galery').length) {    
      var heights = new Array();
      var count=0
      $('.foto_galery').each( function () {
        //heights.push($(this).outerHeight())
        //if (count%2==0) {alert(count)}
        if (typeof pred != 'undefined') {
            if (count%2!=0) {
                if ($(pred).height() > $(this).height()) { // если предыдущий div с картинкой больше текущего в одной строке
                    $(this).css("height",$(pred).height());
                    $(pred).css("height",$(pred).height());
                }
                else {
                    $(this).css("height",$(this).height());
                    $(pred).css("height",$(this).height()); 
                }   
                //alert($(pred).height())
                //alert($(this).height())
            }
            
        }
        pred=this
        count=count+1
      });
          //for (i = 0; i < heights.length; i++) 
            //alert(heights[i]);
      h=0
      count=0
      var margin_top = $(pred).css('margin-top');
      var margin_bottom = $(pred).css('margin-bottom');
      var margin_top = parseInt(margin_top.substr(0, margin_top.length - 2)); // убираем px
      var margin_bottom = parseInt(margin_bottom.substr(0, margin_bottom.length - 2)); // убираем px

      $('.foto_galery').each( function () { // сумма высот div для вычисления общей #main_text
        h=h+$(this).outerHeight() + margin_top + margin_bottom // значение высоты без margin
        //alert(h)
        count=count+1
        current=this
        //alert(h)
      });


      if (count!=0) {
          if (count%2!=0){ h=h+$(current).outerHeight()+margin_bottom+margin_top;  }
          hh=h/2
          $('#main_text').css("height", hh+1000)
          //$('#foto').css("height",hh)
          //$('.foto_windows_navigation').css('background-image', "url('/img/menu-vertical-line.jpg')" )
      }
      //$('.foto_windows_navigation').css('margin', "100px" )
  }
  if ( $('#small_progect').length ) {
        $('#main_text').css("height", 2000)
        
  }
  
};

