var xmlhttp;
function getObj(){
	x=null;
	if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
	//	alert("NOT IE");
	  x= new XMLHttpRequest();
  	}
	else if (window.ActiveXObject){// code for IE6, IE5
		//alert("IE");
	  x=new ActiveXObject("Microsoft.XMLHTTP");
  	}
	return x;
}

function friend_recom(name,email,friends_name,friends_email,comments){
	
	xmlhttp=getObj();
	if(xmlhttp==null){
		alert("Sorry, ur browser doesnot support Ajax");
		return;
	}
		
	var url="friend_recom.php";
	var p="name="+name+"&email="+email+"&friends_name="+friends_name+"&friends_email="+friends_email+"&comments="+comments+"&r="+Math.random();
	
	xmlhttp.onreadystatechange=state_f;
	
	xmlhttp.open("POST",url,true);	
	xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlhttp.setRequestHeader("Content-length", p.length);
	xmlhttp.setRequestHeader("Connection", "close");

	xmlhttp.send(p);
	
	}
	
function state_f()
	{
		//alert(xmlhttp.readyState);
		
	if (xmlhttp.readyState==4)
	  {
			document.getElementById("recommended").innerHTML=xmlhttp.responseText;
			document.getElementById('name').value='';
		document.getElementById('email').value='';
	document.getElementById('friends_name').value='';
	document.getElementById('friends_email').value='';
	document.getElementById('comments').value='';
			
			
		
	  }
	  else{
	  	document.getElementById("recommended").innerHTML='please wait....';
  	  }
}	

//-------------------------------------------end------------------------------------------------
// JavaScript Document
