//declare a global  XMLHTTP Request object
var XmlHttpObj;
var baseurl = "/public/index.php/";

function NewsLoad()
{	
	var requestUrl1;

	var date1 = new Date();
	var ticks1 = date1.getTime();
	// Ticks are being used to avoid IE caching the page.
	requestUrl1 = baseurl + "index/hotnews?ts=" + ticks1;
	
	$.ajax({
	type: "GET",
	url: requestUrl1,
	dataType: "xml",
	success: function(xml) 
	{
		var oControl = document.getElementById('txtHotNews');	
		var hyperlinkHotNews = document.getElementById('hpHotNews');						      
		var nodesList = xml.getElementsByTagName('Item');	
		try
		{		
			var item = nodesList[0];
	
			var sUrl = item.getAttribute("url");	
			hyperlinkHotNews.href = sUrl;
			
			var sTitle = item.childNodes[0].nodeValue;
			oControl.innerHTML = sTitle;
		}
		catch(e)
		{
		}
	}
	});
}

function QuoteLoad()
{
	var requestUrl;
	
	var date = new Date();
	var ticks = date.getTime();
	// Ticks are being used to avoid IE caching the page.
	requestUrl = baseurl + "index/randomquote?ts=" + ticks;					
	
	$.ajax({
	type: "GET",
	url: requestUrl,
	dataType: "xml",
	success: function(xml) 
	{
		var nodesList = xml.getElementsByTagName('Item');
		var item = nodesList[0];
	
		$("#memberName").html(item.getAttribute("name"));
		$("#hpQuote").attr("href", item.getAttribute("url") );

		if (item.childNodes[0].nodeValue != null)
			$("#quotecontent").html(item.childNodes[0].nodeValue);
	
		if (item.getAttribute("image") != null) 
		{
			$("#divImage").css("background-image","url(" + item.getAttribute("image") + ")");
		} 
		else 
		{
			$("#divImage").css("background-image","");
		}
	}
	});	
}
