function UpdateFtseIndexes(APrevId, ADesId, ALastId, APercId)
{
	var callInProgress = false;
	var firstRun = true;
	
	var xmlhttp=false;
	
	if (callInProgress == true) { return; }
	
	function execute()
	{
		try
		{
			/*@cc_on @*/
			/*@if (@_jscript_version >= 5)
			// JScript gives us Conditional compilation, we can cope with old IE versions.
			// and security blocked creation of the objects.
			 try {
				xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
			 } catch (e) {
				try {
				 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
				} catch (E) {
				 xmlhttp = false;
				}
			 }
			@end @*/
			if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
				try {
					xmlhttp = new XMLHttpRequest();
				} catch (e) {
					xmlhttp=false;
				}
			}
			if (!xmlhttp && window.createRequest) {
				try {
					xmlhttp = window.createRequest();
				} catch (e) {
					xmlhttp=false;
				}
			}	
			
			callInProgress = true;
			var url = "/services/FtseIndexes.ashx?a=" + Math.round(Math.random() * 999999999999)
			xmlhttp.open("GET", url,true);
			xmlhttp.onreadystatechange = onReadyStateHandler;
			xmlhttp.send(null);
		}
		catch (e)
		{
			callInProgress = false;
			//Error initializing xmlhttp object.
		}
	}
	this.Execute = execute;
	
	function onReadyStateHandler()
	{
		switch (xmlhttp.readyState)
		{
			case 4:
				try
				{
					var result = eval("(" + xmlhttp.responseText + ")");
					for (var i = 0; i < result.length; i++)
					{
						var elmPrev = document.getElementById(result[i].Symbol + APrevId);
						var elmDes = document.getElementById(result[i].Symbol + ADesId);
						var elmLast = document.getElementById(result[i].Symbol + ALastId);
						var elmPerc = document.getElementById(result[i].Symbol + APercId);
						if (elmPrev && elmDes && elmLast && elmPerc)
						{
							elmLast.innerHTML = formatFloat(result[i].Last, 2);
							elmPerc.innerHTML = formatFloat(result[i].Perc, 2) + ' %';
							if (result[i].Perc > 0)
							{
								elmDes.style.color = "#245c05";
								elmLast.style.color = "#245c05";
								elmPerc.style.color = "#245c05";
							}
							else
							{
								if (result[i].Perc < 0)
								{
									elmDes.style.color = "#cc0000";
									elmLast.style.color = "#cc0000";
									elmPerc.style.color = "#cc0000";
								}
								else
								{
									elmDes.style.color = "";
									elmLast.style.color = "";
									elmPerc.style.color = "";								
								}
							}
							
							if (!firstRun)
							{
								if (parseFloat(elmPrev.innerHTML) > result[i].Last)
								{
									FlashOnFTE(result[i].Symbol + ALastId, "#FDCBCB");
									FlashOnFTE(result[i].Symbol + APercId, "#FDCBCB");
								}
								else
								{
									if (parseFloat(elmPrev.innerHTML) < result[i].Last)
									{
										FlashOnFTE(result[i].Symbol + ALastId, "#b9e1a9");
										FlashOnFTE(result[i].Symbol + APercId, "#b9e1a9");
									}
									else
									{
										//FlashOnFTE(result[i].Symbol + ALastId, "#F9E2A8");
										//FlashOnFTE(result[i].Symbol + APercId, "#F9E2A8");
									}
								}
							}
							elmPrev.innerHTML = result[i].Last; 
						}
					}
					callInProgress = false;
					firstRun = false;
				}
				catch(e)
				{
					//Error
				}
				callInProgress = false;
				firstRun = false;
			break;
			case 2:
				try
				{
					if (xmlhttp.status != 200 )
					{
						xmlhttp.abort();
						callInProgress = false;
						firstRun = false;
					}
				}
				catch (e)
				{
					//Error
				}
			break;
		}
	}
	
	flashOffFTE = function(elmId)
	{
		var elm = document.getElementById(elmId);
		elm.style.backgroundColor = "";
	}
	this.flashOffFTE = flashOffFTE;
	function FlashOnFTE(elmId, color)
	{
		var elm = document.getElementById(elmId);
		elm.style.backgroundColor = color;
		var _self = this;
		setTimeout(function(){_self.flashOffFTE(elmId);}, 2000)
	}
	
}
