define(["util", "ui", "jquery", "windowing", "templates", "templating", "session", "peers"], function (util, ui, $, windowing, templates, templating, session, peers) {
var assert = util.assert;
var walkthrough = util.Module("walkthrough");
var onHideAll = null;
var container = null;
var slides = null;
walkthrough.start = function (firstTime, doneCallback) {
if (! container) {
container = $(templates.walkthrough);
container.hide();
ui.container.append(container);
slides = container.find(".togetherjs-walkthrough-slide");
slides.hide();
var progress = $("#togetherjs-walkthrough-progress");
slides.each(function (index) {
var bullet = templating.sub("walkthrough-slide-progress");
progress.append(bullet);
bullet.click(function () {
show(index);
});
});
container.find("#togetherjs-walkthrough-previous").click(previous);
container.find("#togetherjs-walkthrough-next").click(next);
ui.prepareShareLink(container);
container.find(".togetherjs-self-name").bind("keyup", function (event) {
var val = $(event.target).val();
peers.Self.update({name: val});
});
container.find(".togetherjs-swatch").click(function () {
var picker = $("#togetherjs-pick-color");
if (picker.is(":visible")) {
picker.hide();
return;
}
picker.show();
picker.find(".togetherjs-swatch-active").removeClass("togetherjs-swatch-active");
picker.find(".togetherjs-swatch[data-color=\"" + peers.Self.color + "\"]").addClass("togetherjs-swatch-active");
var location = container.find(".togetherjs-swatch").offset();
picker.css({
top: location.top,