//***********************************************************************
//* APPLICATION	: WTO Web Site
//* COMPONENT	: 
//* PAGE		: 
//* CREATION	: 24/02/2006
//* AUTHOR		: Jane M Pickett
//* CONTENT		: Functions for displaying news items
//*		
//***********************************************************************
//* UPDATES		:
//*
//***********************************************************************

var sorted_news = new Array();
var i = 0;
var j = 0;
var k = 0;
var l = 0;
var cnt = 0;
var popup_width = 0;
var popup_height = 0;
var thbnl_array = new Array();
var language = 1;
var year = "";
var lc_page_name = location.href.toLowerCase();
var path_start = lc_page_name.indexOf("/spanish/");
var lc_root_path = lc_page_name.slice(path_start);
	
// Function to display a list of the annual news archives 
function listNewsArchives()
{
	var truncYear = "";
	var today = new Date();
	var thisYear = today.getFullYear();
	if (thisYear < 1900)
	{
		thisYear = thisYear + 1900;
	}
// check if the latest news item was for the current year (to account for time at the begining of
// a year when there may have been no news items
	if (parseInt(news_item[news_item.length - 1].ni_date.slice(0, 4), 10) != thisYear)
	{
		thisYear = thisYear - 1;
	}
	document.write("<p class=\"paranormaltext\">");
	for (i = thisYear; i >= 1998; i--)
	{
		truncYear = ("" + i).slice(2, 4);
// display a link for each year
		document.write("<a class=\"paracolourtext\" href=\"/spanish/news_s/news" + truncYear + "_s/news" + truncYear + "_s.htm\">" + i + "</a>");
		if ( i != 1998)
		{
			document.write(" / ")
		}
	}
	document.writeln("</p>");
}


// Function to display a list of the annual press release archives 
function listPressArchives()
{
	var truncYear = "";
	var today = new Date();
	var thisYear = today.getFullYear();
	if (thisYear < 1900)
	{
		thisYear = thisYear + 1900;
	}
// read backwards through list of news items to get latest press release
	for (i = news_item.length - 1; i >= 0; i--)
	{
		if ((news_item[i] !== not_defined) && (news_item[i].ni_embargo == ""))
		{
			if (news_item[i].ni_subject.indexOf("PRES") != -1);
			{
// check if the latest press release was for the current year (to account for time at the begining of
// a year when there may have been no press releases
				if (parseInt(news_item[i].ni_date.slice(0, 4), 10) != thisYear)
				{
					thisYear = thisYear - 1;
				}
				document.write("<p class=\"paranormaltext\">");
				for (j = thisYear; j >= 1995; j--)
				{
					truncYear = ("" + j).slice(2, 4);
// display a link for each year
					document.write("<a class=\"paracolourtext\" href=\"/spanish/news_s/pres" + truncYear + "_s/pres" + truncYear + "_s.htm\">" + j + "</a>");
					if (j != 1995)
					{
						document.write(" / ")
					}
				}
				document.writeln("</p>");
				break;
			}
		}
	}
}




// Function to display a list of the subject archives 
function listSubjectArchives()
{
	document.writeln("<ul class=\"paranormaltext\">");
	for (i = 0; i < subject.length; i++)
	{
// display a link for each item in the subject array that has an archive specified
		if (subject[i].archive != "")
		{
			document.writeln("<li><a class=\"paracolourtext\" href=\"" + subject[i].archive + "\">" + subject[i].title.slice(0, 1).toUpperCase() + subject[i].title.slice(1, subject[i].title.length) + "</a></li>");
		}
	}
	document.writeln("</ul>");
}


// Function to display all the links specific to a news item
function showNewsLinks(i)
{
	var j = 0;
	var q = 0;
	var r = 0;
	var quality = "";
// loop through each link object for the news item if more than 3 links
	if (news_item[sorted_news[i][1]].ni_links.length >= 3)
	{
		for (j = 0; j < news_item[sorted_news[i][1]].ni_links.length; j++)
		{
			end_url = news_item[sorted_news[i][1]].ni_links[j].nl_url.substr(news_item[sorted_news[i][1]].ni_links[j].nl_url.length - 3, 3).toLowerCase();
// count number of mp3 links for news item
			if (end_url == "mp3")		
			{
				r = r + 1;
			}
		}
	}
// loop through each link object for the news item
	for (j = 0; j < news_item[sorted_news[i][1]].ni_links.length; j++)
	{
// ignore links that are bookmarks to news gateway
		if ((news_item[sorted_news[i][1]].ni_links[j].nl_url.indexOf("/spanish/news_s/news_s.htm#") == -1) && (news_item[sorted_news[i][1]].ni_links[j].nl_display == "Y"))
		{
// don't display audio if there are more than 3 audio files
		end_url = news_item[sorted_news[i][1]].ni_links[j].nl_url.substr(news_item[sorted_news[i][1]].ni_links[j].nl_url.length - 3, 3).toLowerCase();
		if ((r <= 3) || ((r > 3) && (end_url != "mp3")))
		{
// insert new lines where needed
			if ((news_item[sorted_news[i][1]].ni_intro != "" ) || (j > 0))
			{
				document.write("<br>");
			}
// link contains a url - display a link		
			if (news_item[sorted_news[i][1]].ni_links[j].nl_url != "")
			{
				new_window = false;
				flyout_text = "";
// add image from photo array if one exists
				if (news_item[sorted_news[i][1]].ni_links[j].nl_image != "")
				{
					year = news_item[sorted_news[i][1]].ni_date.slice(0, 4);
					popup_width = parseInt(photo_array[news_item[sorted_news[i][1]].ni_links[j].nl_image][6]) + 20;
					var numlines = Math.ceil(((photo_array[news_item[sorted_news[i][1]].ni_links[j].nl_image][0].length + 2 + photo_array[news_item[sorted_news[i][1]].ni_links[j].nl_image][language].length) * 6) / popup_width);
					popup_height = parseInt(photo_array[news_item[sorted_news[i][1]].ni_links[j].nl_image][7]) + 60 + (numlines * 22);
					document.write("<a href=\"javascript:openAWindow(\'/library/photo_gallery/popup_photo_" + language_letter_array[language] + ".htm?year=" + year + "&id=" + news_item[sorted_news[i][1]].ni_links[j].nl_image + "&section=" + wto_menu_column + "\',\'links\'," + popup_width + "," + popup_height + ",1)\" onmouseover=\"writetxt(\'" + call_out_array[language] + ", (" + photo_array[news_item[sorted_news[i][1]].ni_links[j].nl_image][5] + kb_array[language] + "); " + new_window_array[language] + "\')\" onmouseout=\"writetxt(0)\">");
					if (photo_array[news_item[sorted_news[i][1]].ni_links[j].nl_image][8] == 1)
					{
						thbnl_array = photo_array[news_item[sorted_news[i][1]].ni_links[j].nl_image][4].split(".");
						document.write("<img border=\"0\" src=\"" + thbnl_array[0] + "_thbnl.jpg\" width=\"50\" align=\"left\">");
					}
					else
					{
						document.write("<img border=\"0\" src=\"" + photo_array[news_item[sorted_news[i][1]].ni_links[j].nl_image][4] + "\" width=\"50\" align=\"left\">");
					}
					document.writeln("</a>");			
				}
// link is a docsonline symbol - build code for docsonline search
				if (news_item[sorted_news[i][1]].ni_links[j].nl_dol == "S")
				{
					document.writeln("&gt;&nbsp;<a href=\"\" onclick=\"f_submit(\'(@meta_Symbol " + news_item[sorted_news[i][1]].ni_links[j].nl_url + ")\',\'3\');return false\" class=\"paracolourtext\"  onmouseover=\"writetxt(\'Búsqueda en Documentos en línea.  Los resultados aparecen en una nueva ventana\')\" onmouseout=\"writetxt(0)\">" + news_item[sorted_news[i][1]].ni_links[j].nl_text + "</a>"); 
				}
				else
				{
// link is not a html file
					if (end_url != "htm")
					{
// loop through array of different document types			
						for (k = 0; k < document_type_array.length; k++)
						{
// extension of link is in list of selected docment types - set indicator for a new window 
// and build flyout text
							if (document_type_array[k][0] == end_url)
							{
								new_window = true;
								flyout_text = document_type_array[k][1] + " ";
								if (news_item[sorted_news[i][1]].ni_links[j].nl_pages != "")
								{
									if ((end_url == "mp3") || (end_url == "wmv"))
									{
										flyout_text = flyout_text + news_item[sorted_news[i][1]].ni_links[j].nl_pages  + " minutos; ";
									}
									else
									{
										flyout_text = flyout_text + news_item[sorted_news[i][1]].ni_links[j].nl_pages  + " páginas; ";
									}
								}
								if (news_item[sorted_news[i][1]].ni_links[j].nl_kb != "")
								{
// if filesize > 1MB display size in MB
									if (parseInt(news_item[sorted_news[i][1]].ni_links[j].nl_kb) > 1024)
									{
										file_size = Math.round(parseInt(news_item[sorted_news[i][1]].ni_links[j].nl_kb)/1024);
										flyout_text = flyout_text + file_size + "MB; ";
									}
									else
									{
										flyout_text = flyout_text + news_item[sorted_news[i][1]].ni_links[j].nl_kb + "KB; ";
									}
								}
								flyout_text = flyout_text + new_window_text;
								break;
							}
						}
					}
					start_url = news_item[sorted_news[i][1]].ni_links[j].nl_url.substr(0, 7);
// link is to an external website - set indicator for a new window and build flyout text	
					if ((new_window == false) && ((start_url == "http://") || (start_url == "https:/")))
					{
						new_window = true;
						flyout_text = new_window_text;
					}
					if (end_url == "mp3")
					{
						document.write("<img border=\"0\" src=\"/images/audio.gif\" width=\"24\" height=\"12\"><a href=\"");
					}
					else if (end_url == "wmv")
					{
						document.write("<img border=\"0\" src=\"/images/video.gif\" width=\"24\" height=\"12\"><a href=\"");
					}
					else
					{
						document.write("&gt;&nbsp;<a href=\"");
					}
// link is a directdoc link - build appropriate path
					if (news_item[sorted_news[i][1]].ni_links[j].nl_dol == "D")
					{
						document.write("http://docsonline.wto.org/imrd/directdoc.asp?DDFDocuments/v/");   
					}
					document.write(news_item[sorted_news[i][1]].ni_links[j].nl_url + "\" class=\"paracolourtext\"");
// link opens in a new window if required
					if (new_window == true)
					{
						document.write(" target=\"_blank\""); 
					}
// flyout text is displayed if required
					if (flyout_text != "")
					{
						document.write(" onmouseover=\"writetxt(\'" + flyout_text + "\')\" onmouseout=\"writetxt(0)\"");
					}
					for (q = 0; q < media_quality_array.length; q++)
					{
						if (media_quality_array[q][0] == news_item[sorted_news[i][1]].ni_links[j].nl_quality)
						{
							quality = media_quality_array[q][1];
							break;
						}
					}
					document.write(">" + news_item[sorted_news[i][1]].ni_links[j].nl_text);
					if (quality != "")
					{
						document.write(" (" + quality + ")");
					}
					document.write("</a>");
// array item has variable set to indicate it is in another language - write message to this effect			
					if (news_item[sorted_news[i][1]].ni_links[j].nl_lang_id != 0)
					{
						document.write(" <span class=\"parasmalltext\">(" + language_text_array[news_item[sorted_news[i][1]].ni_links[j].nl_lang_id] + ")</span>");
					}
					var stringLength = news_item[sorted_news[i][1]].ni_links[j].nl_text.length + language_text_array[news_item[sorted_news[i][1]].ni_links[j].nl_lang_id].length;
					if ((news_item[sorted_news[i][1]].ni_links[j].nl_image != "") && (stringLength < 48))
					{
						document.write("<br>&nbsp;");
					}
				}
			}
// link has no url - display coming soon text
			else
			{
				document.writeln("&gt;&nbsp;" + news_item[sorted_news[i][1]].ni_links[j].nl_text + " <span class=\"parasmalltext\">(" + language_text_array[8] + ")</span>");
			}	
		}
	}
	}
}

// Function to display links to each of the cases specified in the cases field of the array
function showCasesLinks(i)
{
// loop through each case in the cases field of the news item
	if (news_item[sorted_news[i][1]].ni_cases != "")
	{
		cases_array = news_item[sorted_news[i][1]].ni_cases.split("#");
		for (k = 0; k < cases_array.length; k++)
		{
			document.writeln("<br>&gt;&nbsp;<a href=\"" + cases_link_array[0] + cases_array[k] + "_s.htm\" class=\"paracolourtext\" onmouseover=\"writetxt(\'" + cases_link_array[2] + "\')\" onmouseout=\"writetxt(0)\">" + cases_link_array[1] + cases_array[k] + "</a>");
		}
	}
}

// Function to display links to each of the countries specified in the countries field of the array
function showCountriesLinks(i)
{
	if (news_item[sorted_news[i][1]].ni_country != "")
	{
		country_array = news_item[sorted_news[i][1]].ni_country.split("#");
// loop through each country in the country field for the news item
		for (k = 0; k < country_array.length; k++)
		{
// loop through the array of country objects
			for (l = 0; l < country.length; l++)
			{
// if matching code found and a country page exists for it display a link
				if ((country[l].code == country_array[k]) && (country[l].page != ""))
				{
					document.writeln("<br>&gt;&nbsp;<a href=\""	+ country[l].page + "\" class=\"paracolourtext\">Más información sobre " + country[l].article + country[l].name + "</a>");
					break;
				}
			}
		}
	}
}

// Function to display links to each of the subjects specified in the subjects field of the array
function showSubjectsLinks(i)
{
	if (news_item[sorted_news[i][1]].ni_subject != "")
	{
		subject_array = news_item[sorted_news[i][1]].ni_subject.split("#");
// loop through each of the subjects specified for the news item
		for (k = 0; k < subject_array.length; k++)
		{
// loop through each subject object in the subject array
			for (l = 0; l < subject.length; l++)
			{
// if subjects match and a gateway for that subject exists display a link
				if ((subject[l].code == subject_array[k]) && (subject[l].gateway != ""))
				{
					document.writeln("<br>&gt;&nbsp;<a href=\""	+ subject[l].gateway + "\" class=\"paracolourtext\">Más información sobre " + subject[l].article + subject[l].title + "</a>");
					break;
				}
			}
		}
	}
}

// Function to display the first news item on news home page
function showFirstNews()
{
	var i = 0;
	var q = 0;
	var quality = "";
	var r = 0;
	var show_media_link = true;
// read backwards through array of news items
for (i = news_item.length - 1; i >= 0; i--)
	{
// news item not under embargo & has a position of 1
		if ((news_item[i] !== not_defined) && (news_item[i].ni_embargo == "") && (news_item[i].ni_pos == "1"))
		{
// generate bookmark
			document.write("<p class=\"news1headlinetext\"><a name=\"bkmk" + i + "\"></a>");
// display image if one exists
			if (news_item[i].ni_image != "")
			{
// doha image has flyout & link				
				if (news_item[i].ni_image == doha_link_array[0])
				{
					document.write("<a href=\"" + doha_link_array[1] + "\"onmouseover=\"writetxt(\'" + doha_link_array[2] + "\')\" onmouseout=\"writetxt(0)\"><img border=\"0\" align=\"left\" src=\"" + news_item[i].ni_image + "\"></a>");
				}
				else
				{
					document.write("<img border=\"0\" align=\"left\" src=\"" + news_item[i].ni_image + "\">");
				}
			}
			document.writeln(news_item[i].ni_head + "</p>");
			document.write("<p class=\"news1bodytext\">"); 
// display introduction if one exists
			if (news_item[i].ni_intro != "")
			{
				document.writeln(news_item[i].ni_intro);
			}
						// loop through each link object for the news item if more than 3 links
	if (news_item[i].ni_links.length >= 3)
	{
		for (j = 0; j < news_item[i].ni_links.length; j++)
		{
			end_url = news_item[i].ni_links[j].nl_url.substr(news_item[i].ni_links[j].nl_url.length - 3, 3).toLowerCase();
// count number of mp3 links for news item
			if (end_url == "mp3")		
			{
				r = r + 1;
			}
		}
	}

// loop through all the links specified for the news item			
			for (j = 0; j < news_item[i].ni_links.length; j++)
			{
				//if ((j > 0 ) && (news_item[i].ni_links[j].nl_url.substr(news_item[i].ni_links[j].nl_url.length - 3, 3).toLowerCase() == "mp3"))
				//{
					//if (news_item[i].ni_links[0].nl_url.substr(news_item[i].ni_links[j].nl_url.length - 3, 3).toLowerCase() == "mp3")
					//{
						//show_media_link = true;
					//}
					//else
					//{
						//show_media_link = false;
					//}
				//}
				//else
				//{
					//show_media_link = true;
				//}
// ignore links that are bookmarks to news gateway
				//if ((news_item[i].ni_links[j].nl_url.indexOf("/spanish/news_s/news_s.htm#") == -1) && (show_media_link == true))
				if ((news_item[i].ni_links[j].nl_url.indexOf("/spanish/news_s/news_s.htm#") == -1) && (news_item[i].ni_links[j].nl_display == "Y"))
				{
	// don't display audio if there are more than 3 audio files
		end_url = news_item[i].ni_links[j].nl_url.substr(news_item[i].ni_links[j].nl_url.length - 3, 3).toLowerCase();
		if ((r <= 3) || ((r > 3) && (end_url != "mp3")))
		{
				if ((news_item[i].ni_intro != "" ) || (j > 0))
				{
					document.write("<br>");
				}
				if (news_item[i].ni_links[j].nl_url != "")
				{
					new_window = false;
					flyout_text = "";
					//end_url = news_item[i].ni_links[j].nl_url.substr(news_item[i].ni_links[j].nl_url.length - 3, 3).toLowerCase();
// link is a doconline search
					if (news_item[i].ni_links[j].nl_dol == "S")
					{
						document.writeln("&gt;&nbsp;<a href=\"\" onclick=\"f_submit(\'(@meta_Symbol " + news_item[i].ni_links[j].nl_url + ")\',\'3\');return false\" class=\"paralargecolourtext\"  onmouseover=\"writetxt(\'Búsqueda en Documentos en línea.  Los resultados aparecen en una nueva ventana\')\" onmouseout=\"writetxt(0)\">" + news_item[i].ni_links[j].nl_text + "</a>"); 
					}
					else
					{
						if (end_url != "htm")
						{
// loop through array of different document types			
							for (k = 0; k < document_type_array.length; k++)
							{
// extension of link is in list of selected docment types - set indicator for a new window 
// and build flyout text
								if (document_type_array[k][0] == end_url)
								{
									new_window = true;
									flyout_text = document_type_array[k][1] + " ";
									if (news_item[i].ni_links[j].nl_pages != "")
									{
										if ((end_url == "mp3") || (end_url == "wmv"))
										{
											flyout_text = flyout_text + news_item[i].ni_links[j].nl_pages  + " minutos; ";
										}
										else
										{
											flyout_text = flyout_text + news_item[i].ni_links[j].nl_pages  + " páginas; ";
										}
									}
									if (news_item[i].ni_links[j].nl_kb != "")
									{
// if filesize > 1MB display size in MB
										if (parseInt(news_item[i].ni_links[j].nl_kb) > 1024)
										{
											file_size = Math.round(parseInt(news_item[i].ni_links[j].nl_kb)/1024);
											flyout_text = flyout_text + file_size + "MB; ";
										}
										else
										{
											flyout_text = flyout_text + news_item[i].ni_links[j].nl_kb + "KB; ";
										}
									}
									flyout_text = flyout_text + new_window_text;
									break;
								}
							}
						}
						start_url = news_item[i].ni_links[j].nl_url.substr(0, 7);
// link is to an external website - set indicator for a new window and build flyout text	
						if ((new_window == false) && ((start_url == "http://") || (start_url == "https:/")))
						{
							new_window = true;
							flyout_text = new_window_text;
						}
						if (end_url == "mp3")
						{
							document.write("<img border=\"0\" src=\"/images/audio.gif\" width=\"24\" height=\"12\"><a href=\"");
						}
						else if (end_url == "wmv")
						{
							document.write("<img border=\"0\" src=\"/images/video.gif\" width=\"24\" height=\"12\"><a href=\"");
						}
						else
						{
							document.write("&gt;&nbsp;<a href=\"");
						}
// link is a directdoc link
						if (news_item[i].ni_links[j].nl_dol == "D")
						{
							document.write("http://docsonline.wto.org/imrd/directdoc.asp?DDFDocuments/v/");   
						}
						document.write(news_item[i].ni_links[j].nl_url + "\" class=\"paralargecolourtext\"");
						if (new_window == true)
						{
							document.write(" target=\"_blank\""); 
						}
						if (flyout_text != "")
						{
							document.write(" onmouseover=\"writetxt(\'" + flyout_text + "\')\" onmouseout=\"writetxt(0)\"");
						}
				for (q = 0; q < media_quality_array.length; q++)
				{
					if (media_quality_array[q][0] == news_item[i].ni_links[j].nl_quality)
					{
						quality = media_quality_array[q][1];
						break;
					}
				}
				document.write(">" + news_item[i].ni_links[j].nl_text);
				if (quality != "")
				{
					document.write(" (" + quality + ")");
				}
				document.write("</a>");
// array item has variable set to indicate it is in another language - write message to this effect			
						if (news_item[i].ni_links[j].nl_lang_id != 0)
						{
							document.write(" <span class=\"parasmalltext\">(" + language_text_array[news_item[i].ni_links[j].nl_lang_id] + ")</span>");
						}
					}
				}
				else
// link has no url - write title with coming soon
				{
					document.writeln("&gt;&nbsp;" + news_item[i].ni_links[j].nl_text + " <span class=\"parasmalltext\">(" + language_text_array[8] + ")</span>");
				}
				}
				}
			}
// specified to show extra links for the news item
			if (news_item[i].ni_xlinks == "Y")
			{
// show links to specified cases
				if (news_item[i].ni_cases != "")
				{
					cases_array = news_item[i].ni_cases.split("#");
					for (k = 0; k < cases_array.length; k++)
					{
						document.writeln("<br>&gt;&nbsp;<a href=\"" + cases_link_array[0] + cases_array[k] + "_s.htm\" class=\"paralargecolourtext\" onmouseover=\"writetxt(\'" + cases_link_array[2] + "\')\" onmouseout=\"writetxt(0)\">" + cases_link_array[1] + cases_array[k] + "</a>");
					}
				}
// show links to specified countries
				if (news_item[i].ni_country != "")
				{
					country_array = news_item[i].ni_country.split("#");
					for (k = 0; k < country_array.length; k++)
					{
						for (l = 0; l < country.length; l++)
						{
							if ((country[l].code == country_array[k]) && (country[l].page != ""))
							{
								document.writeln("<br>&gt;&nbsp;<a href=\""	+ country[l].page + "\" class=\"paralargecolourtext\">Más información sobre " + country[l].article + country[l].name + "</a>");
								break;
							}
						}
					}
				}
// show links to specified subjects
				if (news_item[i].ni_subject != "")
				{
					subject_array = news_item[i].ni_subject.split("#");
					for (k = 0; k < subject_array.length; k++)
					{
						for (l = 0; l < subject.length; l++)
						{
							if ((subject[l].code == subject_array[k]) && (subject[l].gateway != ""))
							{
								document.writeln("<br>&gt;&nbsp;<a href=\""	+ subject[l].gateway + "\" class=\"paralargecolourtext\">Más información sobre " + subject[l].article + subject[l].title + "</a>");
								break;
							}
						}
					}
				}
			}
			document.writeln("</p>");
			break;
		}
	}
}


// Function to display news items 2-10 on news home page
function showNext9News()
{
	var news_date_array = new Array();
	var date_array = new Array();
	var cnt = 0;
	var j = 0;
// loop through each news item
	for (i = 0; i < news_item.length; i++)
	{
// item is not embargoed, position 1 or excluded from news page 
		if ((news_item[i] !== not_defined) && (news_item[i].ni_embargo == "") && (news_item[i].ni_pos != "1") && (news_item[i].ni_pos != "0"))
		{
			sorted_news[j] = [news_item[i].ni_date.slice(0, 19), i];
			j = j + 1;
		}
	}
// sort news items by date
	sorted_news.sort();
// loop backwards through 9 most recent items
	for (i = sorted_news.length-1; i >= 0; i--)
	{
		cnt = cnt + 1;
		document.writeln("<hr size=\"1\">");
		document.write("<p class=\"newsheadlinetext\"><a name=\"bkmk" + sorted_news[i][1] + "\"></a>");
// display image if required
		if (news_item[sorted_news[i][1]].ni_image != "")
		{
// special treatment for doha image
			if (news_item[sorted_news[i][1]].ni_image == doha_link_array[0])
			{
				document.write("<a href=\"" + doha_link_array[1] + "\"onmouseover=\"writetxt(\'" + doha_link_array[2] + "\')\" onmouseout=\"writetxt(0)\"><img border=\"0\" align=\"left\" src=\"" + news_item[sorted_news[i][1]].ni_image + "\"></a>");
			}
			else
			{
				document.write("<img border=\"0\" align=\"left\" src=\"" + news_item[sorted_news[i][1]].ni_image + "\">");
			}
		}
		document.writeln(news_item[sorted_news[i][1]].ni_head + "</p>");
		document.write("<p class=\"newsbodytext\">"); 
// display introductory text if exists
		if (news_item[sorted_news[i][1]].ni_intro != "")
		{
			document.write(news_item[sorted_news[i][1]].ni_intro);
		}
// show all the direct links for the news item
		showNewsLinks(i);
// show additional links if required
		if (news_item[sorted_news[i][1]].ni_xlinks == "Y")
		{
// display links for any cases		
			showCasesLinks(i);
// display links for any countries
			showCountriesLinks(i);
// display links for any subjects			
			showSubjectsLinks(i);
		}
		document.writeln("</p>");
		if (cnt == 9)
		{
			document.writeln("<hr size=\"1\">");
			break;
		}
	}
}


