$(document).ready(function () {
	dhtmlHistory.initialize();
	dhtmlHistory.addListener(fnNavigate);
	var hash = dhtmlHistory.getCurrentHash();
	if (hash != "") {
		fnNavigate(hash, "domready");
	}
	$("#content-peoplesearch ul.toptabs a").attr("href", "#").click(function () {
		var _id = this.id.replace("link-peoplesearch-", "");
		fnNavigate("t=" + _id, true);
		dhtmlHistory.add("t=" + _id);
		return false;
	});
});

function fnNavigate ( hash, historydata ) {
	if (hash == "") {
		return;
	}
	$(".subcontent").hide();
	$("#content-peoplesearch .toptabs li").removeClass("selected");
	if (/^t=name$/.test(hash)) {
		$("#subcontent-peoplesearch-name").show();
		$("#subcontent-peoplesearch-name [name=FirstName]").focus();
		$("#link-peoplesearch-name").parent().addClass("selected");
	} else if (/^t=email$/.test(hash)) {
		$("#subcontent-peoplesearch-email").show();
		$("#subcontent-peoplesearch-email [name=Email]").focus();
		$("#link-peoplesearch-email").parent().addClass("selected");
	} else if (/^t=username$/.test(hash)) {
		$("#subcontent-peoplesearch-username").show();
		$("#subcontent-peoplesearch-username [name=Username]").focus();
		$("#link-peoplesearch-username").parent().addClass("selected");
	} else if (/^t=phone$/.test(hash)) {
		$("#subcontent-peoplesearch-phone").show();
		$("#subcontent-peoplesearch-phone [name=Phone]").focus();
		$("#link-peoplesearch-phone").parent().addClass("selected");
	}
}