$(document).ready(function() {

      $.getJSON("common-utilities/country-list", function(data){
        $("#tbCountry").replaceWith('<select id="tbCountry" name="' + $("#tbCountry").attr("name") + '" />');
        $("#tbCountry").append('<' + 'option value="">Select a country<' + '/' + 'option>');
        $.each(data, function(i, item) {
          $("#tbCountry").append('<' + 'option value="' + item + '">' + item + '<' + '/option' + '>');
        });
        $("#tbCountry2").replaceWith('<select id="tbCountry2" name="' + $("#tbCountry2").attr("name") + '" />');
        $("#tbCountry2").append('<' + 'option value="">Select a country<' + '/' + 'option>');
        $.each(data, function(i, item) {
          $("#tbCountry2").append('<' + 'option value="' + item + '">' + item + '<' + '/option' + '>');
        });
      });

      $('#cbSMS').click(function() {
          if (!$(this).attr('checked')) {
            $('input[name=010-subscription_length]').attr('checked', false);
          }
      });
      $('#subscribe').validate({
          rules: {
              '002-name': 'required',
              '003-address_1': 'required',
              '005-city': 'required',
              '006-state_province': 'required',
              '007-country': 'required',
              '008-zip': 'required',
              '009-email': { required: true, email: true },
              '010-subscription_length': { required: '#cbSMS:checked' },
              '012-name': { required: '#cbG:checked' },
              '013-address_1': { required: '#cbG:checked' },
              '015-city': { required: '#cbG:checked' },
              '016-state_province': { required: '#cbG:checked' },
              '017-country': { required: '#cbG:checked' },
              '018-zip': { required: '#cbG:checked' },
              '019-email': { required: '#cbG:checked', email: true },
              '020-subscription_length': { required: '#cbG:checked' }
          }
      });
    });