// generate flyout for video/audio on home page
function generateFlyout()
{
	var flyout_text = "";
	for (l = 0; l < document_type_array.length; l++)
	{
		if (document_type_array[l][0] == end_url)
		{
			flyout_text = document_type_array[l][1] + " ";
			break;
		}
	}
	if (news_item[sorted_news[i][1]].ni_links[k].nl_pages != "")
	{
		flyout_text = flyout_text + news_item[sorted_news[i][1]].ni_links[k].nl_pages  + " minutos; ";
	}
	if (news_item[sorted_news[i][1]].ni_links[k].nl_kb != "")
	{
// if filesize > 1MB display size in MB
		if (parseInt(news_item[sorted_news[i][1]].ni_links[k].nl_kb) > 1024)
		{
			file_size = Math.round(parseInt(news_item[sorted_news[i][1]].ni_links[k].nl_kb)/1024);
			flyout_text = flyout_text + file_size + "MB; ";
		}
		else
		{
			flyout_text = flyout_text + news_item[sorted_news[i][1]].ni_links[k].nl_kb + "KB; ";
		}
	}
	flyout_text = flyout_text + new_window_text;
	if (news_item[sorted_news[i][1]].ni_links[k].nl_lang_id != 0)
	{
		flyout_text = flyout_text + "; " + language_text_array[news_item[sorted_news[i][1]].ni_links[k].nl_lang_id];
	}
	return flyout_text;
}

// display links to video & podcasts associated with news items on home page
function showMediaLinks()
{
	var video_found = 0;
	var last_media_title = "";
	var last_media_id = 0;
	var last_media_quality = "";
	var audio_found = 0;
	var flyout_text = "";
	var display_text = "";
	var file_size = 0;
	var r = 0;
// count number of media links for news item
	for (k = 0; k < news_item[sorted_news[i][1]].ni_links.length; k++)
	{
		end_url = news_item[sorted_news[i][1]].ni_links[k].nl_url.substr(news_item[sorted_news[i][1]].ni_links[k].nl_url.length - 3, 3).toLowerCase();
		if ((end_url == "wmv") || (end_url == "mp3"))
		{
			r = r + 1;
		}
	}
// if less than 3 media links show them
	if (r <= 3 )
	{
	for (k = 0; k < news_item[sorted_news[i][1]].ni_links.length; k++)
	{
		end_url = news_item[sorted_news[i][1]].ni_links[k].nl_url.substr(news_item[sorted_news[i][1]].ni_links[k].nl_url.length - 3, 3).toLowerCase();
		if ((end_url == "wmv") || (end_url == "mp3"))
		{
//			if (sorted_news[i][0] == "1")
//			{
				if (news_item[sorted_news[i][1]].ni_links[k].nl_text != last_media_title)
				{
					if (last_media_title != "")
					{
						if (last_media_quality != "")
						{
							document.write("&nbsp; <a href=\"" + news_item[sorted_news[i][1]].ni_links[last_media_id].nl_url + "\" target=\"_blank\" class=\"parasmallcolourtext\" onmouseover=\"writetxt('" + flyout_text +"')\" onmouseout=\"writetxt(0)\">" + last_media_quality + "</a>");
						}
						else
						{
							document.write("<a href=\"" + news_item[sorted_news[i][1]].ni_links[last_media_id].nl_url + "\" target=\"_blank\" class=\"subnormalcolourtext\" onmouseover=\"writetxt('" + flyout_text +"')\" onmouseout=\"writetxt(0)\">" + last_media_title + "</a>");
						}
					}
					if (end_url == "wmv")
					{
						document.write("&nbsp;&nbsp; <img src=\"/images/video.gif\" width=\"24\" height=\"12\">");
					}
					else if (end_url == "mp3")
					{
						document.write("&nbsp;&nbsp; <img src=\"/images/audio.gif\" width=\"24\" height=\"12\">");
					}
				}
				else
				{
					if (last_media_quality != "")
					{
						document.write("<span class=\"parasmallboldcolourtext\"> " + last_media_title + "</span>&nbsp; <a href=\"" + news_item[sorted_news[i][1]].ni_links[last_media_id].nl_url + "\" target=\"_blank\" class=\"parasmallcolourtext\" onmouseover=\"writetxt('" + flyout_text +"')\" onmouseout=\"writetxt(0)\">" + last_media_quality + "</a>");
					}
					else
					{
						document.write("<a href=\"" + news_item[sorted_news[i][1]].ni_links[last_media_id].nl_url + "\" target=\"_blank\" class=\"subnormalcolourtext\" onmouseover=\"writetxt('" + flyout_text +"')\" onmouseout=\"writetxt(0)\">" + last_media_title + "</a>");
					}
				}
				last_media_title = news_item[sorted_news[i][1]].ni_links[k].nl_text;
				last_media_id = k;
//				video_found = 1;
				for (l = 0; l < media_quality_array.length; l++)
				{
					if (media_quality_array[l][0] == news_item[sorted_news[i][1]].ni_links[k].nl_quality)
					{
						last_media_quality = media_quality_array[l][1];
						break;
					}
				}
				flyout_text = generateFlyout();
//			}
//			else
//			{
//				if ((end_url == "wmv") && (video_found == 0))
//				{
//					document.write("&nbsp;&nbsp; <img src=\"/images/video.gif\" width=\"24\" height=\"12\">");
//					flyout_text = generateFlyout();
//					document.write("<a href=\"" + news_item[sorted_news[i][1]].ni_links[k].nl_url + "\" target=\"_blank\" class=\"parasmallboldcolourtext\" onmouseover=\"writetxt('" + flyout_text +"')\" onmouseout=\"writetxt(0)\">" + news_item[sorted_news[i][1]].ni_links[k].nl_text + "</a>");
//					video_found = 1;
//				}
//				else if ((end_url == "mp3") && (audio_found == 0))
//				{
//					document.write("&nbsp;&nbsp; <img src=\"/images/audio.gif\" width=\"24\" height=\"12\">");
//					flyout_text = generateFlyout();
//					document.write("<a href=\"" + news_item[sorted_news[i][1]].ni_links[k].nl_url + "\" target=\"_blank\" class=\"parasmallboldcolourtext\" onmouseover=\"writetxt('" + flyout_text +"')\" onmouseout=\"writetxt(0)\">" + news_item[sorted_news[i][1]].ni_links[k].nl_text + "</a>");
//					audio_found = 1;
//				}
//				else if ((video_found == 1) && (audio_found == 1))
//				{
//					break;
//				}
//			}
		}
	}
//	if ((last_media_title != "") && (sorted_news[i][0] == "1"))
	if (last_media_title != "")
	{
		if (last_media_quality != "")
		{
			document.write("&nbsp; <a href=\"" + news_item[sorted_news[i][1]].ni_links[last_media_id].nl_url + "\" target=\"_blank\" class=\"parasmallcolourtext\" onmouseover=\"writetxt('" + flyout_text +"')\" onmouseout=\"writetxt(0)\">" + last_media_quality + "</a>");
		}
		else
		{
			document.write("<a href=\"" + news_item[sorted_news[i][1]].ni_links[last_media_id].nl_url + "\" target=\"_blank\" class=\"subnormalcolourtext\" onmouseover=\"writetxt('" + flyout_text +"')\" onmouseout=\"writetxt(0)\">" + last_media_title + "</a>");
		}
	}
	}
}

// Function to display the news items with positions 1- 3 on press centre page
function showPressNews(items)
{
	var news_date_array = new Array();
	var flyout_text = "";
// loop through each news item
	for (i = 0; i < news_item.length; i++)
	{
// item is not under embargo & has a position - add to array
		if ((news_item[i] !== not_defined) && (news_item[i].ni_embargo == "") && (news_item[i].ni_pos != "") && (news_item[i].ni_pos != "0"))
		{
			sorted_news[j] = [news_item[i].ni_pos, i];
			j = j + 1;
		}
	}
// sort items by position
	sorted_news.sort();
	document.writeln("<ul class=\"paranormaltext\">");
// loop through sorted news items
	for (i = 0; i < sorted_news.length; i++)
	{
// if required number of news items not displayed display news item
		if (parseInt(news_item[sorted_news[i][1]].ni_pos) <= items)
		{
			document.write("<li><p><b>");
// remove leading zero if day less than 10
			if (news_item[sorted_news[i][1]].ni_date.slice(8, 9) == "0")
			{
				daynum = news_item[sorted_news[i][1]].ni_date.slice(9, 10);
			}
			else
			{ 
				daynum = news_item[sorted_news[i][1]].ni_date.slice(8, 10);
			}
// convert month number to name of month
			document.write(daynum + "&nbsp;" + month_array[parseInt(news_item[sorted_news[i][1]].ni_date.slice(5, 7), 10)] + "&nbsp;" + news_item[sorted_news[i][1]].ni_date.slice(0, 4) + ":</b> ");
			end_url = news_item[sorted_news[i][1]].ni_links[0].nl_url.substr(news_item[sorted_news[i][1]].ni_links[0].nl_url.length - 3, 3).toLowerCase();
// if news item has only 1 link put link on headline
			if ((news_item[sorted_news[i][1]].ni_links.length == 1) && (end_url != "mp3"))
			{
				document.write("<a href=\"" + news_item[sorted_news[i][1]].ni_links[0].nl_url + "\" class=\"paraboldcolourtext\">" + news_item[sorted_news[i][1]].ni_head + "</a>");
// array item has variable set to indicate it is in another language - write message to this effect			
				if (news_item[sorted_news[i][1]].ni_links[0].nl_lang_id != 0)
				{
					document.write(" <span class=\"parasmalltext\">(" + language_text_array[news_item[sorted_news[i][1]].ni_links[0].nl_lang_id] + ")</span>");
				}
			}
// otherwise display headline and links separately
			else
			{
				document.write("<span class=\"paraboldcolourtext\">" + news_item[sorted_news[i][1]].ni_head + "</span>");
				if (news_item[sorted_news[i][1]].ni_intro == "")
				{
					document.write("<br>");
				}
				showNewsLinks(i);
// additional links indicator is on
				if (news_item[sorted_news[i][1]].ni_xlinks == "Y")
				{
// display links for any cases		
					showCasesLinks(i);
// display links for any countries
					showCountriesLinks(i);
				}
			}
			document.writeln("</p></li>");
			cnt = cnt + 1;
		}
	}
	document.writeln("</ul>");
}
// Function to display the news items on the home page
function showIndexNews()
{
	var news_date_array = new Array();
	var flyout_text = "";
// loop through each news item
	for (i = 0; i < news_item.length; i++)
	{
// item is not under embargo & has a position - add to array
		if ((news_item[i] !== not_defined) && (news_item[i].ni_embargo == "") && (news_item[i].ni_pos != "") && (news_item[i].ni_pos != "0"))
		{
			sorted_news[j] = [news_item[i].ni_pos, i];
			j = j + 1;
		}
	}
// sort items by position
	sorted_news.sort();
// loop through each sorted item
	for (i = 0; i < sorted_news.length; i++)
	{
		flyout_text = "";
		if (news_item[sorted_news[i][1]].ni_links[0].nl_lang_id != 0)
		{
			flyout_text = language_text_array[news_item[sorted_news[i][1]].ni_links[0].nl_lang_id];
		}
// output position 1 item
		if (sorted_news[i][0] == "1")
		{
			end_url = news_item[sorted_news[i][1]].ni_links[0].nl_url.substr(news_item[sorted_news[i][1]].ni_links[0].nl_url.length - 3, 3).toLowerCase();
			document.write("<p class=\"news1headlinetext\">");
			if (news_item[sorted_news[i][1]].ni_image != "")
			{
				document.write("<img border=\"0\" align=\"left\" src=\"" + news_item[sorted_news[i][1]].ni_image + "\">");
			}
			if (news_item[sorted_news[i][1]].ni_intro == "")
			{
				document.write("<a class=\"news1headlinetext\"");
				if (flyout_text != "")
				{
					document.write(" onmouseover=\"writetxt(\'" + flyout_text + "\')\" onmouseout=\"writetxt(0)\"");
				}
// link to news item if first link is a htm file
				if (end_url == "htm")
				{
					document.write(" href=\"" + news_item[sorted_news[i][1]].ni_links[0].nl_url + "\">");
				}
// link to bookmark on news gateway if first link not htm file
				else
				{
					document.write(" href=\"/spanish/news_s/news_s.htm#bkmk" + sorted_news[i][1] + "\">");
				}
				document.writeln(news_item[sorted_news[i][1]].ni_head + "</a><br>");
			}
			else
			{
				document.writeln(news_item[sorted_news[i][1]].ni_head + "</p>");
				document.write("<p class=\"news1bodytext\"><a class=\"news1bodytext\"");
				if (flyout_text != "")
				{
					document.write(" onmouseover=\"writetxt(\'" + flyout_text + "\')\" onmouseout=\"writetxt(0)\"");
				}
// link to news item if first link is a htm file
				if (end_url == "htm")
				{
					document.write(" href=\"" + news_item[sorted_news[i][1]].ni_links[0].nl_url + "\">");
				}
// link to bookmark on news gateway if first link not htm file
				else
				{
					document.write(" href=\"/spanish/news_s/news_s.htm#bkmk" + sorted_news[i][1] + "\">");
				}
				if (news_item[sorted_news[i][1]].ni_intro.substr(news_item[sorted_news[i][1]].ni_intro.length - 21, 21) == "<br><b>Descargar:</b>")
				{
					news_item[sorted_news[i][1]].ni_intro = news_item[sorted_news[i][1]].ni_intro.substr(0, news_item[sorted_news[i][1]].ni_intro.length - 21);
				}
				document.write(news_item[sorted_news[i][1]].ni_intro + "</a>");
			}
			document.writeln("&nbsp; <span class=\"parasmallgreytext\">" + news_item[sorted_news[i][1]].ni_date.slice(8, 10) + "/" + news_item[sorted_news[i][1]].ni_date.slice(5, 7) + "/" + news_item[sorted_news[i][1]].ni_date.slice(0, 4) + "</span>");
			//showMediaLinks();
			document.writeln("</p><p class=\"subnormalboldcolourtext\">Además:</span></p>");
		}
// output other position items
		else
		{
			end_url = news_item[sorted_news[i][1]].ni_links[0].nl_url.substr(news_item[sorted_news[i][1]].ni_links[0].nl_url.length - 3, 3).toLowerCase();
			document.write("<p class=\"subnormallistitem\">&gt;&nbsp;<a class=\"subnormaltext\"");
			if (flyout_text != "")
			{
				document.write(" onmouseover=\"writetxt(\'" + flyout_text + "\')\" onmouseout=\"writetxt(0)\"");
			}
// link to news item if first link is a htm file
			if (end_url == "htm")
			{
				document.write(" href=\"" + news_item[sorted_news[i][1]].ni_links[0].nl_url + "\">");
			}
// link to bookmark on news gateway if first link not htm file
			else
			{
				document.write(" href=\"/spanish/news_s/news_s.htm#bkmk" + sorted_news[i][1] + "\">");
			}
			document.writeln(news_item[sorted_news[i][1]].ni_head + "</a>&nbsp; <span class=\"parasmallgreytext\">" + news_item[sorted_news[i][1]].ni_date.slice(8, 10) + "/" + news_item[sorted_news[i][1]].ni_date.slice(5, 7) + "/" + news_item[sorted_news[i][1]].ni_date.slice(0, 4) + "</span>");
			//showMediaLinks();
			document.writeln("</p>");
		}
	}
	document.writeln("<p class=\"subnormalcolourtext\">&gt;&nbsp;<a href=\"/spanish/news_s/news_s.htm\" class=\"subnormalcolourtext\">Más noticias de la OMC</a></p>");
}

// Function to display the news items on the home page
function showEventIndexNews(subj, link1txt, link1url, link2txt, link2url)
{
	var news_date_array = new Array();
	var flyout_text = "";
// loop through each news item
	for (i = 0; i < news_item.length; i++)
	{
// item is not under embargo & has a position - add to array
		if ((news_item[i] !== not_defined) && (news_item[i].ni_embargo == "") && (news_item[i].ni_pos != "") && (news_item[i].ni_pos != "0") && (news_item[i].ni_subject.indexOf(subj) != -1))
		{
			sorted_news[j] = [news_item[i].ni_pos, i];
			j = j + 1;
		}
	}
// sort items by position
	sorted_news.sort();
// loop through each sorted item
	for (i = 0; i < sorted_news.length; i++)
	{
		flyout_text = "";
		if (news_item[sorted_news[i][1]].ni_links[0].nl_lang_id != 0)
		{
			flyout_text = language_text_array[news_item[sorted_news[i][1]].ni_links[0].nl_lang_id];
		}
// output position 1 item
		if (sorted_news[i][0] == "1")
		{
			end_url = news_item[sorted_news[i][1]].ni_links[0].nl_url.substr(news_item[sorted_news[i][1]].ni_links[0].nl_url.length - 3, 3).toLowerCase();
			document.write("<p class=\"meetinglstheadlinetext\">");
			if (news_item[sorted_news[i][1]].ni_image != "")
			{
				document.write("<img border=\"0\" align=\"left\" src=\"" + news_item[sorted_news[i][1]].ni_image + "\">");
			}
			if (news_item[sorted_news[i][1]].ni_intro == "")
			{
				document.write("<a class=\"meetinglstheadlinetext\"");
				if (flyout_text != "")
				{
					document.write(" onmouseover=\"writetxt(\'" + flyout_text + "\')\" onmouseout=\"writetxt(0)\"");
				}
// link to news item if first link is a htm file
				if (end_url == "htm")
				{
					document.write(" href=\"" + news_item[sorted_news[i][1]].ni_links[0].nl_url + "\">");
				}
// link to bookmark on news gateway if first link not htm file
				else
				{
					document.write(" href=\"/spanish/news_s/news_s.htm#bkmk" + sorted_news[i][1] + "\">");
				}
				document.writeln(news_item[sorted_news[i][1]].ni_head + "</a><br>");
			}
			else
			{
				document.writeln(news_item[sorted_news[i][1]].ni_head + "</p>");
				document.write("<p class=\"subnormaltext\"><a class=\"subnormaltext\"");
				if (flyout_text != "")
				{
					document.write(" onmouseover=\"writetxt(\'" + flyout_text + "\')\" onmouseout=\"writetxt(0)\"");
				}
// link to news item if first link is a htm file
				if (end_url == "htm")
				{
					document.write(" href=\"" + news_item[sorted_news[i][1]].ni_links[0].nl_url + "\">");
				}
// link to bookmark on news gateway if first link not htm file
				else
				{
					document.write(" href=\"/spanish/news_s/news_s.htm#bkmk" + sorted_news[i][1] + "\">");
				}
				if (news_item[sorted_news[i][1]].ni_intro.substr(news_item[sorted_news[i][1]].ni_intro.length - 20, 20) == "<br><b>Descargar:</b>")
				{
					news_item[sorted_news[i][1]].ni_intro = news_item[sorted_news[i][1]].ni_intro.substr(0, news_item[sorted_news[i][1]].ni_intro.length - 20);
				}
				document.write(news_item[sorted_news[i][1]].ni_intro + "</a>");
			}
			document.writeln("&nbsp; <span class=\"parasmallgreytext\">" + news_item[sorted_news[i][1]].ni_date.slice(8, 10) + "/" + news_item[sorted_news[i][1]].ni_date.slice(5, 7) + "/" + news_item[sorted_news[i][1]].ni_date.slice(0, 4) + "</span>");
			showMediaLinks();
			document.writeln("</p><p class=\"subnormalcolourtext\" align=\"right\">&gt;&nbsp;<a class=\"subnormalboldcolourtext\" href=\"" + link1url + "\">" + link1txt + "</a></p>");
			document.writeln("<p class=\"subnormalcolourtext\" align=\"right\">&gt;&nbsp;<a class=\"subnormalboldcolourtext\" href=\"" + link2url + "\">" + link2txt + "</a></p>");
		}
// output other position items
		else
		{
			end_url = news_item[sorted_news[i][1]].ni_links[0].nl_url.substr(news_item[sorted_news[i][1]].ni_links[0].nl_url.length - 3, 3).toLowerCase();
			document.write("<p class=\"subnormallistitem\">&gt;&nbsp;<a class=\"subnormaltext\"");
			if (flyout_text != "")
			{
				document.write(" onmouseover=\"writetxt(\'" + flyout_text + "\')\" onmouseout=\"writetxt(0)\"");
			}
// link to news item if first link is a htm file
			if (end_url == "htm")
			{
				document.write(" href=\"" + news_item[sorted_news[i][1]].ni_links[0].nl_url + "\">");
			}
// link to bookmark on news gateway if first link not htm file
			else
			{
				document.write(" href=\"/spanish/news_s/news_s.htm#bkmk" + sorted_news[i][1] + "\">");
			}
			document.writeln(news_item[sorted_news[i][1]].ni_head + "</a>&nbsp; <span class=\"parasmallgreytext\">" + news_item[sorted_news[i][1]].ni_date.slice(8, 10) + "/" + news_item[sorted_news[i][1]].ni_date.slice(5, 7) + "/" + news_item[sorted_news[i][1]].ni_date.slice(0, 4) + "</span>");
			showMediaLinks();
			document.writeln("</p>");
		}
	}
// add more on link to subject news archive
		for (l = 0; l < subject.length; l++)
		{
			if ((subject[l].code == subj) && (subject[l].archive != ""))
			{
				document.writeln("<p class=\"subnormalcolourtext\">&gt;&nbsp;<a class=\"subnormalcolourtext\" href=\""	+ subject[l].archive + "\" class=\"paracolourtext\">Más noticias sobre " + subject[l].article + subject[l].title + "</a><br>&nbsp;</p>");
				break;
			}
		}

}

// Function to display the news items on the home page
function showOtherIndexNews(subj)
{
	var sorted_news = new Array();
	var news_date_array = new Array();
	var flyout_text = "";
	var j = 0;
// loop through each news item
	for (i = 0; i < news_item.length; i++)
	{
// item is not under embargo & has a position and is not specified subject - add to array
		if ((news_item[i] !== not_defined) && (news_item[i].ni_embargo == "") && (news_item[i].ni_pos != "") && (news_item[i].ni_pos != "0"))
		{
			if (news_item[i].ni_subject.indexOf(subj) == -1)
			{
				sorted_news[j] = [news_item[i].ni_pos, i];
				j = j + 1;
			}
		}
	}

// sort items by position
	sorted_news.sort();
// loop through each sorted item
	for (i = 0; i < sorted_news.length; i++)
	{
		flyout_text = "";
		if (news_item[sorted_news[i][1]].ni_links[0].nl_lang_id != 0)
		{
			flyout_text = language_text_array[news_item[sorted_news[i][1]].ni_links[0].nl_lang_id];
		}
			end_url = news_item[sorted_news[i][1]].ni_links[0].nl_url.substr(news_item[sorted_news[i][1]].ni_links[0].nl_url.length - 3, 3).toLowerCase();
			document.write("<p class=\"subnormallistitem\">&gt;&nbsp;<a class=\"subnormaltext\"");
			if (flyout_text != "")
			{
				document.write(" onmouseover=\"writetxt(\'" + flyout_text + "\')\" onmouseout=\"writetxt(0)\"");
			}
// link to news item if first link is a htm file
			if (end_url == "htm")
			{
				document.write(" href=\"" + news_item[sorted_news[i][1]].ni_links[0].nl_url + "\">");
			}
// link to bookmark on news gateway if first link not htm file
			else
			{
				document.write(" href=\"/spanish/news_s/news_s.htm#bkmk" + sorted_news[i][1] + "\">");
			}
			document.writeln(news_item[sorted_news[i][1]].ni_head + "</a>&nbsp; <span class=\"parasmallgreytext\">" + news_item[sorted_news[i][1]].ni_date.slice(8, 10) + "/" + news_item[sorted_news[i][1]].ni_date.slice(5, 7) + "/" + news_item[sorted_news[i][1]].ni_date.slice(0, 4) + "</span>");
//			showMediaLinks();
			document.writeln("</p>");
	}
	document.writeln("<p class=\"subnormalcolourtext\">&gt;&nbsp;<a href=\"/spanish/news_s/news_s.htm\" class=\"subnormalcolourtext\">Más noticias de la OMC</a></p>");
}



