//***********************************************************************
//* APPLICATION	: WTO Web Site
//* COMPONENT	: 
//* PAGE		: 
//* CREATION	: 03/11/2005
//* AUTHOR		: Jane M Pickett
//* CONTENT		: Data and functions for watch this space - English
//*		
//***********************************************************************
//* UPDATES		:
//*
//***********************************************************************
var wts_array = new Array();  // array for items to appear in watch this space
	
	wts_array[wts_array.length] =  [
					 "Keep abreast of WTO news",  // display text
					 "http://icd.wto.org/member/register.aspx?l=e",  // link relative to root
					 0, // language text array index
					 "",  // ??&nbsp;pages; ??KB; for document
					 "",  // link to an image relative to root
					"email",  // item type eg email, feature, new
					 ""  // caption for photo
					];  // end of array

	wts_array[wts_array.length] =  [
					 "Latest Statistical Publications",  // display text
					 "",  // link relative to root
					 0, // language text array index
					 "",  // ??&nbsp;pages; ??KB; for document
					 "/images/img_bkshop/its_2009.gif",  // link to an image relative to root
					"feature",  // item type eg email, feature, new
					 ""  // caption for photo
					];  // end of array

//		wts_array[wts_array.length] =  [
//					 "News item",  // display text
//						 "",  // link relative to root
//					 0, // language text array index
//					 "",  // ??&nbsp;pages; ??KB; for document
//					 "",  // link to an image relative to root
//					"feature",  // item type eg email, feature, new
//					 ""  // caption for photo
//					];  // end of array

			
	wts_array[wts_array.length] =  [
					 "International Trade Statistics",  // display text
					 "/english/res_e/statis_e/its2009_e/its09_toc_e.htm",  // link relative to root
					 0, // language text array index
					 "",  // ??&nbsp;pages; ??KB; for document
					 "",  // link to an image relative to root
					"feature",  // item type eg email, feature, new
					 ""  // caption for photo
					];  // end of array

	wts_array[wts_array.length] =  [
					 "Tariff Profiles",  // display text
					 "/english/res_e/publications_e/world_tariff_profiles09_e.htm",  // link relative to root
					 0, // language text array index
					 "",  // ??&nbsp;pages; ??KB; for document
					 "",  // link to an image relative to root
					"feature",  // item type eg email, feature, new
					 ""  // caption for photo
					];  // end of array
		

	wts_array[wts_array.length] =  [
					 "Trade Profiles",  // display text
					 "/english/res_e/publications_e/trade_profiles09_e.htm",  // link relative to root
					 0, // language text array index
					 "",  // ??&nbsp;pages; ??KB; for document
					 "",  // link to an image relative to root
					"feature",  // item type eg email, feature, new
					 ""  // caption for photo
					];  // end of array


				
	
	
//	wts_array[wts_array.length] =  [
		//			 "Audio from book launch",  // display text
					// "",  // link relative to root
					 //0, // language text array index
					 //"",  // ??&nbsp;pages; ??KB; for document
					 //"",  // link to an image relative to root
					//"feature",  // item type eg email, feature, new
	//				 ""  // caption for photo
					//];  // end of array
	
	

//	wts_array[wts_array.length] =  [
//					 "New pages:",  // display text
//					 "",  // link relative to root
//					 0, // language text array index
//					 "",  // ??&nbsp;pages; ??KB; for document
//					 "",  // link to an image relative to root
//					"new",  // item type eg email, feature, new
//					 ""  // caption for photo
//					];  // end of array

wts_array[wts_array.length] =  [
					 "New Working Paper: International Supply Chains and Trade Elasticity in Times of Global Crisis",  // display text
					 "/english/res_e/reser_e/ersd201008_e.htm",  // link relative to root
					 0, // language text array index
					 "",  // ??&nbsp;pages; ??KB; for document
					 "",  // link to an image relative to root
					"new",  // item type eg email, feature, new
					 ""  // caption for photo
					];  // end of array
wts_array[wts_array.length] =  [
					 "Discussion forum: World Trade Report 2010",  // display text
					 "/english/res_e/publications_e/wtr10_e.htm",  // link relative to root
					 0, // language text array index
					 "",  // ??&nbsp;pages; ??KB; for document
					 "",  // link to an image relative to root
					"new",  // item type eg email, feature, new
					 ""  // caption for photo
					];  // end of array




wts_array[wts_array.length] =  [
					 "Trade, Technology and Climate Change Linkages: The Current Debate",  // display text
					 "/english/tratop_e/envir_e/sym_dec09_e/sym_dec09_e.htm",  // link relative to root
					 0, // language text array index
					 "",  // ??&nbsp;pages; ??KB; for document
					 "",  // link to an image relative to root
					"new",  // item type eg email, feature, new
					 ""  // caption for photo
					];  // end of array



