def update_language_case_rules
      cases = parse_language_cases
      case_index = params[:case_index].to_i
      lcase = cases[case_index]

      if params[:case_action].index("add_rule_at")
        position = params[:case_action].split("_").last.to_i
        rule_data = params[:edit_rule].merge(:language => tr8n_current_language)
        lcase.language_case_rules.insert(position, Tr8n::LanguageCaseRule.new(rule_data))
      
      elsif params[:case_action].index("update_rule_at")
        position = params[:case_action].split("_").last.to_i
        rule_data = params[:edit_rule].merge(:language => tr8n_current_language)
        lcase.language_case_rules[position].definition = params[:edit_rule][:definition]

      elsif params[:case_action].index("move_rule_up_at")
        position = params[:case_action].split("_").last.to_i
        temp_node = lcase.language_case_rules[position-1]
        lcase.language_case_rules[position-1] = lcase.language_case_rules[position]
        lcase.language_case_rules[position] = temp_node              

      elsif params[:case_action].index("move_rule_down_at")
        position = params[:case_action].split("_").last.to_i
        temp_node = lcase.language_case_rules[position+1]
        lcase.language_case_rules[position+1] = lcase.language_case_rules[position]
        lcase.language_case_rules[position] = temp_node              
              
      elsif params[:case_action].index("delete_rule_at")
        position = params[:case_action].split("_").last.to_i
        lcase.language_case_rules.delete_at(position)
      
      elsif params[:case_action].index("clear_all")
        lcase.language_case_rules = []
      
      end
    
      render(:partial => "edit_language_case_rules", :locals => {:lcase => lcase, :case_index => case_index})
    end
def update_language_case_rules
      cases = parse_language_cases
      case_index = params[:case_index].to_i
      lcase = cases[case_index]

      if params[:case_action].index("add_rule_at")
        position = params[:case_action].split("_").last.to_i
        rule_data = params[:edit_rule].merge(:language => tr8n_current_language)
        lcase.language_case_rules.insert(position, Tr8n::LanguageCaseRule.new(rule_data))
      
      elsif params[:case_action].index("update_rule_at")
        position = params[:case_action].split("_").last.to_i
        rule_data = params[:edit_rule].merge(:language => tr8n_current_language)
        lcase.language_case_rules[position].definition = params[:edit_rule][:definition]

      elsif params[:case_action].index("move_rule_up_at")
        position = params[:case_action].split("_").last.to_i
        temp_node = lcase.language_case_rules[position-1]
        lcase.language_case_rules[position-1] = lcase.language_case_rules[position]
        lcase.language_case_rules[position] = temp_node              

      elsif params[:case_action].index("move_rule_down_at")
        position = params[:case_action].split("_").last.to_i
        temp_node = lcase.language_case_rules[position+1]
        lcase.language_case_rules[position+1] = lcase.language_case_rules[position]
        lcase.language_case_rules[position] = temp_node              
              
      elsif params[:case_action].index("delete_rule_at")
        position = params[:case_action].split("_").last.to_i
        lcase.language_case_rules.delete_at(position)
      
      elsif params[:case_action].index("clear_all")
        lcase.language_case_rules = []
      
      end
    
      render(:partial => "edit_language_case_rules", :locals => {:lcase => lcase, :case_index => case_index})
    end
ajax method for updating language case rules in edit mode