window.onload = initAll;
var xhr = false;
var url = 'library/adverts.asp';
var Advert = '';

function initAll() {

	if (window.XMLHttpRequest) {
		xhr = new XMLHttpRequest();
	}
	else {
		if (window.ActiveXObject) {
			try {
				xhr = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e) { }
		}
	}

	if (xhr) {
		xhr.onreadystatechange = showAdvert;
		xhr.open("GET", url, true);
		xhr.send(null);
	}
	else {
		//alert("Sorry, but I couldn't create an XMLHttpRequest");
	}
	
}

function showAdvert() {
	if (xhr.readyState == 4) {
		if (xhr.status == 200) {
			
			document.getElementById('advert_tower').innerHTML = xhr.responseText;

}
		else {
			//var outMsg = "There was a problem with the request " + xhr.status;
			//alert('There was a problem with the request ' + xhr.status);
			
		}

	}
}
