anchor.diff:  %% @doc Convienience function to render javascript code.
   %% Eager flag can be used.
   %% @end
  --spec wire(Target :: binary(), Method :: binary(), Args :: binary(), Eager :: boolean()) -> ok.
  -%% ====================================================================
  -wire(Target, Method, Args, Eager) ->
  +-spec wire(TargetID :: binary(), Method :: binary(), Args :: binary(), Eager :: boolean()) -> ok.
  +%% ====================================================================
  +wire(TargetID, Method, Args, Eager) ->
       RenderedArgs = case Args of
                          <<"">> -> <<"">>;
                          <<"''">> -> <<"''">>;
                          _ -> <<"'", Args/binary, "'">>
                      end,
  -    Script = <<"$('#", Target/binary, "').", Method/binary, "(", RenderedArgs/binary, ");">>,
  +    Script = <<"$('#", TargetID/binary, "').", Method/binary, "(", RenderedArgs/binary, ");">>,
       wire(Script, Eager).
   
   
  
positive.code: redirect_from_login() ->
      case wf:q(<<"x">>) of
          undefined -> wf:redirect(<<"/">>);
          TargetPage -> wf:redirect(TargetPage)
      end.
  
  
  
negative.code: %% ====================================================================
  %% @doc Updates contents of a DOM element.
  %% @end
  -spec update(TargetID :: binary(), Content :: term()) -> ok.
  %% ====================================================================
  update(TargetID, Elements) ->
      RenderedElements = gui_str:js_escape(wf:render(Elements)),
      wire(TargetID, <<"html">>, RenderedElements, true).
  
  
  %% replace/2
  %% ====================================================================
  %% @doc Replaces a DOM element with another.
  %% @end
  -spec replace(TargetID :: binary(), Content :: term()) -> ok.
  %% ====================================================================
  replace(TargetID, Elements) ->
      RenderedElements = gui_str:js_escape(wf:render(Elements)),
      wire(TargetID, <<"replaceWith">>, RenderedElements, true).
  
  
  %% insert_top/2
  %% ====================================================================
  %% @doc Prepends an element to a DOM element.
  %% @end
  -spec insert_top(TargetID :: binary(), Content :: term()) -> ok.
  %% ====================================================================
  insert_top(TargetID, Elements) ->
      RenderedElements = gui_str:js_escape(wf:render(Elements)),
      wire(TargetID, <<"prepend">>, RenderedElements, true).
  
  
  %% insert_bottom/2
  %% ====================================================================
  %% @doc Appends an element to a DOM element.
  %% @end
  -spec insert_bottom(TargetID :: binary(), Content :: term()) -> ok.
  %% ====================================================================
  insert_bottom(TargetID, Elements) ->
      RenderedElements = gui_str:js_escape(wf:render(Elements)),
      wire(TargetID, <<"append">>, RenderedElements, true).
  
  
  %% insert_before/2
  %% ====================================================================
  %% @doc Inserts an element before a DOM element.
  %% @end
  -spec insert_before(TargetID :: binary(), Content :: term()) -> ok.
  %% ====================================================================
  insert_before(TargetID, Elements) ->
      RenderedElements = gui_str:js_escape(wf:render(Elements)),
      wire(TargetID, <<"before">>, RenderedElements, true).
  
  
  %% insert_after/2
  %% ====================================================================
  %% @doc Inserts an element after a DOM element.
  %% @end
  -spec insert_after(TargetID :: binary(), Content :: term()) -> ok.
  %% ====================================================================
  insert_after(TargetID, Elements) ->
      RenderedElements = gui_str:js_escape(wf:render(Elements)),
      wire(TargetID, <<"after">>, RenderedElements, true).
  
  
  %% remove/1
  %% ====================================================================
  %% @doc Removes an element from DOM.
  %% @end
  -spec remove(TargetID :: binary()) -> ok.
  %% ====================================================================
  remove(TargetID) ->
      wire(TargetID, <<"remove">>, <<"">>, true).
  
  
  %% show/1
  %% ====================================================================
  %% @doc Displays an HTML element.
  %% @end
  -spec show(TargetID :: binary()) -> ok.
  %% ====================================================================
  show(TargetID) ->
      wire(TargetID, <<"show">>, <<"">>, false).
  
  
  %% hide/1
  %% ====================================================================
  %% @doc Hides an HTML element.
  %% @end
  -spec hide(TargetID :: binary()) -> ok.
  %% ====================================================================
  hide(TargetID) ->
      wire(TargetID, <<"hide">>, <<"">>, false).
  
  
  %% add_class/2
  %% ====================================================================
  %% @doc Adds a class to an HTML element.
  %% @end
  -spec add_class(TargetID :: binary(), Class :: binary()) -> ok.
  %% ====================================================================
  add_class(TargetID, Class) ->
      wire(TargetID, <<"addClass">>, Class, false).
  
  
  %% remove_class/2
  %% ====================================================================
  %% @doc Removes a class from an HTML element.
  %% @end
  -spec remove_class(TargetID :: binary(), Class :: binary()) -> ok.
  %% ====================================================================
  remove_class(TargetID, Class) ->
      wire(TargetID, <<"removeClass">>, Class, false).
  
  
  %% slide_up/2
  %% ====================================================================
  %% @doc Animates an HTML element, displaying it in sliding motion.
  %% @end
  -spec slide_up(TargetID :: binary(), Speed :: integer()) -> ok.
  %% ====================================================================
  slide_up(TargetID, Speed) ->
      wire(TargetID, <<"slideUp">>, integer_to_binary(Speed), false).
  
  
  %% slide_down/2
  %% ====================================================================
  %% @doc Animates an HTML element, hiding it in sliding motion.
  %% @end
  -spec slide_down(TargetID :: binary(), Speed :: integer()) -> ok.
  %% ====================================================================
  slide_down(TargetID, Speed) ->
      wire(TargetID, <<"slideDown">>, integer_to_binary(Speed), false).
  
  
  %% fade_in/2
  %% ====================================================================
  %% @doc Animates an HTML element, making it appear over time.
  %% @end
  -spec fade_in(TargetID :: binary(), Speed :: integer()) -> ok.
  %% ====================================================================
  fade_in(TargetID, Speed) ->
      wire(TargetID, <<"fadeIn">>, integer_to_binary(Speed), false).
  
  
  %% fade_out/2
  %% ====================================================================
  %% @doc Animates an HTML element, making it disappear over time.
  %% @end
  -spec fade_out(TargetID :: binary(), Speed :: integer()) -> ok.
  %% ====================================================================
  fade_out(TargetID, Speed) ->
      wire(TargetID, <<"fadeOut">>, integer_to_binary(Speed), false).
  
  
  %% delay/2
  %% ====================================================================
  %% @doc Delays javascript actions on given target.
  %% @end
  -spec delay(TargetID :: binary(), Time :: integer()) -> ok.
  %% ====================================================================
  delay(TargetID, Time) ->
    wire(TargetID, <<"delay">>, Time, false).
  
  
  %% focus/1
  %% ====================================================================
  %% @doc Focuses an HTML element.
  %% @end
  -spec focus(TargetID :: binary()) -> ok.
  %% ====================================================================
  focus(TargetID) ->
      wire(TargetID, <<"focus">>, <<"">>, false).
  
  
  %% set_text/2
  