    var http = null;
	 if(window.XMLHttpRequest){
          http = new XMLHttpRequest();
      } else if(window.ActiveXObject){
          http = new ActiveXObject("Microsoft.XMLHTTP");
      } else {
          http = "";
      }
function sendRequest_BlogComment() {
	if(checkfrm()==false) return false;
	var sBody = getRequestBody();
	var iblog_id = document.getElementById("iblog_id").value;
	var oXmlHttp = http;
	http.open("post", "blog_comment_a.php?iblog_id="+iblog_id, true);
	http.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	http.onreadystatechange = function () {
		if (http.readyState == 4) {
			if (http.status == 200) {
				saveResult(http.responseText);
			} else {
				saveResult("An error occurred: " + oXmlHttp.statusText);
			}
		}            
	};
	http.send(sBody);        
}

function getRequestBody() {
	var aParams = new Array();
	var sParam = '';
	
	sParam = encodeURIComponent('blog_author'); 
	sParam += "="+document.getElementById("blog_author").value;
	aParams.push(sParam);
	
	sParam = encodeURIComponent('blog_comment'); 
	sParam += "="+document.getElementById("blog_comment").value;
	aParams.push(sParam);
		
	return aParams.join("&");        
}

function checkfrm() {
	if(document.getElementById("blog_author").value==''){
		alert('Please enter name.');
		document.getElementById("blog_author").focus();
		return false;
	}
	
	if(document.getElementById("blog_comment").value==''){
		alert('Please enter comment.');
		document.getElementById("blog_comment").focus();
		return false;
	}
		
	return true;        
}

function saveResult(sMessage) {
	var divStatus = document.getElementById("divStatus");
	divStatus.innerHTML = "" + sMessage;
	document.getElementById("blog_author").value='';
	document.getElementById("blog_comment").value='';
	//parent.frames(0).location.href="index.php?file=blog_comment_list&iblog_id="+document.getElementById('iblog_id').value;            
}
