﻿
function DrawImage(ImgD) {
    var maxWidth = parseInt($(ImgD).css('max-width'));
    var maxHeight = parseInt($(ImgD).css('max-height'));
    var Width = parseInt($(ImgD).width());
    var Height = parseInt($(ImgD).height());
    $(ImgD).css('width', maxWidth > Width ? "auto" : (maxWidth / maxHeight > Width / Height ? "auto" : maxWidth + "px"));
    $(ImgD).css('height', maxHeight > Height ? "auto" : (maxWidth / maxHeight > Width / Height ? maxHeight + "px" : "auto"));
};

$(document).ready(function () {
    $("li.Sort1 li:first-child").addClass("b_top");
    $("ul.Sort li:first-child").addClass("b_tops");
    $("li.Sort1").hover(function () {
        $(this).addClass("sort1po");
        if ($(this).children("ul").children("li").length > 0) {
            $(this).children("ul").show();
        }
    }, function () {
        $(this).removeClass("sort1po");
        $(this).children("ul").hide();
    })
});
