/* 	main.js	part of the WordPress theme "flaxfamily" by Avi Flax, avi@flaxfamily.com	requires: prototype, scriptaculous*/Event.observe(window, "load", initCommentForm, false);function initCommentForm() {	// create pointer to comment form. makes code easier to read and infintismally faster	var commentForm = $("commentform");	if (!commentForm) return null; 	// Hide the comment form title	Element.hide("respondHeader");	if (Element.visible(commentForm)) Element.hide(commentForm);		// Create the "Respond To this Post" button	var theButton = document.createElement("button");	theButton.id = "respondButton";	theButton.appendChild(document.createTextNode("Quick-Respond to this post"));		// Insert the button into the container of the comment form, just above it	Try.these(		function(){ commentForm.parentNode.insertBefore(theButton, commentForm); },		function(){ $("featuredPostDiv").insertBefore(theButton, commentForm); },		function(){ $("postDiv").appendChild(theButton); }	);	// Register an event listener to Open & Close the comment form	Event.observe(theButton, "click", toggleCommentForm);		// Catch the comment form submission. submitComment() is in ajax_comments.js	Event.observe("commentform", "submit", submitComment);		return true;}function toggleCommentForm(buttonLabel) {	new Effect.toggle('commentform', 'appear',  {		buttonLabel: buttonLabel,		afterFinish:function(effect) {			var buttonText = $('respondButton').firstChild;						if (effect.options.buttonLabel.length)			{				buttonText.nodeValue = effect.options.buttonLabel;			}			else if ($("commentform").style.display == "none")			{				// we just hid the comment form				buttonText.nodeValue = "Quick-Respond to this post";			}			else			{				// we just showed the comment form				buttonText.nodeValue = "Cancel Response";				if ($("author")) {					$F("author").length ? $("comment").focus() : $("author").focus();				} else {					$("comment").focus();				}			}		}	});}