var xmlhttp;

function loadIndex()
{
document.getElementById('project-header').innerHTML = "";
xmlhttp=null;
if (window.XMLHttpRequest)
  {// code for Firefox, Opera, IE7, etc.
  xmlhttp=new XMLHttpRequest();
  }
else if (window.ActiveXObject)
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
if (xmlhttp!=null)
  {
  xmlhttp.onreadystatechange=index_state_Change;
  xmlhttp.open("GET","http://www.hodgearts.com/timeline.xml",true);
  xmlhttp.send(null);
  }
else
  {
  alert("Your browser does not support XMLHTTP.");
  }
}

function index_state_Change()
{
if (xmlhttp.readyState==4)
  {// 4 = "loaded"
  if (xmlhttp.status==200)
    {// 200 = "OK"
    
    	var projectindex = "<center><div class='container_640'><h2>Index</h2><div id='project-index'><p>";
    	
    	x=xmlhttp.responseXML.documentElement.getElementsByTagName("object");
    	for(i=0;i<x.length;i++)
		{
  			projectid = x.item(i).attributes.getNamedItem("regName").value;
  			projecttitle = x.item(i).attributes.getNamedItem("title").value;
  			projectcategory = x.item(i).attributes.getNamedItem("category").value;
  			projectindex = projectindex + "<a href='#' onclick=loadProject('" + projectid + "')><b>" + projectid.replace("_", "-") + "</b>&nbsp;" + projecttitle + ",&nbsp;" + projectcategory + "</a><br />";
  		}
  		
  		document.getElementById('dynamic_text_content').innerHTML = projectindex + "</p></div></div></center>";
  		
  		$(function()
		{
			$('#project-index').jScrollPane({scrollbarWidth:16, dragMaxHeight:16});
		});
    }
  }
}
