// Javascript code for news feed from FeedDirect

// the array global_article is used to allow multiple categories
var global_article = new Array();
var global_article_counter = 0;
var article = null;
var early_exit = true;
var moreover_text = 0;	

function newsfeed()
{
  document.write("<p class='moresrc'>Sponsored by Google Ads</p>");

  // load global_article array with articles from category
  if (article != null && (article.length > 0))
  {
    early_exit = false;
    for (var article_counter = 0; article_counter < article.length; article_counter++)
    {
      global_article[global_article_counter] = article[article_counter];
      global_article[global_article_counter].url += "&w=2279233";
      
      global_article[global_article_counter].url += "' target='_blank";
      global_article[global_article_counter].document_url += "' target='_blank";
      global_article_counter++;
    }
  }

  if (global_article.length == 0)
  {
      if (early_exit)
      {
        document.write("<p>Please reload this page to view the headlines.</p>");
      }
      else
      {
        document.write("<p>Sorry, no headlines were found.</p>");
        early_exit = true;
      }
  }

  if (!early_exit)
  {
  var wizard_brand			= "feeddirect";
  var webfeed_heading 			= "Consumer: natural health news";
  var width 				= "100%";
  var numberofarticles 			=  global_article.length;
  var cluster_border 			= "0";
  var time_display 			= "Yes";
  var cell_spacing 			= "0";
  var cell_padding 			= "1";
  var time 				=  new Array(global_article.length);
 
  
  // Start loop for articles
    document.write("<ul class='news'>");
    for (var counter=0; counter < numberofarticles; counter++)
    {
	
      if ((counter == (global_article.length - 1)) && moreover_text == 1) 
      {  
        time_display = "No";
      }
	
      // Print out the headline
      document.write("<li><a href='"+global_article[counter].url+"' class='morehl'>");
      document.write(global_article[counter].headline_text+"...</a><br />");
	
    
      // Print out the source
      if ((counter != (global_article.length - 1)) || moreover_text != 1)
      {
		
	document.write("<a href='"+global_article[counter].document_url+"' + class='moresrc'>");
        document.write(global_article[counter].source+"</a>");  
      }
    
	
      // Print out reg/sub/prem if appropriate
      if (global_article[counter].access_status == "sub" || global_article[counter].access_status == "reg" || global_article[counter].access_status == "prem")
      {
        document.write("<span class='moreti'>&nbsp;</span><a href='"+global_article[counter].access_registration+"' class='moresrc'>");
 	document.write(global_article[counter].access_status+"</a>");
      }
	  
      // Print out the harvest time
      if (time_display == "Yes" && global_article[counter].harvest_time != "")
      {
        // Make a new date object
        time[counter] = new Date(global_article[counter].harvest_time);
        time[counter].setHours(time[counter].getHours() - (time[counter].getTimezoneOffset() / 60 ));
	document.write("<span class='moreti'> &nbsp;"+time[counter].toString()+"</span>");
      } 
      else
      {
       // document.write("<br>&nbsp;<br>");
      }
      document.write("</li>");

    } // End of article loop
    document.write("</ul>");
  

  // Start of clone button code //
  // NOTE: DO NOT REMOVE any of the code in this section //
  document.write("<FORM METHOD='POST' ACTION='http://www.feeddirect.com/cgi-local/wizard_welcome.pl' target='clone' name='moreover_clone'>");
  document.write("<INPUT TYPE='hidden' NAME='parent_code' VALUE='2279233'>");
  document.write("<INPUT TYPE='hidden' NAME='clone_system' VALUE='c'>");
  document.write("<INPUT TYPE='hidden' NAME='system' VALUE='c'>");
  document.write("<INPUT TYPE='hidden' NAME='heading_font_size' VALUE=''><INPUT TYPE='hidden' NAME='headline_bgcolor' VALUE='FFFFFF'>")
  document.write("<INPUT TYPE='hidden' NAME='webfeed_heading' VALUE='Consumer: natural health news'><INPUT TYPE='hidden' NAME='cluster_width' VALUE='100%'>")
  document.write("<INPUT TYPE='hidden' NAME='cluster_name' VALUE='c=Consumer%3A%20natural%20health%20news&o=js'><INPUT TYPE='hidden' NAME='source_time_underline' VALUE='false'>")
  document.write("<INPUT TYPE='hidden' NAME='time_display' VALUE='Yes'><INPUT TYPE='hidden' NAME='heading_display' VALUE='Yes'>")
  document.write("<INPUT TYPE='hidden' NAME='headline_fgcolor' VALUE='003399'><INPUT TYPE='hidden' NAME='cluster_cellspacing' VALUE='0'>")
  document.write("<INPUT TYPE='hidden' NAME='number_of_headlines' VALUE='10'><INPUT TYPE='hidden' NAME='source_time_fgcolor' VALUE='666666'>")
  document.write("<INPUT TYPE='hidden' NAME='headline_font_size' VALUE='12'><INPUT TYPE='hidden' NAME='search_keywords' VALUE=''>")
  document.write("<INPUT TYPE='hidden' NAME='source_time_font_size' VALUE='9'><INPUT TYPE='hidden' NAME='headline_italic' VALUE='false'>")
  document.write("<INPUT TYPE='hidden' NAME='headline_font' VALUE='Arial, geneva, sans-serif'><INPUT TYPE='hidden' NAME='source_time_italic' VALUE='false'>")
  document.write("<INPUT TYPE='hidden' NAME='source_time_font' VALUE='Verdana, geneva, arial, sans-serif'><INPUT TYPE='hidden' NAME='wizard_brand' VALUE='feeddirect'>")
  document.write("<INPUT TYPE='hidden' NAME='cluster_cellpadding' VALUE='1'><INPUT TYPE='hidden' NAME='headline_bold' VALUE='false'>")
  document.write("<INPUT TYPE='hidden' NAME='cluster_border' VALUE='0'><INPUT TYPE='hidden' NAME='source_time_bold' VALUE='false'>")
  document.write("<INPUT TYPE='hidden' NAME='headline_underline' VALUE='false'><INPUT TYPE='hidden' NAME='cluster_layout' VALUE='<BR>'>")

  document.write("</FORM>");
  // End of clone button code //

  // ************************************************************************************
  // This code is subject to the terms & conditions detailed at 
  // http://www.feeddirect.com/terms.html
  // Copyright 2004 FeedDirect. All rights reserved.
  // *************************************************************************************
  } 

  //setTimeout("window.location.reload(true)", 900*1000); // refresh time in ms
}
