﻿$(function() {
    $("#wait").width($("#container").outerWidth());
    $("#wait").height($("#container").outerHeight());

    $("#header h1 a, #header .pngFix").click(function() { window.location = "/"; }); // For PNGFix

    $("#header #secNav ul").superfish({
        onShow: function() {
            $(this).dcCreate({
                imgPrefix: "/BVModules/Themes/MoyerElectronics/images/secnav-sub-",
                fileType: ".gif",
                expand: 2,
                radius: 8,
                position: "outside"
            });
        },
        onHide: function() {
            $(this).dcClear();
        }
    });

    $(".doCorners").dcCreate({
        imgPrefix: "/BVModules/Themes/MoyerElectronics/images/corners-",
        fileType: ".gif",
        expand: 8,
        position: "inside"
    });

    $(".doCornersBlue").dcCreate({
        imgPrefix: "/BVModules/Themes/MoyerElectronics/images/corners-blue-",
        fileType: ".gif",
        expand: 8,
        position: "inside"
    });

    $("#brandsGrid").dcCreate({
        imgPrefix: "/BVModules/Themes/MoyerElectronics/images/brands-grid-",
        fileType: ".gif",
        expand: 6,
        position: "inside",
        exclude: "top, right, left, bottom",
        resize: "img"
    });

    $("#brandsGrid .inner").dcCreate({
        imgPrefix: "/BVModules/Themes/MoyerElectronics/images/brands-grid-2-",
        fileType: ".gif",
        expand: 6,
        position: "inside",
        exclude: "top, right, left, bottom"
    });

    // For Search Box Text
    untilValue(".searchboxform .searchspan .forminput", "Product Search");

});

function untilValue(ele,txt) {
	// onCall
	( g = $(ele) ).val() != txt ? g.addClass("active") : g.removeClass("active");
	// onFocus, onBlur
	g.bind("focus blur", function(){
		( g = $(this) ).val() == txt ?
			g.val("").addClass("active")
		:	
			g.val() == "" ? g.val(txt).removeClass("active") : null
	})
}
