//Create a boolean variable to check for a valid IE instance.
var xmlhttp = false;
//Check if we are using IE.
try {
//If the javascript version is greater than 5.
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
//If not, then use the older active x object.
try {
//If we are using IE.
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
//Else we must be using a non-IE browser.
xmlhttp = false;
}
}
//If we are using a non-IE browser, create a JavaScript instance of the object.
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
xmlhttp = new XMLHttpRequest();
}
//A variable used to distinguish whether to open or close the file.
var showFile = true;
function showCategory(page) {
		
			var objID = "data_content";
				//Change the current image of the minus or plus.
			if (showFile == true){
			
			var engageClass=document.getElementById(page).className = 'numberlink9';
				//The page we are loading.
				var cid = document.getElementById("cid");
				
			//alert(cid.value);
				var serverPage = "includes/ajax/category.php?cid="+cid.value+"&page="+page;
					//Set the open close tracker variable.
					
				//showFile = false;
				
				var obj = document.getElementById(objID);
				
				xmlhttp.open("GET", serverPage,true);
				xmlhttp.onreadystatechange = function() {
					if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
						obj.innerHTML = xmlhttp.responseText;
					}
			}
			xmlhttp.send(null);
			} else {
				//Hide the file.
				
				showFile = true;
			document.getElementById(objID).innerHTML = "";
			}
}
//this function is used in author-articles.php

function showAuthorArticle(page) {
		
			var objID = "date_content_author";
				//Change the current image of the minus or plus.
			if (showFile == true){
			
			var engageClass=document.getElementById(page).className = 'numberlink9';
				//The page we are loading.
				var uid = document.getElementById("uid");
				
			//alert(cid.value);
				var serverPage = "includes/ajax/author_article.php?uid="+uid.value+"&page="+page;
					//Set the open close tracker variable.
					
				//showFile = false;
				
				var obj = document.getElementById(objID);
				
				xmlhttp.open("GET", serverPage,true);
				xmlhttp.onreadystatechange = function() {
					if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
						obj.innerHTML = xmlhttp.responseText;
					}
			}
			xmlhttp.send(null);
			} else {
				//Hide the file.
					showFile = true;
			document.getElementById(objID).innerHTML = "";
			}
}
//this function is used in search-author-caegory.php
function showSearchAuthorCategory(page) {
	//alert("I am here");
		
			var objID = "data_content_search";
				//Change the current image of the minus or plus.
			if (showFile == true){
			
			var engageClass=document.getElementById(page).className = 'numberlink9';
				//The page we are loading.
				var authors = document.getElementById("author_nk");
				var category1 = document.getElementById("category1_nk");
				
			//alert(cid.value);
				var serverPage = "includes/ajax/search_author_category.php?authors="+authors.value+"&category1="+category1.value+"&page="+page;
					//Set the open close tracker variable.
					
				//showFile = false;
				
				var obj = document.getElementById(objID);
				
				xmlhttp.open("GET", serverPage,true);
				xmlhttp.onreadystatechange = function() {
					if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
						obj.innerHTML = xmlhttp.responseText;
					}
			}
			xmlhttp.send(null);
			} else {
				//Hide the file.
					showFile = true;
			document.getElementById(objID).innerHTML = "";
			}
}
//this function is used in search.php page
function showSearch(page) {
	//alert("I am here");
		
			var objID = "data_content_search";
				//Change the current image of the minus or plus.
			if (showFile == true){
			
			var engageClass=document.getElementById(page).className = 'numberlink9';
				//The page we are loading.
				var keywords = document.getElementById("keywords_nk");
				var category = document.getElementById("category_nk");
				
			//alert(cid.value);
				var serverPage = "includes/ajax/search.php?keywords="+keywords.value+"&category="+category.value+"&page="+page;
					//Set the open close tracker variable.
					
				//showFile = false;
				
				var obj = document.getElementById(objID);
				
				xmlhttp.open("GET", serverPage,true);
				xmlhttp.onreadystatechange = function() {
					if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
						obj.innerHTML = xmlhttp.responseText;
					}
			}
			xmlhttp.send(null);
			} else {
				//Hide the file.
					showFile = true;
			document.getElementById(objID).innerHTML = "";
			}
}