function makeNews(c,l){
	this.copy = c;
	this.link = l;
	this.write = writeNews;
}

function writeNews(){
	var str = '';
	str += '<p><a href="' + this.link + '">';
	str += this.copy + '</a></p>';
	return str;
}

var newsArray = new Array();
newsArray[0] = new makeNews("San Mateo, CA &ndash; November 20, 2009<br />Glenborough’s Boyle Tapped as BOMA California Officer and NAIOP Board Member",'news/2009/11_20_09.html').write();
newsArray[1] = new makeNews("San Mateo, CA &ndash; November 12, 2009<br />NxGEN Electronics Plugs into Glenborough's Tierrasanta Research Park",'news/2009/11_12_09.html').write();
newsArray[2] = new makeNews("San Mateo, CA &ndash; November 3, 2009<br />Real Estate Brokerage Giant Recommits to Glenborough's First Financial Plaza",'news/2009/11_03_09.html').write();

var nIndex = 0;
var timerID = null;

function rotateNews(){
	var len = newsArray.length;
	if(nIndex >= len)
		nIndex = 0;
		buttonHighlight();
	document.getElementById('homecontent_news_stories').innerHTML = newsArray[nIndex];
	nIndex++;
	timerID = setTimeout('rotateNews()',3000);
}

function pauseNews() {
	if (timerID != null) {
		clearTimeout(timerID);
		timerID = null;
	}
}

function playNews() {
	if (timerID == null) {
		timerID = setTimeout('rotateNews()', 1000);
	}
}

function jumpNews(article){
	nIndex = article;
	document.getElementById('homecontent_news_stories').innerHTML = newsArray[nIndex];
	buttonHighlight();
}

function buttonHighlight(){
		if(nIndex == 0){
			document.getElementById('homecontent_news_btns').innerHTML = '<a href="#" class="selected" onmousedown="jumpNews(0)"></a><a href="#" onmousedown="jumpNews(1)"></a><a href="#" onmousedown="jumpNews(2)">'
		}
		if(nIndex == 1){
			document.getElementById('homecontent_news_btns').innerHTML = '<a href="#" onmousedown="jumpNews(0)"></a><a href="#" class="selected" onmousedown="jumpNews(1)"></a><a href="#" onmousedown="jumpNews(2)">'
		}
		if(nIndex == 2){
			document.getElementById('homecontent_news_btns').innerHTML = '<a href="#" onmousedown="jumpNews(0)"></a><a href="#" onmousedown="jumpNews(1)"></a><a href="#" class="selected" onmousedown="jumpNews(2)">'
		}
}