$().ready(function(){
  $(".s22 th a").hover(function(){
    $cln = $(this).attr("class");
    if($cln!="thsort"){
      if($cln=="thsort sort-t"){
        $(this).removeClass("sort-t").addClass("sort-d");
      }else{
        $(this).removeClass("sort-d").addClass("sort-t");
      }
    }else{
      $(this).addClass("sort-t");
    }
  },function(){
    $cln = $(this).attr("class");
    if($cln!="sort-t"){
      if($cln=="thsort sort-t"){
        $(this).removeClass("sort-t").addClass("sort-d");
      }else{
        $(this).removeClass("sort-d").addClass("sort-t");
      }
    }else{
      $(this).removeClass("sort-t");
    }    
  })
})


$(window).load(function () {
  $wh = $(window).height();
  $sh = $(".s4").height();
  if($sh<$wh){//Если высота сайта меньше высоты экрана
    $(".s5, .s8, .s10").css("height", $wh+"px");
      $s8h = $(".s8").height();
      $s10h = $(".s10").height();

      $s8lch = $s8h - 200;
      $s14h = $s10h - 277;
      $("#s8lc").css("height", $s8lch+"px");
      $(".s14").css("height", $s14h+"px");
  }else{
    $s8h = $(".s8").height();
    $s10h = $(".s10").height();
    if($s8h>$s10h){
      //alert("2")
      $s10h = $s8h + 180;
//      $(".s10").css("height", $s10h+"px");
      $s14h = $(".s14").height();
      $s12hm = $s8h-$s14h-257;
      $(".s12").css("margin-top", $s12hm+"px");
    }else{
      //alert("3")
      $s8h = $s10h+45;
      $(".s8").css("height", $s10h+"px");
      $s8lch = $("#s8lc").height();
      $s8lcm = $s10h-$s8lch-190;
      $(".s11").css("margin-top", $s8lcm+"px");
      
    }
  }
  //$(".s11").show();
});
