$(document).ready(function() {

var myLinksCollection = document.getElementsByTagName("a");
	
	for (var i = 0; i < myLinksCollection.length; i++) {
		if (myLinksCollection[i].parentNode.className === "heading") {
			myLinksCollection[i].onclick = function() {
				var myClicked = this.parentNode.id;
				$("div.helptitle").css("overflow", "visible");
				myClicked = myClicked.replace("heading-", "");
				$("#container").css("height", "1200px");
				$("#help-message").fadeOut(500, function() {
												 document.getElementById("help-content").innerHTML = document.getElementById("help-"+myClicked).innerHTML;
												 $("#container").css("height", "auto");
												 });
				
				$("#help-message").fadeIn(500, function () {
													$("div.helptitle").css("overflow", "auto");
													$("#container").css("height", "auto");
													$.scrollTo("#help-message", {duration: 700, axis:"y"});
												 });
				
				return false;
			} // anon func ends

		} // if statement ends

	} // for loop ends

		document.getElementById("close").onclick = function() {
			$("div.helptitle").css("overflow", "visible");
			$("#help-message").fadeOut(500);
			$.scrollTo("#container", {duration: 700, axis:"y"});
			return false;
		}

});


