// JavaScript Document
var httpRequest = null;
function cleanItUp(passedURL,divID,bodyID)
{
	if (window.XMLHttpRequest) 
	{
		// If IE7, Mozilla, Safari, and so on: Use native object.
		httpRequest = new XMLHttpRequest();
	}
	else
	{
		if (window.ActiveXObject) 
	  	{
		// ...otherwise, use the ActiveX control for IE5.x and IE6.
		httpRequest = new ActiveXObject('MSXML2.XMLHTTP.3.0');
	  	}
	}
	bodyID = bodyID.substring(0,4);
	passedURL = '/' + bodyID + passedURL;
	if(httpRequest != null)
	{
		httpRequest.open('GET', passedURL, false);
		httpRequest.send(null);
		var theText = httpRequest.responseText;
		// go through and remove the data identifier first
		theText = theText.replace('myHTMLdata=',''); 
		// use replaceAll function to change other tags as needed...
		theText = escape(theText);// Escapes all characters to URL Encode
		theText = theText.replaceAll('%0D','%20');
		theText = theText.replaceAll('%0A','%20');
		theText = unescape(theText);// Reformats Characters as HTML
		var myNew = document.getElementById(divID);
		myNew.innerHTML = theText;
	}
	else
	{
		theText = 'Could not retrieve data.';
		var myNew = document.getElementById(divID);
		myNew.innerHTML = theText;
	}
}
String.prototype.replaceAll = function(strTarget, strSubString)
{
	var strText = this;
	var intIndexOfMatch = strText.indexOf( strTarget );
	// Keep looping while an instance of the target string
	// still exists in the string.
	while (intIndexOfMatch != -1)
	{
		// Relace out the current instance.
		strText = strText.replace( strTarget, strSubString )
		// Get the index of any next matching substring.
		intIndexOfMatch = strText.indexOf( strTarget );
	}
	// Return the updated string with ALL the target strings
	// replaced out with the new substring.
	return(strText);
}
