/*FCY Rates starts */
	var arrCurrency = new Array();
	var arrTTS = new Array();
	var arrMID = new Array();
	var arrTTB = new Array();
	var fxratedate;

	function getElementsByClassName(oElm, strTagName, strClassName)
	{
		var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
		var arrReturnElements = new Array();
		strClassName = strClassName.replace(/\-/g, "\\-");
		var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
		var oElement;
		for(var i=0; i<arrElements.length; i++)
		{
			oElement = arrElements[i];
			if(oRegExp.test(oElement.className))
			{
				arrReturnElements.push(oElement);
			}
		}
		return (arrReturnElements)
	}
	
	function generateFeed(obj)
	{
		document.getElementById('divRate').innerHTML = obj.innerHTML;
		var theCurrency = getElementsByClassName(document, "*", "smlcolor5");
		var sometext=theCurrency[0].innerHTML;
		disdate=(sometext.substring(0,45));
		for(x=0; x<theCurrency.length; x++)
		{
			if (x != 0)
			{
				if( (navigator.appName=="Microsoft Internet Explorer") || (navigator.appName=="Opera"))
				{			
					arrCurrency.push(theCurrency[x].innerHTML);
					arrTTS.push(theCurrency[x].nextSibling.innerHTML);
					arrMID.push(theCurrency[x].nextSibling.nextSibling.innerHTML);
					arrTTB.push(theCurrency[x].nextSibling.nextSibling.nextSibling.innerHTML);
				}
				else
				{
					arrCurrency.push(theCurrency[x].innerHTML);
					arrTTS.push(theCurrency[x].nextSibling.nextSibling.innerHTML);
					arrMID.push(theCurrency[x].nextSibling.nextSibling.nextSibling.nextSibling.innerHTML);
					arrTTB.push(theCurrency[x].nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.innerHTML);
				}				
			}
		}
		displayrates(arrCurrency,arrTTS,arrMID,arrTTB,disdate);
	}	
	
	var fxratesarray =new Array();
	function displayrates(curr,tts,tmid,ttb,disdate)
	{	var stratind,endind;
		var countryflag;
		//Added for ZAR and NOK (annualrateIntrest).
		var annualrateIntrest = [["0.01","0.01"],["---","0.05"],["---","0.05"],["---","0.05"],["---","0.01"],["---","0.01"],["---","0.05"],["---","0.01"],["---","0.01"],["---","0.05"],["---","0.05"]];
		for (i=0;i<curr.length;i++)
		{
			stratind=curr[i].indexOf('(');
			endind=curr[i].indexOf(')');
			country=(curr[i].substring(stratind+1,endind));
			countryflag='fcy_flag_'+(curr[i].substring(stratind+1,endind))+'.gif';
			fxratesarray[i]=[countryflag,country,curr[i],tts[i],tmid[i],ttb[i]];		
		}	
	
	document.getElementById('displayfxratedate').innerHTML=disdate;
	var tbody = document.getElementById('ratestable').getElementsByTagName('tbody')[0]; 	
	for (i=0;i<fxratesarray.length;i++)
	{
		var row = document.createElement('TR'); 
		row.setAttribute("className","fcy_bluetblalternatewhiterow");
		row.setAttribute("class","fcy_bluetblalternatewhiterow");
		var cell1 = document.createElement('TD');
		var cell2 = document.createElement('TD'); 
		var cell3 = document.createElement('TD'); 
		var cell4 = document.createElement('TD');
		var cell5 = document.createElement('TD'); 
		var cell6 = document.createElement('TD'); 
		var cell7 = document.createElement('TD'); 
		var cell8 = document.createElement('TD'); 
		

		cell1.setAttribute("class","fcy_greytblbdrlft");
		cell1.setAttribute("className","fcy_greytblbdrlft");
		cell1.innerHTML ="&nbsp;";		
		
		cell2.setAttribute("class","fcy_greytblbdrrgt fcy_pdtp5");
		cell2.setAttribute("className","fcy_greytblbdrrgt fcy_pdtp5");
		cell2.innerHTML = "<div class='fcy_floatlft fcy_pdlftrght10'><img src='/ja/img/fcy/"+fxratesarray[i][0]+"' alt='"+fxratesarray[i][1]+"' title='"+fxratesarray[i][1]+"' border='0' class='fcy_flagpadding'></div><div class='fcy_floatlft fcy_normaltext'>"+fxratesarray[i][2]+"</div>";

		cell3.setAttribute("class","fcy_greytblbdrrgt fcy_greytbl_data");
		cell3.setAttribute("className","fcy_greytblbdrrgt fcy_greytbl_data");
		cell3.innerHTML = annualrateIntrest[i][0];
		
		cell4.setAttribute("class","fcy_greytblbdrrgt fcy_greytbl_data");
		cell4.setAttribute("className","fcy_greytblbdrrgt fcy_greytbl_data");
		cell4.innerHTML = annualrateIntrest[i][1];

		cell5.setAttribute("class","fcy_greytblbdrrgt fcy_greytbl_data");
		cell5.setAttribute("className","fcy_greytblbdrrgt fcy_greytbl_data");
		cell5.innerHTML = fxratesarray[i][3];
		
		cell6.setAttribute("class","fcy_greytblbdrrgt fcy_greytbl_data");
		cell6.setAttribute("className","fcy_greytblbdrrgt fcy_greytbl_data");
		cell6.innerHTML =fxratesarray[i][4];

		cell7.setAttribute("class","fcy_greytbl_data");
		cell7.setAttribute("className","fcy_greytbl_data");
		cell7.innerHTML = fxratesarray[i][5];

		cell8.setAttribute("class","fcy_greytblbdrrgt");
		cell8.setAttribute("className","fcy_greytblbdrrgt");
		cell8.innerHTML = "&nbsp;";

		row.appendChild(cell1); 
		row.appendChild(cell2); 
		row.appendChild(cell3);
		row.appendChild(cell4);
		row.appendChild(cell5);
		row.appendChild(cell6);
		row.appendChild(cell7);
		row.appendChild(cell8);
       
		if(i % 2 ==0)
		{ row.setAttribute("class","");
		  row.setAttribute("className","");
		}
		
		tbody.appendChild(row); 
	}
}
/*FCY Rates ends */
