document.write ('<script type="text/javascript" src="/common/scripts/jquery.history.js"></script>');

SB.ajax = true;
SB.update = function (hash) {
	var keyword = hash.replace ("keyword=", "");
	SB.input.removeClass ("placeholder").val (keyword.replace (/\+/g, " "));
	var title = function () {
		switch ($ ("html").attr ("lang")) {
			case "de":
				return "Fugue Icons Suche";
				break;
			case "es":
				return "Buscar con Fugue Icons";
				break;
			case "fr":
				return "Recherche Fugue Icons";
				break;
			case "ja":
				return "Fugue Icons Search";
				break;
			default:
				return "Fugue Icons Search";
				break;
		}
	} () + " | p.yusukekamiyamane";
	var url = location.pathname + "?ajax=1";
	if (keyword) {
		document.title = keyword.replace (/\+/g, " ") + " | " + title;
		$ ("a.search-box-hash").each (function () {
			$ (this).get (0).hash = "keyword=" + keyword;
		});
		url += "&keyword=" + keyword;
	} else {
		document.title = title;
		$ ("a.search-box-hash").each (function () {
			$ (this).get (0).hash = "";
		});
	}
	pageTracker._trackPageview (url);
	$ ("div.ajax").load (url + " div.ajax > *", function () {
		SB.initialize ();
	});
}
$ (function () {
	if (location.search) {
		location.replace (location.href.replace ("?keyword=", "#keyword="));
	} else {
		$.history.init (function (hash) {
			SB.update (hash);
		}, {
			unescape: "+="
		});
	}
});
