function CheckOnEnter (obj, string)
{
	if (obj.value == string)
	{
		obj.value = "";
	}

	return;
}

function CheckOnLeave (obj, string)
{
	if (obj.value == "")
	{
		obj.value = string
	}

	return;
}

$(document).ready(function()
{
	$(".tab ul li span.currentbranch0").parent("li").addClass("currentbranch0");
	$(".tab ul li span.currentbranch0 a").parent("span").parent("li").removeClass("currentbranch0");

	var bodyClass = $("body").prop("class");
	var pageType;

	if (bodyClass.indexOf("leader") > -1)
	{
		var currentPath = location.pathname;
		var leaderPathPieces = currentPath.split("/");
		var leaderPath = leaderPathPieces[1];

		$("#middle").addClass(leaderPath);
	}

	if ($("#nav-secondary").length > 0)
	{
		var sectionHeader;
/*
		if ($(".nav-secondary-sectionmenu li").length == 0 || $(".nav-secondary-sectionmenu li").length != $(".nav-secondary-sectionmenu li a").length)
		{
			sectionHeader = $("li.nav-secondary-breadcrumb").last().prev().html();
			$("li.nav-secondary-breadcrumb").last().remove();
		}
		else
		{
			sectionHeader = $("li.nav-secondary-breadcrumb").last().html();
		}
*/
		if ($("ul#children-menu li").length > 0)
		{
			sectionHeader = $("li.nav-secondary-breadcrumb").last().html();
		}
		else
		{
			sectionHeader = $("li.nav-secondary-breadcrumb").last().prev().html();
			$("li.nav-secondary-breadcrumb").last().remove();
			$("#siblings-menu").show();
		}

		$("li.nav-secondary-breadcrumb").last().remove();
		$("#sectionHeaderPlaceholder").remove();
		$(".nav-secondary-sectionheader").prepend(sectionHeader);
	}

	$("a.newWindow").attr("target", "_blank");

	var hostname = location.hostname;

	if ($("#fblike").length && (hostname == "www.manchester.ac.uk" || hostname == "manchester.ac.uk"))
	{
		$("#fblike").onefblike({appID: "750565787"});
	}
});
