function XMLHTTPObject()
{
	var xmlhttp; 
	if (window.ActiveXObject) 
	{
		// Instantiate the latest Microsoft ActiveX Objects
		if (_XML_ActiveX)
		{
			xmlhttp = new ActiveXObject(_XML_ActiveX);
		}
		else
		{ 
			// loops through the various versions of XMLHTTP to ensure we're using the latest
			var versions = ["MSXML2.XMLHTTP", "Microsoft.XMLHTTP", "Msxml2.XMLHTTP.7.0", "Msxml2.XMLHTTP.6.0", "Msxml2.XMLHTTP.5.0", "Msxml2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0"];			
			for (var i = 0; i < versions.length ; i++) 
			{ 
				try
				{
					// Try and create the ActiveXObject for Internet Explorer, if it doesn't work, try again.
					xmlhttp = new ActiveXObject(versions[i]); 
					if (xmlhttp) 
					{ 
						var _XML_ActiveX = versions[i];
						break;
					}
				}
				catch (e)
				{
					// TRAP
				};
			}
			;
		}			
	}// Well if there is no ActiveXObject available it must be firefox, opera, or something else
	if (!xmlhttp && typeof XMLHttpRequest != 'undefined')
	{
		try 
		{ 
			xmlhttp = new XMLHttpRequest(); 
		} 
		catch (e) 
		{
			xmlhttp = false; 
		}
	}
	return xmlhttp;
}
function processRequest(displayId,httpRequest,refreshContentOnFunction,parameterForRefresh)
{ 
	if (httpRequest.readyState == 4) 
	{ 
		if(httpRequest.status == 200)
		{ 
			results = httpRequest.responseText; 
			// http.responseXML; which will lead to an XML based response,
			var para = document.getElementById(displayId); //or whatever ID you gave your element. 			
			para.innerHTML = results; 		
			if (refreshContentOnFunction != "null")
			{		
				refreshContent(refreshContentOnFunction,parameterForRefresh);	
							
			}
		}
		else 
		{ 
			var results = "Sorry, there was an error finding the server-side file. Please contact support."; 
			var para = document.getElementById(displayId); 
			para.innerHTML = results; 
		}
		
	}	
}

