/* profile.js
 * copyright (c) 2006 Eddie Roosenmaallen // rosebleed.net
 * $Id$
 */

if(window.XMLHttpRequest && !(window.ActiveXObject)) {
	try {
		aReq = new XMLHttpRequest();
	} catch(e) {
		aReq = false;
	}
// branch for IE/Windows ActiveX version
} else if(window.ActiveXObject) {
	try {
		aReq = new ActiveXObject("Msxml2.XMLHTTP");
	} catch(e) {
		try {
			aReq = new ActiveXObject("Microsoft.XMLHTTP");
		} catch(e) {
			aReq = false;
		}
	}
}
if(window.XMLHttpRequest && !(window.ActiveXObject)) {
	try {
		tReq = new XMLHttpRequest();
	} catch(e) {
		tReq = false;
	}
// branch for IE/Windows ActiveX version
} else if(window.ActiveXObject) {
	try {
		tReq = new ActiveXObject("Msxml2.XMLHTTP");
	} catch(e) {
		try {
			tReq = new ActiveXObject("Microsoft.XMLHTTP");
		} catch(e) {
			tReq = false;
		}
	}
}

	function callback_a() {
		callback(aReq, 'lastfmArtists');
	}

	function callback_t() {
		callback(tReq, 'lastfmTracks');
	}
	
	function callback(req, targetID) {
		t = document.getElementById(targetID);
	
		// only if req shows "loaded"
		if (req.readyState == 4) {
			// only if "OK"
			if (req.status == 200) {
				t.innerHTML = req.responseText;
			} else {
				t.innerHTML = ("There was a problem retrieving the XML data:\n" +
					req.statusText);
			}
		}
	}
