function UpdateAllStocks(ARowId, ADesId, ALastId, APercId)
{
	var lastValues = new Array();
	var lastResult = "";
	var callInProgress = false;
	var firstRun = true;
	
	var xmlhttp=false;
	
	if (callInProgress == true) { return; }
	
	function execute(getAll)
	{
		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;
			if (getAll == true)
			{
				var url = "/services/allStocksValues.ashx?all=1&langCd=en&a=" + Math.round(Math.random() * 999999999999);
			}
			else
			{
				var url = "/services/allStocksValues.ashx?langCd=en&a=" + Math.round(Math.random() * 999999999999);
			}
			xmlhttp.open("GET", url,true);
			xmlhttp.onreadystatechange = onReadyStateHandler;
			xmlhttp.send(null);
		}
		catch(e){ callInProgress = false; }
	}
	this.Execute = execute;
	
	function onReadyStateHandler()
	{
		switch (xmlhttp.readyState)
		{
			case 4:
				try
				{
					var result = eval("(" + xmlhttp.responseText + ")");
					if (result == lastResult) { callInProgress = false; firstRun = false; return; }
					lastResult = result;	
					for (var i = 0; i < result.length; i++)
					{
						if (lastValues[result[i].S] != result[i].L)
						{
							//Ενημερώνω τον πίνακα με τις προηγούμενες τιμές.
							if (firstRun == true) { lastValues[result[i].S] = result[i].L; }
							var elmRow = document.getElementById(ARowId + result[i].S);
							var elmDes = document.getElementById(ADesId + result[i].S);
							var elmLast = document.getElementById(ALastId + result[i].S);
							var elmPerc = document.getElementById(APercId + result[i].S);
							if (elmRow && elmDes && elmLast && elmPerc)
							{
								elmDes.innerHTML = "<a href='javascript:showTickerFlash(\"" + escape(result[i].S) + "\");'>" + result[i].S + "</a>";
								elmLast.innerHTML = "<a href='/q.asp?s=" + escape(result[i].S) + "'>" + formatFloat(result[i].L, 2) + "</a>";
								elmPerc.innerHTML = formatFloat(result[i].P, 2) + ' %';
								if (result[i].P > 0)
								{
									elmDes.style.color = "#245c05";
									elmDes.firstChild.style.color = "#245c05";
									elmLast.style.color = "#245c05";
									elmLast.firstChild.style.color = "#245c05";
									elmPerc.style.color = "#245c05";
								}
								else
								{
									if (result[i].P < 0)
									{
										elmDes.style.color = "#cc0000";
										elmDes.firstChild.style.color = "#cc0000";
										elmLast.style.color = "#cc0000";
										elmLast.firstChild.style.color = "#cc0000";
										elmPerc.style.color = "#cc0000";
									}
									else
									{
										elmDes.style.color = "#000000";
										elmDes.firstChild.style.color = "#000000";
										elmLast.style.color = "#000000";
										elmLast.firstChild.style.color = "#000000";
										elmPerc.style.color = "#000000";								
									}
								}
								
								if (!firstRun)
								{
									if (parseFloat(lastValues[result[i].S]) > result[i].L)
									{
										FlashOnUAS(ALastId + result[i].S, "#FDCBCB");
										FlashOnUAS(APercId + result[i].S, "#FDCBCB");
									}
									else
									{
										if (parseFloat(lastValues[result[i].S]) < result[i].L)
										{
											FlashOnUAS(ALastId + result[i].S, "#b9e1a9");
											FlashOnUAS(APercId + result[i].S, "#b9e1a9");
										}
										/*else
										{
											FlashOnUAS(ALastId + result[i].S, "#F9E2A8");
											FlashOnUAS(APercId + result[i].S, "#F9E2A8");
										}*/
									}
								}
							}
							lastValues[result[i].S] = result[i].L;
						}
					}
					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;
		}
	}
	
	flashOffUAS = function(elmId)
	{
		var elm = document.getElementById(elmId);
		elm.style.backgroundColor = "";
	}
	this.flashOffUAS = flashOffUAS;
	function FlashOnUAS(elmId, color)
	{
		var elm = document.getElementById(elmId);
		elm.style.backgroundColor = color;
		var _self = this;
		setTimeout(function(){_self.flashOffUAS(elmId);}, 2000)
	}
	
}
