$(function() {
  $('.cb_hide').click(function() {
    RAOS.log($(this).attr('checked'));
    if($(this).attr('checked')) 
      $('#show'+$(this).attr('id')).fadeIn();
    else
      $('#show'+$(this).attr('id')).fadeOut();
  });
  
  $(".pick-date").datepicker({showOn: 'both', buttonImage: '/img/special_events/datepicker.png', buttonImageOnly: true, minDate: 0, beforeShowDay: $.datepicker.noSunday});
  
  $('.interest-check').click(function() {
	$('.pref').hide();
	$('.pref input[type="hidden"]').remove();
    RAOS.log($(this).attr('checked'));
    if($(this).attr('checked'))
		var type = $(this).attr('id');
		var type_val = $(this).val();
      $('#'+type+'_pref').show();
      $('#'+$(this).attr('id')+'_pref').append('<input type=\'hidden\' name=\'data[Appointment][interest][radio_select][id]\' value="'+type+'" /><input type=\'hidden\' name=\'data[Appointment][interest][radio_select][val]\' value="'+type_val+'" />');
  });
  
  $('#wedding_drop').change(function() {
	$('td.wd-tw-ct').show();
	var value = $(this).val();
	if(value!='Diamond Band') $('td.wd-tw-ct').hide();
  });
  
  $('#stud_drop').change(function() {
	$('tr.stud-choices').hide();
	var value = $(this).val();
	if(value=='Studs') $('tr#stud_choice_studs').show();
	if(value=='Diamond Earrings') $('tr#stud_choice_dmdearring').show();
  });
  
  $('#necklace_drop').change(function() {
	$('tr.necklace-choices').hide();
	var value = $(this).val();
	if(value=='Three Stone Pendants') $('tr#necklace_choice_threestone').show();
	if(value=='Diamond Solitaire') $('tr#necklace_choice_solit').show();
  });
  
  $('#engagement_drop').change(function() {
	$('tr.diamond-togo').hide();
	$('td.eg-tw-ct').show();
	$('select#diamond_togo_drop').val('');
	$('tr.custom-ring').hide();
	var value = $(this).val();
	if(value=='Diamond Setting' || value=='Solitaire Setting') $('tr.diamond-togo').show();
	if(value=='Solitaire Setting') $('td.eg-tw-ct').hide();
  });
  
  $('#diamond_togo_drop').change(function() {
	$('tr.custom-ring').hide();
	var value = $(this).val();
	if(value==1) $('tr.custom-ring').show();
  });
});
