$jq(function() {
  var path, prev, next, endtour, tour, cookie_tour, cookie_value;

  path = location.pathname.substring(0, 8);
  if (path != "/en" && path != "/en/") path = "/";

  prev = Drupal.t("&laquo; Prev");
  next = Drupal.t("Next &raquo;");
  endtour = Drupal.t("End Tour");

  tour = new Tour({
    template: "<div class='popover'> \
      <div class='arrow'></div> \
      <h3 class='popover-title' style='font-weight: bold;'></h3> \
      <div class='popover-content small'></div> \
      <div class='popover-navigation'> \
        <div class='btn-group'> \
        <button class='btn btn-sm btn-default' data-role='prev'>" + prev + "</button> \
        <button class='btn btn-sm btn-default' data-role='next'>" + next + "</button> \
        </div> \
        <button class='btn btn-sm btn-default' data-role='end'>" + endtour + "</button> \
      </div> \
      </div>",
    steps: [
      {
        element: "#user-options",
        placement: "left",
        title: Drupal.t("Welcome!"),
        content: Drupal.t("Remember, here you can see your user profile and main options.")
      } , {
        path: path,
        element: "li.suitedesk",
        placement: "bottom",
        title: Drupal.t("What is SuiteDesk?"),
        content: Drupal.t("SuiteDesk is a web based software useful for project management, planning, personal productivity, communication between project stakeholders, collaboration, customers support, documentation, cost control and change management.")
      } , {
        path: path,
        element: "#stormprojects",
        placement: "bottom",
        title: Drupal.t("Active projects"),
        content: Drupal.t("Here you can see your projects. At the most basic level, SuiteDesk will help to track projects from start to finish, allows for the creation, assignment and control of tasks and deadlines, and let project stakeholders at different levels to have an input into the process.")
      } , {
        path: path,
        element: "#stormtickets",
        placement: "bottom",
        title: Drupal.t("An issue tracking system"),
        content: Drupal.t("SuiteDesk facilitates the reporting, notifying, updating, and viewing of issues like bugs, errors and new features. If you want to notify a bug or track an issue, here you can do it. A support ticket should include vital information for the account involved and the issue encountered.")
      } , {
        path: path,
        element: "#storminvoices",
        placement: "bottom",
        title: Drupal.t("Easy invoice tracking"),
        content: Drupal.t("SuiteDesk give you total control of the invoicing and payment activities of projects you are involved with.")
      } , {
        path: path,
        element: "#stormdok",
        placement: "bottom",
        title: Drupal.t("Sharing project documents"),
        content: Drupal.t("It is vital to keep all participants up to date on what is going on. Document sharing and collaboration is essentially a document repository that all project stakeholders have access to.")
      } , {
        path: path,
        element: "#stormfaq",
        placement: "bottom",
        title: Drupal.t("Frequently Asked Questions"),
        content: Drupal.t("A compilation of questions and answers commonly asked by a new customer, user or project member. Before asking a question make sure that you've checked out this list.")
      } , {
        path: path,
        element: "#stormwatcher",
        placement: "bottom",
        title: Drupal.t("Watch content for changes"),
        content: Drupal.t("SuiteDesk lets users a way to easily watch tickets for changes or new comments without having to post themselves. Supports email notifications being sent when both or either of the above occurs.")
      } , {
        path: path,
        element: "#edit-custom-search-blocks-form-1-1",
        placement: "bottom",
        title: Drupal.t("Search in SuiteDesk"),
        content: Drupal.t("You can search for words and phrases on each page. SuiteDesk will show you where the search phrase you've typed appears and lets you highlight all the places where it appears.")
      } , {
        path: path,
        element: "#block-views-updates_recent-block_1",
        placement: "top",
        title: Drupal.t("Updated content"),
        content: Drupal.t("And this block displays the last updated contents of your projects in SuiteDesk.")
      }
    ]
  }).init().start(true);

  if (decodeURI((RegExp('tour=' + '(.+?)(&|$)').exec(location.search)||[,null])[1]) == 'suitedesk') {
    tour.goTo(1);
  }
});