// Function to show the latest webcast for a sucject (for left column)
function showSmallLatestVideo(subj)
{
	var daynum = "";
	var j = 0;
// loop backwards through news items
	for (i = news_item.length-1; i >=0 ; i--)
	{
// news item not under embargo and for specified subject
		if ((news_item[i] !== not_defined) && (news_item[i].ni_embargo == "") && (news_item[i].ni_subject.indexOf(subj) != -1)) 
		{
			for (h = 0; h < news_item[i].ni_links.length; h++)
			{
				end_url = news_item[i].ni_links[h].nl_url.substr(news_item[i].ni_links[h].nl_url.length - 3, 3).toLowerCase();
				{
					if (end_url == "wmv")
					{
						sorted_news[j] = [news_item[i].ni_date.slice(0, 19), i];
// do until 2 news items selected
						if (j > 1)
						{
							break;
						}
						j = j + 1;
						break;
					}
				}
			}
		}
	}
// sort selected news items by date
	if (sorted_news.length != 0)
	{
		sorted_news.sort();
// loop backwards through sorted news items
		for (i = sorted_news.length-1; i >= 0; i--)
		{
// loop through each link object for the news item
			for (j = 0; j < news_item[sorted_news[i][1]].ni_links.length; j++)
			{
// link contains a url - display a link		
				if (news_item[sorted_news[i][1]].ni_links[j].nl_url != "")
				{
					new_window = false;
					flyout_text = news_item[sorted_news[i][1]].ni_date.slice(8, 10) + "/" + news_item[sorted_news[i][1]].ni_date.slice(5, 7) + "/" + news_item[sorted_news[i][1]].ni_date.slice(0, 4) + ": " + news_item[sorted_news[i][1]].ni_head + "<br>";
					end_url = news_item[sorted_news[i][1]].ni_links[j].nl_url.substr(news_item[sorted_news[i][1]].ni_links[j].nl_url.length - 3, 3).toLowerCase();
// link is of type mp3
					if (end_url == "wmv")
					{
						new_window = true;
						flyout_text = flyout_text + document_type_array[6][1] + " ";
// add number of minutes to flyout
						if (news_item[sorted_news[i][1]].ni_links[j].nl_pages != "")
						{
							flyout_text = flyout_text + news_item[sorted_news[i][1]].ni_links[j].nl_pages  + " minutos; ";
						}
// add number of KB to flyout
						if (news_item[sorted_news[i][1]].ni_links[j].nl_kb != "")
						{
// if filesize > 1MB display size in MB
							if (parseInt(news_item[sorted_news[i][1]].ni_links[j].nl_kb) > 1024)
							{
								file_size = Math.round(parseInt(news_item[sorted_news[i][1]].ni_links[j].nl_kb)/1024);
								flyout_text = flyout_text + file_size + "MB; ";
							}
							else
							{
								flyout_text = flyout_text + news_item[sorted_news[i][1]].ni_links[j].nl_kb + "KB; ";
							}
						}
						flyout_text = flyout_text + new_window_text;
						document.write("&gt;&nbsp;<a href=\"");
						document.write(news_item[sorted_news[i][1]].ni_links[j].nl_url + "\" class=\"parasmallcolourtext\"");
						document.write(" target=\"_blank\""); 
// flyout text is displayed if required
						if (flyout_text != "")
						{
							document.write(" onmouseover=\"writetxt(\'" + flyout_text + "\')\" onmouseout=\"writetxt(0)\"");
						}
						document.write(">Fichero de transmisión por la Web más reciente</a><br>");
						break;
					}
				}
			}
			break;
		}
	}
}

// Function to display the annual news archives
function showYearNewsArchive(year)
{
	var news_date_array = new Array();
	var date_array = new Array();
// loop through each news item
	for (i = 0; i < news_item.length; i++)
	{
// news item is not embargoed and is for current specified year - add to array
		if ((news_item[i] !== not_defined) && (news_item[i].ni_embargo == "") && (news_item[i].ni_date.slice(0, 4) == year))
		{
			sorted_news[j] = [news_item[i].ni_date.slice(0, 19), i];
			j = j + 1;
		}
	}
	document.writeln("<table border=\"0\" cellpadding=\"5\" cellspacing=\"1\" width=\"480\">");
// sort items by date
	sorted_news.sort();
// loop backwards through sorted array
	for (i = sorted_news.length-1; i >= 0; i--)
	{
// split dates where more than 1 for news item
		date_array = news_item[sorted_news[i][1]].ni_date.split("#");
		news_date_array = date_array[0].split("_");
// display news date
		document.writeln("<tr><td class=\"paracolourtext\" valign=\"top\">" + news_date_array[0].slice(8,10) + "." + news_date_array[0].slice(5,7) + "." + news_date_array[0].slice(0,4) + "</td>");
		document.write("<td class=\"paranormaltext\" valign=\"top\"><p class=\"newsheadlinetext\"><a name=\"bkmk" + sorted_news[i][1] + "\"></a>");
// display image if it is doha image	
		if (news_item[sorted_news[i][1]].ni_image == doha_link_array[0])
		{
			document.write("<a href=\"" + doha_link_array[1] + "\"onmouseover=\"writetxt(\'" + doha_link_array[2] + "\')\" onmouseout=\"writetxt(0)\"><img border=\"0\" align=\"left\" src=\"" + news_item[sorted_news[i][1]].ni_image + "\"></a>");
		}
		document.writeln(news_item[sorted_news[i][1]].ni_head + "</p>");
		document.write("<p class=\"newsbodytext\">"); 
// display intro if one exists
		if (news_item[sorted_news[i][1]].ni_intro != "")
		{
			document.write(news_item[sorted_news[i][1]].ni_intro);
		}
// display links for news item		
		showNewsLinks(i);
// additional links indicator is on
		if (news_item[sorted_news[i][1]].ni_xlinks == "Y")
		{
// display links for any cases		
			showCasesLinks(i);
// display links for any countries
			showCountriesLinks(i);
// display links for any subjects			
			showSubjectsLinks(i);
		}
		document.writeln("</p></td>");
	}          
	document.writeln("</table>");
}

// Function to display the news archives for a subject (& year)
function showSubjectYearArchive(subject, year)
{
	var news_date_array = new Array();
	var date_array = new Array();
// loop through each news item
	for (i = 0; i < news_item.length; i++)
	{
// news item is not under embargo and is for specified subject
		if ((news_item[i] !== not_defined) && (news_item[i].ni_embargo == "") && (news_item[i].ni_subject.indexOf(subject) != -1)) 
		{
// news item is for specified year if a year is specified
			if ((year == "") || ((year != "") && (news_item[i].ni_date.slice(0, 4) == year)))
			{
				sorted_news[j] = [news_item[i].ni_date.slice(0, 19), i];
				j = j + 1;
			}
		}
	}
// sort selected news items by date
	sorted_news.sort();
// loop backwards through sorted news items
	for (i = sorted_news.length-1; i >= 0; i--)
	{
		date_array = news_item[sorted_news[i][1]].ni_date.split("#");
		news_date_array = date_array[0].split("_");
// display date
		document.writeln("<tr><td class=\"graytd\" valign=\"top\">" + news_date_array[0].slice(8,10) + "." + news_date_array[0].slice(5,7) + "." + news_date_array[0].slice(0,4) + "</td>");
// news item has only 1 link put link on headline
		if (news_item[sorted_news[i][1]].ni_links.length == 1)
		{
			document.write("<td class=\"graytd\" valign=\"top\"><a href=\"" + news_item[sorted_news[i][1]].ni_links[0].nl_url + "\" class=\"paraboldcolourtext\">" + news_item[sorted_news[i][1]].ni_head + "</a>");
// array item has variable set to indicate it is in another language - write message to this effect			
			if (news_item[sorted_news[i][1]].ni_links[0].nl_lang_id != 0)
			{
					document.write(" <span class=\"parasmalltext\">(" + language_text_array[news_item[sorted_news[i][1]].ni_links[0].nl_lang_id] + ")</span>");
			}
// display intro if it exists
			if (news_item[sorted_news[i][1]].ni_intro != "")
			{
				document.write("<br>" + news_item[sorted_news[i][1]].ni_intro);
			}
		}
// news item has several links
		else
		{
// display headline
			document.write("<td class=\"graytd\" valign=\"top\"><span class=\"paraboldcolourtext\">" + news_item[sorted_news[i][1]].ni_head + "</span><br>");
// display intro if it exists
			if (news_item[sorted_news[i][1]].ni_intro != "")
			{
				document.write(news_item[sorted_news[i][1]].ni_intro);
			}
// display links
			showNewsLinks(i);
// additional links indicator is on
			if (news_item[sorted_news[i][1]].ni_xlinks == "Y")
			{
// display links for any cases		
				showCasesLinks(i);
// display links for any countries
				showCountriesLinks(i);
			}
		}
		document.writeln("</td></tr>");
	}
}

// Function to display the speeches archive
function showSpeechesArchive(subject)
{
	var news_date_array = new Array();
	var date_array = new Array();
// loop through each news item
	for (i = 0; i < news_item.length; i++)
	{
// news item is not under embargo and has specified subject
		if ((news_item[i] !== not_defined) && (news_item[i].ni_embargo == "") && (news_item[i].ni_subject.indexOf(subject) != -1)) 
		{
			sorted_news[j] = [news_item[i].ni_date.slice(0, 19), i];
			j = j + 1;
		}
	}
// sort selected news items by date
	sorted_news.sort();
// loop backwards through sorted news items
	for (i = sorted_news.length-1; i >= 0; i--)
	{
		date_array = news_item[sorted_news[i][1]].ni_date.split("#");
		news_date_array = date_array[0].split("_");
// display date
		document.writeln("<tr><td class=\"graytd\" valign=\"top\">" + news_date_array[0].slice(8,10) + "." + news_date_array[0].slice(5,7) + "." + news_date_array[0].slice(0,4) + "</td>");
// display headline with link on it
		document.write("<td class=\"graytd\" valign=\"top\"><a href=\"" + news_item[sorted_news[i][1]].ni_links[0].nl_url + "\" class=\"paracolourtext\">" + news_item[sorted_news[i][1]].ni_head + "</a>");
// array item has variable set to indicate it is in another language - write message to this effect			
		if (news_item[sorted_news[i][1]].ni_links[0].nl_lang_id != 0)
		{
			document.write(" <span class=\"parasmalltext\">(" + language_text_array[news_item[sorted_news[i][1]].ni_links[0].nl_lang_id] + ")</span>");
		}
// display intro if one exists
		if (news_item[sorted_news[i][1]].ni_intro != "")
		{
			document.write("<br>" + news_item[sorted_news[i][1]].ni_intro);
		}
		document.writeln("</td></tr>");
	}

}

// Function to show a specified number of news items on a subject gateway
function showGatewayNews(subj, items)
{
	var daynum = "";
	var news_date_array = new Array();
	var date_array = new Array();
	var temp_array = new Array();
	var subj_array = new Array();
	var h = 0;
	j = 0;
	l = 0;
	subj_array = subj.split("#");
// loop backwards through news items 
	for (i = news_item.length-1; i >=0 ; i--)
	{
// news item is not under embargo & is for specified subject
		if ((news_item[i] !== not_defined) && (news_item[i].ni_embargo == "")) 
		{
			for (l = 0; l < subj_array.length; l++)
			{
				if (news_item[i].ni_subject.indexOf(subj_array[l]) != -1)
				{
					temp_array[j] = [news_item[i].ni_date.slice(0, 19), i];
// continue until 2 more items than required to show
					if (j >= items + 2)
					{
						break;
					}
					j = j + 1;
				}
			}
		}
	}
	sorted_news = temp_array;
	if (sorted_news.length == 0)
	{
		document.writeln("<p class=\"paranormaltext\">No hay noticias recientes sobre este tema</p>");
	}
	else
	{
		document.writeln("<ul class=\"paranormaltext\">");
// sort selected news items by date
		sorted_news.sort();
// loop backwards through sorted news items
		for (i = sorted_news.length-1; i >= 0; i--)
		{
// if required number of news items not displayed display news item
			if (cnt < items)
			{
				document.write("<li><p><b>");
// remove leading zero if day less than 10
				if (news_item[sorted_news[i][1]].ni_date.slice(8, 9) == "0")
				{
					daynum = news_item[sorted_news[i][1]].ni_date.slice(9, 10);
				}
				else
				{ 
					daynum = news_item[sorted_news[i][1]].ni_date.slice(8, 10);
				}
// convert month number to name of month
				document.write(daynum + "&nbsp;" + month_array[parseInt(news_item[sorted_news[i][1]].ni_date.slice(5, 7), 10)] + "&nbsp;" + news_item[sorted_news[i][1]].ni_date.slice(0, 4) + ":</b> ");
				end_url = news_item[sorted_news[i][1]].ni_links[0].nl_url.substr(news_item[sorted_news[i][1]].ni_links[0].nl_url.length - 3, 3).toLowerCase();
// if news item has only 1 link put link on headline
				if ((news_item[sorted_news[i][1]].ni_links.length == 1) && (end_url != "mp3"))
				{
					document.write("<a href=\"" + news_item[sorted_news[i][1]].ni_links[0].nl_url + "\" class=\"paraboldcolourtext\">" + news_item[sorted_news[i][1]].ni_head + "</a>");
// array item has variable set to indicate it is in another language - write message to this effect			
					if (news_item[sorted_news[i][1]].ni_links[0].nl_lang_id != 0)
					{
						document.write(" <span class=\"parasmalltext\">(" + language_text_array[news_item[sorted_news[i][1]].ni_links[0].nl_lang_id] + ")</span>");
					}
				}
// otherwise display headline and links separately
				else
				{
					document.write("<span class=\"paraboldcolourtext\">" + news_item[sorted_news[i][1]].ni_head + "</span>");
					if (news_item[sorted_news[i][1]].ni_intro == "")
					{
						document.write("<br>");
					}
					showNewsLinks(i);
// additional links indicator is on
					if (news_item[sorted_news[i][1]].ni_xlinks == "Y")
					{
// display links for any cases		
						showCasesLinks(i);
// display links for any countries
						showCountriesLinks(i);
					}
				}
				document.writeln("</p></li>");
				cnt = cnt + 1;
			}
		}
		document.writeln("</ul>");
	}
// add more on link to subject news archive
	for (h = 0; h < subj_array.length; h++)
	{
		for (l = 0; l < subject.length; l++)
		{
			if ((subject[l].code == subj_array[h]) && (subject[l].archive != ""))
			{
				document.writeln("<p class=\"strippedsmalltext\" align=\"right\">&gt;&nbsp;<a class=\"parasmallcolourtext\" href=\""	+ subject[l].archive + "\" class=\"paracolourtext\">Más noticias sobre " + subject[l].article + subject[l].title + "</a></p>");
				break;
			}
		}
	}
}

// Function to show a specified number of news items in watch this space box on a page
function showWTSGatewayNews(subj, items)
{
	var daynum = "";
	var news_date_array = new Array();
	var temp_array = new Array();
	var date_array = new Array();
	var j = 0;
	var cnt = 0;
// loop backwards through news items
	for (i = news_item.length-1; i >=0 ; i--)
	{
// news item is not under embargo & is for specified subject
		if ((news_item[i] !== not_defined) && (news_item[i].ni_embargo == "") && (news_item[i].ni_subject.indexOf(subj) != -1)) 
		{
			temp_array[j] = [news_item[i].ni_date.slice(0, 19), i];
// do until 2 more items than required selected
			if (j >= items + 2)
			{
				break;
			}
			j = j + 1;
		}
	}
	sorted_news = temp_array;
// sort selected news items by date
	sorted_news.sort();
// loop backwards through sorted news items
	for (i = sorted_news.length-1; i >= 0; i--)
	{
// required number of news items not yet reached
		if (cnt < items)
		{
			end_url = news_item[sorted_news[i][1]].ni_links[0].nl_url.substr(news_item[sorted_news[i][1]].ni_links[0].nl_url.length - 3, 3).toLowerCase();
			document.write("<p class=\"subnormallistitem\">&gt;&nbsp;<a class=\"subnormalcolourtext\"");
// link to news item if first link is a htm file
			if (end_url == "htm")
			{
				document.write(" href=\"" + news_item[sorted_news[i][1]].ni_links[0].nl_url + "\">");
			}
// link to bookmark on news gateway if first link not htm file
			else
			{
				document.write(" href=\"/spanish/news_s/news_s.htm#bkmk" + sorted_news[i][1] + "\">");
			}
			document.writeln(news_item[sorted_news[i][1]].ni_head + "</a>&nbsp; <span class=\"parasmallgreytext\">" + news_item[sorted_news[i][1]].ni_date.slice(8, 10) + "/" + news_item[sorted_news[i][1]].ni_date.slice(5, 7) + "/" + news_item[sorted_news[i][1]].ni_date.slice(0, 4) + "</span>");
			//showMediaLinks();
			document.writeln("</p>");
			cnt = cnt + 1;
		}
	}
// add link to news archive for subject
	for (l = 0; l < subject.length; l++)
	{
		if ((subject[l].code == subj) && (subject[l].gateway != ""))
		{
			document.writeln("<p class=\"parasmalltext\" align=\"right\">&gt;&nbsp;<a class=\"parasmallcolourtext\" href=\""	+ subject[l].gateway + "\" class=\"paracolourtext\">Más noticias sobre " + subject[l].article + subject[l].title + "</a></p>");
			break;
		}
	}
}


// Function to show the latest news item for a subject in small text (for right column)
function showSmallLatestNews(subj)
{
	var daynum = "";
// loop backwards through news items
	for (i = news_item.length-1; i >=0 ; i--)
	{
// news item not under embargo and for specified subject
		if ((news_item[i] !== not_defined) && (news_item[i].ni_embargo == "") && (news_item[i].ni_subject.indexOf(subj) != -1)) 
		{
			sorted_news[j] = [news_item[i].ni_date.slice(0, 19), i];
// do until 2 news items selected
			if (j > 1)
			{
				break;
			}
			j = j + 1;
		}
	}
// sort selected news items by date
	if (sorted_news.length >= 1)
	{
		sorted_news.sort();
// display news item
		document.writeln("<table  width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td width=\"100%\" class=\"cellheadingwhitetext\">&nbsp;ÚLTIMAS&nbsp;NOTICIAS&nbsp;</td></tr></table><table style=\"border-collapse: collapse\" bordercolor=\"#0080C0\" cellSpacing=\"0\" cellPadding=\"4\" width=\"100%\" border=\"1\"><tr><td width=\"100%\"><table width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"2\"><tr><td valign=\"top\">");
		document.writeln("<p class=\"smallgreaterlistitem\">&gt;&nbsp;" + news_item[sorted_news[sorted_news.length - 1][1]].ni_date.slice(8, 10) + "." + news_item[sorted_news[sorted_news.length - 1][1]].ni_date.slice(5, 7) + "." + news_item[sorted_news[sorted_news.length - 1][1]].ni_date.slice(0, 4) + "<br>");
// link contains a url - display a link		
		if (news_item[sorted_news[sorted_news.length - 1][1]].ni_links[0].nl_url != "")
		{
			new_window = false;
			flyout_text = "";
			end_url = news_item[sorted_news[sorted_news.length - 1][1]].ni_links[0].nl_url.substr(news_item[sorted_news[sorted_news.length - 1][1]].ni_links[0].nl_url.length - 3, 3).toLowerCase();
// link is a docsonline symbol - build code for docsonline search
			if (news_item[sorted_news[sorted_news.length - 1][1]].ni_links[0].nl_dol == "S")
			{
				document.writeln("<a href=\"\" onclick=\"f_submit(\'(@meta_Symbol " + news_item[sorted_news[sorted_news.length - 1][1]].ni_links[0].nl_url + ")\',\'3\');return false\" class=\"parasmallboldcolourtext\"  onmouseover=\"writetxt(\'Búsqueda en Documentos en línea.  Los resultados aparecen en una nueva ventana\')\" onmouseout=\"writetxt(0)\">" + news_item[sorted_news[sorted_news.length - 1][1]].ni_head + "</a>"); 
			}
			else
			{
// link is not a html file
				if (end_url != "htm")
				{
// loop through array of different document types			
					for (k = 0; k < document_type_array.length; k++)
					{
// extension of link is in list of selected docment types - set indicator for a new window 
// and build flyout text
						if (document_type_array[k][0] == end_url)
						{
							new_window = true;
							flyout_text = document_type_array[k][1] + " ";
							if (news_item[sorted_news[sorted_news.length - 1][1]].ni_links[0].nl_pages != "")
							{
								flyout_text = flyout_text + news_item[sorted_news[sorted_news.length - 1][1]].ni_links[0].nl_pages  + " páginas; ";
							}
							if (news_item[sorted_news[sorted_news.length - 1][1]].ni_links[0].nl_kb != "")
							{
// if filesize > 1MB display size in MB
								if (parseInt(news_item[sorted_news[sorted_news.length - 1][1]].ni_links[0].nl_kb) > 1024)
								{
									file_size = Math.round(parseInt(news_item[sorted_news[sorted_news.length - 1][1]].ni_links[0].nl_kb)/1024);
									flyout_text = flyout_text + file_size + "MB; ";
								}
								else
								{
									flyout_text = flyout_text + news_item[sorted_news[sorted_news.length - 1][1]].ni_links[0].nl_kb + "KB; ";
								}
							}
							flyout_text = flyout_text + new_window_text;
							break;
						}
					}
				}
				start_url = news_item[sorted_news[sorted_news.length - 1][1]].ni_links[0].nl_url.substr(0, 7);
// link is to an external website - set indicator for a new window and build flyout text	
				if ((new_window == false) && ((start_url == "http://") || (start_url == "https:/")))
				{
					new_window = true;
					flyout_text = new_window_text;
				}
				document.write("<a href=\"");
// link is a directdoc link - build appropriate path
				if (news_item[sorted_news[sorted_news.length - 1][1]].ni_links[0].nl_dol == "D")
				{
					document.write("http://docsonline.wto.org/imrd/directdoc.asp?DDFDocuments/v/");   
				}
				if (news_item[sorted_news[sorted_news.length - 1][1]].ni_links[0].nl_url.indexOf("/spanish/news_s/news_s.htm#") == -1)
				{
					document.write(news_item[sorted_news[sorted_news.length - 1][1]].ni_links[0].nl_url + "\" class=\"parasmallboldcolourtext\"");
				}
				else
				{
					document.write("/spanish/news_s/news" + news_item[sorted_news[sorted_news.length - 1][1]].ni_date.slice(2, 4) + "_s/news" + news_item[sorted_news[sorted_news.length - 1][1]].ni_date.slice(2, 4) + "_s.htm#bkmk" + sorted_news[sorted_news.length - 1][1] + "\" class=\"parasmallboldcolourtext\"");
				}
// link opens in a new window if required
				if (new_window == true)
				{
					document.write(" target=\"_blank\""); 
				}
// flyout text is displayed if required
				if (flyout_text != "")
				{
					document.write(" onmouseover=\"writetxt(\'" + flyout_text + "\')\" onmouseout=\"writetxt(0)\"");
				}
				document.write(">" + news_item[sorted_news[sorted_news.length - 1][1]].ni_head + "</a>");
// array item has variable set to indicate it is in another language - write message to this effect			
				if (news_item[sorted_news[sorted_news.length - 1][1]].ni_links[0].nl_lang_id != 0)
				{
					document.write(" <span class=\"parasmalltext\">(" + language_text_array[news_item[sorted_news[sorted_news.length - 1][1]].ni_links[0].nl_lang_id] + ")</span>");
				}
			}
		}
// link has no url - display coming soon text
		else
		{
			document.write(news_item[sorted_news[sorted_news.length - 1][1]].ni_head + " <span class=\"parasmalltext\">(" + language_text_array[8] + ")</span>");
		}
		document.writeln("</p>");
// display link to subject news archive
		for (l = 0; l < subject.length; l++)
		{
			if ((subject[l].code == subj) && (subject[l].archive != ""))
			{
				document.writeln("<p class=\"smallgreaterlistitem\">&gt;&nbsp;<a class=\"parasmallcolourtext\" href=\""	+ subject[l].archive + "\">Más noticias sobre " + subject[l].article + subject[l].title + "</a></p></td></tr></table></td></tr></table>");
				break;
			}
		}
	}
}