//wts_array[wts_array.length] =  [
					// "Events:",  // display text
					//"",  // link relative to root
					//0, // language text array index
					//"",  // ??&nbsp;pages; ??KB; for document
					//""  // link to an image relative to root
					//"",  // item type eg email feature event new
//					 ""  // caption for photo
					//];  // end of array



var item_type_array = new Array(); // array for different watch this space sections
	item_type_array[0] = ["email", "&nbsp;EMAIL&nbsp;UPDATES&nbsp;", "", ""];
	item_type_array[1] = ["feature", "&nbsp;FEATURE&nbsp;", "More publications", "english/res_e/res_e.htm#publications"];
//	item_type_array[2] = ["event", "&nbsp;EVENT&nbsp;", "", ""];
	item_type_array[2] = ["new", "&nbsp;NEW&nbsp;ON&nbsp;THE&nbsp;WEBSITE&nbsp;", "", ""];
	
var language_text_array = new Array(); // array for text to indicate that item is in a different language
	language_text_array[0] = "";
	language_text_array[1] = "temporarily in English";
	language_text_array[2] = "only in English";
	language_text_array[3] = "bilingual statement &mdash; translations will follow shortly";
	language_text_array[4] = "temporarily in French";
	language_text_array[5] = "only in French";
	language_text_array[6] = "temporarily in Spanish";
	language_text_array[7] = "only in Spanish";

var document_type_array = new Array();  // array for flyout text to be used depending on the document type
	document_type_array[0] = ["doc", "MS word format;"];
	document_type_array[1] = ["pdf", "pdf format;"];
	document_type_array[2] = ["wpf", "Wordperfect format;"];
	document_type_array[3] = ["xls", "MS excel format;"];
	document_type_array[4] = ["ppt", "MS powerpoint format;"];
var start_url = "";  // variable for start of url
var end_url = "";  // variable for end of url
var new_window = false; // boolean to indicate if a new window is needed
var new_window_text = "opens in a new window"; // variable for text to display if document should open in a new window
var document_type = "";  // variable for text to display if document is not html
var flyout_text = ""; // variable for flyout text
var new_box = true;
var index_page = false;
var border_colour = "#18497B";
var slideshow_array = new Array();
	
