var request266686489 = createRequest(); // Inform the db that the zak has been checked

function Submit_XML_Request (Community_ID, XML_Request) {   
   //^Send request for Profile properties, such as Latest Replies, and Friend Posts
	 var url = "Ajax-2-Community-XML.php";

		 request266686489.open("POST", url, true); /* this line initiates the connection */
		 request266686489.onreadystatechange = update_XML_Request;
		 request266686489.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	 
		request266686489.send("Community_ID=" + Community_ID + "&XML_Request=" + XML_Request); /* this sends the request (with zero data) */
} // Submit the XML request to get right side profile modules [ Submit XML Request ]
  
function update_XML_Request() {  

  if (request266686489.readyState == 4) {
		if (request266686489.status == 200) {
		// Get the updated result from the XML response
		var xmlDoc = request266686489.responseXML;

			if (xmlDoc.getElementsByTagName ("XML_Request")[0].firstChild.nodeValue == "Right_Side_Panel") {

				show_related_communities (xmlDoc);				
				show_latest_post (xmlDoc);		
				show_top_users (xmlDoc);
				show_community_members (xmlDoc);
			
			}

		}
		request266686489.createRequest();    	
	}
} // Get XML request for the right side profile modules [ update XML Request ]
  
function show_top_users (xmlDoc) {
		// --- Update the page with latest replies --- //
		XMLcount = xmlDoc.getElementsByTagName ("Top_User_Profile").length; 
		for (i=0; i < XMLcount; i++) {

			var XML_User_Profile = unescape(xmlDoc.getElementsByTagName ("Top_User_Profile")[i].firstChild.nodeValue); 
			//http://www.the-art-of-web.com/javascript/escape/

		    var top_user = document.getElementById("top_user" + i);
			top_user.innerHTML = "<span id = 'Field'>" + XML_User_Profile + "</span>";
		}	
		
} // show the top users in this community based on their recent karma gain [ show top users ]

function show_related_communities (xmlDoc) {

		XMLcount = xmlDoc.getElementsByTagName ("Related_Community_Name").length; 
		for (i=0; i < XMLcount; i++) {

			var XML_Related_Community_Name = decodeURIComponent(xmlDoc.getElementsByTagName ("Related_Community_Name")[i].firstChild.nodeValue); 
			var XML_Related_Community_Photo_Link = decodeURIComponent(xmlDoc.getElementsByTagName ("Related_Community_Photo_Link")[i].firstChild.nodeValue); 			
			//http://www.the-art-of-web.com/javascript/escape/

		    var Related_Community_Name = document.getElementById("Related_Community_Name" + i);
			Related_Community_Name.innerHTML = XML_Related_Community_Name;
			
		    var Related_Community_Photo = document.getElementById("Related_Community_Photo" + i);
			Related_Community_Photo.innerHTML = XML_Related_Community_Photo_Link;			
		}	
		
} // show all the related communities [ show related communities ]

function show_community_members (xmlDoc) {

		XMLcount = xmlDoc.getElementsByTagName ("Member_First_Name").length; 
		for (i=0; i < XMLcount; i++) {

			var XML_Community_Member_Name = unescape(xmlDoc.getElementsByTagName ("Member_First_Name")[i].firstChild.nodeValue); 
			var XML_Member_Photo_Link = decodeURIComponent(xmlDoc.getElementsByTagName ("Member_Photo_Link")[i].firstChild.nodeValue); 			
			//http://www.the-art-of-web.com/javascript/escape/

		    var Community_Member_Name = document.getElementById("Community_Member_Name" + i);
			Community_Member_Name.innerHTML = "<span id = 'Field'>" + XML_Community_Member_Name + "</span>";
			
		    var Member_Photo_Link = document.getElementById("Member_Photo_Link" + i);
			Member_Photo_Link.innerHTML = XML_Member_Photo_Link;			
		}	
		
} // show all the members in this community [ show community members ]

function show_latest_post (xmlDoc) {

	var XML_Latest_Community_Post = unescape(xmlDoc.getElementsByTagName ("Latest_Community_Post")[0].firstChild.nodeValue); 
	var XML_Latest_Community_Post_Author_Name = unescape(xmlDoc.getElementsByTagName ("Latest_Community_Post_Author_Name")[0].firstChild.nodeValue); 			
			//http://www.the-art-of-web.com/javascript/escape/

		    var Latest_Community_Post = document.getElementById("Latest_Community_Post");
		    var Latest_Community_Post_Author_Name = document.getElementById("Latest_Community_Post_Author_Name");			
			
			Latest_Community_Post.innerHTML = XML_Latest_Community_Post;
			Latest_Community_Post_Author_Name.innerHTML = XML_Latest_Community_Post_Author_Name;			
			
		//}	
		
} // [ Show Latest Post ]
