 // Start of table
 document.write('<table border=0 width=100%>');





// Create arrays of articles
syndicate.article_title = new Array;
syndicate.article_url = new Array;
syndicate.article_date = new Array;
syndicate.article_summary = new Array;
syndicate.article_content = new Array;

// This section of the script is published by the software
syndicate.index = 0;
  syndicate.article_title[ syndicate.index ] = 'Extra Staff Training Day';
  syndicate.article_url[ syndicate.index ] = 'http://newbattle.mgfl.info/artman2/publish/news/Extra_Staff_Training_Dya.shtml';
  syndicate.article_date[ syndicate.index ] = 'Feb 19, 2010';
  syndicate.article_summary[ syndicate.index ] = 'In a change to school term dates that had previously been issued, there will be an extra Staff Training Day on <strong>Tuesday 18th May 2010</strong>.&nbsp; This is in addition to the Victoria Day holiday on Monday 17th May 2010.&nbsp; For all term and holiday dates, see the <a href=\"Information/termdates.html\">school term dates 2009-2010</a> page.';
  syndicate.index++;  syndicate.article_title[ syndicate.index ] = 'World Maths Day';
  syndicate.article_url[ syndicate.index ] = 'http://newbattle.mgfl.info/artman2/publish/Maths/World_Maths_Day.shtml';
  syndicate.article_date[ syndicate.index ] = 'Mar 01, 2010';
  syndicate.article_summary[ syndicate.index ] = 'All S1 maths classes will be taking part in the World Maths Day Challenge this week - you can log in to the site here:&nbsp;<a href=\"http://www.worldmathsday.com/\">http://www.worldmathsday.com/</a>';
  syndicate.index++;  syndicate.article_title[ syndicate.index ] = 'Course Choices for current S2 pupils';
  syndicate.article_url[ syndicate.index ] = 'http://newbattle.mgfl.info/artman2/publish/news/coursechoice.shtml';
  syndicate.article_date[ syndicate.index ] = 'Jan 30, 2010';
  syndicate.article_summary[ syndicate.index ] = 'Now is the time for S2 pupils to make&nbsp;important decisions about which courses to take next year. Visit our <a href=\"WhichCourseS3/index.html\">online S3 course guide \"<em>Which Course</em>?\"</a>,&nbsp;which contains information that will help parents and students to make informed decisions on courses choices for next year and beyond.';
  syndicate.index++;  syndicate.article_title[ syndicate.index ] = 'Thanks from the Gambia';
  syndicate.article_url[ syndicate.index ] = 'http://newbattle.mgfl.info/artman2/publish/news/Thanks_from_the_Gambia.shtml';
  syndicate.article_date[ syndicate.index ] = 'Jan 26, 2010';
  syndicate.article_summary[ syndicate.index ] = 'A thank you letter has been sent with some photos of people wearing the Scotland&nbsp;shirts staff and pupils kindly donated&nbsp;to The Gambians at Christmas.&nbsp; There is also a little information about school life in The Gambia.&nbsp; <a href=\"http://newbattle.mgfl.info/artman2/uploads/1/gambialetter.pdf\">Click here to view the thank you letter</a>.';
  syndicate.index++;  syndicate.article_title[ syndicate.index ] = 'Associated Primary School Extra-Curricular Programme';
  syndicate.article_url[ syndicate.index ] = 'http://newbattle.mgfl.info/artman2/publish/news/Associated_Primary_School_Extra-Curricular_Programme.shtml';
  syndicate.article_date[ syndicate.index ] = 'Jan 25, 2010';
  syndicate.article_summary[ syndicate.index ] = 'The new <a href=\"Groups/Sports/PrimaryTT.pdf\">programme for extra curricular sports in Newbattle\'s associated <strong>Primary schools</strong></a> has now been launched.&nbsp; This means that together with the <a href=\"Groups/Sports/SportsTT.pdf\">extra-curricular programme for pupils at Newbattle High</a>, pupils in our community now have access to curricular and extra-curricular sport from the ages of 5 up to 17 years';
  syndicate.index++;  syndicate.article_title[ syndicate.index ] = 'Commonwealth Gold Medallist visits Newbattle';
  syndicate.article_url[ syndicate.index ] = 'http://newbattle.mgfl.info/artman2/publish/news/Steve_Frew_Commonwealth_Gold_Medallist_visit.shtml';
  syndicate.article_date[ syndicate.index ] = 'Jan 24, 2010';
  syndicate.article_summary[ syndicate.index ] = 'Steve Frew, Commonwealth Gymnast Gold Medallist makes an inspirational visit to Newbattle High School.';
  syndicate.index++;  syndicate.article_title[ syndicate.index ] = 'Midlothian Provost and Staff meet new Scotland Coach';
  syndicate.article_url[ syndicate.index ] = 'http://newbattle.mgfl.info/artman2/publish/news/Midlothian_Provost_and_Staff_meet_new_Scotland_Coach.shtml';
  syndicate.article_date[ syndicate.index ] = 'Jan 23, 2010';
  syndicate.article_summary[ syndicate.index ] = 'Midlothian Provost and staff meet Craig Levein the new Scotland Football coach at 7th Annual Grassroots Awards at Hampden Stadium.';
  syndicate.index++;  syndicate.article_title[ syndicate.index ] = 'Commonwealth Gold medal winning gymnast visits Newbattle';
  syndicate.article_url[ syndicate.index ] = 'http://newbattle.mgfl.info/artman2/publish/news/Commonwealth_Gold_medal_winning_gymnast_Steve_Frew_goes_back_to_school_in_Newbattle_High.shtml';
  syndicate.article_date[ syndicate.index ] = 'Jan 15, 2010';
  syndicate.article_summary[ syndicate.index ] = 'Commonwealth Gold medal winning gymnast, Steve Frew is to visit pupils from Newbattle High School on Tuesday 19th January as part of their involvement in <a href=\"http://livingforsport.skysports.com/index.aspx\">Sky Sport\'s Living for Sport</a> – an initiative that uses the power of sport to motivate and inspire young people.';
  syndicate.index++;  syndicate.article_title[ syndicate.index ] = 'Sport Programme January-April 2010';
  syndicate.article_url[ syndicate.index ] = 'http://newbattle.mgfl.info/artman2/publish/news/Sport_Programme.shtml';
  syndicate.article_date[ syndicate.index ] = 'Jan 07, 2010';
  syndicate.article_summary[ syndicate.index ] = 'The new <a href=\"Groups/Sports/SportsTT.pdf\">Extra-Curricular sport timetable</a> for Winter 2010 has been published. Click the link to find out about all the activities on offer, or go to our <a href=\"Groups/index.html\">Groups and Clubs section</a> for information on all extra-curricular activities.';
  syndicate.index++;  syndicate.article_title[ syndicate.index ] = 'Strictly Come Dancing Photos';
  syndicate.article_url[ syndicate.index ] = 'http://newbattle.mgfl.info/artman2/publish/news/Strictly_Come_Dancing_Photos.shtml';
  syndicate.article_date[ syndicate.index ] = 'Dec 18, 2009';
  syndicate.article_summary[ syndicate.index ] = '<em>Strictly Come Dancing </em>came to Newbattle on Thursday 3rd December to raise money for BBC Children in Need.&nbsp; Now, you can view our <strong>photo gallery</strong> and <strong>videos</strong> of the fantastic evening:&nbsp;<a href=\"News/Strictly/index.html\">click here to find out more</a>, or <a href=\"http://www.newbattle.org.uk/PhotoGalleries/Strictly/index.htm\">click here to go straight to the photos</a>.';
  syndicate.index++;