// This function displays just the feature box
function displayFeature()
{
	if ((this_page.indexOf("/english/") == -1) && (this_page.indexOf("/french/") == -1) && (this_page.indexOf("/spanish/") == -1))
	{
		index_page = true;
	}
	if (this_page.indexOf("/docs_") != -1)
	{
		border_colour = "#FF0000";
	}
	else if (this_page.indexOf("/forums_") != -1)
	{
		border_colour = "#000080";
	}
	else if (this_page.indexOf("/info_") != -1)
	{
		border_colour = "#0080C0";
	}
	else if (this_page.indexOf("/news_") != -1)
	{
		border_colour = "#0080FF";
	}
	else if (this_page.indexOf("/res_") != -1)
	{
		border_colour = "#008080";
	}
	else if (this_page.indexOf("/thewto_") != -1)
	{
		border_colour = "#0080C0";
	}
	else if (this_page.indexOf("/tratop_") != -1)
	{
		border_colour = "#800000";
	}
	if (index_page == true)
	{
		document.writeln("<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td width=\"30%\" class=\"cellheadingcolourtext\">" + item_type_array[1][1] + "</td><td class=\"cellheadingwhitetext\">&nbsp;</td></tr></table>");
	}
	else
	{
		document.writeln("<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td width=\"30%\" class=\"cellheadingwhitetext\">" + item_type_array[1][1] + "</td><td class=\"cellheadingblacktext\">&nbsp;</td></tr></table>");
	}
	document.writeln("<table style=\"border-style:solid; border-color:" + border_colour + "; border-width:1px; border-collapse:collapse\"  border=\"1\" cellSpacing=\"0\" cellPadding=\"4\" width=\"100%\" bgcolor=\"#FFFFFF\"><tr><td width=\"100%\"><table width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"2\"><tr><td valign=\"top\" class=\"paranormaltext\">");
// loops through each item of the array of watch this space items
	for (i = 0; i < wts_array.length; i++)
	{
		if (wts_array[i][5] == "feature")
		{
			if (wts_array[i][1] != "")
			{
				new_window = false;
				flyout_text = "";
				end_url = wts_array[i][1].substr(wts_array[i][1].length - 3, 3).toLowerCase();
// loop through array of different document types			
				for (j = 0; j < document_type_array.length; j++)
				{
// extension of link is in list of selected docment types - set indicator for a new window 
// and build flyout text
					if (document_type_array[j][0] == end_url)
					{
						new_window = true;
						flyout_text = document_type_array[j][1] + " " + wts_array[i][3] + " " + new_window_text;
						break;
					}
				}
				start_url = wts_array[i][1].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://"))
				{
					new_window = true;
					flyout_text = new_window_text;
				}
				if (wts_array[i][2] != 0)
				{
					if (flyout_text != "")
					{
						flyout_text = flyout_text + "; ";
					}
					flyout_text = flyout_text + language_text_array[wts_array[i][2]];
				}
			}
// array item contains no link - display as a heading
			if (wts_array[i][1] == "")
			{
				document.write("<p align=\"left\" class=\"subnormalboldcolourtext\">" + wts_array[i][0]);
				if (wts_array[i][4] != "")
				{
					document.write("<br><img border=\"0\" src=\"" + wts_array[i][4]);
					if (wts_array[i][6] != "")
					{
						document.write("\"  onmouseover=\"writetxt(\'" + wts_array[i][6] + "\')\" onmouseout=\"writetxt(0)");
					}
					document.write("\">");
				}
				document.writeln("</p>");
			}
			else if ((wts_array[i][1] != "") && (wts_array[i][4] != ""))
			{
				document.write("<p align=\"left\" class=\"subnormalboldcolourtext\">" + wts_array[i][0] + "<br>");
				document.write("<a class=\"parasmallcolourtext\" href=\"" + wts_array[i][1] + "\"");
				if (new_window == true)
				{
					document.write(" target=\"_blank\""); 
				}
				if (wts_array[i][6] != "")
				{
					flyout_text = wts_array[i][6] + flyout_text;
				}
				if (flyout_text != "")
				{
					document.write(" onmouseover=\"writetxt(\'" + flyout_text + "\')\" onmouseout=\"writetxt(0)\"");
				}
				document.writeln("><img border=\"0\" src=\"" + wts_array[i][4] + "\" ></a></p>");			
			}
			else
// array item contains a link - display as a link		
			{
// write link
				document.write("<p align=\"left\" class=\"smallgreaterlistitem\">");
				if (wts_array[i][0] == "Slideshow")
				{
					slideshow_array = wts_array[i][1].split(", ");
					insertOccasionSlideshow(slideshow_array[0], slideshow_array[1],  parseInt(slideshow_array[2]), parseInt(slideshow_array[3]));
				}
				else
				{
					if (wts_array[i][4] != "")
					{
						document.write("<a class=\"parasmallcolourtext\" href=\"" + wts_array[i][1] + "\"");
						if (new_window == true)
						{
							document.write(" target=\"_blank\""); 
						}
						if (flyout_text != "")
						{
							document.write(" onmouseover=\"writetxt(\'" + flyout_text + "\')\" onmouseout=\"writetxt(0)\"");
						}
						document.write("><img border=\"0\" src=\"" + wts_array[i][4] + "\" align=\"right\" width=\"50\"></a>");			
					}
					document.write("&gt;&nbsp;<a class=\"parasmallcolourtext\" href=\"" + wts_array[i][1] + "\"");
					if (new_window == true)
					{
						document.write(" target=\"_blank\""); 
					}
					if (flyout_text != "")
					{
						document.write(" onmouseover=\"writetxt(\'" + flyout_text + "\')\" onmouseout=\"writetxt(0)\"");
					}
					document.write(">" + wts_array[i][0] + "</a>");
					document.writeln("</p>");
				}
			}
		}
	}
// write end of table tags	
    document.writeln("</td></tr></table></td></tr></table>");
	return false;
	
}