// Function to display the chonological list of TPRs on the page tp_rep
function showTPRChronList()
{
	var country_array = new Array();
	var daynum1 = "";
	var daynum2 = "";
	var j = 0;
// loop through each news item
	for (i = news_item.length-1; i >=0 ; i--)
	{
// news item not under embargo and is a TPR for a specified country
		if ((news_item[i] !== not_defined) && (news_item[i].ni_embargo == "") && (news_item[i].ni_subject.indexOf("TPR") != -1) && (news_item[i].ni_country != "")) 
		{
			sorted_news[j] = [news_item[i].ni_date.slice(0, 19), i];
			j = j + 1;
		}
	}
// srt selected items by date
	sorted_news.sort();
// loop backwards through sorted items
	for (i = sorted_news.length-1; i >=0 ; i--)
	{
		country_array = news_item[sorted_news[i][1]].ni_country.split("#");
		document.write("<li><a href=\"" + news_item[sorted_news[i][1]].ni_links[0].nl_url + "\" class=\"paraboldcolourtext\">");
// loop through each country for the tpr
		for (j = 0; j < country_array.length; j++)
		{
// loop through array of countries to find the matching country
			for (k = 0; k < country.length; k++)
			{
				if (country[k].code == country_array[j])
				{
// display country name
					document.write(country[k].name);
					if (j != country_array.length -1)
					{
						if (j < country_array.length - 2)
						{
							document.write(", ");
						}
						else
						{
							document.write(" y ");
						}
					}
					break;
				}
			}
		}
// display dates for the tpr stripping leading zeros and writing month name
		if (news_item[sorted_news[i][1]].ni_date.slice(8, 9) == "0")
		{
			daynum1 = news_item[sorted_news[i][1]].ni_date.slice(9, 10);
		}
		else
		{ 
			daynum1 = news_item[sorted_news[i][1]].ni_date.slice(8, 10);
		}
		if (news_item[sorted_news[i][1]].ni_date.slice(28, 29) == "0")
		{
			daynum2 = news_item[sorted_news[i][1]].ni_date.slice(29, 30);
		}
		else
		{ 
			daynum2 = news_item[sorted_news[i][1]].ni_date.slice(28, 30);
		}

		document.write("</a>: " + daynum1 + "&nbsp;");
		if (news_item[sorted_news[i][1]].ni_date.slice(5, 7) != news_item[sorted_news[i][1]].ni_date.slice(25, 27))
		{
			document.write(month_array[parseInt(news_item[sorted_news[i][1]].ni_date.slice(5, 7), 10)] + "&nbsp;");
		}
		document.writeln("y " + daynum2 + "&nbsp;" + month_array[parseInt(news_item[sorted_news[i][1]].ni_date.slice(25, 27), 10)] + "&nbsp;" + news_item[sorted_news[i][1]].ni_date.slice(0, 4) + "</li>");
	}
}


// This function lists all the tprs that have taken place in the last year for display on the page tpr
function showRecentTPRs()
{
	var j = 0;
	var startDate = "";
	var today = new Date();
	var startDateYear = today.getFullYear() - 1;
	var startDateMonth = today.getMonth() + 1;
	var startDateDay = today.getDate();
// adding leading zero to current month number
	if (startDateMonth < "10")
	{
		startDateMonth = "0" + startDateMonth;
	}
// add leading zero to current day number
	if (startDateDay < "10")
	{
		startDateDay = "0" + startDateDay;
	}
	startDate = startDateYear + "." + startDateMonth + "." + startDateDay;
// loop through each news item
	for (i = news_item.length-1; i >=0 ; i--)
	{
// news item is not under embargo and is a tpr for a country in the last year
		if ((news_item[i] !== not_defined) && (news_item[i].ni_embargo == "") && (news_item[i].ni_date.slice(0, 10) >= startDate)&& (news_item[i].ni_subject.indexOf("TPR") != -1) && (news_item[i].ni_country != "")) 
		{
			sorted_news[j] = [news_item[i].ni_date.slice(0, 19), i];
			j = j + 1;
		}
	}
// sort selected items by date
	sorted_news.sort();
// loop backwards through sorted items
	for (i = sorted_news.length-1; i >=0 ; i--)
	{
// display month and year
		document.write(month_array[parseInt(news_item[sorted_news[i][1]].ni_date.slice(5, 7), 10)].slice(3) + " " + news_item[sorted_news[i][1]].ni_date.slice(0, 4) + " <a class=\"parasmallcolourtext\" href=\"" + news_item[sorted_news[i][1]].ni_links[0].nl_url + "\">");
		country_array = news_item[sorted_news[i][1]].ni_country.split("#");
// loop through each country for the tpr
		for (j = 0; j < country_array.length; j++)
		{
// loop trough each country in the list of countries
			for (k = 0; k < country.length; k++)
			{
// matching country found, display country name
				if (country[k].code == country_array[j])
				{
					document.write(country[k].name);
					if (j != country_array.length -1)
					{
						if (j < country_array.length - 2)
						{
							document.write(", ");
						}
						else
						{
							document.write(" y ");
						}
					}
					break;
				}
			}
		}
		document.writeln("</a><br>");
	}
}

// Function to show the country and year in the breadcrumbs for a TPR
function showTPRBreadcrumb(news_ref)
{
	var country_code_array = new Array();
	var country_name_array = new Array();
	var j = 0;
	country_code_array = news_item[news_ref].ni_country.split("#");
// loop through each country for the tpr
	for (i = 0; i < country_code_array.length; i++)
	{
// loop through each of the country details
		for (j = 0; j < country.length; j++)
		{
// if matching countries are found get their name
			if (country[j].code == country_code_array[i])
			{
				country_name_array[i] = country[j].name.toLowerCase();
				break;
			}
		}
	}
	document.write("<span class=\"paraorangetext\">");
	for (i = 0; i < country_name_array.length; i++)
	{
		document.write(country_name_array[i]);
		if (country_name_array.length > 1)
		{
			if (i < country_name_array.length - 2)
			{
				document.write(", ");
			}
			else if (i == country_name_array.length - 2)
			{
				document.write(" y ");
			}
		}
	}
	document.write(" " + news_item[news_ref].ni_date.slice(0, 4) + "</span>");
}

// Tis function displays the date of the news item in the news item above the kicker text
function showNewsItemDate(news_ref)
{
	var date_array = new Array();
	date_array = news_item[news_ref].ni_date.split("#");
	document.write("<p class=\"kickertext\">");
// loop through all the dates for the news item
	for (i = 0; i < date_array.length; i++)
	{
// remove leeading zero from day if necessary
		if (date_array[i].slice(8, 9) == "0")
		{
			document.write(date_array[i].slice(9, 10) + "&nbsp;");
		}
		else
		{ 
			document.write(date_array[i].slice(8, 10) + "&nbsp;");
		}
// process for where to write commas, and and month name
		if (date_array.length > 1)
		{
			if (i < date_array.length-1)
			{
				if (date_array[i].slice(5, 7) != date_array[date_array.length-1].slice(5, 7))
				{
					document.write(month_array[parseInt(date_array[i].slice(5, 7), 10)] + "&nbsp;");
				}
				if (date_array[i].slice(0, 4) != date_array[date_array.length-1].slice(0, 4))
				{
					document.write(date_array[i].slice(0, 4) + "&nbsp;");
				}
			document.write("y ");
			}
			else
			{
				document.write(month_array[parseInt(date_array[i].slice(5, 7), 10)] + "&nbsp;" + date_array[i].slice(0, 4));
			}
		}
		else
		{
			document.write(month_array[parseInt(date_array[i].slice(5, 7), 10)] + "&nbsp;" + date_array[i].slice(0, 4));
		}
	}
	document.writeln("</p>");
}

// This function displays the text for the first subject defined for a news item as the kicker text
// in te news item
function showKickerText(news_ref)
{
	subject_array = news_item[news_ref].ni_subject.split("#");
// check a subject has been specified
	if (subject_array.length >= 1)
	{
// loop through the list of possible subjects
		for (i = 0; i < subject.length; i++)
		{
// matching subject found - display it as kicker text
			if (subject[i].code == subject_array[0])
			{
				document.writeln("<p class=\"kickertext\"><b>" + subject[i].title.toUpperCase() + "</b></p>");
				break;
			}
		}
	}
}

// This function displays an image in the news item if one has been specified
function showNewsImage(news_ref)
{
// news item has an image that isn't the DSB one
	if ((news_item[news_ref].ni_image != "") && (news_item[news_ref].ni_image != "/images/img_mews/dsb_icon04.gif"))
	{
// if image is the doha one display larger doha image with callout & link
		if (news_item[news_ref].ni_image == doha_link_array[0])
		{
			document.write("<a href=\"" + doha_link_array[1] + "\"onmouseover=\"writetxt(\'" + doha_link_array[2] + "\')\" onmouseout=\"writetxt(0)\"><img border=\"0\" align=\"left\" src=\"" + doha_link_array[3] + "\"></a>");
		}
		else
// otherwise display the specified 
		{
			document.write("<img border=\"0\" align=\"left\" src=\"" + news_item[news_ref].ni_image + "\">");
		}
	}
}

// This function displays the news item headline on the news item page (including image)
function showNewsHeadline(news_ref)
{
	document.write("<p class=\"pagetitletext\">");
	showNewsImage(news_ref);
	document.writeln(news_item[news_ref].ni_head + "</p>");
}

// This function displays the news item intro on the news item page
function showNewsIntro(news_ref)
{
	if (news_item[news_ref].ni_intro != "")
	{
		document.write("<p class=\"paralargetext\">" + news_item[news_ref].ni_intro + "</p>");
	}
}

// This function displays the other links for a news item in the left hand column of one of the links
// in the news item
function showLeftNewsLinks(news_ref)
{
// news item has more than 1 link
	if (news_item[news_ref].ni_links.length > 1)
	{
// loop through each link for the news item
		for (i = 0; i < news_item[news_ref].ni_links.length; i++)
		{
// link is not the current page - process to display the link
			if ((news_item[news_ref].ni_links[i].nl_url != wto_path)  && (news_item[news_ref].ni_links[i].nl_url.indexOf("/spanish/news_s/news_s.htm#") == -1))
			{
				end_url = news_item[news_ref].ni_links[i].nl_url.substr(news_item[news_ref].ni_links[i].nl_url.length - 3, 3).toLowerCase();
				if ((end_url != "mp3") && (end_url != "wmv"))
				{
					if (news_item[news_ref].ni_links[i].nl_url != "")
					{
					new_window = false;
					flyout_text = "";
// link is a docsonline symbol - build code for docsonline search
					if (news_item[news_ref].ni_links[i].nl_dol == "S")
					{
						document.writeln("&gt;&nbsp;<a href=\"\" onclick=\"f_submit(\'(@meta_Symbol " + news_item[news_ref].ni_links[i].nl_url + ")\',\'3\');return false\" class=\"parasmallboldcolourtext\"  onmouseover=\"writetxt(\'Búsqueda en Documentos en línea.  Los resultados aparecen en una nueva ventana\')\" onmouseout=\"writetxt(0)\">" + news_item[news_ref].ni_links[i].nl_text + "</a>"); 
					}
					else
					{
// link is not a html file
						if (end_url != "htm")
						{
// loop through array of different document types			
							for (k = 0; k < document_type_array.length; k++)
							{
// extension of link is in list of selected docment types - set indicator for a new window 
// and build flyout text
								if (document_type_array[k][0] == end_url)
								{
									new_window = true;
									flyout_text = document_type_array[k][1] + " ";
									if (news_item[news_ref].ni_links[i].nl_pages != "")
									{
										flyout_text = flyout_text + news_item[news_ref].ni_links[i].nl_pages  + " páginas; ";
									}
									if (news_item[news_ref].ni_links[i].nl_kb != "")
									{
// if filesize > 1MB display size in MB
										if (parseInt(news_item[news_ref].ni_links[i].nl_kb) > 1024)
										{
											file_size = Math.round(parseInt(news_item[news_ref].ni_links[i].nl_kb)/1024);
											flyout_text = flyout_text + file_size + "MB; ";
										}
										else
										{
											flyout_text = flyout_text + news_item[news_ref].ni_links[i].nl_kb + "KB; ";
										}
									}
									flyout_text = flyout_text + new_window_text;
									break;
								}
							}
						}
						start_url = news_item[news_ref].ni_links[i].nl_url.substr(0, 7);
// link is to an external website - set indicator for a new window and build flyout text	
						if ((new_window == false) && ((start_url == "http://") || (start_url == "https:/")))
						{
							new_window = true;
							flyout_text = new_window_text;
						}
						document.write("&gt;&nbsp;<a href=\"");
// link is a directdoc link - build appropriate path
						if (news_item[news_ref].ni_links[i].nl_dol == "D")
						{
							document.write("http://docsonline.wto.org/imrd/directdoc.asp?DDFDocuments/v/");   
						}
						document.write(news_item[news_ref].ni_links[i].nl_url + "\" class=\"parasmallboldcolourtext\"");
// link opens in a new window if required
						if (new_window == true)
						{
							document.write(" target=\"_blank\""); 
						}
// flyout text is displayed if required
						if (flyout_text != "")
						{
							document.write(" onmouseover=\"writetxt(\'" + flyout_text + "\')\" onmouseout=\"writetxt(0)\"");
						}
						document.write(">" + news_item[news_ref].ni_links[i].nl_text + "</a>");
// array item has variable set to indicate it is in another language - write message to this effect			
						if (news_item[news_ref].ni_links[i].nl_lang_id != 0)
						{
							document.write(" <span class=\"parasmalltext\">(" + language_text_array[news_item[news_ref].ni_links[i].nl_lang_id] + ")</span>");
						}
						document.write("<br>");
					}
					}
					else
// link has no url - write title with coming soon
					{
					document.writeln("&gt;&nbsp;" + news_item[news_ref].ni_links[i].nl_text + " <span class=\"parasmalltext\">(" + language_text_array[8] + ")</span><br>");
					}
				}
			}
		}
	}
}

// This function displays the other links for a news item in the headline/introduction cell of one of the links
// in the news item
function showIntroNewsLinks(news_ref)
{
	var first_link = true;
// news item has more than 1 link
	if (news_item[news_ref].ni_links.length > 1)
	{
// loop through each link for the news item
		for (i = 0; i < news_item[news_ref].ni_links.length; i++)
		{
// url is not the one for this page add a link to the url
			if ((news_item[news_ref].ni_links[i].nl_url != wto_path)  && (news_item[news_ref].ni_links[i].nl_url.indexOf("/spanish/news_s/news_s.htm#") == -1))
			{
				end_url = news_item[news_ref].ni_links[i].nl_url.substr(news_item[news_ref].ni_links[i].nl_url.length - 3, 3).toLowerCase();
				if ((end_url != "mp3") && (end_url != "wmv"))
				{
					if (first_link == true)
					{
						document.writeln("<p class=\"paralargetext\" align=\"right\">");
						first_link = false;
					}
					else
					{
						document.writeln("<br>");
					}
					new_window = false;
					flyout_text = "";
// link is a docsonline symbol - build code for docsonline search
					if (news_item[news_ref].ni_links[i].nl_dol == "S")
					{
						document.writeln("&gt;&nbsp;<a href=\"\" onclick=\"f_submit(\'(@meta_Symbol " + news_item[news_ref].ni_links[i].nl_url + ")\',\'3\');return false\" class=\"paralargecolourtext\"  onmouseover=\"writetxt(\'Búsqueda en Documentos en línea.  Los resultados aparecen en una nueva ventana\')\" onmouseout=\"writetxt(0)\">" + news_item[news_ref].ni_links[i].nl_text + "</a>"); 
					}
					else
					{
// link is not a html file
						if (end_url != "htm")
						{
// loop through array of different document types			
							for (k = 0; k < document_type_array.length; k++)
							{
// extension of link is in list of selected docment types - set indicator for a new window 
// and build flyout text
								if (document_type_array[k][0] == end_url)
								{
									new_window = true;
									flyout_text = document_type_array[k][1] + " ";
									if (news_item[news_ref].ni_links[i].nl_pages != "")
									{
										flyout_text = flyout_text + news_item[news_ref].ni_links[i].nl_pages  + " páginas; ";
									}
									if (news_item[news_ref].ni_links[i].nl_kb != "")
									{
// if filesize > 1MB display size in MB
										if (parseInt(news_item[news_ref].ni_links[i].nl_kb) > 1024)
										{
											file_size = Math.round(parseInt(news_item[news_ref].ni_links[i].nl_kb)/1024);
											flyout_text = flyout_text + file_size + "MB; ";
										}
										else
										{
											flyout_text = flyout_text + news_item[news_ref].ni_links[i].nl_kb + "KB; ";
										}
									}
									flyout_text = flyout_text + new_window_text;
									break;
								}
							}
						}
						start_url = news_item[news_ref].ni_links[i].nl_url.substr(0, 7);
// link is to an external website - set indicator for a new window and build flyout text	
						if ((new_window == false) && ((start_url == "http://") || (start_url == "https:/")))
						{
							new_window = true;
							flyout_text = new_window_text;
						}
						document.write("&gt;&nbsp;<a href=\"");
// link is a directdoc link - build appropriate path
						if (news_item[news_ref].ni_links[i].nl_dol == "D")
						{
							document.write("http://docsonline.wto.org/imrd/directdoc.asp?DDFDocuments/v/");   
						}
						document.write(news_item[news_ref].ni_links[i].nl_url + "\" class=\"paralargecolourtext\"");
// link opens in a new window if required
						if (new_window == true)
						{
							document.write(" target=\"_blank\""); 
						}
// flyout text is displayed if required
						if (flyout_text != "")
						{
							document.write(" onmouseover=\"writetxt(\'" + flyout_text + "\')\" onmouseout=\"writetxt(0)\"");
						}
						document.write(">" + news_item[news_ref].ni_links[i].nl_text + "</a>");
// array item has variable set to indicate it is in another language - write message to this effect			
						if (news_item[news_ref].ni_links[i].nl_lang_id != 0)
						{
							document.write(" <span class=\"paranormaltext\">(" + language_text_array[news_item[news_ref].ni_links[i].nl_lang_id] + ")</span>");
						}
					}
				}
			}
		}
		if (first_link == false)
		{
		document.writeln("</p>");
		}
	}
}

// This function shows the subject links for the specified subjects in the left column of the news item
function showXtraSubjectLinks(news_ref)
{
	subject_array = news_item[news_ref].ni_subject.split("#");
// loop through each subject for the news item
	for (j = 0; j < subject_array.length; j++)
	{
// loop through all of the different subjects
		for (k = 0; k < subject.length; k++)
		{
// if matching subject found & it has a gateway make a link 
			if ((subject[k].code == subject_array[j]) && (subject[k].gateway != ""))
			{
				document.write("&gt;&nbsp;<a class=\"parasmallboldcolourtext\" href=\"" + subject[k].gateway + "\"");
				new_window = false;
				flyout_text = "";
				start_url = subject[k].gateway.substr(0, 7);
// link is to an external website - set indicator for a new window and build flyout text	
				if ((start_url == "http://") || (start_url == "https:/"))
				{
					new_window = true;
					flyout_text = new_window_text;
				}
// link opens in a new window if required
				if (new_window == true)
				{
					document.write(" target=\"_blank\""); 
				}
// flyout text is displayed if required
				if (flyout_text != "")
				{
					document.write(" onmouseover=\"writetxt(\'" + flyout_text + "\')\" onmouseout=\"writetxt(0)\"");
				}
				document.write(">Más información sobre " + subject[k].article + subject[k].title + "</a><br>");
				break;
			}
		}
	}
}

// This function shows the subject links for the specified subjects in the left column of the news item
function showShortXtraSubjectLinks(news_ref)
{
	var link_text = "";
	subject_array = news_item[news_ref].ni_subject.split("#");
// loop through each subject for the news item
	if (subject_array.length > 1)
	{
		document.writeln("<p class=\"parasmallcolourtext\"><b>Más información:</b><br>");
	for (j = 0; j < subject_array.length; j++)
	{
// loop through all of the different subjects
		for (k = 0; k < subject.length; k++)
		{
// if matching subject found & it has a gateway make a link 
			if ((subject[k].code == subject_array[j]) && (subject[k].gateway != ""))
			{
				document.write("&gt;&nbsp;<a class=\"parasmallcolourtext\" href=\"" + subject[k].gateway + "\"");
				new_window = false;
				flyout_text = "";
				start_url = subject[k].gateway.substr(0, 7);
// link is to an external website - set indicator for a new window and build flyout text	
				if ((start_url == "http://") || (start_url == "https:/"))
				{
					new_window = true;
					flyout_text = new_window_text;
				}
// link opens in a new window if required
				if (new_window == true)
				{
					document.write(" target=\"_blank\""); 
				}
// flyout text is displayed if required
				if (flyout_text != "")
				{
					document.write(" onmouseover=\"writetxt(\'" + flyout_text + "\')\" onmouseout=\"writetxt(0)\"");
				}
				link_text = subject[k].title.substring(0, 1).toUpperCase() + subject[k].title.substring(1, subject[k].title.length);
				document.write(">" + link_text + "</a><br>");
				break;
			}
		}
	}
		document.writeln("</p>");
	}
}

// This function displays the coutry links for a specified news item in the left column of the news item
function showXtraCountryLinks(news_ref)
{
	country_array = news_item[news_ref].ni_country.split("#");
// loop through each country specified for the news item
	for (j = 0; j < country_array.length; j++)
	{
// loop through the list of countries
		for (k = 0; k < country.length; k++)
		{
// if countries match and a country page exists display a link
			if ((country[k].code == country_array[j]) && (country[k].page != ""))
			{
				document.writeln("&gt;&nbsp;<a class=\"parasmallboldcolourtext\" href=\"" + country[k].page + "\">Más información sobre " + country[k].article + country[k].name + "</a><br>");
				break;
			}
		}
	}
}
// This function displays the cases links for a specified news item in the left column of the news item
function showXtraCasesLinks(news_ref)
{
	cases_array = news_item[news_ref].ni_cases.split("#");
// loop through each subject for the news item
	for (k = 0; k < cases_array.length; k++)
	{
			document.writeln("&gt;&nbsp;<a href=\"" + cases_link_array[0] + cases_array[k] + "_s.htm\" class=\"parasmallboldcolourtext\" onmouseover=\"writetxt(\'" + cases_link_array[2] + "\')\" onmouseout=\"writetxt(0)\">" + cases_link_array[1] + cases_array[k] + "</a><br>");
	}
}

// This function displays the country name in the kickertext of a TPR news item
function showTPRCountry(news_ref)
{
	country_array = news_item[news_ref].ni_country.split("#");
// loop through each of the countries for the news item
	for (j = 0; j < country_array.length; j++)
	{
// loop through list of countries
		for (k = 0; k < country.length; k++)
		{
// if countries match display country name
			if (country[k].code == country_array[j])
			{
				document.write(country[k].name.toUpperCase());
				if (j != country_array.length -1)
				{
					if (j < country_array.length - 2)
					{
						document.write(", ");
					}
					else
					{
						document.write(" Y ");
					}
				}
				break;
			}
		}
	}
}

// This function displays the link to the TPR in the CRC
function showTPRLink(news_ref)
{
	var headline_array = new Array();
	headline_array = news_item[news_ref].ni_intro.split(", según un informe");

	document.writeln("&gt;&nbsp;<a class=\"parasmallboldcolourtext\" href=\"" + news_item[news_ref].ni_links[0].nl_url + "\">Comunicado de prensa</a>: " + headline_array[0]);
// array item has variable set to indicate it is in another language - write message to this effect			
	if (news_item[news_ref].ni_links[0].nl_lang_id != 0)
	{
		document.write(" (" + language_text_array[news_item[news_ref].ni_links[0].nl_lang_id] + ")");
	}
	document.writeln("<br>");
}

// This function displays the link to the TPR in the CRC
function showTPRLinkHeadline(news_ref)
{

	document.write("&gt;&nbsp;<a class=\"parasmallboldcolourtext\" href=\"" + news_item[news_ref].ni_links[0].nl_url + "\">Comunicado de prensa</a>: ");
}

