// JavaScript Document

function getContent(url, cid)
{
	var req = false;
	if (window.XMLHttpRequest)
		req = new XMLHttpRequest();
	else if (window.ActiveXObject)
	{
		try 
		{
			req = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e) 
		{
			try
			{
				req = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e) 
			{
				return false;
			}
		}
	}
	else
		return false;
	
	if( cid )
		document.getElementById(cid).innerHTML="<center><img src='images/ajax.gif'></center>";

	req.onreadystatechange=function() { onchstatcode(req, cid) }
	bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
	req.open('GET', url+bustcacheparameter, true);
	req.send(null);
}

function postContent(url, cid)
{
	var req = false;
	if (window.XMLHttpRequest)
		req = new XMLHttpRequest();
	else if (window.ActiveXObject)
	{
		try 
		{
			req = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e) 
		{
			try
			{
				req = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e) 
			{
				return false;
			}
		}
	}
	else
		return false;
	
	if( cid )
		document.getElementById(cid).innerHTML="<center><img src='images/ajax.gif'></center>";

	req.onreadystatechange=function() { onchstatcode(req, cid) }
	bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
	req.open('POST', url+bustcacheparameter, true);
	req.send(null);
}

function onchstatcode(req, cid)
{
	if (req.readyState == 4 && (req.status==200 || window.location.href.indexOf("http")==-1))
	if( cid )
	{
		if( req.responseText.length > 0 )
		{
			if( cid == 'alert' )
				alert(req.responseText);
			else
				document.getElementById(cid).innerHTML=req.responseText;
		}
		else
			if( cid != 'alert' )
				document.getElementById(cid).innerHTML='';
	}
	else
		return req.responseText.length;
}
