﻿$(document).ready(function() {

    $('#hidePrompt').live('click', function(e) {       
        $('#cartPrompt').hide();
        e.preventDefault();
    });

    $('input.btn-add').hide();

    $('.checkout-box input[type=text]').focus(function() {
        $(this).addClass('focus');
    }).blur(function() {
        $(this).removeClass('focus');
    });

    $('div.product-slide-pod div.innertube').css('border-color', '#ffffff');
    $('div.product-pod div.innertube').css('border-color', '#ffffff');

    $(qClientId).focus(function() {
        if ($(this).val() == 'Enter keyword...')
            $(this).val('');
    });

    $('div.product').hover(function() {
        $(this).find('input.btn-add').show();
    }, function() {
        $(this).find('input.btn-add').hide();
    });

    $('div.product-slide-pod div.innertube').hover(function() {
        $(this).css('border-color', '#f1f1f1');
    }, function() {
        $(this).css('border-color', '#ffffff');
    });


    $('div.product-pod div.innertube').hover(function() {
        $(this).css('border-color', '#f1f1f1');
    }, function() {
        $(this).css('border-color', '#ffffff');
    });

    $('div.footer-helpline').hover(function() {
        $(this).addClass('footer-helpline-on');
    }, function() {
        $(this).removeClass('footer-helpline-on');
    });

    $('a.helpline').hover(function() {
        $(this).addClass('helpline-on');
    }, function() {
        $(this).removeClass('helpline-on');
    });

    $('div.image').hover(function() {
        $(this).find('span.enlarge').show();
    }, function() {
        $(this).find('span.enlarge').hide();
    });
});

/* Make block elements across a page the same height */
function equalHeight(group) {
    var tallest = 0;
    group.each(function() {
        var thisHeight = $(this).height();
        if (thisHeight > tallest) {
            tallest = thisHeight;
            
        }
    });
    group.height(tallest);
}

function SetUniqueRadioButton(nameregex, current) {
    re = new RegExp(nameregex);
    for (i = 0; i < document.forms[0].elements.length; i++) {
        elm = document.forms[0].elements[i]
        if (elm.type == 'radio') {
            if (re.test(elm.name)) {
                elm.checked = false;
            }
        }
    }
    current.checked = true;
}