// Set defaults for arguments if user hasn't set them
if (syndicate.title_fontface == null)    { syndicate.title_fontface = 'Geneva, Arial, sans-serif'; }
if (syndicate.title_fontsize == null)    { syndicate.title_fontsize = '2'; }
if (syndicate.title_fontcolor == null)   { syndicate.title_fontcolor = '#003399'; }
if (syndicate.title_fontbold == null)    { syndicate.title_fontbold = true; }
if (syndicate.title_fontital == null)    { syndicate.title_fontital = false; }
if (syndicate.date_fontface == null)     { syndicate.date_fontface = 'Geneva, Arial, sans-serif'; }
if (syndicate.date_fontsize == null)     { syndicate.date_fontsize = '1'; }
if (syndicate.date_fontcolor == null)    { syndicate.date_fontcolor = '#6699cc'; }
if (syndicate.date_fontbold == null)     { syndicate.date_fontbold = false; }
if (syndicate.date_fontital == null)     { syndicate.date_fontital = false; }
if (syndicate.date_fontunder == null)    { syndicate.date_fontunder = false; }
if (syndicate.summary_fontface == null)  { syndicate.summary_fontface = 'Geneva, Arial, sans-serif'; }
if (syndicate.summary_fontsize == null)  { syndicate.summary_fontsize = '2'; }
if (syndicate.summary_fontcolor == null) { syndicate.summary_fontcolor = '#6699cc'; }
if (syndicate.summary_fontbold == null)  { syndicate.summary_fontbold = false; }
if (syndicate.summary_fontital == null)  { syndicate.summary_fontital = false; }
if (syndicate.summary_fontunder == null) { syndicate.summary_fontunder = false; }

if (syndicate.title_maxlength == null)   { syndicate.title_maxlength = 0; }
if (syndicate.summary_maxlength == null) { syndicate.summary_maxlength = 0; }

