/*wp thread comment 1.4.4*/
var cfmParent=null;
var cfmlst=null;

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 false;
	}

	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 false;
	}
	
	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 false;
	}

	if(Id){

		replyId.value = Id;
		reRootElement.style.display = "block";

		var OId = document.getElementById("comment-"+Id);
/*		if(OId == null){
			alert("Error:\nThere is no hidden form field called\n'comment-xxx'. 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 false;
		}*/

		if(OId == null){
			if(cfmParent != null){
				cfm.parentNode.removeChild(cfm);
				if(cfmlst == 'nonecfmlst'){
					cfmParent.appendChild(cfm);
				}else{
					cfmParent.insertBefore(cfm, cfmlst);
				}
				cfmParent = null;
			}

			comment = document.getElementById("comment")
			
			comment.value = "alert this because themes conflict. now you is replying comment #" + Id;
			//var co = comment.value;
			comment.onclick = function(){
				if(this.value == comment.value)
					this.value='';
				comment.onclick = null;
			}
			comment.focus();
			comment.blur();
		}else{
			if(cfmParent == null)
				cfmParent = cfm.parentNode;

			if(cfmlst == null){
				if(cfmParent.lastChild != cfm){
					cfmlst = cfm.nextSibling;
				}else{
					cfmlst = 'nonecfmlst';
				}
			}

			cfm.parentNode.removeChild(cfm);
			OId.appendChild(cfm);

			document.getElementById("comment").focus();
		}

		cfm.style.display = "block";
	}else{

		replyId.value = "0";
		reRootElement.style.display = "none";

		if(cfmParent == null){
			//comment = document.getElementById("comment");
			//document.getElementById("comment").value = "";
			//comment.onclick = null;
		}else{
			cfm.parentNode.removeChild(cfm);
			if(cfmlst == 'nonecfmlst'){
				cfmParent.appendChild(cfm);
			}else{
				cfmParent.insertBefore(cfm, cfmlst);
			}
		}

		document.getElementById("comment").focus();
	}
	return true;
}