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/j_capitol.jpg';
   var feat_img2 = new Image();
   feat_img2.src = 'images/j_kit.jpg';
   var feat_img3 = new Image();
   feat_img3.src = 'images/j_smithville.jpg';
      var feat_img4 = new Image();
   feat_img4.src = 'images/i_flooding.jpg';
   var feat_img5 = new Image();
   feat_img5.src = 'images/j_localema.jpg';





   var newsArray = new Array();

   newsArray[0] = new makeNews(
	"A Message From Governor Bryant",
      "'Mississippians face a wide variety of disasters year round. That's why it is important for all of us to be prepared.' Click to view a preparedness message and tips from Gov. Phil Bryant.",
       'http://www.youtube.com/watch?v=1-0FsaN_UsM&list=UUIFLXdSnYj5nQbQ8HRlS4Tw&index=1&feature=plcp',
       'Watch The Video',feat_img1).write();
   
   newsArray[1] = new makeNews(
	  "Disaster Supply Kit",
      "When disasters strike in Mississippi it is important for every citizen to be prepared. That means having a disaster supply kit on hand to get you and your family through the immediate hours and sometimes days following a major disaster.",
      'http://msema.org/supplykit/index.html',
      'Learn More',feat_img2).write();
   
        newsArray[2] = new makeNews(
   "Tornado in Smithville",
      "On April 27, 2011 a super-outbreak of tornadoes took the lives of 37 people and caused damages in 49 counties. The community of Smithville in Monroe county was hit by an EF 5 tornado with wind in excess of 200 mph. In our state we can see tornadoes 12 months a year, so it is critical for residents to know what to do when severe weather threatens.",
      'http://msema.org/preparation/severe.html',
      'Be Prepared',feat_img3).write();
		
	   newsArray[3] = new makeNews(
	  "Stay Flood Smart",
      "Learn about the National Flood Insurance Program (NFIP) and ways that you can be prepared after a flooding disaster.",
      'http://www.floodsmart.gov',
      'Read More',feat_img4).write();
   
   newsArray[4] = new makeNews(
	  "Local EMA",
      "All 82 counties in Mississippi have a local Emergency Management Office.  The Mississippi Emergency Management Agency and these dedicated professionals are ready to answer your questions and assist you with preparedness activities you may have.",
      'http://msema.org/about/local.html',
      'Find Yours',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
