       bc = $(element)
       href = bc.find('a')
       if href.length > 0
-        Breadcrumbs.mark_menu_item(href.html())
+        text = href.html()
       else
-        Breadcrumbs.mark_menu_item(bc.html())
+        text = bc.html()
+      Breadcrumbs.mark_menu_item(text)
+      Breadcrumbs.change_document_title(title_prefix, title_suffix, text) if (index + 1) >= $('.breadcrumb li').length
+
+    # default title if there is no breadcrumbs
+    Breadcrumbs.change_document_title("","", title_default) if $('.breadcrumb li').lenght <= 0
+
 
   @mark_menu_item: (val) ->
     finding_string = "li[data-breadcrumb-id='" + val + "']"

    found = $(finding_string)
    found.addClass('active') if found

window.Breadcrumbs = Breadcrumbs
#  hasCode(val)

class Breadcrumbs
  @mark_active_menu_items: (title_default, title_prefix, title_suffix) ->
    title_default = Breadcrumbs.load_title_default(title_default)
    title_prefix = Breadcrumbs.load_title_prefix(title_prefix)
    title_suffix = Breadcrumbs.load_title_suffix(title_suffix)


    $('a[data-breadcrumb-id],li[data-breadcrumb-id]').each (index, element) =>
      $(element).removeClass('active')

