﻿$(document).ready(function () {

    $("#switch").toggle(function () {
        $("body").addClass("dark");
    }, function () {
        $("body").removeClass("dark");
    });

    $("#nav ul li.topNav").hoverIntent({
        over: showMenu,
        timeout: 400,
        out: hideMenu
    });
    $("#homeGallery .thumbnailImage").mouseenter(function () {
        $(this).stop().animate({
            boxShadow: "0 2px 4px rgba(0,0,0,0.5)",
            bottom: "1"
        }, 100);
    });
    $("#homeGallery .thumbnailImage").mouseleave(function () {
        $(this).stop().animate({
            boxShadow: "0 1px 2px rgba(0,0,0,0.33)",
            bottom: "0"
        }, 100);
    });
    $("#homeGallery .thumbnailImage").click(function () {
        $(this).find(".overlay").fadeTo(200, 0.5);
    });
    $("#homeGallery .thumbnailImage").click(function () {
        $(this).siblings().find(".overlay").fadeOut(200);
    });

    $("#homeGallery .thumbnailImage:nth-child(2n)").css("marginRight", "0px");
    $("#categoryView .categoryProduct table tr td:first-child").addClass("firstColumn");
    $("#productPage table tr td:first-child").addClass("firstColumn");
    $("#productPageGallery #thumbs ul li").mouseenter(function () {
        $(this).stop().animate({
            boxShadow: "0 2px 4px rgba(0,0,0,0.5)",
            bottom: "1"
        }, 100);
    });
    $("#productPageGallery #thumbs ul li").mouseleave(function () {
        $(this).stop().animate({
            boxShadow: "0 1px 2px rgba(0,0,0,0.33)",
            bottom: "0"
        }, 100);
    });
    $("#productPageGallery #thumbs ul li").click(function () {
        $(this).find(".overlay").fadeTo(200, 0.5);
    });
    $("#productPageGallery #thumbs ul li").click(function () {
        $(this).siblings().find(".overlay").fadeOut(200);
    });
    $("#stockList tr:odd").addClass("oddRow");

    //    $('#soldToggle').toggle(function () {
    //        $("#soldToggleSlider").animate({
    //            right: "43px"
    //        });
    //        $("#soldToggleSlider #on").delay(200).fadeOut(200);
    //        $("#soldToggleSlider #off").fadeIn(200);

    //    }, function () {
    //        $("#soldToggleSlider").animate({
    //            right: "-3px"
    //        });
    //        $("#soldToggleSlider #off").delay(200).fadeOut(200);
    //        $("#soldToggleSlider #on").fadeIn(200);
    //    });

});   // close document.ready

function showMenu() {
    $(this).siblings().removeClass("show");
    $(this).addClass("show");
}
function hideMenu() {
    $(this).removeClass("show");
}
$(function () {
    var path = location.pathname.substring(1);
    if (path)
        $('#nav .container_12 li.topNav a[href$="' + path + '"]').parent().addClass('current');
});