function populateByType(objType)
{
try
{
	var httpRequest=null;
	var refreshContent = "null";
	var result = true;
	var fields = new Array();
	var typeId = objType.value;	
	{
		;	
	}
	if (typeId != "Invalid")
	{
		httpRequest = XMLHTTPObject();			
		var varContentUrl =  "left.php?processfunction=populateByType&typeId="+typeId;				
		var displayId = "DivId";				
		var para = document.getElementById(displayId);
		para.innerHTML = "<img src='images/ajax-loader.gif'/>"; 
		httpRequest.open("GET", varContentUrl, true); 
		httpRequest.onreadystatechange = function () {processRequest(displayId,httpRequest,refreshContent,""); } ;
		httpRequest.setRequestHeader('Cache-Control', 'no-cache');
		httpRequest.setRequestHeader('Cache-Control', 'no-store');
		httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');		
		httpRequest.send(null);	
	}
	else
	{
		var objError = document.getElementById("DivId");
		objError.innerHTML = "<span class='errorstrings'>There is no record found for your search.Try again.</span>";
	}
}
catch(e)
{
	alert(e.description);
}
}
function populateByCity(objCity)
{
try
{
	var httpRequest=null;
	var refreshContent = "null";
	var result = true;
	var fields = new Array();
	var cityId = objCity.value;	
	{
		;	
	}
	if (cityId != "Invalid")
	{
		httpRequest = XMLHTTPObject();			
		var varContentUrl =  "left.php?processfunction=populateByCity&cityId="+cityId;				
		var displayId = "DivId";				
		var para = document.getElementById(displayId);
		para.innerHTML = "<img src='images/ajax-loader.gif'/>"; 
		httpRequest.open("GET", varContentUrl, true); 
		httpRequest.onreadystatechange = function () {processRequest(displayId,httpRequest,refreshContent,""); } ;
		httpRequest.setRequestHeader('Cache-Control', 'no-cache');
		httpRequest.setRequestHeader('Cache-Control', 'no-store');
		httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');		
		httpRequest.send(null);	
	}
	else
	{
		var objError = document.getElementById("DivId");
		objError.innerHTML = "<span class='errorstrings'>There is no record found for your search.Try again.</span>";
	}
}
catch(e)
{
	alert(e.description);
}
}
function populateByProject(objProject)
{
try
{
	var httpRequest=null;
	var refreshContent = "null";
	var result = true;
	var fields = new Array();
	var projectId = objProject.value;	
	{
		;	
	}
	if (projectId != "Invalid")
	{
		httpRequest = XMLHTTPObject();			
		var varContentUrl =  "left.php?processfunction=populateByProject&projectId="+projectId;				
		var displayId = "DivId";				
		var para = document.getElementById(displayId);
		para.innerHTML = "<img src='images/ajax-loader.gif'/>"; 
		httpRequest.open("GET", varContentUrl, true); 
		httpRequest.onreadystatechange = function () {processRequest(displayId,httpRequest,refreshContent,""); } ;
		httpRequest.setRequestHeader('Cache-Control', 'no-cache');
		httpRequest.setRequestHeader('Cache-Control', 'no-store');
		httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');		
		httpRequest.send(null);	
	}
	else
	{
		var objError = document.getElementById("DivId");
		objError.innerHTML = "<span class='errorstrings'>There is no record found for your search.Try again.</span>";
	}
}
catch(e)
{
	alert(e.description);
}
}
function populateByProjectname(objProject)
{
try
{
	var httpRequest=null;
	var refreshContent = "null";
	var result = true;
	var fields = new Array();
	var projectId = objProject.value;	
	{
		;	
	}
	if (projectId != "Invalid")
	{
		httpRequest = XMLHTTPObject();			
		var varContentUrl =  "latestcomments.php?processfunction=populateByProjectname&projectId="+projectId;				
		var displayId = "RightDivId";				
		var para = document.getElementById(displayId);
		para.innerHTML = "<img src='images/ajax-loader.gif'/>"; 
		httpRequest.open("GET", varContentUrl, true); 
		httpRequest.onreadystatechange = function () {processRequest(displayId,httpRequest,refreshContent,""); } ;
		httpRequest.setRequestHeader('Cache-Control', 'no-cache');
		httpRequest.setRequestHeader('Cache-Control', 'no-store');
		httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');		
		httpRequest.send(null);	
	}
	else
	{
		var objError = document.getElementById("RightDivId");
		objError.innerHTML = "<span class='errorstrings'>There is no record found for your search.Try again.</span>";
	}
}
catch(e)
{
	alert(e.description);
}
}
function populateByProjectname1(objProject)
{
try
{
	var httpRequest=null;
	var refreshContent = "null";
	var result = true;
	var fields = new Array();
	var projectId = objProject.value;	
	{
		;	
	}
	if (projectId != "Invalid")
	{
		httpRequest = XMLHTTPObject();			
		var varContentUrl =  "getuser.php?processfunction=populateByProjectname1&projectId="+projectId;				
		var displayId = "txtHint";				
		var para = document.getElementById(displayId);
		para.innerHTML = "<img src='images/ajax-loader.gif'/>"; 
		httpRequest.open("GET", varContentUrl, true); 
		httpRequest.onreadystatechange = function () {processRequest(displayId,httpRequest,refreshContent,""); } ;
		httpRequest.setRequestHeader('Cache-Control', 'no-cache');
		httpRequest.setRequestHeader('Cache-Control', 'no-store');
		httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');		
		httpRequest.send(null);	
	}
	else
	{
		var objError = document.getElementById("txtHint");
		objError.innerHTML = "<span class='errorstrings'>There is no record found for your search.Try again.</span>";
	}
}
catch(e)
{
	alert(e.description);
}
}

