//pre-load images

var listImg = new Image();
listImg.src = 'Press/img_12/MLK 2012_1a.jpg';


var autoImg = new Image();
autoImg.src = 'Press/img_12/Wedding Expo 2012 1_1a.jpg';

var formImg = new Image();
formImg.src = 'Press/img_12/Big Brother Big Sisters 1_1a.jpg';

var treeImg = new Image();
treeImg.src = 'Press/img_12/Three Kings 2012_1a.jpg';




function makeNews(c,l,f,i){
	this.copy = c;
	this.link = l;
	this.follow = f;
	this.img = i;
	this.write = writeNews;
}

function writeNews(){
	var str = '';
	str += '<a href="' + this.link + '" class="nr">';
	str += '<img border="0" src="' + this.img.src + '" Hspace="18" Vspace="15" align = center></a>';
	str += this.copy + '<br>';
    str += '<a href="' + this.link + '" class="rn">' + this.follow + '</a>';
	return str;
}
// this method makes it easier to manage because the numbering is automatically determined by the order of the array items
var rotateNum = 0;
var newsArray = new Array();

newsArray[rotateNum++] = new makeNews("<br> On Monday, January 16, Brooklyn Borough President Marty Markowitz and Deputy Borough President Sandra Chapman honored the life and legacy of Dr. Martin Luther King, Jr. at the 26th annual Martin Luther King, Jr. Celebration at the Brooklyn Academy of Music (BAM)... ",'http://www.brooklyn-usa.org/Press/2012/jan17_FR.htm','More Info',listImg).write();

newsArray[rotateNum++] = new makeNews("<br> On Sunday, January 15, Brooklyn Borough President Marty Markowitz and the Brooklyn Community Pride Center hosted the first annual lesbian, gay, bisexual and transgender (LGBT) Wedding Expo at Brooklyn Borough Hall... ",'http://www.brooklyn-usa.org/Press/2012/jan15_FR.htm','More Info',autoImg).write();

newsArray[rotateNum++] = new makeNews("<br> On Tuesday, January 10, Brooklyn Borough President Marty Markowitz welcomed Big Brothers Big Sisters of New York City and executive director Hector Batista to Brooklyn Borough Hall in celebration of National Mentoring Month... ",'http://www.brooklyn-usa.org/Press/2012/jan10_FR.htm','More Info',formImg).write();

newsArray[rotateNum++] = new makeNews("<br> On Friday, January 6, Brooklyn Borough President Marty Markowitz presented donated toys and a proclamation to the Three Kings Day Parade Committee and hosted a reception to celebrate Three Kings Day... ",'http://www.brooklyn-usa.org/Press/2012/jan6_FR.htm','More Info',treeImg).write();





var nIndex = 0;
var timerID = null;
function rotateNews(){
	var len = newsArray.length;
	if(nIndex >= len)
		nIndex = 0;
	document.getElementById('stories').innerHTML = newsArray[nIndex];
	nIndex++;
	timerID = setTimeout('rotateNews()',18000);
}
function pauseNews() {
	if (timerID != null) {
		clearTimeout(timerID);
		timerID = null;
	}
}

function playNews() {
	if (timerID == null) {
		timerID = setTimeout('rotateNews()', 10);
	}
}

