﻿$(document).ready(function() {
    $("a").each(function() {
        if (this.href.indexOf(location.hostname) == -1) {
            $(this).attr('target', '_blank');
        }
    });

    $("#gallery ul li").each(function() {
        $(this).children().lightBox();
    });

    // Broken in IE
    //$("a.exploreBtn").corner("round");

    if (document.getElementById("flashbanner") != null) {
        var params = { // Parameters for display
            wmode: "transparent" // a common request to make the
        };
        var swfObj = '/content/images/media/header.swf';
        swfobject.embedSWF(swfObj, "flashbanner", "855", "265", "9.0.0", null, null, params);
    }

    // Code to handle the product list drop down
    $("#topnav-products").show();
    $("#topnav-products").hover(
                function() {
                    var el = $("#topnav-products");
                    var elPos = el.position();
                    $("#DD-Product-List").css({ top: 29, left: elPos.left }).slideDown(100);
                    $("#topnav-products").attr("fadeout", "false");

                }, function() {
                    DDProductListHide();
                }
            );
    $("#DD-Product-List").hover(
                function() {
                    $("#topnav-products").attr("fadeout", "false");
                }, function() {
                    DDProductListHide();
                }
            );
    function DDProductListHide() {
        $("#topnav-products").attr("fadeout", "true");
        setTimeout(function() {
            if ($("#topnav-products").attr("fadeout") == "true") {
                $("#DD-Product-List").slideUp(100);
            }
        }, 400);
    }

});