function XatafaceNews(items, id){
	if ( typeof(id) == 'undefined' ) id = 'featured-item';
	this.id = id;
	this.items = items;
	
	this.currIndex = Math.floor(Math.random()*(this.items.length));
	this.next();
	
}

XatafaceNews.prototype.next = function(){
	var featuredBox = document.getElementById(this.id);
	var currItem = this.items[this.currIndex];
	//alert('here');
	featuredBox.style.backgroundImage = "url("+currItem.image_url+")";
	featuredBox.onclick = function(){
		window.location.href=this.items[this.currIndex].story_url;
	};
	featuredBox.style.cursor='pointer';
	
	this.currIndex = (this.currIndex+1) % this.items.length;
}

function XatafaceSpotlight(items, id){
	if ( typeof(id) == 'undefined' ) id = 'featured-item';
	this.id = id;
	this.items = items;
	
	this.currIndex = Math.floor(Math.random()*(this.items.length));
	this.next();
	
}

XatafaceSpotlight.prototype.next = function(){
	var featuredBox = document.getElementById(this.id);
	var currItem = this.items[this.currIndex];
	//alert('here');
	//featuredBox.style.backgroundImage = "url("+currItem.image_url+")";
	featuredBox.onclick = function(){
		window.location.href=this.items[this.currIndex].more_url;
	};
	featuredBox.style.cursor='pointer';
	var item = this.items[this.currIndex];
	var html = '<h3>Spotlight:</h3><h4>'+item.heading+'</h4>';
	if ( item.image ){
		html += '<img src="http://dev.weblite.ca/phpimageserver/photos/xataface.com/'+item.image+'?max_width=225&max_height=250" align="right" hspace="10" vspace="10"/>';
		
	}
	
	html += '<div class="spotlight-content">'+item.content+'</div>';
	html += '<div><a href="'+item.more_url+'">More Information</a></div>';
	featuredBox.innerHTML = html;
	
	this.currIndex = (this.currIndex+1) % this.items.length;
}