// This function displays the link to the CRC in the TPR and also the searches for minutes/revisions/q&a 
function showCRCLink(news_ref, document_number)
{
	var today = new Date();
	var tprdate = new Date(Date.UTC(parseInt(news_item[news_ref].ni_date.slice(0, 4), 10),parseInt(news_item[news_ref].ni_date.slice(5, 7), 10) - 1, parseInt(news_item[news_ref].ni_date.slice(8, 10), 10) + 1, 0, 0, 0, 0));
	var twoweeks = 1209600000; // 2 weeks in milliseconds
	var sixweeks = 3628800000; // 6 weeks in milliseconds
// display search for revisions if more than 2 weeks after meeting date 
	document.write("<li>");
	if (today.getTime() > (tprdate.getTime() + twoweeks))
	{
		document.write("<a href=\"\" class=\"docsonline\" onmouseover=\"writetxt(\'Busca todos los documentos en Documentos en Línea. Los resultados aparecen en una nueva ventana.\')\" onmouseout=\"writetxt(0)\" onclick=\"f_submit(\'(@meta_Symbol WT/TPR/S/" + document_number + "/Rev* or WT/TPR/S/" + document_number + "/Add* or WT/TPR/G/" + document_number + "/Rev* or WT/TPR/M/" + document_number + "/Rev*)\', \'3\');return false\">Las revisiones</a> ");
	}
	else
	{
		document.write("Las revisiones ");
	}
	document.writeln("de los documentos antes mencionados podrán emitirse aproximadamente dos semanas después de la reunión.<br>&nbsp;&nbsp; </li>");
	document.write("<li>");
// if url doesn't exist display coming soon
	if (news_item[news_ref].ni_links[1].nl_url != "")
	{
		document.write("<a class=\"paraboldcolourtext\" href=\"" + news_item[news_ref].ni_links[1].nl_url + "\">" + news_item[news_ref].ni_links[1].nl_text + "</a>");
		if (news_item[news_ref].ni_links[1].nl_lang_id != 0)
		{
			document.write(" <span class=\"parasmalltext\">(" + language_text_array[news_item[news_ref].ni_links[1].nl_lang_id] + ")</span>");
		}
		for (cnt = 0; cnt < news_item[news_ref].ni_links.length; cnt++)
		{
			if (news_item[news_ref].ni_links[cnt].nl_url.substr(news_item[news_ref].ni_links[cnt].nl_url.length - 3, 3).toLowerCase() == "mp3")
			{
				flyout_text = document_type_array[5][1] + " ";

				if (news_item[news_ref].ni_links[cnt].nl_pages != "")
				{
					flyout_text = flyout_text + news_item[news_ref].ni_links[cnt].nl_pages  + " minutos; ";
				}
				if (news_item[news_ref].ni_links[cnt].nl_kb != "")
				{
// if filesize > 1MB display size in MB
					if (parseInt(news_item[news_ref].ni_links[cnt].nl_kb) > 1024)
					{
						file_size = Math.round(parseInt(news_item[news_ref].ni_links[cnt].nl_kb)/1024);
						flyout_text = flyout_text + file_size + "MB; ";
					}
					else
					{
						flyout_text = flyout_text + news_item[news_ref].ni_links[cnt].nl_kb + "KB; ";
					}
				}
				flyout_text = flyout_text + new_window_text;
// array item has variable set to indicate it is in another language - write message to this effect			
				if (news_item[news_ref].ni_links[cnt].nl_lang_id != 0)
				{
					flyout_text = flyout_text + "; " + language_text_array[news_item[news_ref].ni_links[cnt].nl_lang_id];
				}
				document.write("<br><img border=\"0\" src=\"/images/audio.gif\" width=\"24\" height=\"12\"><a href=\"");
				document.write(news_item[news_ref].ni_links[cnt].nl_url + "\"  target=\"_blank\" class=\"paracolourtext\"");
// flyout text is displayed if required
				if (flyout_text != "")
				{
					document.write(" onmouseover=\"writetxt(\'" + flyout_text + "\')\" onmouseout=\"writetxt(0)\"");
				}
				document.write(">" + news_item[news_ref].ni_links[cnt].nl_text + "</a>");
			}
		}
	}
	else
	{
		document.write(news_item[news_ref].ni_links[1].nl_text + " <span class=\"parasmalltext\">(" + language_text_array[8] + ")</span>");
	}
	document.writeln("<br>&nbsp;&nbsp;</li>");
// display search for revisions if more than 6 weeks from meeting date
	document.write("<li>");
	if (today.getTime() > (tprdate.getTime() + sixweeks))
	{
		document.write("<a href=\"\" class=\"docsonline\" onmouseover=\"writetxt(\'Busca todos los documentos en Documentos en Línea. Los resultados aparecen en una nueva ventana.\')\" onmouseout=\"writetxt(0)\" onclick=\"f_submit(\'(@meta_Symbol WT/TPR/M/" + document_number + "* and not WT/TPR/M/" + document_number + "/Add*)\', \'3\');return false\">El acta de la reunión</a> ");
	}
	else
	{
		document.write("El acta de la reunión ");
	}
	document.writeln("está disponible aproximadamente seis semanas después de celebrada la reunión.<br>&nbsp;&nbsp; </li>");
// display search for questions & answers if more than 6 weeks from meeting date
	document.write("<li>");
	if (today.getTime() > (tprdate.getTime() + sixweeks))
	{
	document.write("<a href=\"\" class=\"docsonline\" onmouseover=\"writetxt(\'Busca todos los documentos en Documentos en Línea. Los resultados aparecen en una nueva ventana.\')\" onmouseout=\"writetxt(0)\" onclick=\"f_submit(\'(@meta_Symbol WT/TPR/M/" + document_number + "/Add*)\', \'3\');return false\">Preguntas y respuestas formuladas por los Miembros de la OMC</a> ");
	}
	else
	{
		document.write("Preguntas y respuestas formuladas por los Miembros de la OMC ");
	}
	document.writeln("estarán disponibles aproximadamente seis semanas después de la reunión.</li>");
}

// This function displays a link to retrieve the program of TPRs for the year in the TPR press release
function showTPRProgram1()
{
	var today = new Date();
	document.write("<p class=\"greaterlistitem\">&gt;&nbsp;<a href=\"\"  class=\"paracolourtext\" onclick=\"f_submit(\'( @meta_Symbol WT/TPR/*) and (@meta_Title (programme of reviews for) and " + today.getFullYear() + ")  and not (@meta_Title Draft)  \',\'3\');return false\" onmouseover=\"writetxt(\'Búsqueda en Documentos en línea.  Los resultados aparecen en una nueva ventana\')\" onmouseout=\"writetxt(0)\">Programa de exámenes para " + today.getFullYear() + "</a><br>&nbsp;</p>");
}

// This function displays a link to retrieve the program of TPRs for the year in the DOL box on
// the TPR page
function showTPRProgram2()
{
	var today = new Date();
	document.write("<li><b>Programa</b> de exámenes: " + today.getFullYear() + " <span class=\"parasmallgreytext\">(Signatura del documento: WT/TPR/* y la palabra clave &ldquo;programme of reviews for " + today.getFullYear());
	document.write("&rdquo;)</span>&nbsp;&nbsp;&nbsp; &gt;&nbsp;<a href=\"\"  class=\"paracolourtext\" onclick=\"f_submit(\'( @meta_Symbol WT/TPR/*) and (@meta_Title (programme of reviews for) and " + today.getFullYear() + ")  and not (@meta_Title Draft)  \',\'3\');return false\">buscar</a>&nbsp;&nbsp;&nbsp; &gt;&nbsp;<a href=\"javascript:openAWindow(\'/library/download_instructions_s.htm\',\'links\',650,550,1)\" class=\"paracolourtext\">ayuda</a></li>");
}


// Function to display an archive of podcast audio files
function showPodcastArchive()
{
	var daynum = "";
	var popup_width = 0;
	var popup_height = 0;
	var thbnl_array = new Array();
	var language = 3;
	var year = "";
// loop through each news item
	for (i = 0; i < news_item.length; i++)
	{
// news item is not under embargo
		if ((news_item[i] !== not_defined) && (news_item[i].ni_embargo == "")) 
		{
// news item contains a link of type mp3
			for (h = 0; h < news_item[i].ni_links.length; h++)
			{
				end_url = news_item[i].ni_links[h].nl_url.substr(news_item[i].ni_links[h].nl_url.length - 3, 3).toLowerCase();
				if (end_url == "mp3")
				{
					sorted_news[j] = [news_item[i].ni_date.slice(0, 19), i];
					j = j + 1;
					break;
				}
			}
		}
	}
// sort selected news items by date
	sorted_news.sort();
// loop backwards through sorted news items
	for (i = sorted_news.length-1; i >= 0; i--)
	{
		year = news_item[sorted_news[i][1]].ni_date.slice(0, 4);
// display date
		document.writeln("<p class=\"paranormaltext\"><b>"); 
// remove leading zero if day less than 10
		if (news_item[sorted_news[i][1]].ni_date.slice(8, 9) == "0")
		{
			daynum = news_item[sorted_news[i][1]].ni_date.slice(9, 10);
		}
		else
		{ 
			daynum = news_item[sorted_news[i][1]].ni_date.slice(8, 10);
		}
// convert month number to name of month
		document.write(daynum + "&nbsp;" + month_array[parseInt(news_item[sorted_news[i][1]].ni_date.slice(5, 7), 10)] + "&nbsp;" + news_item[sorted_news[i][1]].ni_date.slice(0, 4) + ":</b> ");
// display headline
		document.write(news_item[sorted_news[i][1]].ni_head);
// loop through each link object for the news item
		for (j = 0; j < news_item[sorted_news[i][1]].ni_links.length; j++)
		{
// link contains a url - display a link		
			if (news_item[sorted_news[i][1]].ni_links[j].nl_url != "")
			{
				new_window = false;
				flyout_text = "";
				end_url = news_item[sorted_news[i][1]].ni_links[j].nl_url.substr(news_item[sorted_news[i][1]].ni_links[j].nl_url.length - 3, 3).toLowerCase();
// link is of type mp3
				if (end_url == "mp3")
				{
					new_window = true;
					flyout_text = document_type_array[5][1] + " ";
// add number of minutes to flyout
					if (news_item[sorted_news[i][1]].ni_links[j].nl_pages != "")
					{
						flyout_text = flyout_text + news_item[sorted_news[i][1]].ni_links[j].nl_pages  + " minutes; ";
					}
// add number of KB to flyout
					if (news_item[sorted_news[i][1]].ni_links[j].nl_kb != "")
					{
// if filesize > 1MB display size in MB
						if (parseInt(news_item[sorted_news[i][1]].ni_links[j].nl_kb) > 1024)
						{
							file_size = Math.round(parseInt(news_item[sorted_news[i][1]].ni_links[j].nl_kb)/1024);
							flyout_text = flyout_text + file_size + "MB; ";
						}
						else
						{
							flyout_text = flyout_text + news_item[sorted_news[i][1]].ni_links[j].nl_kb + "KB; ";
						}
					}
					flyout_text = flyout_text + new_window_text;
					document.write("<br>");
	// add image from photo array if one exists
					if (news_item[sorted_news[i][1]].ni_links[j].nl_image != "")
					{
						popup_width = parseInt(photo_array[news_item[sorted_news[i][1]].ni_links[j].nl_image][6]) + 20;
						var numlines = Math.ceil(((photo_array[news_item[sorted_news[i][1]].ni_links[j].nl_image][0].length + 2 + photo_array[news_item[sorted_news[i][1]].ni_links[j].nl_image][language].length) * 6) / popup_width);
						popup_height = parseInt(photo_array[news_item[sorted_news[i][1]].ni_links[j].nl_image][7]) + 60 + (numlines * 22);
						document.write("<a href=\"javascript:openAWindow(\'/library/photo_gallery/popup_photo_" + language_letter_array[language] + ".htm?year=" + year + "&id=" + news_item[sorted_news[i][1]].ni_links[j].nl_image + "&section=" + wto_menu_column + "\',\'links\'," + popup_width + "," + popup_height + ",1)\" onmouseover=\"writetxt(\'" + call_out_array[language] + ", (" + photo_array[news_item[sorted_news[i][1]].ni_links[j].nl_image][5] + kb_array[language] + "); " + new_window_array[language] + "\')\" onmouseout=\"writetxt(0)\">");
						if (photo_array[news_item[sorted_news[i][1]].ni_links[j].nl_image][8] == 1)
						{
							thbnl_array = photo_array[news_item[sorted_news[i][1]].ni_links[j].nl_image][4].split(".");
							document.write("<img border=\"0\" src=\"" + thbnl_array[0] + "_thbnl.jpg\" width=\"50\" align=\"left\">");
						}
						else
						{
							document.write("<img border=\"0\" src=\"" + photo_array[news_item[sorted_news[i][1]].ni_links[j].nl_image][4] + "\" width=\"50\" align=\"left\">");
						}
						document.writeln("</a>");			
					}
					document.write("<img border=\"0\" src=\"/images/audio.gif\" width=\"24\" height=\"12\"><a href=\"");
					document.write(news_item[sorted_news[i][1]].ni_links[j].nl_url + "\" class=\"paracolourtext\"");
					document.write(" target=\"_blank\""); 
// flyout text is displayed if required
					if (flyout_text != "")
					{
						document.write(" onmouseover=\"writetxt(\'" + flyout_text + "\')\" onmouseout=\"writetxt(0)\"");
					}
					document.write(">" + news_item[sorted_news[i][1]].ni_links[j].nl_text + "</a>");
// array item has variable set to indicate it is in another language - write message to this effect			
					if (news_item[sorted_news[i][1]].ni_links[j].nl_lang_id != 0)
					{
						document.write(" <span class=\"parasmalltext\">(" + language_text_array[news_item[sorted_news[i][1]].ni_links[j].nl_lang_id] + ")</span>");
					}
				}
			}
		}
// add a link to news item if first link is htm file	
		end_url = news_item[sorted_news[i][1]].ni_links[0].nl_url.substr(news_item[sorted_news[i][1]].ni_links[0].nl_url.length - 3, 3).toLowerCase();
		if (end_url == "htm")
		{
			document.write("<br>&gt;&nbsp;<a href=\"" + news_item[sorted_news[i][1]].ni_links[0].nl_url + "\" class=\"paracolourtext\">" + news_item[sorted_news[i][1]].ni_links[0].nl_text + "</a>");
// array item has variable set to indicate it is in another language - write message to this effect			
			if (news_item[sorted_news[i][1]].ni_links[0].nl_lang_id != 0)
			{
			document.write(" <span class=\"parasmalltext\">(" + language_text_array[news_item[sorted_news[i][1]].ni_links[0].nl_lang_id] + ")</span>");
			}
		}
		document.writeln("</p>");
	}
}

// Function to display an webcasting news files on webcasting gateway
function showWebcastGatewayNews(items)
{
	var q = 0;
	var quality = "";
	var daynum = "";
	var popup_width = 0;
	var popup_height = 0;
	var thbnl_array = new Array();
	var language = 1;
	var year = "";
	var j = 0;
// loop through each news item
	for (i = news_item.length - 1; i >= 0; i--)
	{
// news item is not under embargo
		if ((news_item[i] !== not_defined) && (news_item[i].ni_embargo == "")) 
		{
// news item contains a link of type wmv
			for (h = 0; h < news_item[i].ni_links.length; h++)
			{
				end_url = news_item[i].ni_links[h].nl_url.substr(news_item[i].ni_links[h].nl_url.length - 3, 3).toLowerCase();
				if (end_url == "wmv")
				{
					sorted_news[j] = [news_item[i].ni_date.slice(0, 19), i];
// continue until 2 more items than required to show
					if (j >= items + 2)
					{
						break;
					}
					j = j + 1;
					break;
				}
			}
		}
	}
// sort selected news items by date
	if (sorted_news.length == 0)
	{
		document.writeln("<p class=\"paranormaltext\">No hay noticias recientes sobre este tema</p>");
	}
	else
	{
	sorted_news.sort();
// loop backwards through sorted news items
		for (i = sorted_news.length-1; i >= 0; i--)
		{
// if required number of news items not displayed display news item
			if (cnt < items)
			{
				year = news_item[sorted_news[i][1]].ni_date.slice(0, 4);
// display date
				document.writeln("<p class=\"paranormaltext\"><b>"); 
// remove leading zero if day less than 10
				if (news_item[sorted_news[i][1]].ni_date.slice(8, 9) == "0")
				{
					daynum = news_item[sorted_news[i][1]].ni_date.slice(9, 10);
				}
				else
				{ 
					daynum = news_item[sorted_news[i][1]].ni_date.slice(8, 10);
				}
// convert month number to name of month
				document.write(daynum + "&nbsp;" + month_array[parseInt(news_item[sorted_news[i][1]].ni_date.slice(5, 7), 10)] + "&nbsp;" + news_item[sorted_news[i][1]].ni_date.slice(0, 4) + ":</b> ");
// display headline
				document.write(news_item[sorted_news[i][1]].ni_head);
// loop through each link object for the news item
				for (j = 0; j < news_item[sorted_news[i][1]].ni_links.length; j++)
				{
// link contains a url - display a link		
					if (news_item[sorted_news[i][1]].ni_links[j].nl_url != "")
					{
						new_window = false;
						flyout_text = "";
						end_url = news_item[sorted_news[i][1]].ni_links[j].nl_url.substr(news_item[sorted_news[i][1]].ni_links[j].nl_url.length - 3, 3).toLowerCase();
// link is of type mp3
						if (end_url == "wmv")
						{
							new_window = true;
							flyout_text = document_type_array[6][1] + " ";
// add number of minutes to flyout
							if (news_item[sorted_news[i][1]].ni_links[j].nl_pages != "")
							{
								flyout_text = flyout_text + news_item[sorted_news[i][1]].ni_links[j].nl_pages  + " minutos; ";
							}
// add number of KB to flyout
							if (news_item[sorted_news[i][1]].ni_links[j].nl_kb != "")
							{
// if filesize > 1MB display size in MB
								if (parseInt(news_item[sorted_news[i][1]].ni_links[j].nl_kb) > 1024)
								{
									file_size = Math.round(parseInt(news_item[sorted_news[i][1]].ni_links[j].nl_kb)/1024);
									flyout_text = flyout_text + file_size + "MB; ";
								}
								else
								{
									flyout_text = flyout_text + news_item[sorted_news[i][1]].ni_links[j].nl_kb + "KB; ";
								}
							}
							flyout_text = flyout_text + new_window_text;
							document.write("<br>");
	// add image from photo array if one exists
							if (news_item[sorted_news[i][1]].ni_links[j].nl_image != "")
							{
								popup_width = parseInt(photo_array[news_item[sorted_news[i][1]].ni_links[j].nl_image][6]) + 20;
								var numlines = Math.ceil(((photo_array[news_item[sorted_news[i][1]].ni_links[j].nl_image][0].length + 2 + photo_array[news_item[sorted_news[i][1]].ni_links[j].nl_image][language].length) * 6) / popup_width);
								popup_height = parseInt(photo_array[news_item[sorted_news[i][1]].ni_links[j].nl_image][7]) + 60 + (numlines * 22);
								document.write("<a href=\"javascript:openAWindow(\'/library/photo_gallery/popup_photo_" + language_letter_array[language] + ".htm?year=" + year + "&id=" + news_item[sorted_news[i][1]].ni_links[j].nl_image + "&section=" + wto_menu_column + "\',\'links\'," + popup_width + "," + popup_height + ",1)\" onmouseover=\"writetxt(\'" + call_out_array[language] + ", (" + photo_array[news_item[sorted_news[i][1]].ni_links[j].nl_image][5] + kb_array[language] + "); " + new_window_array[language] + "\')\" onmouseout=\"writetxt(0)\">");
								if (photo_array[news_item[sorted_news[i][1]].ni_links[j].nl_image][8] == 1)
								{
									thbnl_array = photo_array[news_item[sorted_news[i][1]].ni_links[j].nl_image][4].split(".");
									document.write("<img border=\"0\" src=\"" + thbnl_array[0] + "_thbnl.jpg\" width=\"50\" align=\"left\">");
								}
								else
								{
									document.write("<img border=\"0\" src=\"" + photo_array[news_item[sorted_news[i][1]].ni_links[j].nl_image][4] + "\" width=\"50\" align=\"left\">");
								}
								document.writeln("</a>");			
							}
							document.write("<img border=\"0\" src=\"/images/video.gif\" width=\"24\" height=\"12\"><a href=\"");
							document.write(news_item[sorted_news[i][1]].ni_links[j].nl_url + "\" class=\"paracolourtext\"");
							document.write(" target=\"_blank\""); 
// flyout text is displayed if required
							if (flyout_text != "")
							{
								document.write(" onmouseover=\"writetxt(\'" + flyout_text + "\')\" onmouseout=\"writetxt(0)\"");
							}
				for (q = 0; q < media_quality_array.length; q++)
				{
					if (media_quality_array[q][0] == news_item[sorted_news[i][1]].ni_links[j].nl_quality)
					{
						quality = media_quality_array[q][1];
						break;
					}
				}
				document.write(">" + news_item[sorted_news[i][1]].ni_links[j].nl_text);
				if (quality != "")
				{
					document.write(" (" + quality + ")");
				}
				document.write("</a>");
// array item has variable set to indicate it is in another language - write message to this effect			
							if (news_item[sorted_news[i][1]].ni_links[j].nl_lang_id != 0)
							{
								document.write(" <span class=\"parasmalltext\">(" + language_text_array[news_item[sorted_news[i][1]].ni_links[j].nl_lang_id] + ")</span>");
							}
						}
					}
				}
// add a link to news item if first link is htm file	
				end_url = news_item[sorted_news[i][1]].ni_links[0].nl_url.substr(news_item[sorted_news[i][1]].ni_links[0].nl_url.length - 3, 3).toLowerCase();
				if (end_url == "htm")
				{
					document.write("<br>&gt;&nbsp;<a href=\"" + news_item[sorted_news[i][1]].ni_links[0].nl_url + "\" class=\"paracolourtext\">" + news_item[sorted_news[i][1]].ni_links[0].nl_text + "</a>");
// array item has variable set to indicate it is in another language - write message to this effect			
					if (news_item[sorted_news[i][1]].ni_links[0].nl_lang_id != 0)
					{
						document.write(" <span class=\"parasmalltext\">(" + language_text_array[news_item[sorted_news[i][1]].ni_links[0].nl_lang_id] + ")</span>");
					}
				}
				document.writeln("</p>");
				cnt = cnt + 1;
			}
		}
	}
}

// Function to display the webcasting archive (& year)
function showVideoArchive(year)
{
	var q = 0;
	var quality = "";
	var news_date_array = new Array();
	var date_array = new Array();
// loop through each news item
	for (i = 0; i < news_item.length; i++)
	{
// news item is not under embargo and is for specified subject
		if ((news_item[i] !== not_defined) && (news_item[i].ni_embargo == "")) 
		{
// news item is for specified year if a year is specified
			if ((year == "") || ((year != "") && (news_item[i].ni_date.slice(0, 4) == year)))
			{
// news item contains a link of type wmv
				for (h = 0; h < news_item[i].ni_links.length; h++)
				{
					end_url = news_item[i].ni_links[h].nl_url.substr(news_item[i].ni_links[h].nl_url.length - 3, 3).toLowerCase();
					if (end_url == "wmv")
					{
						sorted_news[j] = [news_item[i].ni_date.slice(0, 19), i];
						j = j + 1;
						break;
					}
				}
			}
		}
	}
// sort selected news items by date
	sorted_news.sort();
// loop backwards through sorted news items
	for (i = sorted_news.length-1; i >= 0; i--)
	{
		date_array = news_item[sorted_news[i][1]].ni_date.split("#");
		news_date_array = date_array[0].split("_");
// display date
		document.writeln("<tr><td class=\"graytd\" valign=\"top\">" + news_date_array[0].slice(8,10) + "." + news_date_array[0].slice(5,7) + "." + news_date_array[0].slice(0,4) + "</td>");
// display headline
		document.write("<td class=\"graytd\" valign=\"top\"><span class=\"paraboldcolourtext\">" + news_item[sorted_news[i][1]].ni_head + "</span><br>");
// display intro if it exists
		if (news_item[sorted_news[i][1]].ni_intro != "")
		{
			document.write(news_item[sorted_news[i][1]].ni_intro);
		}

// loop through each link object for the news item
		for (j = 0; j < news_item[sorted_news[i][1]].ni_links.length; j++)
		{
// link contains a url - display a link		
			if (news_item[sorted_news[i][1]].ni_links[j].nl_url != "")
			{
				new_window = false;
				flyout_text = "";
				end_url = news_item[sorted_news[i][1]].ni_links[j].nl_url.substr(news_item[sorted_news[i][1]].ni_links[j].nl_url.length - 3, 3).toLowerCase();
// link is of type mp3
				if (end_url == "wmv")
				{
					new_window = true;
					flyout_text = document_type_array[6][1] + " ";
// add number of minutes to flyout
					if (news_item[sorted_news[i][1]].ni_links[j].nl_pages != "")
					{
						flyout_text = flyout_text + news_item[sorted_news[i][1]].ni_links[j].nl_pages  + " minutos; ";
					}
// add number of KB to flyout
					if (news_item[sorted_news[i][1]].ni_links[j].nl_kb != "")
					{
// if filesize > 1MB display size in MB
						if (parseInt(news_item[sorted_news[i][1]].ni_links[j].nl_kb) > 1024)
						{
							file_size = Math.round(parseInt(news_item[sorted_news[i][1]].ni_links[j].nl_kb)/1024);
							flyout_text = flyout_text + file_size + "MB; ";
						}
						else
						{
							flyout_text = flyout_text + news_item[sorted_news[i][1]].ni_links[j].nl_kb + "KB; ";
						}
					}
					flyout_text = flyout_text + new_window_text;
					document.write("<br>");
// add image from photo array if one exists
					if (news_item[sorted_news[i][1]].ni_links[j].nl_image != "")
					{
						popup_width = parseInt(photo_array[news_item[sorted_news[i][1]].ni_links[j].nl_image][6]) + 20;
						var numlines = Math.ceil(((photo_array[news_item[sorted_news[i][1]].ni_links[j].nl_image][0].length + 2 + photo_array[news_item[sorted_news[i][1]].ni_links[j].nl_image][language].length) * 6) / popup_width);
						popup_height = parseInt(photo_array[news_item[sorted_news[i][1]].ni_links[j].nl_image][7]) + 60 + (numlines * 22);
						document.write("<a href=\"javascript:openAWindow(\'/library/photo_gallery/popup_photo_" + language_letter_array[language] + ".htm?year=" + year + "&id=" + news_item[sorted_news[i][1]].ni_links[j].nl_image + "&section=" + wto_menu_column + "\',\'links\'," + popup_width + "," + popup_height + ",1)\" onmouseover=\"writetxt(\'" + call_out_array[language] + ", (" + photo_array[news_item[sorted_news[i][1]].ni_links[j].nl_image][5] + kb_array[language] + "); " + new_window_array[language] + "\')\" onmouseout=\"writetxt(0)\">");
						if (photo_array[news_item[sorted_news[i][1]].ni_links[j].nl_image][8] == 1)
						{
							thbnl_array = photo_array[news_item[sorted_news[i][1]].ni_links[j].nl_image][4].split(".");
							document.write("<img border=\"0\" src=\"" + thbnl_array[0] + "_thbnl.jpg\" width=\"50\" align=\"left\">");
						}
						else
						{
							document.write("<img border=\"0\" src=\"" + photo_array[news_item[sorted_news[i][1]].ni_links[j].nl_image][4] + "\" width=\"50\" align=\"left\">");
						}
						document.writeln("</a>");			
					}
					document.write("<img border=\"0\" src=\"/images/video.gif\" width=\"24\" height=\"12\"><a href=\"");
					document.write(news_item[sorted_news[i][1]].ni_links[j].nl_url + "\" class=\"paracolourtext\"");
					document.write(" target=\"_blank\""); 
// flyout text is displayed if required
					if (flyout_text != "")
					{
						document.write(" onmouseover=\"writetxt(\'" + flyout_text + "\')\" onmouseout=\"writetxt(0)\"");
					}
				for (q = 0; q < media_quality_array.length; q++)
				{
					if (media_quality_array[q][0] == news_item[sorted_news[i][1]].ni_links[j].nl_quality)
					{
						quality = media_quality_array[q][1];
						break;
					}
				}
				document.write(">" + news_item[sorted_news[i][1]].ni_links[j].nl_text);
				if (quality != "")
				{
					document.write(" (" + quality + ")");
				}
				document.write("</a>");
// array item has variable set to indicate it is in another language - write message to this effect			
					if (news_item[sorted_news[i][1]].ni_links[j].nl_lang_id != 0)
					{
						document.write(" <span class=\"parasmalltext\">(" + language_text_array[news_item[sorted_news[i][1]].ni_links[j].nl_lang_id] + ")</span>");
					}
				}
			}
		}
// add a link to news item if first link is htm file	
		end_url = news_item[sorted_news[i][1]].ni_links[0].nl_url.substr(news_item[sorted_news[i][1]].ni_links[0].nl_url.length - 3, 3).toLowerCase();
		if (end_url == "htm")
		{
			document.write("<br>&gt;&nbsp;<a href=\"" + news_item[sorted_news[i][1]].ni_links[0].nl_url + "\" class=\"paracolourtext\">" + news_item[sorted_news[i][1]].ni_links[0].nl_text + "</a>");
// array item has variable set to indicate it is in another language - write message to this effect			
			if (news_item[sorted_news[i][1]].ni_links[0].nl_lang_id != 0)
			{
				document.write(" <span class=\"parasmalltext\">(" + language_text_array[news_item[sorted_news[i][1]].ni_links[0].nl_lang_id] + ")</span>");
			}
		}
		document.writeln("</td></tr>");
	}
}


