/**
 * Ajax - The javascript code for calling Ajax
 *
 * @author Anez A
 * @version 1.0
 */

function changeContent(baseUrl,callBack)
{	
	new loadXmlHttp(baseUrl,callBack);
}

function loadXmlHttp(baseUrl,callBack)
{	
	var f = this;
	f.xmlHttp=null;
	f.callBack=callBack;

	try
	{
	// Firefox, Opera 8.0+, Safari
		f.xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
			f.xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			f.xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	if (f.xmlHttp==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	} 
	var url=baseUrl;
	url=url+"&sid="+Math.random();
	url=url+"&uid="+(new Date()).getTime();
	f.xmlHttp.onreadystatechange=function(){f.stateChanged();};
	f.xmlHttp.open("GET",url,true);
	f.xmlHttp.send(null);
}
loadXmlHttp.prototype.stateChanged=function () 
{
	if (this.xmlHttp.readyState==4)
	{
		var result = this.xmlHttp.responseText;;
		//Give the data to the callback function.
		if(this.callBack)
		{
			this.callBack(result);
		} 
		else 
		{ 
		//An error occured

		}
	}
}



