﻿$(document).ready(function () {
    //product page alterations
    var pathname = window.location.pathname;
    //if (pathname == '/p-40-salmon-cove-e-gift-card.aspx' || pathname == '/p-41-salmon-cove-printable-gift-card.aspx') {
    if (pathname.indexOf('gift-card') != -1) {
        $('.variantprice').hide();
        /* old gift card process
        var newHtml = '<span>Enter Card Amount:</span>' + $('.prod_qty').html().replace('<br>', '');
        $('.prod_qty').html(newHtml);
        $('.prod_qty').addClass('giftcard_wrapper');
        */

        // replace text of gift card select list
        $(".SizeText option[index=2]}").text('$25');
        $(".SizeText option[index=3]}").text('$50');
        $(".SizeText option[index=4]}").text('$100');
        $(".SizeText option[index=5]}").text('$150');
    }
    else {
        var newHtml = $('.variantprice').html();
        if (newHtml) {
            newHtml = newHtml.replace('Price:&nbsp;', '');
            $('.variantprice').html(newHtml);
        }
    }

    //remove breadcrumb from topic pages
    if (pathname.indexOf("/t-") > 0) {
        $('#bcrumb').hide();
    }

    // remove last name from username link
    var username = $('.username').html();
    if (username) {
        var username = username.substring(0, username.indexOf(' '));
        $('.username').html(username);
    }

    //product pages with customer level pricing
    var levelPriceText = $('.LevelPrice').html();
    if (levelPriceText) {
        var newText = "Your " + levelPriceText.substring(levelPriceText.indexOf('Price'), levelPriceText.length);
        $('.LevelPrice').html(newText);
    }
});

function getTextBoxBlur(elem, text) {
    if (elem.value == "") {
        elem.value = text;
    }
}

