function commentSubmit(){
	if(document.getElementById("name").value == ""){
		document.getElementById("name").focus();
		document.getElementById("name").style.background = "#FFFF99";
		document.getElementById("name").style.border = "1px solid #CF3339";
		return false;
	}
	if(document.getElementById("email").value == ""){
		document.getElementById("email").focus();
		document.getElementById("email").style.background = "#FFFF99";
		document.getElementById("email").style.border = "1px solid #CF3339";
		return;
	}
	if(document.getElementById("email").value.length > 0){
		if(!isemail(document.getElementById("email").value)){
			document.getElementById("email").focus();
			document.getElementById("email").value = "";
			return;
		}
	}
	if(document.getElementById("contents").value == ""){
		document.getElementById("contents").focus();
		document.getElementById("contents").style.background = "#FFFF99";
		document.getElementById("contents").style.border = "1px solid #CF3339";
		return false;
	}
	document.getElementById("commentform").submit();
}
function isemail(email){
	var re = /^(\w|[^_]\.[^_]|[\-])+(([^_])(\@){1}([^_]))(([a-z]|[\d]|[_]|[\-])+|([^_]\.[^_])*)+\.[a-z]{2,3}$/i;
	return re.test(email);
}
function makePOSTAddRequest(url,parameters,id){
	http_request = false;
	if(window.XMLHttpRequest){
		http_request = new XMLHttpRequest();
		if(http_request.overrideMimeType){
			http_request.overrideMimeType('text/html');
		}
		} else if(window.ActiveXObject){
		try{
			http_request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch(e){
		try{
			http_request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch(e){}
		}
	}
	if(!http_request){
		alert('Cannot create XMLHTTP instance');
		return false;
	}
	http_request.onreadystatechange = function(){
		alertAdd(id); 
	};
	http_request.open('POST', url, true);
	http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	http_request.setRequestHeader("Content-length", parameters.length);
	http_request.setRequestHeader("Connection", "close");
	http_request.send(parameters);
}
function alertAdd(id){
	document.getElementById(id).innerHTML="<br><p align=\"center\"><img src=\"/images/loading.gif\"><br>T&#7843;i d&#7919; li&#7879;u</p>";
	if(http_request.readyState == 4){
		if(http_request.status == 200){
			result = http_request.responseText;
			document.getElementById(id).innerHTML = result;           
		} else{
			alert('Welcome to website www.vncollect.com');
		}
	}
}
function actComment(obj,id){
	var postComment = "data=" + encodeURIComponent(document.getElementById("name").value) +
	"|" + encodeURIComponent(document.getElementById("email").value) + 
	"|" + encodeURIComponent(document.getElementById("contents").value) + 
	"|" + encodeURIComponent(document.getElementById("datID").value) + 
	"|" + encodeURIComponent(document.getElementById("comAction").value);
	/*alert(postComment);*/
	makePOSTAddRequest('/comments.php', postComment,id);
}