// JavaScript Document

function GHttpRequest(url, aFunction, aDiv) {
	
	var xmlhttp = null;
	
	if(window.XMLHttpRequest) {
		xmlhttp = new XMLHttpRequest();
	}	
	
	if(xmlhttp == null) {
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	}
	
	if(xmlhttp == null) {
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
	
	aDiv.innerHTML = "<img src='http://www.myfconline.com/images/loading.gif' height='30px' /> Loading...";
	
	//alert(xmlhttp);
	
	function checkStateChange(e) {
		if(xmlhttp.readyState == 4) {
			if(xmlhttp.status == 200) {
				aFunction(xmlhttp.responseText, aDiv);
			}	
		}
	}
	
	xmlhttp.onreadystatechange = checkStateChange;
	xmlhttp.open('GET', url);
	xmlhttp.send(null);
	
}

function requestPmHistory(mid1, aDiv) {
	
	var loadPmHistory = function(responseText) {
		aDiv.innerHTML = responseText;
	}
	
	var url = "http://www.myfconline.com/page/requestPmHistory.php?mid1=" + mid1;
	GHttpRequest(url, loadPmHistory, aDiv);
	
}

function requestMemberForumPosts(memberId, aDiv) {
	var loadMemberForumPosts = function(responseText) {
		aDiv.innerHTML = responseText;
	}
	var url = "http://www.myfconline.com/page/requestMemberForumPosts.php?member_id=" + memberId;
	GHttpRequest(url, loadMemberForumPosts, aDiv);
}

function requestFriendsList(memberId, aDiv) {
	var loadFriendsList = function(responseText) {
		aDiv.innerHTML = responseText;
	}
	var url = "http://www.myfconline.com/page/requestFriendsList.php?member_id=" + memberId;
	GHttpRequest(url, loadFriendsList, aDiv);
}