
// JavaScript Document
var xmlhttp;

function stateChanged(){
	if (xmlhttp.readyState==4){
		document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
	}
}

function GetXmlHttpObject(){
	if (window.XMLHttpRequest){
		return new XMLHttpRequest(); 								// code for IE7+, Firefox, Chrome, Opera, Safari
	}
	if (window.ActiveXObject){
	  return new ActiveXObject("Microsoft.XMLHTTP");				// code for IE6, IE5
	}
	return null;
}

function feedback_enter(frm){
	var name=frm.name.value;
	var phone=frm.pno.value;
	var add=frm.address.value;
	var email=frm.email.value;
	var comment=frm.comment.value;
	if(name!="" &&  phone!="" && add!="" && email!="" && comment!=""){
		xmlhttp=GetXmlHttpObject();
		if (xmlhttp==null){
		  alert ("Browser does not support HTTP Request");
		  return;
		}
		var url="comment.php";
		url=url+"?name="+name+"&pno="+phone+"&add="+add+"&email="+email+"&comment="+comment;
		//alert(url);
		xmlhttp.onreadystatechange=stateChanged;
		xmlhttp.open("GET",url,true);
		xmlhttp.send(null);
		frm.name.value=" ";
		frm.pno.value=" ";
		frm.address.value=" ";
		frm.email.value=" ";
		frm.comment.value=" ";
		alert("Thank you "+name+" for your comment");
	}
	else{
		alert("all fields are required !!!");
	}
}
