﻿$(document).ready(function () {

    // Opacity fading on the category images
    $("ul img").hover(function () {
        $(this).stop().fadeTo("normal", 0.8);
        $(this).next().stop().fadeTo("normal", 0.8);
    }, function () {
        $(this).stop().fadeTo("normal", 1);
        $(this).next().stop().fadeTo("normal", 1);
    });

    // 3 column layout - removing the right margin from the 3rd (last) item on each row
    $("ul li:nth-child(3n+3)").css("margin-right", "0");

    // Pagination image button hover
    $("#pagination a[href]").css("opacity", "1");
    $("#pagination a[href]").hover(function () {
        $(this).fadeTo("fast", 0.8);
    }, function () {
        $(this).fadeTo("normal", 1);
    });

    // Change CSS for pagination image if not link
    $("#pagination a[disabled] img").css("opacity", "0");

    var categorySelect = $("#ddlSubCategories option:selected");

    if (!(categorySelect.val() == "0")) {
        $("#lblDescription").html(categorySelect.text());
    }
});
