function fx4u_retrieve_quotes() {
	var script = document.createElement('SCRIPT');
	script.type = 'text/javascript';
	script.src = 'http://js.forex4you.com/quotes_json.js?' + "rnd=" + (new Date().getTime());
	document.documentElement.firstChild.appendChild(script);
}

function fx4u_update_quotes(quotes) {
	var q = [],i,k,o,r;

	if ('ALL' == fx4u_allowed_symbols) {
		fx4u_allowed_symbols=[];
		for (var i in quotes['data']) fx4u_allowed_symbols.push(i);
	}

	var out = fx4u_quotes_header;
	
	for (i in fx4u_allowed_symbols) {
		var s = fx4u_allowed_symbols[i];
		if (q = quotes['data'][s])
		{
			r = {'%SYMBOL%':s,'%DIRECTION%':q['dir'],'%BID%':q['bid'],'%ASK%':q['ask'],'%ICON_DIR%':'http://forex4you.org:81/arrow-'+('up'==q['dir']?'up':'dn')+'.gif'};
			o = fx4u_quotes_quote;
			for (k in r) {
				o = o.replace(new RegExp(k,'g'),r[k]);
			}
			out+=o;
		}
	}

	out += fx4u_quotes_footer;

	r = {'%UPDATED_DATE%':quotes['updated']['date'],'%UPDATED_TIME%':quotes['updated']['time']};
	for (k in r) {
		out = out.replace(new RegExp(k,'g'),r[k]);
	}

	if (document.getElementById('fx4u_quotes')) {
		document.getElementById('fx4u_quotes').innerHTML = out;
	}

	for (i in fx4u_update_quotes_callback) {
		fx4u_update_quotes_callback[i](quotes);
	}
}
