var last_price = Array();
var last_icons = Array();
var breakevenprices = Array();

// JavaScript Document
function donate()
{
	alert("Thank you!");
	document.donationform.submit();
}

function launch_price_ticker(share)
{
	setInterval("populate_latest_price('"+share+"')",5000);
}

function populate_latest_price(share)
{
	AjaxRequest.get(
	  {
		'url':'/bdna/latestshareprice.htm?share='+share
		,'onSuccess':function(req){ 
		
			var floatval = parseFloat(req.responseText);
			var icon;
			if(floatval>=breakevenprices[share]) icon = "smile";
			else icon = "sad";
		
			document.getElementById("sharepriceval_"+share).innerHTML = req.responseText;
			document.getElementById("shareprice_"+share).style.backgroundImage = "url(/img/graphics/emoticon_"+icon+".png)";
			
			uparrow = document.getElementById("uparrow_"+share);
			downarrow = document.getElementById("downarrow_"+share);
			//uparrow.style.display="none";
			//downarrow.style.display = "none";
			if(floatval>last_price[share]) 
			{
				uparrow.style.visibility="visible";
				last_icons[share] = uparrow;
			}
			else uparrow.style.visibility="hidden";
			if(floatval<last_price[share]) 
			{
				downarrow.style.visibility="visible";
				last_icons[share] = downarrow;
			}
			else downarrow.style.visibility="hidden";
			if(floatval==last_price[share])
			{
				if(last_icons[share]!=undefined) last_icons[share].style.visibility="visible";
			}
	
			last_price[share] = floatval;
		}
	  }
	);
}