function createRequestObject() {
	var ro;
	if (navigator.appName == "Microsoft Internet Explorer") {
		ro = new ActiveXObject("Microsoft.XMLHTTP");
	} else {
		ro = new XMLHttpRequest();
	}
	return ro;
}
var http = createRequestObject();



function addtxtmate(field, id) {
	http.open('get', 'http://www.txtmate.com/www-modules/addfriend.php?fid=' + id);
	http.onreadystatechange = res(field);
	http.send(null);
}


function res(field) {
	if (http.readyState == 4) {
		document.getElementById(field).innerHTML = http.responseText;
		//alert(http.responseText);
	}
}

function request(div, id, action){
         // Set up request varible
         try {xmlhttp = window.XMLHttpRequest?new XMLHttpRequest(): new ActiveXObject("Microsoft.XMLHTTP");}  catch (e) { alert("Error: Could not load page.");}
		 
         //Show page is loading
         document.getElementById(div).innerHTML = '<img src="http://www.txtmate.com/nt_images/loading.gif" />';
      		
			 //scroll to top
			 
			 //scroll(0,0);
			 xmlhttp.open('get', 'http://www.txtmate.com/requestaction.php?action=' + action + '&rid='+id);
			 //xmlhttp.open('GET', 'http://www.txtmate.com/addfriend.php?fid=' + id);	
			    xmlhttp.onreadystatechange = function(){
                 //Check page is completed and there were no problems.
                
				 if (xmlhttp.readyState == 4) {
					 if (xmlhttp.status == 200) {
							document.getElementById(div).innerHTML = xmlhttp.responseText;							
						//}
					 } else {
						alert('There was a problem with the request.');
					 }
				  }
					 }
			 //send data
			  		
			  xmlhttp.send(null); 
			  return false ;
		/* }*/
}

function addf(div,id) {
         // Set up request varible
         try {xmlhttp = window.XMLHttpRequest?new XMLHttpRequest(): new ActiveXObject("Microsoft.XMLHTTP");}  catch (e) { alert("Error: Could not load page.");}
		 
         //Show page is loading
         document.getElementById(div).innerHTML = '<img src="http://www.txtmate.com/nt_images/loading.gif" />';
      		
			 //scroll to top
			 
			 //scroll(0,0);
			 xmlhttp.open('GET', 'http://www.txtmate.com/addfriend.php?fid=' + id);	
			    xmlhttp.onreadystatechange = function(){
                 //Check page is completed and there were no problems.
                
				 if (xmlhttp.readyState == 4) {
					 if (xmlhttp.status == 200) {
							document.getElementById(div).innerHTML = xmlhttp.responseText;							
						//}
					 } else {
						alert('There was a problem with the request.');
					 }
				  }
					 }
			 //send data
			  		
			  xmlhttp.send(null); 
			  return false ;
		/* }*/
}