// Function to show the latest podcast in small text (for right column)
function showSmallLatestPodcast()
{
	var sorted_news = new Array();
	var daynum = "";
	var j = 0;
// loop backwards through news items
	for (i = news_item.length-1; i >=0 ; i--)
	{
// news item not under embargo and for specified subject
		if ((news_item[i] !== not_defined) && (news_item[i].ni_embargo == "")) 
		{
// news item contains a link of type mp3
			for (h = 0; h < news_item[i].ni_links.length; h++)
			{
				end_url = news_item[i].ni_links[h].nl_url.substr(news_item[i].ni_links[h].nl_url.length - 3, 3).toLowerCase();
				if (end_url == "mp3")
				{
					sorted_news[j] = [news_item[i].ni_date.slice(0, 19), i, h];
// do until 2 news items selected
					if (j > 10)
					{
						break;
					}
					j = j + 1;
				}
			}
		}
	}
// sort selected news items by date
	if (sorted_news.length >= 1)
	{
		sorted_news.sort();
// display news item
		document.writeln("<p class=\"parasmallcolourtext\"><b>Fichero podcast más reciente:</b><br>");
		document.writeln(news_item[sorted_news[sorted_news.length - 1][1]].ni_date.slice(8, 10) + "." + news_item[sorted_news[sorted_news.length - 1][1]].ni_date.slice(5, 7) + "." + news_item[sorted_news[sorted_news.length - 1][1]].ni_date.slice(0, 4) + ": " + news_item[sorted_news[sorted_news.length - 1][1]].ni_head + "<br><img border=\"0\" src=\"/images/audio.gif\" width=\"24\" height=\"12\">");
// link contains a url - display a link		
		if (news_item[sorted_news[sorted_news.length - 1][1]].ni_links[sorted_news[sorted_news.length - 1][2]].nl_url != "")
		{
			new_window = false;
			flyout_text = "";
			end_url = news_item[sorted_news[sorted_news.length - 1][1]].ni_links[sorted_news[sorted_news.length - 1][2]].nl_url.substr(news_item[sorted_news[sorted_news.length - 1][1]].ni_links[sorted_news[sorted_news.length - 1][2]].nl_url.length - 3, 3).toLowerCase();
			new_window = true;
			flyout_text = document_type_array[5][1] + " ";
			if (news_item[sorted_news[sorted_news.length - 1][1]].ni_links[sorted_news[sorted_news.length - 1][2]].nl_pages != "")
			{
				flyout_text = flyout_text + news_item[sorted_news[sorted_news.length - 1][1]].ni_links[sorted_news[sorted_news.length - 1][2]].nl_pages  + " minutos; ";
			}
			if (news_item[sorted_news[sorted_news.length - 1][1]].ni_links[sorted_news[sorted_news.length - 1][2]].nl_kb != "")
			{
// if filesize > 1MB display size in MB
				if (parseInt(news_item[sorted_news[sorted_news.length - 1][1]].ni_links[sorted_news[sorted_news.length - 1][2]].nl_kb) > 1024)
				{
					file_size = Math.round(parseInt(news_item[sorted_news[sorted_news.length - 1][1]].ni_links[sorted_news[sorted_news.length - 1][2]].nl_kb)/1024);
					flyout_text = flyout_text + file_size + "MB; ";
				}
				else
				{
					flyout_text = flyout_text + news_item[sorted_news[sorted_news.length - 1][1]].ni_links[sorted_news[sorted_news.length - 1][2]].nl_kb + "KB; ";
				}
			}
			flyout_text = flyout_text + new_window_text;
			start_url = news_item[sorted_news[sorted_news.length - 1][1]].ni_links[sorted_news[sorted_news.length - 1][2]].nl_url.substr(0, 7);
// link is to an external website - set indicator for a new window and build flyout text	
			if ((new_window == false) && ((start_url == "http://") || (start_url == "https:/")))
			{
				new_window = true;
				flyout_text = new_window_text;
			}
			document.write("<a href=\"");
			document.write(news_item[sorted_news[sorted_news.length - 1][1]].ni_links[sorted_news[sorted_news.length - 1][2]].nl_url + "\" class=\"parasmallcolourtext\"");
// link opens in a new window if required
			if (new_window == true)
			{
				document.write(" target=\"_blank\""); 
			}
// flyout text is displayed if required
			if (flyout_text != "")
			{
				document.write(" onmouseover=\"writetxt(\'" + flyout_text + "\')\" onmouseout=\"writetxt(0)\"");
			}
			document.write(">" + news_item[sorted_news[sorted_news.length - 1][1]].ni_links[sorted_news[sorted_news.length - 1][2]].nl_text + "</a>");
// array item has variable set to indicate it is in another language - write message to this effect			
			if (news_item[sorted_news[sorted_news.length - 1][1]].ni_links[sorted_news[sorted_news.length - 1][2]].nl_lang_id != 0)
			{
				document.write(" <span class=\"parasmalltext\">(" + language_text_array[news_item[sorted_news[sorted_news.length - 1][1]].ni_links[sorted_news[sorted_news.length - 1][2]].nl_lang_id] + ")</span>");
			}
		}
		document.writeln("<br>&gt;&nbsp;<a href=\"javascript:openAWindow(\'/spanish/news_s/news06_s/pop_podcasting_help_s.htm\',\'links\',300,500,1)\" class=\"parasmallcolourtext\">ayuda</a></p>");
	}
}


// Function to show the latest webcast in small text (for right column)
function showSmallLatestWebcast()
{
	var sorted_news = new Array();
	var daynum = "";
	var j = 0;
// loop backwards through news items
	for (i = news_item.length-1; i >=0 ; i--)
	{
// news item not under embargo and for specified subject
		if ((news_item[i] !== not_defined) && (news_item[i].ni_embargo == "")) 
		{
// news item contains a link of type wmv
			for (h = 0; h < news_item[i].ni_links.length; h++)
			{
				end_url = news_item[i].ni_links[h].nl_url.substr(news_item[i].ni_links[h].nl_url.length - 3, 3).toLowerCase();
				if (end_url == "wmv")
				{
					sorted_news[j] = [news_item[i].ni_date.slice(0, 19), i, h];
// do until 2 news items selected
					if (j > 10)
					{
						break;
					}
					j = j + 1;
				}
			}
		}
	}
// sort selected news items by date
	if (sorted_news.length >= 1)
	{
		sorted_news.sort();
// display news item
		document.writeln("<p class=\"parasmallcolourtext\"><b>Fichero de transmisión por la Web más reciente:</b><br>");
		document.writeln(news_item[sorted_news[sorted_news.length - 1][1]].ni_date.slice(8, 10) + "." + news_item[sorted_news[sorted_news.length - 1][1]].ni_date.slice(5, 7) + "." + news_item[sorted_news[sorted_news.length - 1][1]].ni_date.slice(0, 4) + ": " + news_item[sorted_news[sorted_news.length - 1][1]].ni_head + "<br><img border=\"0\" src=\"/images/video.gif\" width=\"24\" height=\"12\">");
// link contains a url - display a link		
		if (news_item[sorted_news[sorted_news.length - 1][1]].ni_links[sorted_news[sorted_news.length - 1][2]].nl_url != "")
		{
			new_window = false;
			flyout_text = "";
			end_url = news_item[sorted_news[sorted_news.length - 1][1]].ni_links[sorted_news[sorted_news.length - 1][2]].nl_url.substr(news_item[sorted_news[sorted_news.length - 1][1]].ni_links[sorted_news[sorted_news.length - 1][2]].nl_url.length - 3, 3).toLowerCase();
			new_window = true;
			flyout_text = document_type_array[6][1] + " ";
			if (news_item[sorted_news[sorted_news.length - 1][1]].ni_links[sorted_news[sorted_news.length - 1][2]].nl_pages != "")
			{
				flyout_text = flyout_text + news_item[sorted_news[sorted_news.length - 1][1]].ni_links[sorted_news[sorted_news.length - 1][2]].nl_pages  + " minutos; ";
			}
			if (news_item[sorted_news[sorted_news.length - 1][1]].ni_links[sorted_news[sorted_news.length - 1][2]].nl_kb != "")
			{
// if filesize > 1MB display size in MB
				if (parseInt(news_item[sorted_news[sorted_news.length - 1][1]].ni_links[sorted_news[sorted_news.length - 1][2]].nl_kb) > 1024)
				{
					file_size = Math.round(parseInt(news_item[sorted_news[sorted_news.length - 1][1]].ni_links[sorted_news[sorted_news.length - 1][2]].nl_kb)/1024);
					flyout_text = flyout_text + file_size + "MB; ";
				}
				else
				{
					flyout_text = flyout_text + news_item[sorted_news[sorted_news.length - 1][1]].ni_links[sorted_news[sorted_news.length - 1][2]].nl_kb + "KB; ";
				}
			}
			flyout_text = flyout_text + new_window_text;
			start_url = news_item[sorted_news[sorted_news.length - 1][1]].ni_links[sorted_news[sorted_news.length - 1][2]].nl_url.substr(0, 7);
// link is to an external website - set indicator for a new window and build flyout text	
			if ((new_window == false) && ((start_url == "http://") || (start_url == "https:/")))
			{
				new_window = true;
				flyout_text = new_window_text;
			}
			document.write("<a href=\"");
			document.write(news_item[sorted_news[sorted_news.length - 1][1]].ni_links[sorted_news[sorted_news.length - 1][2]].nl_url + "\" class=\"parasmallcolourtext\"");
// link opens in a new window if required
			if (new_window == true)
			{
				document.write(" target=\"_blank\""); 
			}
// flyout text is displayed if required
			if (flyout_text != "")
			{
				document.write(" onmouseover=\"writetxt(\'" + flyout_text + "\')\" onmouseout=\"writetxt(0)\"");
			}
			document.write(">" + news_item[sorted_news[sorted_news.length - 1][1]].ni_links[sorted_news[sorted_news.length - 1][2]].nl_text + "</a>");
// array item has variable set to indicate it is in another language - write message to this effect			
			if (news_item[sorted_news[sorted_news.length - 1][1]].ni_links[sorted_news[sorted_news.length - 1][2]].nl_lang_id != 0)
			{
				document.write(" <span class=\"parasmalltext\">(" + language_text_array[news_item[sorted_news[sorted_news.length - 1][1]].ni_links[sorted_news[sorted_news.length - 1][2]].nl_lang_id] + ")</span>");
			}
		}
document.writeln("</p>");
	}
}


// Function to put a message to indicate the language of the page if it is not in appropriate language for the section
function checkTranslation(news_ref)
{
// loop through each link for the news item
	for (i = 0; i < news_item[news_ref].ni_links.length; i++)
	{
// url is the one for this page
		if (news_item[news_ref].ni_links[i].nl_url == wto_path) 
		{
// language is not appropriate for the page - indicate page language			
			if (news_item[news_ref].ni_links[i].nl_lang_id != 0)
			{
				document.writeln("<p class=\"paralargetext\">(" + language_text_array[news_item[news_ref].ni_links[i].nl_lang_id] + ")</p>");
			}
			break;
		}
	}
}


// This function displays the news item headline on the news item page (including image)
function showNewsPodcasts(news_ref)
{
	var first_link = true;
	var temp_array = new Array();
	var link_text = "";
// news item has more than 1 link
	if (news_item[news_ref].ni_links.length > 1)
	{
// loop through each link for the news item
		for (i = 0; i < news_item[news_ref].ni_links.length; i++)
		{
			end_url = news_item[news_ref].ni_links[i].nl_url.substr(news_item[news_ref].ni_links[i].nl_url.length - 3, 3).toLowerCase();
			if (end_url == "mp3")
			{
				if (first_link == true)
				{
					document.writeln("<p class=\"smallgreaterlistitem\"><img border=\"0\" src=\"/images/audio.gif\" width=\"24\" height=\"12\"><span class=\"parasmallboldcolourtext\">Audio:</span></p>");
					first_link = false;
				}
				flyout_text = document_type_array[5][1] + " ";

				if (news_item[news_ref].ni_links[i].nl_pages != "")
				{
					flyout_text = flyout_text + news_item[news_ref].ni_links[i].nl_pages  + " minutos; ";
				}
				if (news_item[news_ref].ni_links[i].nl_kb != "")
				{
// if filesize > 1MB display size in MB
					if (parseInt(news_item[news_ref].ni_links[i].nl_kb) > 1024)
					{
						file_size = Math.round(parseInt(news_item[news_ref].ni_links[i].nl_kb)/1024);
						flyout_text = flyout_text + file_size + "MB; ";
					}
					else
					{
						flyout_text = flyout_text + news_item[news_ref].ni_links[i].nl_kb + "KB; ";
					}
				}
				flyout_text = flyout_text + new_window_text;
// array item has variable set to indicate it is in another language - write message to this effect			
				if (news_item[news_ref].ni_links[i].nl_lang_id != 0)
				{
					flyout_text = flyout_text + "; " + language_text_array[news_item[news_ref].ni_links[i].nl_lang_id];
				}
				temp_array = news_item[news_ref].ni_links[i].nl_text.split("Audio: ");
				if (temp_array.length == 1)
				{
					link_text = temp_array[0];
				}
				else
				{
					link_text = temp_array[1];
				}
				document.write("<p class=\"smallgreaterlistitem\">&gt;&nbsp;<a href=\"");
				document.write(news_item[news_ref].ni_links[i].nl_url + "\"  target=\"_blank\" class=\"parasmallcolourtext\"");
// flyout text is displayed if required
				if (flyout_text != "")
				{
					document.write(" onmouseover=\"writetxt(\'" + flyout_text + "\')\" onmouseout=\"writetxt(0)\"");
				}
				document.write(">" + link_text + "</a>");
				document.writeln("</p>");
			}
		}
		if (first_link == false)
		{
			document.writeln("<p class=\"smallgreaterlistitem\">&gt;&nbsp;<a href=\"javascript:openAWindow(\'/spanish/news_s/news06_s/pop_podcasting_help_s.htm\',\'links\',300,500,1)\" class=\"parasmallcolourtext\" onmouseover=\"writetxt(\'se abrirá una nueva ventana')\" onmouseout=\"writetxt(0)\">ayuda</a></p>");
			document.writeln("<p class=\"smallgreaterlistitem\"><a href=\"/library/rss/podcasts_e.xml\" target=\"_blank\" onmouseover=\"writetxt(\'se abrirá una nueva ventana')\" onmouseout=\"writetxt(0)\"><img border=\"0\" src=\"/images/img_webcast/rss_podcast.gif\" align=\"absbottom\" vspace=\"2\" width=\"80\" height=\"15\"></a></p>");
		}
	}
}
// This function displays a list of podcasts for the item in the centre of the news item page
function showCentreNewsPodcasts(news_ref)
{
// news item has more than 1 link
	if (news_item[news_ref].ni_links.length > 1)
	{
// loop through each link for the news item
		for (i = 0; i < news_item[news_ref].ni_links.length; i++)
		{
			end_url = news_item[news_ref].ni_links[i].nl_url.substr(news_item[news_ref].ni_links[i].nl_url.length - 3, 3).toLowerCase();
			if (end_url == "mp3")
			{
				flyout_text = document_type_array[5][1] + " ";

				if (news_item[news_ref].ni_links[i].nl_pages != "")
				{
					flyout_text = flyout_text + news_item[news_ref].ni_links[i].nl_pages  + " minutos; ";
				}
				if (news_item[news_ref].ni_links[i].nl_kb != "")
				{
// if filesize > 1MB display size in MB
					if (parseInt(news_item[news_ref].ni_links[i].nl_kb) > 1024)
					{
						file_size = Math.round(parseInt(news_item[news_ref].ni_links[i].nl_kb)/1024);
						flyout_text = flyout_text + file_size + "MB; ";
					}
					else
					{
						flyout_text = flyout_text + news_item[news_ref].ni_links[i].nl_kb + "KB; ";
					}
				}
				flyout_text = flyout_text + new_window_text;
// array item has variable set to indicate it is in another language - write message to this effect			
				if (news_item[news_ref].ni_links[i].nl_lang_id != 0)
				{
					flyout_text = flyout_text + "; " + language_text_array[news_item[news_ref].ni_links[i].nl_lang_id];
				}
				document.write("<p class=\"greaterlistitem\"><img border=\"0\" src=\"/images/audio.gif\" width=\"24\" height=\"12\"><a href=\"");
				document.write(news_item[news_ref].ni_links[i].nl_url + "\"  target=\"_blank\" class=\"paracolourtext\"");
// flyout text is displayed if required
				if (flyout_text != "")
				{
					document.write(" onmouseover=\"writetxt(\'" + flyout_text + "\')\" onmouseout=\"writetxt(0)\"");
				}
				document.write(">" + news_item[news_ref].ni_links[i].nl_text + "</a>");
				document.writeln("</p>");
			}
		}
		document.writeln("<p class=\"parasmalltext\">&gt;&nbsp;<a href=\"javascript:openAWindow(\'/spanish/news_s/news06_s/pop_podcasting_help_s.htm\',\'links\',300,500,1)\" class=\"parasmallcolourtext\" onmouseover=\"writetxt(\'se abrirá una nueva ventana')\" onmouseout=\"writetxt(0)\">ayuda</a>");
		document.writeln("&nbsp; <a href=\"/library/rss/podcasts_e.xml\" target=\"_blank\" onmouseover=\"writetxt(\'se abrirá una nueva ventana')\" onmouseout=\"writetxt(0)\"><img border=\"0\" src=\"/images/img_webcast/rss_podcast.gif\" align=\"absbottom\" vspace=\"2\" width=\"80\" height=\"15\"></a></p>");
	}
}

// generate flyout for video/audio on home page
function generateMediaFlyout()
{
	var flyout_text = "";
	for (l = 0; l < document_type_array.length; l++)
	{
		if (document_type_array[l][0] == end_url)
		{
			flyout_text = document_type_array[l][1] + " ";
			break;
		}
	}
	if (news_item[news_ref].ni_links[k].nl_pages != "")
	{
		flyout_text = flyout_text + news_item[news_ref].ni_links[k].nl_pages  + " minutes; ";
	}
	if (news_item[news_ref].ni_links[k].nl_kb != "")
	{
// if filesize > 1MB display size in MB
		if (parseInt(news_item[news_ref].ni_links[k].nl_kb) > 1024)
		{
			file_size = Math.round(parseInt(news_item[news_ref].ni_links[k].nl_kb)/1024);
			flyout_text = flyout_text + file_size + "MB; ";
		}
		else
		{
			flyout_text = flyout_text + news_item[news_ref].ni_links[k].nl_kb + "KB; ";
		}
	}
	flyout_text = flyout_text + new_window_text;
	if (news_item[news_ref].ni_links[k].nl_lang_id != 0)
	{
		flyout_text = flyout_text + "; " + language_text_array[news_item[news_ref].ni_links[k].nl_lang_id];
	}
	return flyout_text;
}

// display links to video & podcasts associated with news items on home page
function showNewsWebcasts(news_ref)
{
	var video_found = 0;
	var last_media_title = "";
	var last_media_id = 0;
	var last_media_quality = "";
	var audio_found = 0;
	var flyout_text = "";
	var display_text = "";
	var file_size = 0;
	for (k = 0; k < news_item[news_ref].ni_links.length; k++)
	{
		end_url = news_item[news_ref].ni_links[k].nl_url.substr(news_item[news_ref].ni_links[k].nl_url.length - 3, 3).toLowerCase();
		if (end_url == "wmv")
		{
				if (news_item[news_ref].ni_links[k].nl_text != last_media_title)
				{
					if (last_media_title != "")
					{
						if (last_media_quality != "")
						{
							document.write("<br><a href=\"" + news_item[news_ref].ni_links[last_media_id].nl_url + "\" target=\"_blank\" class=\"parasmallcolourtext\" onmouseover=\"writetxt('" + flyout_text +"')\" onmouseout=\"writetxt(0)\">" + last_media_quality + "</a>");
						}
						else
						{
							document.write("<a href=\"" + news_item[news_ref].ni_links[last_media_id].nl_url + "\" target=\"_blank\" class=\"parasmallboldcolourtext\" onmouseover=\"writetxt('" + flyout_text +"')\" onmouseout=\"writetxt(0)\">" + last_media_title + "</a>");
						}
						document.write("</p>");
					}
					document.write("<p  class=\"parasmallcolourtext\"><img src=\"/images/video.gif\" width=\"24\" height=\"12\">");
				}
				else
				{
					if (last_media_quality != "")
					{
						document.write("<span class=\"parasmallboldcolourtext\"> " + last_media_title + "</span><br><a href=\"" + news_item[news_ref].ni_links[last_media_id].nl_url + "\" target=\"_blank\" class=\"parasmallcolourtext\" onmouseover=\"writetxt('" + flyout_text +"')\" onmouseout=\"writetxt(0)\">" + last_media_quality + "</a>");
					}
					else
					{
						document.write("<a href=\"" + news_item[news_ref].ni_links[last_media_id].nl_url + "\" target=\"_blank\" class=\"parasmallboldcolourtext\" onmouseover=\"writetxt('" + flyout_text +"')\" onmouseout=\"writetxt(0)\">" + last_media_title + "</a>");
					}
				}
				last_media_title = news_item[news_ref].ni_links[k].nl_text;
				last_media_id = k;
				for (l = 0; l < media_quality_array.length; l++)
				{
					if (media_quality_array[l][0] == news_item[news_ref].ni_links[k].nl_quality)
					{
						last_media_quality = media_quality_array[l][1];
						break;
					}
				}
				flyout_text = generateMediaFlyout();
		}
	}
	if (last_media_title != "")
	{
		if (last_media_quality != "")
		{
			document.write("<br><a href=\"" + news_item[news_ref].ni_links[last_media_id].nl_url + "\" target=\"_blank\" class=\"parasmallcolourtext\" onmouseover=\"writetxt('" + flyout_text +"')\" onmouseout=\"writetxt(0)\">" + last_media_quality + "</a>");
		}
		else
		{
			document.write("<a href=\"" + news_item[news_ref].ni_links[last_media_id].nl_url + "\" target=\"_blank\" class=\"parasmallboldcolourtext\" onmouseover=\"writetxt('" + flyout_text +"')\" onmouseout=\"writetxt(0)\">" + last_media_title + "</a>");
		}
	}
}

