﻿$(document).ready(function() {
    $('#hidePrompt').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 your search..')
            $(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.image').hover(function() {
        $(this).find('span.enlarge').show();
    }, function() {
        $(this).find('span.enlarge').hide();
    });

    $('.chkInvoice input[type=checkbox]').click(function() {
        if ($(this).attr('checked')) {
            $('div.cardpayment').hide();
            $('div.bottomtube .btn-continue').attr('ValidationGroup', 'None');
            $('.card-validation').each(function() {
                ValidatorEnable(this, false);
            });
        }
        else {
            $('div.cardpayment').show();
            $('.card-validation').each(function() {
                ValidatorEnable(this, true);
            });
        }

    });
});

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;
}