// This function displays the Watch this space table on a web page
function displayWatchThisSpace()
{
	if ((this_page.indexOf("/english/") == -1) && (this_page.indexOf("/french/") == -1) && (this_page.indexOf("/spanish/") == -1))
	{
		index_page = true;
	}
	if (this_page.indexOf("/docs_") != -1)
	{
		border_colour = "#FF0000";
	}
	else if (this_page.indexOf("/forums_") != -1)
	{
		border_colour = "#000080";
	}
	else if (this_page.indexOf("/info_") != -1)
	{
		border_colour = "#0080C0";
	}
	else if (this_page.indexOf("/news_") != -1)
	{
		border_colour = "#0080FF";
	}
	else if (this_page.indexOf("/res_") != -1)
	{
		border_colour = "#008080";
	}
	else if (this_page.indexOf("/thewto_") != -1)
	{
		border_colour = "#0080C0";
	}
	else if (this_page.indexOf("/tratop_") != -1)
	{
		border_colour = "#800000";
	}

// loops through array of different watch this space sections
	for (h = 0; h < item_type_array.length; h++)
	{
		new_box = true;
// loops through each item of the array of watch this space items
		for (i = 0; i < wts_array.length; i++)
		{
			if (wts_array[i][5] == item_type_array[h][0])
			{
				if (new_box == true)
				{
					if (h != 0)
					{
    					document.writeln("<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td>&nbsp;</td></tr></table>");
					}
					if (index_page == true)
					{
						document.writeln("<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td width=\"30%\" class=\"cellheadingcolourtext\">" + item_type_array[h][1] + "</td><td class=\"cellheadingwhitetext\">&nbsp;</td></tr></table>");
					}
					else
					{
						document.writeln("<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td width=\"30%\" class=\"cellheadingwhitetext\">" + item_type_array[h][1] + "</td><td class=\"cellheadingblacktext\">&nbsp;</td></tr></table>");
					}
	    			document.writeln("<table style=\"border-style:solid; border-color:" + border_colour + "; border-width:1px; border-collapse:collapse\" border=\"1\" cellSpacing=\"0\" cellPadding=\"4\" width=\"100%\" bgcolor=\"#FFFFFF\"><tr><td width=\"100%\"><table width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"2\"><tr><td valign=\"top\" class=\"paranormaltext\">");
					new_box = false;
				}
				if (wts_array[i][1] != "")
				{
					new_window = false;
					flyout_text = "";
					end_url = wts_array[i][1].substr(wts_array[i][1].length - 3, 3).toLowerCase();
// loop through array of different document types			
					for (j = 0; j < document_type_array.length; j++)
					{
// extension of link is in list of selected docment types - set indicator for a new window 
// and build flyout text
						if (document_type_array[j][0] == end_url)
						{
							new_window = true;
							flyout_text = document_type_array[j][1] + " " + wts_array[i][3] + " " + new_window_text;
							break;
						}
					}
					start_url = wts_array[i][1].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://"))
					{
						new_window = true;
						flyout_text = new_window_text;
					}
					if (wts_array[i][2] != 0)
					{
						if (flyout_text != "")
						{
							flyout_text = flyout_text + "; ";
						}
						flyout_text = flyout_text + language_text_array[wts_array[i][2]];
					}
				}
// array item contains no link - display as a heading
				if (wts_array[i][1] == "")
				{
					document.write("<p align=\"left\" class=\"subnormalboldcolourtext\">" + wts_array[i][0]);
					if (wts_array[i][4] != "")
					{
						document.write("<br><img border=\"0\" src=\"" + wts_array[i][4]);
						if (wts_array[i][6] != "")
						{
							document.write("\"  onmouseover=\"writetxt(\'" + wts_array[i][6] + "\')\" onmouseout=\"writetxt(0)");
						}
						document.write("\">");
					}
					document.writeln("</p>");
				}
				else if ((wts_array[i][1] != "") && (wts_array[i][4] != ""))
				{
					document.write("<p align=\"left\" class=\"subnormalboldcolourtext\">" + wts_array[i][0] + "<br>");
					document.write("<a class=\"parasmallcolourtext\" href=\"" + wts_array[i][1] + "\"");
					if (new_window == true)
					{
						document.write(" target=\"_blank\""); 
					}
					if (wts_array[i][6] != "")
					{
						flyout_text = wts_array[i][6] + flyout_text;
					}
					if (flyout_text != "")
					{
						document.write(" onmouseover=\"writetxt(\'" + flyout_text + "\')\" onmouseout=\"writetxt(0)\"");
					}
					document.writeln("><img border=\"0\" src=\"" + wts_array[i][4] + "\" ></a></p>");			
				}
				else
// array item contains a link - display as a link		
				{
// write link
					document.write("<p align=\"left\" class=\"smallgreaterlistitem\">");
					if (wts_array[i][0] == "Slideshow")
					{
						slideshow_array = wts_array[i][1].split(", ");
						insertOccasionSlideshow(slideshow_array[0], slideshow_array[1],  parseInt(slideshow_array[2]), parseInt(slideshow_array[3]));
					}
					else
					{
					if (wts_array[i][4] != "")
					{
						document.write("<a class=\"parasmallcolourtext\" href=\"" + wts_array[i][1] + "\"");
						if (new_window == true)
						{
							document.write(" target=\"_blank\""); 
						}
						if (flyout_text != "")
						{
							document.write(" onmouseover=\"writetxt(\'" + flyout_text + "\')\" onmouseout=\"writetxt(0)\"");
						}
						document.write("><img border=\"0\" src=\"" + wts_array[i][4] + "\" align=\"right\" width=\"50\"></a>");			
					}
					document.write("&gt;&nbsp;<a class=\"parasmallcolourtext\" href=\"" + wts_array[i][1] + "\"");
					if (new_window == true)
					{
						document.write(" target=\"_blank\""); 
					}
					if (flyout_text != "")
					{
						document.write(" onmouseover=\"writetxt(\'" + flyout_text + "\')\" onmouseout=\"writetxt(0)\"");
					}
					document.write(">" + wts_array[i][0] + "</a>");
					document.writeln("</p>");
				}
				}
			}
		}
// write end of table tags	
    	document.writeln("</td></tr></table></td></tr></table>");
	}
	return false;
}
//-->

