/*wp thread comment 1.4.2*/
var cfmParent='';
var cfmlst='';

function movecfm(Id){
	var cfm = document.getElementById(vcommentform);

	if(cfm == null){
	  	alert("ERROR:\nThreaded Comments can't find the '"+vcommentform+"' div.\nThis is probably because you have changed\nthe comments.php file.\nMake sure there is a tag around the form\nthat has the id 'addcomment'");
		return;
	}

	var reRootElement = document.getElementById("reroot");

	if(reRootElement == null){
		alert("Error:\nThere is no anchor tag called 'reroot' where\nthe comment form starts.\nPlease compare your comments.php to the original\ncomments.php and copy the reroot anchor tag over.");
		return;
	}
	
	var replyId = document.getElementById("comment_reply_ID");
	
	if(replyId == null){
		alert("Error:\nThere is no hidden form field called\n'comment_reply_ID'. This is probably because you\nchanged the comments.php file and forgot\nto include the field. Please take a look\nat the original comments.php and copy the\nform field over.");
		return;
	}

	if(Id){
		if(cfmParent == '')
			cfmParent = cfm.parentNode;

		if(cfmlst == ''){
			if(cfmParent.lastChild != cfm){
				cfmlst = cfm.nextSibling;
			}else{
				cfmlst = 'nonecfmlst';
			}
		}

		var OId = document.getElementById("comment-"+Id);

		cfm.parentNode.removeChild(cfm);
		OId.appendChild(cfm);

		replyId.value = Id;

		reRootElement.style.display = "block";
		cfm.style.display = "block";
		document.getElementById("comment").focus();
	}else{
		replyId.value = "0";

		reRootElement.style.display = "none";
		cfm.parentNode.removeChild(cfm);
		if(cfmlst == 'nonecfmlst'){
			cfmParent.appendChild(cfm);
		}else{
			cfmParent.insertBefore(cfm, cfmlst);
		}
		document.getElementById("comment").focus();
	}
	return;
}