$('#attributes_block a.delete').live('click', function(){
  $(this).parent().parent().parent().remove();
});

$('#attributes_block a.add').click(function(){
  $('#attributes').append("<%= escape_javascript(render(:partial => 'admin/user_attribute_models/attribute_model', :object => @user_attribute_model.attribute_models.build)) %>");
});

$('#attributes_block a.remove_existing_record').click(function(){
  $(this).next('.should_destroy').attr('value', 1);
  $(this).parent().parent().hide();
});

$('#attributes_block a.change_built_in').click(function(){
  $(this).parent().toggleClass('disable');
	var $am = $(this).next('.built_in_state')
	$am.attr('value', ($am.attr('value') == "false") ? "true" : "false");
});

$('.select_mulitlingual input').live('click', function(){
  $(this).next().attr('value', this.checked);
});

$('.select_type select').live('change', function(){
  if(this.value == 'select')
  {
    $(this).next().show();
  }
  else
  {
    $(this).next().hide();
  }
});