Reuters.namespace("article");

Reuters.article.inlinelinks = [];
/*Reuters.article.inlinelinks.push( { "text": "World Cup", "url": "http://football.uk.reuters.com/league/worldcup2010/", "title": "World Cup" } );*/
Reuters.article.inlinelinks.push( { "text": "Afghanistan", "url": "/places/afghanistan", "title": "Afghanistan" } );
Reuters.article.inlinelinks.push( { "text": "Brazil", "url": "/places/brazil", "title": "Brazil" } );
Reuters.article.inlinelinks.push( { "text": "China", "url": "/places/china", "title": "China" } );
Reuters.article.inlinelinks.push( { "text": "France", "url": "/places/france", "title": "France" } );
Reuters.article.inlinelinks.push( { "text": "Germany", "url": "/places/germany", "title": "Germany" } );
Reuters.article.inlinelinks.push( { "text": "Greece", "url": "/places/greece", "title": "Greece" } );
Reuters.article.inlinelinks.push( { "text": "Iran", "url": "/places/iran", "title": "Iran" } );
Reuters.article.inlinelinks.push( { "text": "Ireland", "url": "/places/ireland ", "title": "Ireland" } );
Reuters.article.inlinelinks.push( { "text": "Italy", "url": "/places/italy", "title": "Italy" } );
Reuters.article.inlinelinks.push( { "text": "Japan", "url": "/places/japan", "title": "Japan" } );
Reuters.article.inlinelinks.push( { "text": "Libya", "url": "/places/libya", "title": "Libya" } );
Reuters.article.inlinelinks.push( { "text": "Pakistan", "url": "/places/pakistan", "title": "Pakistan" } );
Reuters.article.inlinelinks.push( { "text": "Portugal", "url": "/places/portugal", "title": "Portugal" } );
Reuters.article.inlinelinks.push( { "text": "Russia", "url": "/places/russia", "title": "Russia" } );
Reuters.article.inlinelinks.push( { "text": "Syria", "url": "/places/syria", "title": "Syria" } );
Reuters.article.inlinelinks.push( { "text": "Turkey", "url": "/places/turkey", "title": "Turkey" } );
Reuters.article.inlinelinks.push( { "text": "Olympics", "url": "http://www.reuters.com/london-olympics-2012", "title": "Olympics" } );
Reuters.article.inlinelinks.push( { "text": "London 2012", "url": "http://www.reuters.com/london-olympics-2012", "title": "London 2012" } );
Reuters.article.inlinelinks.push( { "text": "Formula One", "url": "/news/sports/formula-one", "title": "Formula One" } );
Reuters.article.inlinelinks.push( { "text": "Football", "url": "http://football.uk.reuters.com/", "title": "Football" } );
Reuters.article.inlinelinks.push( { "text": "Tennis", "url": "/news/sports/tennis", "title": "Tennis" } );
Reuters.article.inlinelinks.push( { "text": "Cricket", "url": "/news/sports/cricket", "title": "Cricket" } );
Reuters.article.inlinelinks.push( { "text": "Golf", "url": "/news/sports/golf", "title": "Golf" } );
Reuters.article.inlinelinks.push( { "text": "Personal finance", "url": "/business/personalFinance", "title": "Personal finance" } );
Reuters.article.inlinelinks.push( { "text": "currencies", "url": "/business/currencies", "title": "currencies" } );
Reuters.article.inlinelinks.push( { "text": "Exchange rate", "url": "/business/currencies", "title": "currencies" } );
Reuters.article.inlinelinks.push( { "text": "Fxpert", "url": "/business/fxpert", "title": "Fxpert" } );
Reuters.article.inlinelinks.push( { "text": "green business", "url": "/business/greenBusiness", "title": "green business" } );
Reuters.article.inlinelinks.push( { "text": "Dow Jones Industrial Average", "url": "/business/markets/index?symbol=us!dji", "title": "Dow Jones Industrial Average" } );
Reuters.article.inlinelinks.push( { "text": "Nasdaq", "url": "/business/markets/index?symbol=us!comp", "title": "Nasdaq Composite Index" } );
Reuters.article.inlinelinks.push( { "text": "S&P 500", "url": "/business/markets/index?symbol=us!spx", "title": "S&P 500" } );
Reuters.article.inlinelinks.push( { "text": "Nikkei", "url": "/business/markets/index?symbol=jp!n225", "title": "Nikkei Stock Average 225" } );
Reuters.article.inlinelinks.push( { "text": "Hang Seng", "url": "/business/markets/index?symbol=hk!hsi", "title": "Hang Seng Index" } );
Reuters.article.inlinelinks.push( { "text": "FTSE", "url": "/business/markets/index?symbol=gb!ftse", "title": "FTSE 100 Index" } );
Reuters.article.inlinelinks.push( { "text": "EUR", "url": "/business/currencies/quote?srcCurr=EUR ", "title": "EUR" } );
Reuters.article.inlinelinks.push( { "text": "JPY", "url": "/business/currencies/quote?srcCurr=JPY ", "title": "JPY" } );
Reuters.article.inlinelinks.push( { "text": "GBP", "url": "/business/currencies/quote?srcCurr=GBP", "title": "GBP" } );
Reuters.article.inlinelinks.push( { "text": "Brent crude", "url": "/business/commodity?symbol=GB@IB.1", "title": "Brent crude" } );
Reuters.article.inlinelinks.push( { "text": "Latin American Investment Summit", "url": "/business/summit/LatinAmericanInvestment11", "title": "the Reuters Latin American Investment Summit" } );
Reuters.article.inlinelinks.push( { "text": "Global Mergers and Acquisitions Summit", "url": "/summit/MergersandAcquisitions11", "title": "Global Mergers and Acquisitions Summit" } );
Reuters.article.inlinelinks.push( { "text": "Reuters Health Summit", "url": "/summit/Health11", "title": "the Reuters Health Summit" } );
Reuters.article.inlinelinks.push( { "text": "Davos", "url": "/subjects/davos", "title": "the Davos World Economic Forum" } );
Reuters.article.inlinelinks.push( { "text": "Global Technology Summit", "url": "/summit/GlobalTech11", "title": "Global Technology Summit" } );
Reuters.article.inlinelinks.push( { "text": "Rebuilding Japan Summit", "url": "/summit/JapanInvestment11", "title": "Rebuilding Japan Summit" } );
Reuters.article.inlinelinks.push( { "text": "euro zone", "url": "/subjects/euro-zone ", "title": "Euro Zone" } );

