function GetXmlHttpObject()
{
	var xmlHttp=null;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
}

var base_url = location.protocol+"//"+location.host+"/";

function setupXmlHttp(url)
{
	xmlHttp=GetXmlHttpObject();
	url = url.replace(base_url,'');
	url = base_url+url;
	return url;
}


function sendXmlHttp(url)
{
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

//url is the url called for the dynamic html
//id is the id in which the html will be placed
function getHTML(url, id)
{
	url = setupXmlHttp(url);
	setXmlOnReady(url, id);
	sendXmlHttp(url);
}

function setXmlOnReady(url, id)
{
	xmlHttp.onreadystatechange=function()
	{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{
			if(id)
			{
				setHTML(xmlHttp.responseText, id);
			}
		} 
	}	
}

//url is the url called for the dynamic html
//id is the id in which the html will be placed
function setHTML(html, id)
{
	var ele = document.getElementById(id);
	if(ele)
	{
		ele.innerHTML= html;
	}
}