// This function shows the cases links for the specified cases in the centre column of the news item
function showNewsCasesLinks(news_ref)
{
	cases_array = news_item[news_ref].ni_cases.split("#");
// loop through each subject for the news item
	for (k = 0; k < cases_array.length; k++)
	{
			document.writeln("<br>&gt;&nbsp;<a href=\"" + cases_link_array[0] + cases_array[k] + "_s.htm\" class=\"paracolourtext\" onmouseover=\"writetxt(\'" + cases_link_array[2] + "\')\" onmouseout=\"writetxt(0)\">" + cases_link_array[1] + cases_array[k] + "</a>");
	}
}


// This function displays the news item headline & intro for a speech on the news item page (including image)
function showSpeechHeadline(news_ref)
{
	document.write("<p class=\"pagetitletext\">");
	showNewsImage(news_ref);
	document.writeln(news_item[news_ref].ni_head + "</p>");

	if (news_item[news_ref].ni_intro != "")
	{
		document.write("<p class=\"paralargetext\">" + news_item[news_ref].ni_intro + " El Director General dijo lo siguiente:</p>");
	}
}


// Function to show the month and year in the breadcrumbs for a meeting agenda
function showMeetingBreadcrumb(news_ref)
{
	document.write("<span class=\"paraorangetext\">reunión " + month_array[parseInt(news_item[news_ref].ni_date.slice(5, 7), 10)].toLowerCase() + " " + news_item[news_ref].ni_date.slice(0, 4) + "</span>");
}

// This function displays the date of the news item in the news item above the kicker text
function showMeetingKickerDate(news_ref)
{
	var date_array = new Array();
	date_array = news_item[news_ref].ni_date.split("#");
	document.write("REUNI&Oacute;N DE ");
// loop through all the dates for the news item
	for (i = 0; i < date_array.length; i++)
	{
// remove leading zero from day if necessary
		if (date_array[i].slice(8, 9) == "0")
		{
			document.write(date_array[i].slice(9, 10));
		}
		else
		{ 
			document.write(date_array[i].slice(8, 10));
		}
// process for where to write commas, and and month name
		if (date_array.length > 1)
		{
			if (i < date_array.length-1)
			{
				if (date_array[i].slice(5, 7) != date_array[date_array.length-1].slice(5, 7))
				{
					document.write(month_array[parseInt(date_array[i].slice(5, 7), 10)].toUpperCase() + "&nbsp;");
				}
				if (date_array[i].slice(0, 4) != date_array[date_array.length-1].slice(0, 4))
				{
					document.write(date_array[i].slice(0, 4) + "&nbsp;");
				}
			document.write("-");
			}
			else
			{
				document.write("&nbsp;" + month_array[parseInt(date_array[i].slice(5, 7), 10)].toUpperCase() + "&nbsp;" + date_array[i].slice(0, 4));
			}
		}
		else
		{
			document.write("&nbsp;" + month_array[parseInt(date_array[i].slice(5, 7), 10)].toUpperCase() + "&nbsp;" + date_array[i].slice(0, 4));
		}
	}
}
// This function displays the date of the news item in the news item above the kicker text
function showMeetingAgendaLink(news_ref, symbol)
{
	document.write("&gt;&nbsp;<a href=\"\" onClick=\"f_submit(\'(@meta_Symbol " + symbol + " and @meta_Meet_Date " + news_item[news_ref].ni_date.slice(8, 10) + "/" + news_item[news_ref].ni_date.slice(5, 7) + "/" + news_item[news_ref].ni_date.slice(0, 4) + " and @meta_Title agenda*)\',\'3\');return false\" class=\"parasmallboldcolourtext\"  onMouseOver=\"writetxt('Búsqueda en Documentos en línea. Los resultados aparecen en una nueva ventana.')\" onMouseOut=\"writetxt(0)\">Orden del día propuesto</a><br>");

}

// This function displays a link to minutes of the meeting
function showMeetingMinutesLink(news_ref, symbol)
{
	document.writeln("<a name=\"minutes\"></a>&gt;&nbsp;<a href=\"\" onClick=\"f_submit(\'(@meta_Symbol " + symbol + " and @meta_Meet_Date " + news_item[news_ref].ni_date.slice(8, 10) + "/" + news_item[news_ref].ni_date.slice(5, 7) + "/" + news_item[news_ref].ni_date.slice(0, 4) + ")\',\'3\');return false\" class=\"parasmallboldcolourtext\" onMouseOver=\"writetxt('Búsqueda en Documentos en línea. Los resultados aparecen en una nueva ventana.')\" onMouseOut=\"writetxt(0)\">Acta de la reunión</a> (publicada como documento de carácter reservado y posteriormente puesta en distribución general de conformidad con los <a class=\"parasmallcolourtext\" target=\"_blank\" href=\"http://docsonline.wto.org/imrd/directdoc.asp?DDFDocuments/v/WT/L/452.doc\" onMouseOver=\"writetxt('Se abre una nueva ventana.')\" onMouseOut=\"writetxt(0)\">procedimientos para la distribución y la supresión del carácter reservado de los documentos de la OMC</a>).<br>");
	document.writeln("&gt;&nbsp;<a href=\"\" onClick=\"f_submit(\'((@meta_Symbol " + symbol + ") and NOT (@meta_Meet_Date " + news_item[news_ref].ni_date.slice(8, 10) + "/" + news_item[news_ref].ni_date.slice(5, 7) + "/" + news_item[news_ref].ni_date.slice(0, 4) + "))\',\'3\');return false\" class=\"parasmallboldcolourtext\"  onMouseOver=\"writetxt('Búsqueda en Documentos en línea. Los resultados aparecen en una nueva ventana.')\" onMouseOut=\"writetxt(0)\">Actas de reuniones anteriores</a><br>");

}

// This function displays an embargo box on a page
function showEmbargoBox(news_ref)
{
	if (this_page.indexOf("/xmedia_s/") != -1)
	{	
		var EmbargoDate = new Date(news_item[news_ref].ni_date.slice(0, 4), news_item[news_ref].ni_date.slice(5, 7) - 1, news_item[news_ref].ni_date.slice(8, 10), news_item[news_ref].ni_date.slice(11, 13), news_item[news_ref].ni_date.slice(14, 16));
		var EndOct = new Date(news_item[news_ref].ni_date.slice(0, 4), 9, 31);
		var EndMar = new Date(news_item[news_ref].ni_date.slice(0, 4), 2, 31);
		var SummerTimeStarts = new Date(news_item[news_ref].ni_date.slice(0, 4), 2, (31 - EndMar.getDay()), 2);
		var SummerTimeEnds = new Date(news_item[news_ref].ni_date.slice(0, 4), 9, (31 - EndOct.getDay()), 3);
		var GMTEmbargoDate = new Date(EmbargoDate);
		
		if ((EmbargoDate >= SummerTimeStarts) && (EmbargoDate <= SummerTimeEnds))
		{
			GMTEmbargoDate.setHours(GMTEmbargoDate.getHours() - 2);
		}
		else
		{
			GMTEmbargoDate.setHours(GMTEmbargoDate.getHours() - 1);
		}
		document.write("<table border=\"0\" cellspacing=\"5\" cellpadding=\"5\"><tr><td align=\"right\" valign=\"top\" bgcolor=\"#E5E5E5\"><p class=\"paranormaltext\"><span class=\"paraboldcolourtext\">EMBARGO:</span><br>Prohibida la publicación o distribución por agencias de noticias, antes de las ");
		if (EmbargoDate.getDate() == GMTEmbargoDate.getDate())
		{
			document.write("<span class=\"paraboldcolourtext\">");
			if (EmbargoDate.getHours() < 10)
			{
				document.write("0");
			}
			document.write(EmbargoDate.getHours() + ".");
			if (EmbargoDate.getMinutes() < 10)
			{
				document.write("0");
			}
			document.write(EmbargoDate.getMinutes() + " hora de Ginebra</span> (");
			if (GMTEmbargoDate.getHours() < 10)
			{
				document.write("0");
			}
			document.write(GMTEmbargoDate.getHours() + ".");
			if (GMTEmbargoDate.getMinutes() < 10)
			{
				document.write("0");
			}
			document.write(GMTEmbargoDate.getMinutes() + "&nbsp;GMT) <span class=\"paraboldcolourtext\">" + EmbargoDate.getDate() + "&nbsp;" + month_array[parseInt(EmbargoDate.getMonth() + 1, 10)] + "&nbsp;" + EmbargoDate.getFullYear() + "</span><br>");
		}
		else
 		{
			document.write("<span class=\"paraboldcolourtext\">");
			if (EmbargoDate.getHours() < 10)
			{
				document.write("0");
			}
			document.write(EmbargoDate.getHours() + ".");
			if (EmbargoDate.getMinutes() < 10)
			{
				document.write("0");
			}
			document.write(EmbargoDate.getMinutes() + " hora de Ginebra " + EmbargoDate.getDate() + "&nbsp;" + month_array[parseInt(EmbargoDate.getMonth() + 1, 10)] + "&nbsp;" + EmbargoDate.getFullYear() + "</span> (");
			if (GMTEmbargoDate.getHours() < 10)
			{
				document.write("0");
			}
			document.write(GMTEmbargoDate.getHours() + ".");
			if (GMTEmbargoDate.getMinutes() < 10)
			{
				document.write("0");
			}
			document.write(GMTEmbargoDate.getMinutes() + "&nbsp;GMT " + GMTEmbargoDate.getDate() + "&nbsp;" + month_array[parseInt(GMTEmbargoDate.getMonth() + 1, 10)] + "&nbsp;" + GMTEmbargoDate.getFullYear() + ")<br>");
		}
   		document.writeln("&gt;&nbsp;<a href=\"http://www.timeanddate.com/worldclock/city.html?n=87\" target=\"_blank\" class=\"paracolourtext\" onmouseover=\"writetxt('Se abrirá una nueva ventana')\" onmouseout=\"writetxt(0)\">Hora actual en Ginebra</a></p></td></tr></table>");
	}
}

