jQuery.noConflict();
jQuery(document).ready(function($){
  $('table.pricing thead').show();
  $('table.pricing tbody').hide();
  $('table.pricing tbody.selected').show();

  $('table.pricing thead select').each(function() {
    $('table.pricing tbody').hide();
    $('table.pricing tbody.' + this.value).show();
  });

  $('table.pricing thead select').change(function(e) {
    $('table.pricing tbody').hide();
    $('table.pricing tbody.' + e.target.value).show();
  });

  $('table.pricing input[name=price_point_change]').each(function() {
    if(this.checked) {
      $('table.pricing colgroup').removeClass('selected');
      $('#price_point_' + this.value).addClass('selected');
    }
  });
  
  $('table.pricing input[name=price_point_change]').click(function(e) {
    $('table.pricing colgroup').removeClass('selected');
    $('#price_point_' + e.target.value).addClass('selected');
  });


  $('#cm-newsletter').attr('value', 'Email Address').addClass('empty').focus(function() {
    this.value = "";
    $(this).removeClass('empty');
  });

  $('#cm-newsletter').blur(function() {
    if(jQuery.trim(this.value) == "") {
      this.value = "Email Address";
      $(this).addClass('empty');
    }
  });

  $($('.example pre').get(0)).before('<div class="switcher"><a href="#xml">XML</a> | <a href="#json">JSON</a></div>');
  $('div.switcher a[href=#xml]').click(function(e) {
    e.preventDefault();
    $('.json').fadeOut('slow', function() {
      $('.xml').fadeIn();
    });
  });
  $('div.switcher a[href=#json]').click(function(e) {
    e.preventDefault();
    $('.xml').fadeOut('slow', function() {
      $('.json').fadeIn();
    });
  });
});

