cluster_size = 10
cluster_counter = 0;
webfeed_heading = "";
width = "98%"
category = ""
numberofarticles = 10
//  numberofarticles = global_article.length
item_spacing = "5"
cluster_bgcolor = "ffffff"
cluster_border = "0"
heading_display = "Yes"
time_display = "No"
source_display = "No"
cell_spacing = "0"
cell_padding = "3"
heading_bgcolor = "ffffff"
heading_font = "Verdana, Arial,Helvetica, sans-serif"
heading_font_size = "-2"
heading_fgcolor = "333333"
headline_bgcolor = "ffffff"
headline_font = "Verdana, Arial,Helvetica, sans-serif"
headline_font_size = "-2"
headline_fgcolor = "333333"
source_font = "Verdana, Arial,Helvetica, sans-serif"
source_font_size = "-2"
source_fgcolor = "008080"
access_font = "Verdana, Arial,Helvetica, sans-serif"
access_font_size = "-2"
access_fgcolor = "008080"
time_font = "Verdana, Arial,Helvetica, sans-serif"
time_font_size = "-2"
time_fgcolor = "008080"

function init_news()
    {

    // the array global_article is used to allow multiple categories
    global_article = new Array();

    global_article_counter = 0;
    article = null;
    early_exit = 1;
    moreover_text = 0;
    }

function load_wizard()
    {
    var newwin = window.open("", "clone", "resizable,scrollbars,width=500");

    document.forms.moreover_clone.submit();
    return true;
    }

function load_articles()
    {

    // load global_article array with articles from category
    if (article != null)
        {
        early_exit = 0;

        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=502292";
            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.writeln("<CENTER>Please reload this page to view the headlines</CENTER>");
            }

        else
            {
            document.writeln("<CENTER>Sorry, no articles matched your search criteria</CENTER>");

            early_exit = 1;
            }
        }
    }

