function getHTTPObject() {
	if (window.ActiveXObject)
		return new ActiveXObject("Microsoft.XMLHTTP");
	else if (window.XMLHttpRequest)
		return new XMLHttpRequest();
	else {      
		alert("Your browser does not support AJAX.");
		return null;   
	}
}

function getNav(p, n, cl) {
	httpObject = getHTTPObject();
	
	if (httpObject != null) {
		var now = new Date();
		var url = 'ajax-nav.php?cl=' + escape(cl) + '&p=' + escape(p) + '&n=' + escape(n) + '&ts=' + now.getTime();
		
		httpObject.open("GET", url, true);
		httpObject.send(null);
		httpObject.onreadystatechange = setOutputNav;
	}
}


function setOutputNav() {
	if(httpObject.readyState == 4) {
		if (httpObject.responseText == '')
			nextAd();
		else
			document.getElementById('ajax-nav').innerHTML = httpObject.responseText;
	}
}


