function get_changes() {
	width = 0;
	
	function time_ago(time) {
		now = new Date();
		
		difference = (now - time)/1000;
		
		if (difference < 60) interval = "s";
		else if (difference >= 60 && difference < 60*60) interval = "n";
		else if (difference >= 60*60 && difference < 60*60*24) interval = "h";
		else if (difference >= 60*60*24 && difference < 60*60*24*7) interval = "d";
		else interval = "a long time ago.";
		
		switch(interval) {
			case "d":
				datediff = Math.floor(difference/60/60/24);
				res = (datediff==1) ? datediff + " day ago" : datediff + " days ago";
				break;
			case "h":
				datediff = Math.floor(difference/60/60);
				res = (datediff==1) ? datediff + " hour ago" : datediff + " hours ago";
				break;
			case "n":
				datediff = Math.floor(difference/60);
				res = (datediff==1) ? datediff + " minute ago" : datediff + " minutes ago";
				break;
			case "s":
				datediff = Math.floor(difference);
				res = (datediff==1) ? datediff + " second ago" : datediff + " seconds ago";
				break;
			default:
				res = "a long time ago";
				break;
		}
		
		return res;
	}
	
	function get_width() {
		if (typeof(window.innerWidth) == 'number') {
			width = window.innerWidth;
		}
		else {
			if (document.documentElement && document.documentElement.clientWidth) {
				width = document.documentElement.clientWidth;
			}
			else {
				if (document.body && document.body.clientWidth) {
					width = document.body.clientWidth;
				}
			}
		}
	}
	
	function ajax() {
		var xmlHttp;
		try {
			// Firefox, Opera 8.0+, Safari
			xmlHttp=new XMLHttpRequest();
		}
		catch (e) {
			// Internet Explorer
			try {
				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch (e) {
				try {
					xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch (e) {
					alert("Your browser does not support AJAX!");
					return false;
				}
			}
		}
		return xmlHttp;
	}
	
	get_width();
	xmlHttp = ajax();
	xmlHttp.onreadystatechange=function() {
		if(xmlHttp.readyState==4) {
			
			try //Internet Explorer
			  {
			  xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
			  xmlDoc.async="false";
			  xmlDoc.loadXML(xmlHttp.responseText);
			  }
			catch(e)
			  {
			  try //Firefox, Mozilla, Opera, etc.
			    {
			    parser=new DOMParser();
  				xmlDoc=parser.parseFromString(xmlHttp.responseText,"text/xml");
			    }
			  catch(e)
			    {
			    alert(e.message);
			    return;
			    }
			  }
			
			document.getElementById("witter-container").innerHTML = "";
			willfit = Math.floor(width/248);
			now = new Date();
			
			for (var i=1;i<willfit+2;i++) {
				element = document.createElement("div");
				inner = document.createElement("div");
				element.setAttribute("class", "witter-unit");
				element.setAttribute("style", "position: fixed; bottom: 0; left: " + (i-1)*258 + "px;");
				inner.setAttribute("class", "inner");
				element.innerHTML = "<img src='/genericon.png' style='float: left;' />";
				var item_date = new Date(xmlDoc.getElementsByTagName("pubDate")[i-1].childNodes[0].nodeValue);
				inner.innerHTML += "<div class='when'>" + time_ago(item_date) + "</div>";
				var user = "User:" + xmlDoc.getElementsByTagName("item")[i-1].childNodes[9].childNodes[0].nodeValue;
				inner.innerHTML += "<a href='http://socialmediahubsite.com/" + user + "' class='bold'>" + user + "</a>";
				inner.innerHTML += "<br />";
				title = xmlDoc.getElementsByTagName("title")[i].childNodes[0].nodeValue;
				inner.innerHTML += "<a href='http://socialmediahubsite.com/" + title + "'>" + title + "</a><br />";
				inner.innerHTML += "<a href='" + xmlDoc.getElementsByTagName("link")[i].childNodes[0].nodeValue + "'><i>" + xmlDoc.getElementsByTagName("description")[i].childNodes[0].nodeValue.split("\n")[0] + "</i></a>";
				element.appendChild(inner);
				
				document.getElementById("witter-container").appendChild(element);
			}
		}
	}
	xmlHttp.open("GET","http://socialmediahubsite.com/w/index.php?title=Special:RecentChanges&feed=rss",true);
	xmlHttp.send(null);
	
	setTimeout(get_changes, 60000);
}
