// JavaScript Document
document.observe("dom:loaded", function() {
		new Ajax.Request("http://depts.washington.edu/omad/feature.php", {
			method: "get",
			onSuccess: getText,
			onFailure : ajaxFailure,
			onException : ajaxFailure
			}
		);							
	}
);

function getText(ajax) {
	var lines = ajax.responseText.split("\n");
	var img = document.createElement("img");
	img.alt = lines[0];
	img.border = "3";
	img.src = "/omad/images/" + lines[1];
	
	var p1 = document.createElement("p");
	p1.innerHTML = lines[2];
	var p2 = document.createElement("p");
	p2.innerHTML = lines[3];
	
	$("feature").appendChild(img);
	$("feature").appendChild(p1);
	$("feature").appendChild(p2);
}

function ajaxFailure(ajax, exception) {
    alert("Error making Ajax request:" + 
          "\n\nServer status:\n" + ajax.status + " " + ajax.statusText + 
          "\n\nServer response text:\n" + ajax.responseText);
    if (exception) {
        throw exception;
    }
}
