﻿/* START - CATEGORY FUNCTIONALITY ------------------------------------------------------------------------- */
function showSubCategories(strDiv) {
    document.getElementById(strDiv).style.display = 'block';
}

function hideSubCategories(strDiv) {
    document.getElementById(strDiv).style.display = 'none';
}
/* END - CATEGORY FUNCTIONALITY ------------------------------------------------------------------------- */


/* START - SEARCH FUNCTIONALITY ------------------------------------------------------------------------- */
function searchTextChanged() {
    document.getElementById('ctl00_btnSearchChanged').click();
}

function showSearchTerms() {
    document.getElementById('divSearchTerms').style.display = 'block';
}

function delayHideSearchTerms() {
    window.setTimeout('hideSearchTerms();', 200);
}

function hideSearchTerms() {
    document.getElementById('divSearchTerms').style.display = 'none';
}

function setSearchBoxTerm(term) {
    document.getElementById('ctl00_txtSearch').value = term;
    document.getElementById('btnSearchHeader').click();
}

function submitSearch() {
    var strSearch = document.getElementById('ctl00_txtSearch').value;

    if (strSearch != '') {
        window.location = 'Results.aspx?md=s&search=' + strSearch+ '&rt=1';
    }
}
/* END - SEARCH FUNCTIONALITY ------------------------------------------------------------------------- */


/* START - SEE IT TOGETHER FUNCTIONALITY ------------------------------------------------------------------------- */
function showSIT() {
    document.getElementById('divSeeItTogether').style.display = 'block';
}

function hideSIT() {
    document.getElementById('divSeeItTogether').style.display = 'none';
}

function addSIT(ProductID, Img) {
    document.getElementById('ctl00_ContentPlaceHolder1_vmSIT_hidSITProductID').value = ProductID;
    document.getElementById('ctl00_ContentPlaceHolder1_vmSIT_hidSITImage').value = Img;
    document.getElementById('ctl00_ContentPlaceHolder1_vmSIT_btnSIT').click();
}
/* END - SEE IT TOGETHER FUNCTIONALITY ------------------------------------------------------------------------- */

/* START - GWP / PWP POPUP GREY OUT SCREEN---------------------------------------------------------------------- */
function dimOff() {

    document.getElementById("darkLayer").style.display = "none";
}
function dimOn() {
    document.getElementById("darkLayer").style.width = pageWidth();
    document.getElementById("darkLayer").style.height = pageHeight();
    document.getElementById("darkLayer").style.display = "block";
}

function pageWidth() { return window.innerWidth != null ? window.innerWidth : document.body != null ? document.body.clientWidth : null; }
function pageHeight() { return window.innerHeight != null ? window.innerHeight : document.body != null ? document.body.clientHeight : null; }

/* END - GWP / PWP POPUP GREY OUT SCREEN---------------------------------------------------------------------- */

function loadFunctions() {
    try {GetMap();}catch (err) {}
}

function pageWidth() { return window.innerWidth != null ? window.innerWidth : document.body != null ? document.body.clientWidth : null; }
function pageHeight() { return window.innerHeight != null ? window.innerHeight : document.body != null ? document.body.clientHeight : null; }

/* END - GWP / PWP POPUP GREY OUT SCREEN---------------------------------------------------------------------- */
/* Start Update CartCount periodically */
function updateCartCount() {
    document.getElementById('ctl00_btnUpdateCartCount').click();
    
}
function updateCartCountTimer() {

    if (document.getElementById('ctl00_hidSBCount').value == 1) {
        document.getElementById('ctl00_hidSBCount').value = "";
        document.getElementById('ctl00_btnUpdateCartCount').click();
    }
}
function timedSBCountTimer() {
    var t = setInterval("updateCartCount()", 2000);
}

/* End */





/*Start  AA added for disabling enter keys on form fields*/
/* used in check out pages and gift options*/


function disableEnterKey(e) {
    var key;
    if (window.event)
        key = window.event.keyCode; //IE
    else
        key = e.which; //firefox      

    return (key != 13);
}

/*Start AA added for disabling enter keys on form fields*/


// PopUp Opener
function openPopUp(newURL, type, newQVars, useGlobals, skipLoader, realHeight) {
    var url;  //location of popup content
    var h;   //top
    var w;   //left
    var h;   //height
    var w;   //width
    var opts; //options

    url = "default.aspx";   // default settings here
    t = 50;
    l = 50;
    h = 560;
    w = 520;
    opts = "resizable=yes, toolbar=no, location=no, status=no, scrollbars=yes, menubar=no, titlebar=no";

    switch (type) {
        //   opts = "resizable=yes, toolbar=no, location=no, status=no, scrollbars=no, menubar=no, titlebar=no";
        case "sample": { url = "list.htm"; h = 400; break; }
        case "larger": { w = 560; h = 620; break; }
        case "survey": { w = 635; h = 650; break; }
        case "xl": { w = 750; h = 550; l = 10; opts = "resizable=yes, toolbar=yes, location=no, status=no, scrollbars=yes, menubar=yes, titlebar=no"; break; }
        case "hidef": { h = 520; w = 760; t = 25; l = 0; }
        default: { break; }   // just in case
    }

    if (realHeight) { h = realHeight; }

    opts = "top=" + t + ",left=" + l + ",width=" + w + ",height=" + h + "," + opts;

    url = newURL;

    winpops = window.open(url, "popup", opts);
   // resizeWindowTo(h, w, winpops);
    winpops.focus();

    return;
}

function showFreeInfo() {
    document.getElementById('divHeaderFreeExpand').style.display = 'block';
    document.getElementById('divHeaderFreeHover').style.top = '12px';
    document.getElementById('divHeaderFreeHover').style.left = '365px';
    document.getElementById('divHeaderFreeHoverTopText1').style.display = 'none';
    document.getElementById('divHeaderFreeHoverBotText').style.display = 'none';
}

function hideFreeInfo() {
    document.getElementById('divHeaderFreeExpand').style.display = 'none';
    document.getElementById('divHeaderFreeHover').style.top = '13px';
    document.getElementById('divHeaderFreeHover').style.left = '420px';
    document.getElementById('divHeaderFreeHoverTopText1').style.display = 'block';
    document.getElementById('divHeaderFreeHoverBotText').style.display = 'block';
}
