/**This file loads the events from the given events file which is currently events.dat
*because the server handles the extension .xml differently.
*/
var $j = jQuery.noConflict();
$j(function() {
    $j.ajax({
		url: 'http://www.seattleschools.org/schools/westseattle/lib/links.dat',
		type: 'GET',
		timeout: 1000,
		dataType: "text",
		success: function(data){
			//Internet explorer
			try {
				xml=new ActiveXObject("Microsoft.XMLDOM");
			} catch(e){
			//Firefox, Mozilla, Opera, etc.
				try{
					xml=document.implementation.createDocument("","",null);
				} catch(e) {alert(e.message)}
			} try {
				xml.async=true;
				xml.loadXML(data);
			}
			catch(e) {alert(e.message)}
			var ul = $j('<ul></ul>');
			$j(xml).find('link').each(function(){
				var kids = $j(this).children();
				var txt = "<a href='" + $j(kids[1]).text()//url
						+"'>" + $j(kids[0]).text() //name
						+"</a>";
				var li = $j('<li></li>');
				
				li.html(txt).appendTo(ul);
			});
			ul.appendTo($j('#links'));
		}
	});
});