if (syndicate.bgcolor == null)           { syndicate.bgcolor = '#ffffff'; }
if (!syndicate.max_articles)             { syndicate.max_articles = syndicate.article_title.length; }  // !syndicate.max_articles catches null and zero
if (syndicate.display_date == null)      { syndicate.display_date = true; }
if (syndicate.display_summaries == null) { syndicate.display_summaries = true; }


// Don't allow user to display too many articles
if (syndicate.max_articles > syndicate.article_title.length) {
  syndicate.max_articles = syndicate.article_title.length;
}

/*
//Function to crop text on word boundaries
function crop_text(text, max_length) {

  // If the string is already small enough, return it unscathed
  if (text.length <= max_length) { return( text ); }

  // If the user has specified a length of 0, it means he wants the whole thing
  if (max_length == 0) { return( text ); }

  // Start looking for a space, leaving space for an elipsis on the end
  var test_length = (max_length - 3);
  if (test_length < 1) { return( '...' ); }   // max_length too small
  while (text.charAt(test_length) != ' ') {
    test_length--;

    // If we didn't find any spaces to break on, return the string broken at max_length
    if (test_length == 0) { return( text.substring(0, max_length - 3) + '...' ); }
  }

  return text.substring(0, test_length) + '...';
}
*/

// List our articles, stopping if the user doesn't want any more
for ( syndicate.index = 0; syndicate.index < syndicate.max_articles ; syndicate.index++ ) {

  /*syndicate.article_title[syndicate.index] = crop_text(syndicate.article_title[syndicate.index], syndicate.title_maxlength);
  syndicate.article_summary[syndicate.index] = crop_text(syndicate.article_summary[syndicate.index], syndicate.summary_maxlength);*/

  document.write('<tr><td bgcolor="' + syndicate.bgcolor + '">');
  document.write('<a href="' + syndicate.article_url[syndicate.index] + '" target="_blank">');
  if (syndicate.title_fontbold)  { document.write('<b>'); }
  if (syndicate.title_fontital)  { document.write('<i>'); }
  document.write('<font color="' + syndicate.title_fontcolor + '" face="' + syndicate.title_fontface + '" size="' + syndicate.title_fontsize + '"');
  if (syndicate.title_style)     { document.write(' style="' + syndicate.title_style + '"'); }
  document.write('>');
  document.write(syndicate.article_title[syndicate.index]);
  document.write('<br></font>');
  if (syndicate.title_fontital)  { document.write('</i>'); }
  if (syndicate.title_fontbold)  { document.write('</b>'); }
  document.write('</a>');

  if (syndicate.display_date) {
    if (syndicate.date_fontbold)  { document.write('<b>'); }
    if (syndicate.date_fontital)  { document.write('<i>'); }
    if (syndicate.date_fontunder) { document.write('<u>'); }
    document.write('<font color="' + syndicate.date_fontcolor + '" face="' + syndicate.date_fontface + '" size="' + syndicate.date_fontsize + '"');
    if (syndicate.date_style)     { document.write(' style="' + syndicate.date_style + '"'); }
    document.write('>');
    document.write(syndicate.article_date[syndicate.index]);
    document.write('<br></font>');
    if (syndicate.date_fontunder) { document.write('</u>'); }
    if (syndicate.date_fontital)  { document.write('</i>'); }
    if (syndicate.date_fontbold)  { document.write('</b>'); }
  }

  if (syndicate.display_summaries) {
    if (syndicate.summary_fontbold)  { document.write('<b>'); }
    if (syndicate.summary_fontital)  { document.write('<i>'); }
    if (syndicate.summary_fontunder) { document.write('<u>'); }
    document.write('<font color="' + syndicate.summary_fontcolor + '" face="' + syndicate.summary_fontface + '" size="' + syndicate.summary_fontsize + '"');
    if (syndicate.summary_style)     { document.write(' style="' + syndicate.summary_style + '"'); }
    document.write('>');
    document.write(syndicate.article_summary[syndicate.index]);
    document.write('<br></font>');
    if (syndicate.summary_fontunder) { document.write('</u>'); }
    if (syndicate.summary_fontital)  { document.write('</i>'); }
    if (syndicate.summary_fontbold)  { document.write('</b>'); }
  }

  document.write('<br></td></tr>\n');
}

// If you want your Webfeeds to be branded, uncomment the following lines.
// To do this, remove the // at the beginning of the next five lines:

//document.write('<tr><td bgcolor="' + syndicate.bgcolor + '">');
//document.write('<a href="#" target="_blank">');
//document.write('<font color="' + syndicate.title_fontcolor + '" face="Verdana, Arial, Helvetica, sans-serif" size="1">');
//document.write('<p><b>Powered by Newbattle CHS</b></font></a>');
//document.write('<br><br></b></font></td></tr>\n');

 // End of table
document.write('</table>');