function show_articles()
    {
    if (!early_exit)
        {
        var time = new Array(global_article.length);

        // Print out the table containing the headlines
        document.writeln("<CENTER><TABLE BORDER=" + cluster_border + " BGCOLOR='#" + cluster_bgcolor + "' WIDTH='" + width + "' CELLPADDING=0 CELLSPACING=0>");
        document.writeln("<TR><TD><CENTER><TABLE BGCOLOR='#" + cluster_bgcolor + "' CELLPADDING=" + cell_padding + " CELLSPACING=" + cell_spacing + "  WIDTH='100%'>");

        // Start loop for articles
        for (var counter = 0; counter < numberofarticles; counter++)
            {
            if ((counter == (global_article.length - 1)) && moreover_text == 1)
                {
                headline_fgcolor = source_fgcolor;

                time_display = "No";
                }

            // Check for new category
            if (((counter % cluster_size) == 0) && (heading_display == "Yes"))
                {
                // Print a new category heading
                document.writeln("<TR BGCOLOR='#" + heading_bgcolor + "'><TD>")

                if (counter)
                    {
                    document.writeln("<BR>")
                    }

                document.writeln("<B CLASS='headlinetopic'>" + clusters[cluster_counter++] + "</B><BR><BR></TD></TR>")
                }

            else
                {
                // first headline in cluster?
                if (((counter % cluster_size) == 1))
                    {
                    document.writeln("<TR><TD><P>");
                    }

                // Print out the headline
                document.writeln("<P><A HREF='" + global_article[counter].url + "' >");
                document.writeln("<SPAN CLASS='headline'>" + global_article[counter].headline_text + "</SPAN></A></P>");

                // Print out reg/sub if appropriate
                if (global_article[counter].access_status == "sub" || global_article[counter].access_status == "reg")
                    {
                    document.writeln("<A HREF='" + global_article[counter].access_registration + "'>");

                    document.writeln("<FONT FACE=" + access_font + " SIZE=" + access_font_size);
                    document.writeln(" COLOR='#" + access_fgcolor + "'>&nbsp;[" + global_article[counter].access_status + "]</FONT></A>&nbsp;&nbsp;");
                    }

                //document.writeln("<BR>");

                // Print out the source
                if (source_display == "Yes")
                    {
                    if ((counter != (global_article.length - 1)) || moreover_text != 1)
                        {
                        document.writeln("<A HREF='" + global_article[counter].document_url + "' >");

                        document.writeln("<FONT FACE=" + source_font + " SIZE=" + source_font_size + " COLOR='#" + source_fgcolor + "'>");
                        document.writeln("" + global_article[counter].source + "</FONT></A>&nbsp;&nbsp;");
                        }
                    }

                // Print out the harvest time
                if (time_display == "Yes")
                    {
                    // 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.writeln("<FONT FACE=" + time_font + " SIZE=" + time_font_size + " COLOR='#" + time_fgcolor + "'>");
                    document.writeln("" + time[counter].toString() + "</FONT>");
                    }
                } // else	 
            }     // End of article loop

        document.writeln("</P></TD></TR><TR BGCOLOR='#" + headline_bgcolor + "'><TD BGCOLOR='#" + headline_bgcolor + "' HEIGHT=" + item_spacing + "></TD></TR>");

        // Start of clone button code //
        // NOTE: DO NOT REMOVE any of the code in this section //
        document.writeln("<FORM METHOD='POST' ACTION='http://www.moreover.com/cgi-local/wizard_clone.pl' target='clone' name='moreover_clone'>");
        document.writeln("<INPUT TYPE='hidden' NAME='parent_code' VALUE='502292'>");
        document.writeln("<INPUT TYPE='hidden' NAME='heading_font_size' VALUE='-1'><INPUT TYPE='hidden' NAME='source_font_size' VALUE='-2'>")
        document.writeln("<INPUT TYPE='hidden' NAME='cluster_width' VALUE='400'><INPUT TYPE='hidden' NAME='time_display' VALUE='Yes'>")
        document.writeln("<INPUT TYPE='hidden' NAME='time_font' VALUE='Verdana, Arial,Helvetica, sans-serif'><INPUT TYPE='hidden' NAME='cluster_cellspacing' VALUE='0'>")
        document.writeln("<INPUT TYPE='hidden' NAME='heading_font' VALUE='Verdana, Arial,Helvetica, sans-serif'><INPUT TYPE='hidden' NAME='number_of_headlines' VALUE='5'>")
        document.writeln("<INPUT TYPE='hidden' NAME='cluster_bgcolor' VALUE='ffffff'><INPUT TYPE='hidden' NAME='search_keywords' VALUE=''>")
        document.writeln("<INPUT TYPE='hidden' NAME='refine_category' VALUE=''><INPUT TYPE='hidden' NAME='time_fgcolor' VALUE='008080'>")
        document.writeln("<INPUT TYPE='hidden' NAME='access_fgcolor' VALUE='008080'><INPUT TYPE='hidden' NAME='time_font_size' VALUE='-2'>")
        document.writeln("<INPUT TYPE='hidden' NAME='headline_bgcolor' VALUE='ffffff'><INPUT TYPE='hidden' NAME='access_font_size' VALUE='-2'>")
        document.writeln("<INPUT TYPE='hidden' NAME='cluster_name' VALUE='c=Open%20source%20news&o=js'><INPUT TYPE='hidden' NAME='heading_display' VALUE='Yes'>")
        document.writeln("<INPUT TYPE='hidden' NAME='headline_fgcolor' VALUE='333333'><INPUT TYPE='hidden' NAME='source_font' VALUE='Verdana, Arial,Helvetica, sans-serif'>")
        document.writeln("<INPUT TYPE='hidden' NAME='access_font' VALUE='Verdana, Arial,Helvetica, sans-serif'><INPUT TYPE='hidden' NAME='headline_font_size' VALUE='-1'>")
        document.writeln("<INPUT TYPE='hidden' NAME='headline_font' VALUE='Verdana, Arial,Helvetica, sans-serif'><INPUT TYPE='hidden' NAME='heading_bold' VALUE='Yes'>")
        document.writeln("<INPUT TYPE='hidden' NAME='item_spacing' VALUE='5'><INPUT TYPE='hidden' NAME='wizard_brand' VALUE='moreover_new'>")
        document.writeln("<INPUT TYPE='hidden' NAME='heading_bgcolor' VALUE='ffffff'><INPUT TYPE='hidden' NAME='cluster_cellpadding' VALUE='1'>")
        document.writeln("<INPUT TYPE='hidden' NAME='heading_fgcolor' VALUE='333333'><INPUT TYPE='hidden' NAME='source_fgcolor' VALUE='008080'>")
        document.writeln("<INPUT TYPE='hidden' NAME='cluster_border' VALUE='0'><INPUT TYPE='hidden' NAME='cluster_layout' VALUE='<br>'>")

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

        document.writeln("</TABLE></CENTER></TD></TR></TABLE></CENTER>");
        }
    }





