﻿
$(document).ready(function () {
    
    //toggle product popup
    $("#ProductList .ProdSmallImage").hover(
        function () {
            // clone productpopup to show it above its inner-frame with overflow 
            var node = $(this).find(".ProductPopup").clone();
            var rootElem = $(".fwRoot");
            node.appendTo(rootElem);
            node.show();

            var popupImg = $(node).find("img");
            var h = popupImg.attr("height");
            if (h > 300 || h == 0) { h = 300; }

            var myElemOffset = $(this).offset();
            node.css("left", (myElemOffset.left + 125));
            node.css("top", (myElemOffset.top - (h / 2) + 40));

            //get the pointer and position it.
            var pointer = node.find(".Pointer");
            pointer.css("top", (h / 2));
        },
        function () {
            $(".fwRoot > .ProductPopup").remove();
        }
   );
   
    //Show/hide quick order box
    $("#QuickOrderBox").click(function () {
        $("#QuickOrderFrame").toggle(100);
    });
    // Show hide submenus on the left menu
    $("#LeftMenu ul li > a").click(function () {
        var ul = $(this).next();
        if (ul.css("display") == "block") {
            ul.hide(100);
        } else {
            ul.show(100);
        }
    });
    
    // Show all attributes 
    $(".SkuAttributes .Sku .ShowLink").click( function() {  
       $(this).find("a.Show").hide();     
       $(this).find("ul").fadeIn();
    });
});

