var xmlHttp;
function createXMLHttpRequest() {
    if (window.XMLHttpRequest) {
        xmlHttp = new XMLHttpRequest();
    }
    else if (window.ActiveXObject) {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    return xmlHttp; 
}

function startRequest(pageUrl,proce) {
	var url = pageUrl;
	var params = proce;
	createXMLHttpRequest();
	xmlHttp.onreadystatechange = viewDiv;
	xmlHttp.open("POST", url, true);
	xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8;");
	xmlHttp.setRequestHeader("Content-length", params.length);
	xmlHttp.setRequestHeader("Connection", "close");
	xmlHttp.send(params);
}

var vnum = 0
var commentWidth = null;
function reply(num,width){

	var f = document.commentForm;
	var userID = "<?=$userid?>";

	if(width == null)
		commentWidth = 470;
	else
		commentWidth = 470;
	
	alert(userID);

	if(userID == ""){
	
		alert("로그인후 글쓰기가능합니다");
		return false;
	
	}

	var textarea = "<textarea name=replycomment style=width:"+commentWidth+" onclick=textClear('reply')></textarea>";



	if(vnum != 0){
		
		var obj = document.getElementById("knowlreply"+vnum);
		var obj1 = document.getElementById("replycomment"+vnum);
		obj.style.display = "none";
		obj1.innerHTML = "";
	
	}
	
	var obj = document.getElementById("knowlreply"+num);
	var obj1 = document.getElementById("replycomment"+num);
	
	if(obj.style.display == "none" && obj1.innerHTML == ""){
		obj.style.display = "block";
		obj1.innerHTML = textarea;
	
	} else {
	
		obj.style.display = "none";
		obj1.innerHTML = "";
	
	}
	vnum = num;
}