function show_articles2() {

if (early_exit == 0)

  {  
  var time = new Array(global_article.length)

  // Print out the table containing the headlines

  document.writeln("<CENTER><TABLE BORDER="+cluster_border+" BGCOLOR='#"+cluster_bgcolor+"' WIDTH='"+width+"' CELLPADDING=2 CELLSPACING=0>")
  
  document.writeln("<TR><TD><CENTER><TABLE BGCOLOR='#"+cluster_bgcolor+"' CELLPADDING="+cell_padding+" CELLSPACING="+cell_spacing+"  WIDTH='100%'>")

  // Start loop for articles

  for (var counter=0; counter < numberofarticles; counter++)
    {

    if ((counter == (global_article.length - 1)) && moreover_text == 1)
      {
      headline_fgcolor = source_fgcolor;
      time_display = "No";
      }

    // Check for new category
    if ((category != global_article[counter].cluster) && (heading_display == "Yes"))
      {
      // Set current category to new category
      category = global_article[counter].cluster

      // Print a new category heading
      document.writeln("<TR BGCOLOR='#"+heading_bgcolor+"'><TD>HELLO")
      document.writeln("<FONT SIZE="+heading_font_size+" FACE="+heading_font+" COLOR='#"+heading_fgcolor+"'>")
      document.writeln("<B>"+global_article[counter].cluster+"</B></FONT></TD></TR>")
      }

    // Print out the headline
    document.writeln("<TR BGCOLOR='#"+headline_bgcolor+"'><TD><A HREF='"+global_article[counter].url+"' >")
    document.writeln("<FONT SIZE="+headline_font_size+" FACE="+headline_font+" COLOR='#"+headline_fgcolor+"'")
    document.writeln(">"+global_article[counter].headline_text+"...</FONT></A><br>")

    // Print out the source
    if ((counter != (global_article.length - 1)) || moreover_text != 1)
       {
       document.writeln("<A HREF='"+global_article[counter].document_url+"' >")
       document.writeln("<FONT FACE="+source_font+" SIZE="+source_font_size+" COLOR='#"+source_fgcolor+"'>")
       document.writeln(""+global_article[counter].source+"</FONT></A>&nbsp;&nbsp;")
       }

    // Print out reg/sub if appropriate
    if (global_article[counter].access_status == "sub" || global_article[counter].access_status == "reg")
      {
      document.writeln(" <A HREF='"+global_article[counter].access_registration+"'>")
      document.writeln("<FONT FACE="+access_font+" SIZE="+access_font_size)
      document.writeln(" COLOR='#"+access_fgcolor+"'>"+global_article[counter].access_status+"</FONT></A>&nbsp;&nbsp;")
      }

    // Print out the harvest time
    if (time_display == "Yes")
      {
      // Make a new date object
      time[counter] = new Date(global_article[counter].harvest_time)
      time[counter].setHours(time[counter].getHours() - (time[counter].getTimezoneOffset() / 60 )) // adjust the time to local
      document.writeln("<FONT FACE="+time_font+" SIZE="+time_font_size+" COLOR='#"+time_fgcolor+"'>")
      document.writeln(""+time[counter].toString()+"</FONT>")
      }

    document.writeln("</TD></TR><TR BGCOLOR='#"+headline_bgcolor+"'><TD BGCOLOR='#"+headline_bgcolor+"' HEIGHT="+item_spacing+"></TD></TR>")
    } // End of article loop

  document.writeln("<TR><FORM METHOD='POST' ACTION='http://www.moreover.com/cgi-local/wizard_clone.pl' target='clone' name='moreover_clone'><TD align='center'>")
  document.writeln("<INPUT TYPE='hidden' NAME='heading_font_size' VALUE='-1'><INPUT TYPE='hidden' NAME='source_font_size' VALUE='-2'>")
  document.writeln("<INPUT TYPE='hidden' NAME='cluster_width' VALUE='400'><INPUT TYPE='hidden' NAME='time_display' VALUE='Yes'>")
  document.writeln("<INPUT TYPE='hidden' NAME='time_font' VALUE='Verdana, Arial,Helvetica, sans-serif'><INPUT TYPE='hidden' NAME='cluster_cellspacing' VALUE='0'>")
  document.writeln("<INPUT TYPE='hidden' NAME='heading_font' VALUE='Verdana, Arial,Helvetica, sans-serif'><INPUT TYPE='hidden' NAME='number_of_headlines' VALUE='5'>")
  document.writeln("<INPUT TYPE='hidden' NAME='cluster_bgcolor' VALUE='ffffff'><INPUT TYPE='hidden' NAME='time_fgcolor' VALUE='ff6600'>")
  document.writeln("<INPUT TYPE='hidden' NAME='access_fgcolor' VALUE='ff6600'><INPUT TYPE='hidden' NAME='time_font_size' VALUE='-2'>")

  // The following line sets the category that the Wizard will load in, when a user clicks on 'Get these headlines on your site...' 

  document.writeln("<INPUT TYPE='hidden' NAME='headline_bgcolor' VALUE='ffffff'><INPUT TYPE='hidden' NAME='cluster_name' VALUE='c=Top%20stories'>")
  document.writeln("<INPUT TYPE='hidden' NAME='access_font_size' VALUE='-2'><INPUT TYPE='hidden' NAME='heading_display' VALUE='Yes'>")
  document.writeln("<INPUT TYPE='hidden' NAME='headline_fgcolor' VALUE='333333'><INPUT TYPE='hidden' NAME='source_font' VALUE='Verdana, Arial,Helvetica, sans-serif'>")
  document.writeln("<INPUT TYPE='hidden' NAME='access_font' VALUE='Verdana, Arial,Helvetica, sans-serif'><INPUT TYPE='hidden' NAME='headline_font_size' VALUE='-1'>")
  document.writeln("<INPUT TYPE='hidden' NAME='headline_font' VALUE='Verdana, Arial,Helvetica, sans-serif'><INPUT TYPE='hidden' NAME='heading_bold' VALUE='Yes'>")
  document.writeln("<INPUT TYPE='hidden' NAME='item_spacing' VALUE='5'><INPUT TYPE='hidden' NAME='wizard_brand' VALUE='moreover'>")
  document.writeln("<INPUT TYPE='hidden' NAME='heading_bgcolor' VALUE='ffffff'><INPUT TYPE='hidden' NAME='cluster_cellpadding' VALUE='1'>")
  document.writeln("<INPUT TYPE='hidden' NAME='heading_fgcolor' VALUE='333333'><INPUT TYPE='hidden' NAME='source_fgcolor' VALUE='ff6600'>")
  document.writeln("<INPUT TYPE='hidden' NAME='cluster_border' VALUE='0'><INPUT TYPE='hidden' NAME='cluster_layout' VALUE='<br>'>")
  document.writeln("</TD></FORM></TR>")

  // End of clone button code //

  document.writeln("</TABLE></CENTER></TD></TR></TABLE></CENTER>")
}
}



  function show_articles3() {
  
  if (!early_exit)
  {
  var time = new Array(global_article.length);

  // Print out the table containing the headlines
  document.writeln("<CENTER><TABLE BORDER="+cluster_border+" BGCOLOR='#"+cluster_bgcolor+"' WIDTH='"+width+"' CELLPADDING=2 CELLSPACING=0>");
  document.writeln("<tr><td  align='center'><img src='http://i.moreover.com/images/moreover_wizard_link.gif' border='0'></td></tr>")
  document.writeln("<TR><TD><CENTER><TABLE BGCOLOR='#"+cluster_bgcolor+"' CELLPADDING="+cell_padding+" CELLSPACING="+cell_spacing+"  WIDTH='100%'>");

  if (heading_display == "Yes")
    {
    // Print a new category heading
    document.writeln("<TR BGCOLOR='#"+heading_bgcolor+"'><TD>");
    document.writeln("<FONT SIZE="+heading_font_size+" FACE="+heading_font+" COLOR='#"+heading_fgcolor+"'>");
    document.writeln("<B>"+webfeed_heading+"</B></FONT></TD></TR>");
    }

  // Start loop for articles
    for (var counter=0; counter < numberofarticles; counter++)
    {
    if ((counter == (global_article.length - 1)) && moreover_text == 1) 
      { 
      headline_fgcolor = source_fgcolor; 
      time_display = "No";
      }

    // Print out the headline
    document.writeln("<TR BGCOLOR='#"+headline_bgcolor+"'><TD><A HREF='"+global_article[counter].url+"' >");
    document.writeln("<FONT SIZE="+headline_font_size+" FACE="+headline_font+" COLOR='#"+headline_fgcolor+"'");
    document.writeln(">"+global_article[counter].headline_text+"...</FONT></A><br>");
    
    // Print out the source
    if ((counter != (global_article.length - 1)) || moreover_text != 1)
       {
       document.writeln("<A HREF='"+global_article[counter].document_url+"' >");
       document.writeln("<FONT FACE="+source_font+" SIZE="+source_font_size+" COLOR='#"+source_fgcolor+"'>");
       document.writeln(""+global_article[counter].source+"</FONT></A>&nbsp;&nbsp;");
       }
  
    // Print out reg/sub if appropriate
    if (global_article[counter].access_status == "sub" || global_article[counter].access_status == "reg")
      {
      document.writeln(" <A HREF='"+global_article[counter].access_registration+"'>");
      document.writeln("<FONT FACE="+access_font+" SIZE="+access_font_size);
      document.writeln(" COLOR='#"+access_fgcolor+"'>"+global_article[counter].access_status+"</FONT></A>&nbsp;&nbsp;");
      }

    // Print out the harvest time
    if (time_display == "Yes")
      {
      // 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.writeln("<FONT FACE="+time_font+" SIZE="+time_font_size+" COLOR='#"+time_fgcolor+"'>");
      document.writeln(""+time[counter].toString()+"</FONT>");
      } 

    document.writeln("</TD></TR><TR BGCOLOR='#"+headline_bgcolor+"'><TD BGCOLOR='#"+headline_bgcolor+"' HEIGHT="+item_spacing+"></TD></TR>");
    } // End of article loop

  // Start of clone button code //
  // NOTE: DO NOT REMOVE any of the code in this section //
  document.writeln("<FORM METHOD='POST' ACTION='http://www.moreover.com/cgi-local/wizard_clone.pl' target='clone' name='moreover_clone'>");
  document.writeln("<INPUT TYPE='hidden' NAME='parent_code' VALUE='502292'>");
  document.writeln("<INPUT TYPE='hidden' NAME='heading_font_size' VALUE='-1'><INPUT TYPE='hidden' NAME='source_font_size' VALUE='-2'>")
  document.writeln("<INPUT TYPE='hidden' NAME='cluster_width' VALUE='400'><INPUT TYPE='hidden' NAME='time_display' VALUE='Yes'>")
  document.writeln("<INPUT TYPE='hidden' NAME='time_font' VALUE='Verdana, Arial,Helvetica, sans-serif'><INPUT TYPE='hidden' NAME='cluster_cellspacing' VALUE='0'>")
  document.writeln("<INPUT TYPE='hidden' NAME='heading_font' VALUE='Verdana, Arial,Helvetica, sans-serif'><INPUT TYPE='hidden' NAME='number_of_headlines' VALUE='5'>")
  document.writeln("<INPUT TYPE='hidden' NAME='cluster_bgcolor' VALUE='ffffff'><INPUT TYPE='hidden' NAME='search_keywords' VALUE=''>")
  document.writeln("<INPUT TYPE='hidden' NAME='refine_category' VALUE=''><INPUT TYPE='hidden' NAME='time_fgcolor' VALUE='008080'>")
  document.writeln("<INPUT TYPE='hidden' NAME='access_fgcolor' VALUE='008080'><INPUT TYPE='hidden' NAME='time_font_size' VALUE='-2'>")
  document.writeln("<INPUT TYPE='hidden' NAME='headline_bgcolor' VALUE='ffffff'><INPUT TYPE='hidden' NAME='access_font_size' VALUE='-2'>")
  document.writeln("<INPUT TYPE='hidden' NAME='cluster_name' VALUE='c=Open%20source%20news&o=js'><INPUT TYPE='hidden' NAME='heading_display' VALUE='Yes'>")
  document.writeln("<INPUT TYPE='hidden' NAME='headline_fgcolor' VALUE='333333'><INPUT TYPE='hidden' NAME='source_font' VALUE='Verdana, Arial,Helvetica, sans-serif'>")
  document.writeln("<INPUT TYPE='hidden' NAME='access_font' VALUE='Verdana, Arial,Helvetica, sans-serif'><INPUT TYPE='hidden' NAME='headline_font_size' VALUE='-1'>")
  document.writeln("<INPUT TYPE='hidden' NAME='headline_font' VALUE='Verdana, Arial,Helvetica, sans-serif'><INPUT TYPE='hidden' NAME='heading_bold' VALUE='Yes'>")
  document.writeln("<INPUT TYPE='hidden' NAME='item_spacing' VALUE='5'><INPUT TYPE='hidden' NAME='wizard_brand' VALUE='moreover_new'>")
  document.writeln("<INPUT TYPE='hidden' NAME='heading_bgcolor' VALUE='ffffff'><INPUT TYPE='hidden' NAME='cluster_cellpadding' VALUE='1'>")
  document.writeln("<INPUT TYPE='hidden' NAME='heading_fgcolor' VALUE='333333'><INPUT TYPE='hidden' NAME='source_fgcolor' VALUE='008080'>")
  document.writeln("<INPUT TYPE='hidden' NAME='cluster_border' VALUE='0'><INPUT TYPE='hidden' NAME='cluster_layout' VALUE='<br>'>")

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

  document.writeln("</TABLE></CENTER></TD></TR></TABLE></CENTER>");

  } 
}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            