var loadingHTML = '<div class="footer-template"><h4></h4><ul><li id="loading"><img src="images/layout/indicator.gif" alt="" /></li></ul><a href="#" class="button"></a></div>';



function showContent() {
		document.getElementById("footer_contents").innerHTML = this.req.responseText;
	}
 
	function loadContents(url) {
	  	var loader = new net.ContentLoader(url, showContent);
	}
	
	function addclick(eleID, url, newID)
	{
	
	document.getElementById(eleID).onclick = function () {
		
		linksEle = document.getElementById("footer_sidebar");
		liEles = linksEle.getElementsByTagName("li");
		
		contentsEle = document.getElementById("footer_contents");
		contentsTemplateEles = contentsEle.getElementsByTagName("div");
		
		if (!hasClass(this, "footer_selected"))
		{		
			for (n=0; n<liEles.length; n++)
			{
			 	removeClass(liEles[n].firstChild,"footer_selected");
			}
		
			this.className = "footer_selected";
			document.getElementById("footer_contents").innerHTML = loadingHTML;
			contentsTemplateEles[0].id = newID; /* setting new id before full loaded*/
		
			loadContents(url);
		}
			return false; //avoiding page load
	};
	}
	
	loadContents("includes/footer-social.php"); //default
	
	addclick("footer-news", "includes/footer-news.php", "footer_news");
	addclick("footer-social", "includes/footer-social.php", "footer_social");
	addclick("footer-stock", "includes/footer-stock.php", "footer_stock");
	addclick("footer-blog", "includes/footer-blog.php", "footer_blog");
	addclick("footer-tutorials", "includes/footer-tutorials.php", "footer_blog");

	