// This function displays the embargo box & link to an embargoed text on the Xmedia page
function listEmbargoedItems()
{
	var path_array = new Array();
	var embargoed_items_array = new Array();
	var j = 0;
	var cutOffDate = new Date();
	var cutOffDateString = "";
	var monthNum = 0;
	var englishLink = "";
	var frenchLink = "";
	var spanishLink = "";
	
	cutOffDate.setDate(cutOffDate.getDate() - 10);	
	cutOffDateString = cutOffDate.getFullYear() + ".";
	monthNum = cutOffDate.getMonth() + 1;
	if (monthNum < 10 )
	{
		cutOffDateString = cutOffDateString + "0" + monthNum + ".";
	}
	else
	{
		cutOffDateString = cutOffDateString + monthNum + ".";
	}
	if (cutOffDate.getDate() < 10)
	{
		cutOffDateString = cutOffDateString + "0" + cutOffDate.getDate();
	}
	else
	{
		cutOffDateString = cutOffDateString + cutOffDate.getDate();
	}
// read backwards through list of news items to build array of those whose embargo expired less than 10 days ago
	for (i = news_item.length - 1; i >= 0; i--)
	{
		if ((news_item[i] !== not_defined) && (news_item[i].ni_embargo_langs != ""))
		{
			if (news_item[i].ni_date.slice(0, 10) >= cutOffDateString)
			{
				embargoed_items_array[j] = [news_item[i].ni_date.slice(0, 19), i];
				j = j + 1;
			}
		}
	}
	embargoed_items_array.sort();
	flyout_text = "";
	if (embargoed_items_array.length == 0)
	{ 
		document.writeln("<p class=\"paracolourtext\">No hay textos cuya divulgación no está autorizada</p>");
	}
	else
	{
		for (i = embargoed_items_array.length -1; i >= 0; i--)
		{
		document.write("<table>");
			for (h = 0; h < news_item[embargoed_items_array[i][1]].ni_links.length; h++)
			{
				if (news_item[embargoed_items_array[i][1]].ni_links[h].nl_url != "")
				{
				flyout_text = "";
				path_array = news_item[embargoed_items_array[i][1]].ni_links[h].nl_url.split("/");
				end_url = news_item[embargoed_items_array[i][1]].ni_links[h].nl_url.substr(news_item[embargoed_items_array[i][1]].ni_links[h].nl_url.length - 3, 3).toLowerCase();
				if (h == 0)
				{
					document.write("<tr>");
	document.write("<td width=\"160\" valign=\"top\" class=\"graytd\">");
			showEmbargoBox(embargoed_items_array[i][1]);
			document.write("</td>");
				}
				if (end_url != "htm")
				{
					flyout_text = " target=\"_blank\"  onmouseover=\"writetxt(\'";
					for (k = 0; k < document_type_array.length; k++)
					{
// extension of link is in list of selected document types - set indicator for a new window 
// and build flyout text
						if (document_type_array[k][0] == end_url)
						{
							flyout_text = flyout_text + document_type_array[k][1] + " Se abrirá una nueva ventana\')\" onmouseout=\"writetxt(0)\"";
							break;
						}
					}
				}
				if (h == 0)
				{
					if (news_item[embargoed_items_array[i][1]].ni_embargo == "")
					{ 
						spanishLink = news_item[embargoed_items_array[i][1]].ni_links[0].nl_url;
						frenchLink = news_item[embargoed_items_array[i][1]].ni_links[0].nl_url.replace(/_s\./g, "_f.");
						frenchLink = frenchLink.replace(/_s\//g, "_f/");
						frenchLink = frenchLink.replace(/\/spanish\//g, "/french/");
						englishLink = news_item[embargoed_items_array[i][1]].ni_links[0].nl_url.replace(/_s\./g, "_e.");
						englishLink = englishLink.replace(/_s\//g, "_e/");
						englishLink = englishLink.replace(/\/spanish\//g, "/english/");
					}
					else 
					{
						spanishLink = "/spanish/forums_s/media_s/xmedia_s/" + path_array[path_array.length-1];
						frenchLink = "/french/forums_f/media_f/xmedia_f/" + path_array[path_array.length-1].replace("_s.", "_f.");
						englishLink = "/english/forums_e/media_e/xmedia_e/" + path_array[path_array.length-1].replace("_s.", "_e.");
					}
					document.write("<td  valign=\"top\"><p class=\"paracolourtext\">" + parseInt(news_item[embargoed_items_array[i][1]].ni_date.slice(8, 10), 10) + "&nbsp;" + month_array[parseInt(news_item[embargoed_items_array[i][1]].ni_date.slice(5, 7), 10)] + "&nbsp;" + news_item[embargoed_items_array[i][1]].ni_date.slice(0, 4) + "<br>");
					if ((news_item[embargoed_items_array[i][1]].ni_embargo_langs.indexOf("E") == -1) && (news_item[embargoed_items_array[i][1]].ni_embargo_langs.indexOf("F") == -1) && (news_item[embargoed_items_array[i][1]].ni_embargo_langs.indexOf("S") != -1))
					{
						document.write("<a class=\"paraboldcolourtext\" href=\"" + spanishLink + "\"" + flyout_text + ">" + news_item[embargoed_items_array[i][1]].ni_head + "</a>");
					}
					else
					{
						document.write("<span class=\"paraboldcolourtext\">" + news_item[embargoed_items_array[i][1]].ni_head + "</span>");
						if (news_item[embargoed_items_array[i][1]].ni_embargo_langs.indexOf("E") != -1)
						{
							document.write("<br>&gt;&nbsp;<a class=\"paracolourtext\" href=\"" + englishLink + "\"" + flyout_text + ">English</a>");
						}				
						if (news_item[embargoed_items_array[i][1]].ni_embargo_langs.indexOf("F") != -1)
						{
							document.write("<br>&gt;&nbsp;<a class=\"paracolourtext\" href=\"" + frenchLink + "\"" + flyout_text + ">Français</a>");
						}		
						if (news_item[embargoed_items_array[i][1]].ni_embargo_langs.indexOf("S") != -1)
						{
							document.write("<br>&gt;&nbsp;<a class=\"paracolourtext\" href=\"" + spanishLink + "\"" + flyout_text + ">Espa&ntilde;ol</a>");
						}		
					}
				}
				else
				{
					document.write("<br><a class=\"paraboldcolourtext\" href=\"" + news_item[embargoed_items_array[i][1]].ni_links[h].nl_url + "\"" + flyout_text + ">" + news_item[embargoed_items_array[i][1]].ni_links[h].nl_text + "</a>");
				}
				}
			}
			document.writeln("</p></td>");
			
			document.write("</tr>");
		document.writeln("</table>");
		}
	}
}

// Function to show a specified number of news items on a country gateway
function showCountryNews(items, countryNum)
{
	var daynum = "";
	var news_date_array = new Array();
	var date_array = new Array();
	var temp_array = new Array();
	j = 0;
// loop backwards through news items 
			for (i = news_item.length-1; i >=0 ; i--)
			{
// news item is not under embargo & is for specified subject
				if ((news_item[i] !== not_defined) && (news_item[i].ni_embargo == "") && (news_item[i].ni_country.indexOf(country[countryNum].code) != -1)) 
				{
					temp_array[j] = [news_item[i].ni_date.slice(0, 19), i];
					j = j + 1;
				}
			}
			sorted_news = temp_array;
			if (sorted_news.length == 0)
			{
				document.writeln("<p class=\"paranormaltext\">No hay noticias recientes</p>");
			}
			else
			{
				document.writeln("<ul class=\"paranormaltext\">");
// sort selected news items by date
				sorted_news.sort();
// loop backwards through sorted news items
				for (i = sorted_news.length-1; i >= 0; i--)
				{
// if required number of news items not displayed display news item
					if ((items == 0) || (cnt < items))
					{
						document.write("<li><p><b>");
// remove leading zero if day less than 10
						if (news_item[sorted_news[i][1]].ni_date.slice(8, 9) == "0")
						{
							daynum = news_item[sorted_news[i][1]].ni_date.slice(9, 10);
						}
						else
						{ 
							daynum = news_item[sorted_news[i][1]].ni_date.slice(8, 10);
						}
// convert month number to name of month
						document.write(daynum + "&nbsp;" + month_array[parseInt(news_item[sorted_news[i][1]].ni_date.slice(5, 7), 10)] + "&nbsp;" + news_item[sorted_news[i][1]].ni_date.slice(0, 4) + ":</b> ");
						end_url = news_item[sorted_news[i][1]].ni_links[0].nl_url.substr(news_item[sorted_news[i][1]].ni_links[0].nl_url.length - 3, 3).toLowerCase();
// if news item has only 1 link put link on headline
						if ((news_item[sorted_news[i][1]].ni_links.length == 1) && (end_url != "mp3"))
						{
							document.write("<a href=\"" + news_item[sorted_news[i][1]].ni_links[0].nl_url + "\" class=\"paraboldcolourtext\">" + news_item[sorted_news[i][1]].ni_head + "</a>");
// array item has variable set to indicate it is in another language - write message to this effect			
							if (news_item[sorted_news[i][1]].ni_links[0].nl_lang_id != 0)
							{
								document.write(" <span class=\"parasmalltext\">(" + language_text_array[news_item[sorted_news[i][1]].ni_links[0].nl_lang_id] + ")</span>");
							}
						}
// otherwise display headline and links separately
						else
						{
							document.write("<span class=\"paraboldcolourtext\">" + news_item[sorted_news[i][1]].ni_head + "</span>");
							if (news_item[sorted_news[i][1]].ni_intro == "")
							{
								document.write("<br>");
							}
							showNewsLinks(i);
						}
						document.writeln("</p></li>");
						cnt = cnt + 1;
					}
				}
				document.writeln("</ul>");
			}
// add more on link to subject news archive
			document.writeln("<p class=\"strippedsmalltext\" align=\"right\">&gt;&nbsp;<a class=\"parasmallcolourtext\" href=\"/spanish/news_s/archive_s/country_arc_s.htm?country1="	+ country[countryNum].code + "\" class=\"paracolourtext\">Más noticias sobre " + country[countryNum].article + country[countryNum].name + "</a></p>");
}

// Function to display the news archives for a country (& year)
function showCountryYearArchive(cntry, year)
{
	var news_date_array = new Array();
	var date_array = new Array();
// loop through each news item
	for (i = 0; i < news_item.length; i++)
	{
// news item is not under embargo and is for specified subject
		if ((news_item[i] !== not_defined) && (news_item[i].ni_embargo == "") && (news_item[i].ni_country.indexOf(cntry) != -1)) 
		{
// news item is for specified year if a year is specified
			if ((year == "") || ((year != "") && (news_item[i].ni_date.slice(0, 4) == year)))
			{
				sorted_news[j] = [news_item[i].ni_date.slice(0, 19), i];
				j = j + 1;
			}
		}
	}
// sort selected news items by date
	sorted_news.sort();
	if (sorted_news.length == 0)
	{
		document.writeln("<tr><td class=\"paranormaltext\" valign=\"top\">No hay noticias respecto de este país</td><tr>");
	}
// loop backwards through sorted news items
	for (i = sorted_news.length-1; i >= 0; i--)
	{
		date_array = news_item[sorted_news[i][1]].ni_date.split("#");
		news_date_array = date_array[0].split("_");
// display date
		document.writeln("<tr><td class=\"graytd\" valign=\"top\">" + news_date_array[0].slice(8,10) + "." + news_date_array[0].slice(5,7) + "." + news_date_array[0].slice(0,4) + "</td>");
// news item has only 1 link put link on headline
		if (news_item[sorted_news[i][1]].ni_links.length == 1)
		{
			document.write("<td class=\"graytd\" valign=\"top\"><a href=\"" + news_item[sorted_news[i][1]].ni_links[0].nl_url + "\" class=\"paraboldcolourtext\">" + news_item[sorted_news[i][1]].ni_head + "</a>");
// array item has variable set to indicate it is in another language - write message to this effect			
			if (news_item[sorted_news[i][1]].ni_links[0].nl_lang_id != 0)
			{
					document.write(" <span class=\"parasmalltext\">(" + language_text_array[news_item[sorted_news[i][1]].ni_links[0].nl_lang_id] + ")</span>");
			}
// display intro if it exists
			if (news_item[sorted_news[i][1]].ni_intro != "")
			{
				document.write("<br>" + news_item[sorted_news[i][1]].ni_intro);
			}
		}
// news item has several links
		else
		{
// display headline
			document.write("<td class=\"graytd\" valign=\"top\"><span class=\"paraboldcolourtext\">" + news_item[sorted_news[i][1]].ni_head + "</span><br>");
// display intro if it exists
			if (news_item[sorted_news[i][1]].ni_intro != "")
			{
				document.write(news_item[sorted_news[i][1]].ni_intro);
			}
// display links
			showNewsLinks(i);
		}
		document.writeln("</td></tr>");
	}
}
// Function to show a specified number of news items on a country gateway
function showDisputeNews(dsnumber, items)
{
	var daynum = "";
	var news_date_array = new Array();
	var date_array = new Array();
	var temp_array = new Array();
	var dispute_array = new Array();
	j = 0;
// loop backwards through news items 
	for (i = news_item.length-1; i >=0 ; i--)
	{
// news item is not under embargo & is for specified subject
		if ((news_item[i] !== not_defined) && (news_item[i].ni_embargo == "") && (news_item[i].ni_cases != "")) 
		{
			dispute_array = news_item[i].ni_cases.split("#");
			for (k = 0; k < dispute_array.length; k++)
			{
				if (dispute_array[k] == dsnumber)
				{
					temp_array[j] = [news_item[i].ni_date.slice(0, 19), i];
					if (items > 0)
					{
// continue until 2 more items than required to show
						if (j >= items + 2)
						{
							break;
						}
					}
					j = j + 1;
					break;
				}
			}
		}
	}
	sorted_news = temp_array;
	if (sorted_news.length == 0)
	{
		document.writeln("<p class=\"paranormaltext\">No hay noticias recientes</p>");
	}
	else
	{
		document.writeln("<ul class=\"paranormaltext\">");
// sort selected news items by date
		sorted_news.sort();
// loop backwards through sorted news items
		for (i = sorted_news.length-1; i >= 0; i--)
		{
// if required number of news items not displayed display news item
			if ((items == 0) || (cnt < items))
			{
				document.write("<li><p><b>");
// remove leading zero if day less than 10
				if (news_item[sorted_news[i][1]].ni_date.slice(8, 9) == "0")
				{
					daynum = news_item[sorted_news[i][1]].ni_date.slice(9, 10);
				}
				else
				{ 
					daynum = news_item[sorted_news[i][1]].ni_date.slice(8, 10);
				}
// convert month number to name of month
				document.write(daynum + "&nbsp;" + month_array[parseInt(news_item[sorted_news[i][1]].ni_date.slice(5, 7), 10)] + "&nbsp;" + news_item[sorted_news[i][1]].ni_date.slice(0, 4) + ":</b> ");
				end_url = news_item[sorted_news[i][1]].ni_links[0].nl_url.substr(news_item[sorted_news[i][1]].ni_links[0].nl_url.length - 3, 3).toLowerCase();
// if news item has only 1 link put link on headline
				if ((news_item[sorted_news[i][1]].ni_links.length == 1) && (end_url != "mp3"))
				{
					document.write("<a href=\"" + news_item[sorted_news[i][1]].ni_links[0].nl_url + "\" class=\"paraboldcolourtext\">" + news_item[sorted_news[i][1]].ni_head + "</a>");
// array item has variable set to indicate it is in another language - write message to this effect			
					if (news_item[sorted_news[i][1]].ni_links[0].nl_lang_id != 0)
					{
						document.write(" <span class=\"parasmalltext\">(" + language_text_array[news_item[sorted_news[i][1]].ni_links[0].nl_lang_id] + ")</span>");
					}
				}
// otherwise display headline and links separately
				else
				{
					document.write("<span class=\"paraboldcolourtext\">" + news_item[sorted_news[i][1]].ni_head + "</span>");
					if (news_item[sorted_news[i][1]].ni_intro == "")
					{
						document.write("<br>");
					}
					showNewsLinks(i);
				}
				document.writeln("</p></li>");
				cnt = cnt + 1;
			}
		}
		document.writeln("</ul>");
// add more on link to dispute case news archive
		document.writeln("<p class=\"strippedsmalltext\" align=\"right\">&gt;&nbsp;<a class=\"parasmallcolourtext\" href=\"/spanish/news_s/archive_s/dscases_arc_s.htm?case="	+ dsnumber + "\" class=\"paracolourtext\">Más noticias sobre DS" + dsnumber + "</a></p>");
	}
}

// Function to display the news archives for a country (& year)
function showDisputeYearArchive(dsnumber, year)
{
	var news_date_array = new Array();
	var date_array = new Array();
// loop through each news item
	for (i = 0; i < news_item.length; i++)
	{
// news item is not under embargo and is for specified subject
		if ((news_item[i] !== not_defined) && (news_item[i].ni_embargo == "") && (news_item[i].ni_cases != "")) 
		{
			dispute_array = news_item[i].ni_cases.split("#");
			for (k = 0; k < dispute_array.length; k++)
			{
				if (dispute_array[k] == dsnumber)
				{
// news item is for specified year if a year is specified
					if ((year == "") || ((year != "") && (news_item[i].ni_date.slice(0, 4) == year)))
					{
						sorted_news[j] = [news_item[i].ni_date.slice(0, 19), i];
						j = j + 1;
					}
					break;
				}
			}
		}
	}
// sort selected news items by date
	sorted_news.sort();
// loop backwards through sorted news items
	for (i = sorted_news.length-1; i >= 0; i--)
	{
		date_array = news_item[sorted_news[i][1]].ni_date.split("#");
		news_date_array = date_array[0].split("_");
// display date
		document.writeln("<tr><td class=\"graytd\" valign=\"top\">" + news_date_array[0].slice(8,10) + "." + news_date_array[0].slice(5,7) + "." + news_date_array[0].slice(0,4) + "</td>");
// news item has only 1 link put link on headline
		if (news_item[sorted_news[i][1]].ni_links.length == 1)
		{
			document.write("<td class=\"graytd\" valign=\"top\"><a href=\"" + news_item[sorted_news[i][1]].ni_links[0].nl_url + "\" class=\"paraboldcolourtext\">" + news_item[sorted_news[i][1]].ni_head + "</a>");
// array item has variable set to indicate it is in another language - write message to this effect			
			if (news_item[sorted_news[i][1]].ni_links[0].nl_lang_id != 0)
			{
					document.write(" <span class=\"parasmalltext\">(" + language_text_array[news_item[sorted_news[i][1]].ni_links[0].nl_lang_id] + ")</span>");
			}
// display intro if it exists
			if (news_item[sorted_news[i][1]].ni_intro != "")
			{
				document.write("<br>" + news_item[sorted_news[i][1]].ni_intro);
			}
		}
// news item has several links
		else
		{
// display headline
			document.write("<td class=\"graytd\" valign=\"top\"><span class=\"paraboldcolourtext\">" + news_item[sorted_news[i][1]].ni_head + "</span><br>");
// display intro if it exists
			if (news_item[sorted_news[i][1]].ni_intro != "")
			{
				document.write(news_item[sorted_news[i][1]].ni_intro);
			}
// display links
			showNewsLinks(i);
		}
		document.writeln("</td></tr>");
	}
}

//***********************************************************************
// This opens up an new email message with the to address filled in with 
// the variable called email and the subject filled in with the variable
// called subject plus the name of the page the user is currently on
//***********************************************************************
function emailWTO(email, subject)
{
	var location = "mailto:" + email + "?subject=" + subject + " - " + this_page;
//	openAWindow( location, 'email',300,350,1);
	window.open(location, 'email');
}

// Function to show a specified number of news items on an acceding country gateway
function showAccedingCountryNews(cntry, items)
{
	var daynum = "";
	var news_date_array = new Array();
	var date_array = new Array();
	var temp_array = new Array();
	var memberdate = "";
	j = 0;
	for (h=0; h<country.length; h++)
	{
		if (country[h].code == cntry)
		{
			memberdate = country[h].joindate;
			break;
		}
	}
// loop backwards through news items 
	for (i = news_item.length-1; i >=0 ; i--)
	{
// news item is not under embargo & is for specified subject
		if ((news_item[i] !== not_defined) && (news_item[i].ni_embargo == "") && (news_item[i].ni_country.indexOf(country[h].code) != -1) && ((news_item[i].ni_date.slice(0, 19) < memberdate) || (memberdate == ""))) 
		{
			temp_array[j] = [news_item[i].ni_date.slice(0, 19), i];
			j = j + 1;
		}
	}
	sorted_news = temp_array;
	if (sorted_news.length == 0)
	{
		document.writeln("<p class=\"paranormaltext\">No hay noticias recientes</p>");
	}
	else
	{
		document.writeln("<ul class=\"paranormaltext\">");
// sort selected news items by date
		sorted_news.sort();
// loop backwards through sorted news items
		for (i = sorted_news.length-1; i >= 0; i--)
		{
// if required number of news items not displayed display news item
			if ((items == 0) || (cnt < items))
			{
				document.write("<li><p><b>");
// remove leading zero if day less than 10
				if (news_item[sorted_news[i][1]].ni_date.slice(8, 9) == "0")
				{
					daynum = news_item[sorted_news[i][1]].ni_date.slice(9, 10);
				}
				else
				{ 
					daynum = news_item[sorted_news[i][1]].ni_date.slice(8, 10);
				}
// convert month number to name of month
				document.write(daynum + "&nbsp;" + month_array[parseInt(news_item[sorted_news[i][1]].ni_date.slice(5, 7), 10)] + "&nbsp;" + news_item[sorted_news[i][1]].ni_date.slice(0, 4) + ":</b> ");
				end_url = news_item[sorted_news[i][1]].ni_links[0].nl_url.substr(news_item[sorted_news[i][1]].ni_links[0].nl_url.length - 3, 3).toLowerCase();
// if news item has only 1 link put link on headline
				if ((news_item[sorted_news[i][1]].ni_links.length == 1) && (end_url != "mp3"))
				{
					document.write("<a href=\"" + news_item[sorted_news[i][1]].ni_links[0].nl_url + "\" class=\"paraboldcolourtext\">" + news_item[sorted_news[i][1]].ni_head + "</a>");
// array item has variable set to indicate it is in another language - write message to this effect			
					if (news_item[sorted_news[i][1]].ni_links[0].nl_lang_id != 0)
					{
						document.write(" <span class=\"parasmalltext\">(" + language_text_array[news_item[sorted_news[i][1]].ni_links[0].nl_lang_id] + ")</span>");
					}
				}
// otherwise display headline and links separately
				else
				{
					document.write("<span class=\"paraboldcolourtext\">" + news_item[sorted_news[i][1]].ni_head + "</span>");
					if (news_item[sorted_news[i][1]].ni_intro == "")
					{
						document.write("<br>");
					}
					showNewsLinks(i);
				}
				document.writeln("</p></li>");
				cnt = cnt + 1;
			}
		}
		document.writeln("</ul>");
	}
// add more on link to subject news archive
	for (l = 0; l < country.length; l++)
	{
		if (country[l].code == country[h].code)
		{
			document.writeln("<p class=\"strippedsmalltext\" align=\"right\">&gt;&nbsp;<a class=\"parasmallcolourtext\" href=\"/spanish/news_s/archive_s/country_arc_s.htm?country1="	+ country[l].code + "\" class=\"paracolourtext\">Más noticias sobre " + country[l].article + country[l].name + "</a></p>");
			break;
		}
	}
}



// displays link to tariff profile for specified year for country page
function showTariffProfiles(countryNum, year)
{
	document.write("<a href=\"/spanish/tratop_s/tariffs_s/tariff_profiles_" + year + "_s/" + country[countryNum].code.toLowerCase() + "_s.pdf\"  target=\"_blank\" class=\"paracolourtext\"  onMouseOver=\"writetxt('" + document_type_array[1][1] + " " + new_window_text + "')\" onMouseOut=\"writetxt(0)\">" + year + "</a>&nbsp;&nbsp; ");
}

// displays link to tariff profile for specified year for country page
function showSchedulesTableLink(countryNum)
{
	document.write("<a href=\"/spanish/tratop_s/schedules_s/goods_schedules_table_s.htm#" + country[countryNum].code.toLowerCase() + "\"  class=\"paracolourtext\"  onMouseOver=\"writetxt('Vínculos al cuadro donde figuran las listas originales de cada Miembro y sus modificaciones')\" onMouseOut=\"writetxt(0)\">Situación actual de las listas de productos</a>");
}
// processes the selections from up to 2 dropdown lists & submits it as dol search
function searchForDocs(list1, error1, list2, error2)
{
	var searchString = "";
	var list1value = "";
	var list2value = "";
	var opt1Selected  = document.hiddenform.elements[list1].selectedIndex;	
	list1value = document.hiddenform.elements[list1].options[opt1Selected].value;
	if (list2 != "")
	{
		var opt2Selected  = document.hiddenform.elements[list2].selectedIndex;	
		list2value = document.hiddenform.elements[list2].options[opt2Selected].value;
	}
	if (list1value == "")
	{
		alert("Tiene que seleccionar " + error1 + " la búsqueda");
	} 
	else if ((list2value == "") && (list2 != ""))
	{
		alert("Tiene que seleccionar " + error2 + " la búsqueda");
	}
	else
	{
		searchString = "(" + list1value + list2value + ")"; 
// Search for document symbol		
		f_submit(searchString, "3");
		return false;
	}
}

// gets (and returns) the array id of the country for country pages
function getCountryNum()
{
	var countryNum = 0;
	var path_array = new Array();
	path_array = lc_root_path.split("#");
	for (i=0; i<country.length; i++)
	{
		if (country[i].page == path_array[0])
		{
			countryNum =  i;
			break;
		}
	}
	return countryNum;
}

// displays search box for negotiating documents search on country pages
function displayNegsDocsSearch(countryNum)
{
	var valueString1 = "";
	var valueString2 = "";
	var valueString3 = "";
	document.write("<p class=\"subtitlecolourtext\"><a name=\"dda_docs\"></a>Documentos de negociación del PDD presentados por " + country[countryNum].article + country[countryNum].name + " o en los que se menciona ");
	if (country[countryNum].article == "el ")
	{
		document.write("al " + country[countryNum].name);
	}
	else
	{
		document.write("a " + country[countryNum].article + country[countryNum].name);
	}
	document.writeln("&nbsp; <a href=\"#top\" class=\"parasmallgreytext\">volver&nbsp;al&nbsp;principio</a></p>");
	for (i = 0; i < eu_array.length; i++)
	{
		if ( eu_array[i] == country[countryNum].code)
		{
			document.writeln("<p class=\"paranormaltext\">Véanse también los documentos relacionados con las <a class=\"paracolourtext\" href=\"/spanish/thewto_s/countries_s/european_communities_s.htm#dda_docs\">Comunidades Europeas</a>.</p>");
			break;
		}
	}
	document.writeln("<table border=\"0\" bgcolor=\"#E5E5E5\" cellspacing=\"1\" cellpadding=\"3\" width=\"100%\">");
    document.writeln("<tr><td width=\"100%\" valign=\"top\" align=\"left\" bgcolor=\"#FDF7E3\"><p class=\"paragreytext\"><b>Búsqueda en Documentos en línea</b><br><span class=\"parasmallgreytext\">Estos enlaces abren una nueva ventana: espere un momento hasta que aparezca la lista de resultados.<br>Algunas búsquedas pueden recuperar documentos no pertinentes debido a limitaciones de catalogación/dispositivo de búsqueda.</span></p>");
	document.writeln("<p align=\"right\" class=\"parasmallgreytext\">&gt;&nbsp;<a href=\"javascript:openAWindow('/library/download_instructions_s.htm','links',650,550,1)\" class=\"parasmalldarkredtext\">Ayuda</a> para descargar estos documentos.</p>");			
    document.writeln("<ul class=\"paranormaltext\">");
    document.writeln("<li><b>Documentos de negociación en los que se hace referencia a este Miembro</b><br>");
	document.writeln("<select size=\"1\" name=\"neg_subject1_documents\">");
	for ( j = 0; j < neg_docs_array.length; j++)
	{
		if (neg_docs_array[j][1] != "")
		{
			valueString1 = "(@meta_Symbol " + neg_docs_array[j][1] + ")";
		}
		document.writeln("<option value=\"" + valueString1 + "\">" + neg_docs_array[j][0] + "</option>");
	}
   	document.writeln("</select><br>");
	document.writeln("<select size=\"1\" name=\"scope\">");
	document.writeln("<option value=\"\">¿Este Miembro como autor?  ¿O mencionado?...</option>");
	document.writeln("<option value=\" & ( @meta_Countries " + country[countryNum].dolsearch + ")\">Sólo los documentos PRESENTADOS por este Miembro</option>");
	document.writeln("<option value=\" & (" + country[countryNum].name + ")\">Documentos y actas en los que se MENCIONA a este Miembro</option>");
   	document.writeln("</select><br>");
	document.writeln("<a href=\"\" class=\"paradarkredtext\" onclick=\"searchForDocs('neg_subject1_documents', 'un tema para', 'scope', 'el alcance de');return false\">buscar</a></li>");
    document.writeln("<li><b>Intervenciones del Miembro registradas en actas y resúmenes de reuniones</b><br>");
	document.writeln("<select size=\"1\" name=\"neg_subject2_documents\">");
	for ( j = 0; j < neg_docs_array.length; j++)
	{
		if (neg_docs_array[j][1] != "")
		{
			valueString2 = "((@meta_Symbol " + neg_docs_array[j][1] + ") & ( @meta_Types Minutes) & (" + country[countryNum].name + "))";
		}
		document.writeln("<option value=\"" + valueString2 + "\">" + neg_docs_array[j][0] + "</option>");
	}
   	document.writeln("</select><br>");
	document.writeln("<a href=\"\" class=\"paradarkredtext\" onclick=\"searchForDocs('neg_subject2_documents', 'un tema para', '', '');return false\">buscar</a></li>");
    document.writeln("<li><b>En conferencias ministeriales</b><br>");
	document.writeln("<select size=\"1\" name=\"min1_documents\">");
	for ( j = 0; j < ministerials_array.length; j++)
	{
		if (ministerials_array[j][2] != "")
		{
			if (ministerials_array[j][1] != "")
			{
				valueString3 = "(" + ministerials_array[j][1] + " &  (@meta_Symbol WT/MIN* ";
			}
			document.writeln("<option value=\"" + valueString3 + "\">" + ministerials_array[j][0] + "</option>");
		}
	}
   	document.writeln("</select><br>");
	document.writeln("<select size=\"1\" name=\"mindoctype\">");
	document.writeln("<option value=\"\">Escoja el tipo de documento...</option>");
	document.writeln("<option value=\") & ( @meta_Countries " + country[countryNum].dolsearch + ") & ( @meta_Types Communication OR Proposal))\">Comunicaciones y propuestas</option>");
	document.writeln("<option value=\") & (" + country[countryNum].name + ") & ( @meta_Types Summary record))\">Minutas y actas resumidas</option>");
	document.writeln("<option value=\" AND (ST)) & ( @meta_Countries " + country[countryNum].dolsearch + "))\">Declaraciones</option>");
   	document.writeln("</select><br>");
	document.writeln("<a href=\"\" class=\"paradarkredtext\" onclick=\"searchForDocs('min1_documents', 'una conferencia para', 'mindoctype', 'el tipo de documento para');return false\">buscar</a></li>");
	document.writeln("</ul>");
			
	document.writeln("</td></tr></table>");
}



// displays search box for other documents search on country pages
function displayOtherDocsSearch(countryNum)
{
	var valueString = "";
	document.write("<p class=\"subtitlecolourtext\"><a name=\"other_docs\"></a>Otros documentos oficiales presentados por " + country[countryNum].article + country[countryNum].name + " o en los que se menciona ");
	if (country[countryNum].article == "el ")
	{
		document.write("al " + country[countryNum].name);
	}
	else
	{
		document.write("a " + country[countryNum].article + country[countryNum].name);
	}
	document.writeln("&nbsp; <a href=\"#top\" class=\"parasmallgreytext\">volver&nbsp;al&nbsp;principio</a></p>");
	for (i = 0; i < eu_array.length; i++)
	{
		if ( eu_array[i] == country[countryNum].code)
		{
			document.writeln("<p class=\"paranormaltext\">Véanse también los documentos relacionados con las <a class=\"paracolourtext\" href=\"/spanish/thewto_s/countries_s/european_communities_s.htm#other_docs\">Comunidades Europeas</a>.</p>");
			break;
		}
	}
	document.writeln("<table border=\"0\" bgcolor=\"#E5E5E5\" cellspacing=\"1\" cellpadding=\"3\" width=\"100%\">");
    document.writeln("<tr><td width=\"100%\" valign=\"top\" align=\"left\" bgcolor=\"#FDF7E3\"><p class=\"paragreytext\"><b>Búsqueda en Documentos en línea</b><br><span class=\"parasmallgreytext\">Estos enlaces abren una nueva ventana: espere un momento hasta que aparezca la lista de resultados.<br>Algunas búsquedas pueden recuperar documentos no pertinentes debido a limitaciones de catalogación/dispositivo de búsqueda.</span></p>");
	document.writeln("<p align=\"right\" class=\"parasmallgreytext\">&gt;&nbsp;<a href=\"javascript:openAWindow('/library/download_instructions_s.htm','links',650,550,1)\" class=\"parasmalldarkredtext\">Ayuda</a> para descargar estos documentos.</p>");			
    document.writeln("<ul class=\"paranormaltext\">");
    document.writeln("<li><b>En conferencias ministeriales no englobadas en la Ronda de Doha</b><br>");
	document.writeln("<select size=\"1\" name=\"min2_documents\">");
	for ( j = 0; j < ministerials_array.length; j++)
	{
		if (ministerials_array[j][2] != "dda")
		{
			if (ministerials_array[j][1] != "")
			{
				valueString = "(" + ministerials_array[j][1] + " &  (@meta_Symbol WT/MIN* ";
			}
			document.writeln("<option value=\"" + valueString + "\">" + ministerials_array[j][0] + "</option>");
		}
	}
   	document.writeln("</select>&nbsp; ");
	document.writeln("<select size=\"1\" name=\"mindoctype2\">");
	document.writeln("<option value=\"\">Escoja el tipo de documento...</option>");
	document.writeln("<option value=\") & ( @meta_Countries " + country[countryNum].dolsearch + ") & ( @meta_Types Communication OR Proposal))\">Comunicaciones y propuestas</option>");
	document.writeln("<option value=\") & (" + country[countryNum].name + ") & ( @meta_Types Summary record))\">Minutas y actas resumidas</option>");
	document.writeln("<option value=\" AND (ST)) & ( @meta_Countries " + country[countryNum].dolsearch + "))\">Declaraciones</option>");
   	document.writeln("</select><br>");
	document.writeln("<a href=\"\" class=\"paradarkredtext\" onclick=\"searchForDocs('min2_documents', 'una conferencia para', 'mindoctype2', 'el tipo de documento para');return false\">buscar</a></li>");
    document.writeln("<li><b>En reuniones del Consejo General</b><br>");
	document.writeln("<select size=\"1\" name=\"gcdoctype\">");
	document.writeln("<option value=\"\">Escoja el tipo de documento...</option>");
	document.writeln("<option value=\"(@meta_Symbol WT/GC/*) & ( @meta_Countries " + country[countryNum].dolsearch + ") & ( @meta_Types Communication OR Proposal)\">Comunicaciones y propuestas</option>");
	document.writeln("<option value=\"(@meta_Symbol WT/GC/*) & (" + country[countryNum].name + ") & ( @meta_Types Minutes )\">Minutas</option>");
	document.writeln("<option value=\"(@meta_Symbol WT/GC/*) & ( @meta_Countries " + country[countryNum].dolsearch + ") & ( @meta_Title Statement )\">Declaraciones</option>");
   	document.writeln("</select><br>");
	document.writeln("<a href=\"\" class=\"paradarkredtext\" onclick=\"searchForDocs('gcdoctype', 'el tipo de documento para', '', '' );return false\">buscar</a></li>");

	document.writeln("</ul>");
	document.writeln("</td></tr></table>");
}

// displays links to bound and applied tariffs on country pages
function displayTariffLinks(countryNum)
{
	var euCountry = "False";
	var countryCode = "";
	document.writeln("<li><a href=\"/spanish/tratop_s/tariffs_s/tariff_data_s.htm\" class=\"paracolourtext\">Explicación sobre aranceles, tipos consolidados y aplicados, el Sistema Armonizado (SA) y jerga conexa.</a></li>");
	for (i = 0; i < eu_array.length; i++)
	{
		if ( eu_array[i] == country[countryNum].code)
		{
			var euCountry = "True";
			document.writeln("<li>Véanse los <a href=\"http://stat.wto.org/idbdata/cts_eec_s.zip\" target=\"_blank\" class=\"paraboldcolourtext\" onMouseOver=\"writetxt('formato zip; se abrirá una nueva ventana')\" onMouseOut=\"writetxt(0)\">aranceles consolidados</a> al nivel de subpartida de 6 dígitos del SA correspondientes a las Comunidades Europeas</li>");
			document.writeln("<li>Véanse los <a href=\"http://stat.wto.org/idbdata/idb_eec_last_s.zip\" target=\"_blank\" class=\"paraboldcolourtext\" onMouseOver=\"writetxt('formato zip; se abrirá una nueva ventana')\" onMouseOut=\"writetxt(0)\">aranceles NMF aplicados</a> al nivel de subpartida de 6 dígitos del SA correspondientes a las Comunidades Europeas más recientes de los que se dispone</li>");
			document.writeln("<li>Véanse los <a href=\"http://stat.wto.org/idbdata/idb_eec_s.zip\" target=\"_blank\" class=\"paraboldcolourtext\" onMouseOver=\"writetxt('formato zip; se abrirá una nueva ventana')\" onMouseOut=\"writetxt(0)\">aranceles aplicados históricamente</a> al nivel de subpartida de 6 dígitos del SA correspondientes a las Comunidades Europeas <span class=\"parasmalltext\">(archivo grande)</span></li>");
			break;
		}
	}
	if (euCountry == "False")
	{
		switch(country[countryNum].code.toLowerCase())
		{
			case "180":
				countryCode = "cod";
				break;
			case "807":
				countryCode = "mkd";
				break;
			case "myn":
				countryCode = "mmr";
				break;
			case "tpkm":
				countryCode = "cht";
				break;
			case "lie":
				countryCode = "che";
				break;
			default:
				countryCode = country[countryNum].code.toLowerCase();
				break;
		}
		document.writeln("<li><a href=\"http://stat.wto.org/idbdata/cts_" + countryCode + "_s.zip\" target=\"_blank\" class=\"paraboldcolourtext\" onMouseOver=\"writetxt('formato zip; se abrirá una nueva ventana')\" onMouseOut=\"writetxt(0)\">Aranceles consolidados</a> al nivel de subpartida de 6 dígitos del SA</li>");
		document.writeln("<li><a href=\"http://stat.wto.org/idbdata/idb_" + countryCode + "_last_s.zip\" target=\"_blank\" class=\"paraboldcolourtext\" onMouseOver=\"writetxt('formato zip; se abrirá una nueva ventana')\" onMouseOut=\"writetxt(0)\">Aranceles NMF aplicados</a> al nivel de subpartida de 6 dígitos del SA más recientes de los que se dispone</li>");
		document.writeln("<li><a href=\"http://stat.wto.org/idbdata/idb_" + countryCode + "_s.zip\" target=\"_blank\" class=\"paraboldcolourtext\" onMouseOver=\"writetxt('formato zip; se abrirá una nueva ventana')\" onMouseOut=\"writetxt(0)\">Aranceles aplicados históricamente</a> al nivel de subpartida de 6 dígitos del SA <span class=\"parasmalltext\">(archivo grande)</span></li>");
	}
}


//-->

