function makeNews(h,c,l,f,i){
	  this.headline = h;
	  this.copy = c;
      this.link = l;
      this.follow = f;
      this.img = i;
      this.write = writeNews;
   }


   function writeNews(){
      var str = '';
      str += '';
      str += '<img border="0" src="' + this.img.src + '"><br>';
      str += '<div id="news_copy">' + this.copy +'</div>';
	  str += '<div id="news_headline">' + this.headline +'</div>';
      str +=  '<div id="news_buttons"><a href="' + this.link + '" target="_blank">' + this.follow + '</a></div>';
      return str;
   }



   var feat_img1 = new Image();
   feat_img1.src = 'images/i_director.jpg';
   var feat_img2 = new Image();
   feat_img2.src = 'images/i_barbour.jpg';
   var feat_img3 = new Image();
   feat_img3.src = 'images/i_4years.jpg';
      var feat_img4 = new Image();
   feat_img4.src = 'images/i_cottage.jpg';
   var feat_img5 = new Image();
   feat_img5.src = 'images/i_obama_barbour.jpg';





   var newsArray = new Array();

   newsArray[0] = new makeNews(
	"Meet Director Womack",
      "MEMA Director Mike Womack is an experienced leader and emergency manager which is why in 2006 Governor Haley Barbour appointed him to his current position of Director.  Womack has served in several positions within the agency as well as being designated State Coordinating Officer during Hurricanes Katrina and Ivan.",
       'http://www.msema.org/feature/pages/feature1.html',
       'Learn More',feat_img1).write();
   
   newsArray[1] = new makeNews(
	  "A Message from Governor Barbour",
      "For the last few years, Mississippians had experienced quiet hurricane seasons. But Katrina taught us that it only takes one major storm to cause devastation like this.",
      'http://www.msema.org/feature/pages/feature2_jon.html',
      'Watch the Video',feat_img2).write();
   
        newsArray[2] = new makeNews(
   "Four Years After Katrina",
      "This is the fourth annual report published by the Governor Haley Barbour's Office of Recovery and Renewal detailing the State's recovery four years after the worst natural disaster in American history.",
      'http://www.msema.org/feature/pages/4_years_after.pdf',
      'Read the Report',feat_img3).write();
		
		      newsArray[3] = new makeNews(
   "Mississippi Alternative Housing Program",
      "Gulfport, MS, April 22, 2008 -- Vicki Ladner Meshell and husband Ricky stand on the porch of their Mississippi Cottage. More than 2,800 families in Mississippi have transitioned from FEMA travel trailers and mobile homes into the Cottages.",
      'http://www.msema.org/feature/pages/feature5.html',
      'Find Out More',feat_img4).write();
   
   newsArray[4] = new makeNews(
	  "Gulf Coast Recovery Efforts",
      "President Barack Obama walks with Mississippi Gov. Haley Barbour, right, and his wife Marsha, center, after he arrived on Air Force One at Gulfport BIloxi Airport in Gulfport, Miss., Monday, June 14, 2010, as he visited the gulf coast region affected by the BP Deepwater Horizon oil spill.",
      '#',
      '',feat_img5).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()',9000);
   }


   function pauseNews() {
      if (timerID != null) {
         clearTimeout(timerID);
         timerID = null;
      }
   }
   
   function playNews() {
      if (timerID == null) {
         timerID = setTimeout('rotateNews()', 5000);
      }
   }
   
   function rotateNewsManual(loc){
      var len = newsArray.length;
      /*if(nIndex >= len)*/
         nIndex = loc;
      document.getElementById('stories').innerHTML = 
         newsArray[nIndex];
      nIndex++;
      timerID = setTimeout('rotateNews()',9000);
   }   
// JavaScript Document