var doSiteUpdate = true;

function toggleArticle (i)
{
	var o = document.getElementById(i).style;
	
	if (o.display == 'none') { o.display = 'block'; }
	else { o.display = 'none'; }
}

function getData (dataSource, id)
{
	var HttpObj = false;
	
	if (window.XMLHttpRequest)
	{
		HttpObj = new XMLHttpRequest();
	}
	else if (window.ActiveXObject)
	{
		HttpObj = new ActiveXObject("Microsoft.XMLHttp");
	}
	
	if (HttpObj)
	{
		HttpObj.open("GET", dataSource);
		
		HttpObj.onreadystatechange = function()
		{
			if (HttpObj.readyState == 4 && HttpObj.status == 200)
			{
				document.getElementById(id).innerHTML = HttpObj.responseText;
				delete HttpObj;
				HttpObj = null;
			}
		}
		
		HttpObj.send(null);
	}
}

function iniSetup ()
{
	getData('/loadpage.php?p=home', 'mainwindow');
	getData('/new-scripts/reloadTime.php', 'update');
}

function showLoading (id)
{
	document.getElementById(id).innerHTML = '<div class="windowHead">Loading...</div><div class="windowMain">The content you requested is loading...</div>';
}

function updateDate ()
{
	getData('/new-scripts/reloadTime.php', 'update');
}
 
function updateSite ()
{
	if (doSiteUpdate)
	{
		getData('/loadpage.php?p=home', 'mainwindow');
	}
}


