// used on any page where there is a featured_feed div

//document.onmousedown = function() { return false; }

function getFeatured(num) {
	if (window.XMLHttpRequest) ajax = new XMLHttpRequest();
	else                       ajax = new ActiveXObject("Microsoft.XMLHTTP");
	ajax.onreadystatechange = function() {
		if ( ajax.readyState==4 ) { 
			// even if there is an error output everything (so we can see what the server said)
			document.getElementById('featured_feed').innerHTML = ajax.responseText;
			//alert(ajax.responseText);
		}
	}

	var url = "/featured_ajax?"+num;
	ajax.open("GET",url,true);
	ajax.send();
}

function initFeatured() {
	if ( document.getElementById('featured_feed') ) getFeatured(0); // starts with a random one
}



if ( window.addEventListener ) {
	window.addEventListener('load',initFeatured,false);
}
else if ( window.attachEvent ) {
	window.attachEvent('onload',initFeatured);
}