Reuters.article.paragraphs = document.getElementsByTagName("p");

Reuters.article.trackInlineLink = function(ind) {
	try {
		thisLink = Reuters.article.inlinelinks[ind];
		dcsMultiTrack('DCSext.VirtualEvent', '1','DCSext.rChannel','Contextual Keyword Link','WT.cg_n', 'Contextual Keyword Link - ' + thisLink.text,'DCSext.modURL',thisLink.url,'DCSext.ModID','','DCSext.ModImp','','DCSext.DartZone','');
	} catch(e) {}
}

for (i=0; i<Reuters.article.paragraphs.length; i++) { 
	for (j=0; j<Reuters.article.inlinelinks.length; j++) { 
		if (((Reuters.article.paragraphs[i].parentNode.id == "articleText") || (Reuters.article.paragraphs[i].parentNode.className == "focusParagraph")) && (Reuters.article.paragraphs[i].innerHTML.search(Reuters.article.inlinelinks[j].text) != -1) && (Reuters.article.paragraphs[i].innerHTML.search('</a>') == -1) && (Reuters.article.inlinelinks[j].linked != 1) ) {
			var linkedtext = '<a href="' + Reuters.article.inlinelinks[j].url + '" title="Full coverage of ' + Reuters.article.inlinelinks[j].title + '" onclick="Reuters.article.trackInlineLink(' + j + ')">' + Reuters.article.inlinelinks[j].text + '</a>';
			Reuters.article.paragraphs[i].innerHTML = Reuters.article.paragraphs[i].innerHTML.replace(Reuters.article.inlinelinks[j].text, linkedtext);
			Reuters.article.inlinelinks[j].linked = 1;
			break;
		}
	}
}
