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 = '';
	var num_str = '';

	str += '<a href="' + this.link + '">';
	str += '<img border="0" src="' + this.img.src + '" height="250" width="420" align="left" hspace="20"></a>';
	str += this.copy + '<br /><br />';
	str += '<a href="' + this.link + '">' + this.follow + '</a>';
	//str += '<div style="vertical-align:text-bottom; text-align:right;"><a href="#" class="story_numbers" onMouseOver="nIndex=0;pauseNews(); rotateNews()">1</a>&nbsp;<a href="#" class="story_numbers" onMouseOver="nIndex=1;pauseNews(); rotateNews()">2</a>&nbsp;<a href="#" class="story_numbers" onMouseOver="nIndex=2;pauseNews(); rotateNews()">3</a>&nbsp;<a href="#" class="story_numbers" onMouseOver="nIndex=3;pauseNews(); rotateNews()">4</a>&nbsp;</div>';
	return str;
}

var missionImg1 = new Image();
var missionImg2 = new Image();
var missionImg3 = new Image();
var missionImg4 = new Image();
var missionImg5 = new Image();
var missionImg6 = new Image();
   
missionImg1.src = 'assets/images/hl1_resized.jpg';
missionImg2.src = 'assets/images/hl2_resized.jpg';
missionImg3.src = 'assets/images/sr1_resized.jpg';
missionImg4.src = 'assets/images/sr2_resized.jpg';
missionImg5.src = 'assets/images/yd1_resized.jpg';
missionImg6.src = 'assets/images/yd2_resized.jpg';

var newsArray = new Array();
newsArray[0] = new makeNews(
		"&quot;I've had a knee replacement. Water aerobics provides me with a great workout without stressing my joints. Water Aerobics is great!  I get lots of exercise with no fear of falling or stumbling.&quot;<br /><strong>-Jill, Y Member</strong>",
		'y_page.php?pi=90',
		'Learn More',missionImg1).write();
   
newsArray[1] = new makeNews(
		"&quot;The Kokomo Y has been a key factor in my journey towards a healthy lifestyle. I joined the Holiday Trimmings in 2009, and within one year, lost 32lbs., going from a size 16 to size 6, and reduced my medications 85%.   Good health is a gift to be treasured. Thanks to the YMCA, I've got my life back!&quot;<br /><strong>-Karen, Y Member</strong>",
		'y_page.php?pi=91',
		'More Info',missionImg2).write();

newsArray[2] = new makeNews(
		"&quot;By participating in the YMCA ARISE program, I have come to know that I'm not the only teenager out there fighting pressure from peers and going through everyday struggles in life. ARISE is the reason that I haven't been getting in as much trouble.&quot;<br />-<strong>Jomika; Y Member & ARISE participant</strong>",
		'y_page.php?pi=92',
		'Full Story',missionImg3).write();
 
newsArray[3] = new makeNews(
		"&quot;HUDDLE couldn't reach the men it does if it weren't for the YMCA's generous contribution... The YMCA is the perfect place for HUDDLE to meet and to draw men to Christ, and it absolutely wouldn't happen if the YMCA did not invest in us like they do!&quot;<br /><strong>-Dick; Y Member & HUDDLE Board</strong>",
		'y_page.php?pi=93',
		'More Info',missionImg4).write();
 
newsArray[4] = new makeNews(
		"&quot;The thing I value most about Y Child care is the day to day security and stability they provide for my children, as well as for me a working parent. I am constantly amazed that the same teachers who cared for my 13 yr. old have cared for all my children.&quot;<br /><strong>-Sherry; Y Member & child care parent</strong>",
		'y_page.php?pi=94',
		'More Info',missionImg5).write();
 
newsArray[5] = new makeNews(
		"&quot;We currently have 3 daughters participating in 3 different youth sport programs at the YMCA. The girls absolutely love the sport programs. Not only have they been taught the skills of the sports, they have also been taught life skills such as teamwork and sportsmanship.&quot;<br /><strong>-Alyssa; Y Member</strong>",
		'y_page.php?pi=95',
		'More Info',missionImg6).write();

var nIndex = 0;
var timerID = null;
   
function rotateNews(){
	var len = newsArray.length;

  if (nIndex >= len) nIndex = 0;

  document.getElementById('stories').innerHTML = newsArray[nIndex];
  document.getElementById('numbers').innerHTML = '<div style="vertical-align:text-bottom; text-align:right;"><a href="#" class="story_numbers" onMouseOver="nIndex=0;pauseNews(); rotateNews()">1</a>&nbsp;<a href="#" class="story_numbers" onMouseOver="nIndex=1;pauseNews(); rotateNews()">2</a>&nbsp;<a href="#" class="story_numbers" onMouseOver="nIndex=2;pauseNews(); rotateNews()">3</a>&nbsp;<a href="#" class="story_numbers" onMouseOver="nIndex=3;pauseNews(); rotateNews()">4</a>&nbsp;<a href="#" class="story_numbers" onMouseOver="nIndex=4;pauseNews(); rotateNews()">5</a>&nbsp;<a href="#" class="story_numbers" onMouseOver="nIndex=5;pauseNews(); rotateNews()">6</a>&nbsp;</div>';

  nIndex++;
  timerID = setTimeout('rotateNews()',6000);
}

function pauseNews() {
	if (timerID != null) {
  	clearTimeout(timerID);
    timerID = null;
  }
}
   
function playNews() {
	if (timerID == null) {
		timerID = setTimeout('rotateNews()', 2000);
	}
}

