var _navlink = "<div onclick='javascript:location.href =\"#URL#\"' style='cursor:pointer'><a href='#URL#'>#NAME#</a></div>";
var _navselect = "<div>#NAME#</div>";

var _naventry = [
	{ name:'商品期货<br>Futures', url:'futures.htm' },
	{ name:'国际外汇<br>Forex', url:'foreignexchange.htm' },
	{ name:'环球指数<br>Index', url:'index.htm' },
	{ name:'宏观数据<br>Macro Data', url:'macrodata.htm' },
	{ name:'债&nbsp;&nbsp;&nbsp;&nbsp;券<br>Bond', url:'bond.htm' }
];

function write_nav()
{
	var thisurl = this.location.href;
	var pos = thisurl.indexOf('?');
	if (pos > 0) thisurl = thisurl.substring(0, pos);
	pos = thisurl.lastIndexOf('/');
	if (pos > 0) thisurl = thisurl.substring(pos + 1);
	
	var navhtml = "";
	for (i = 0; i < _naventry.length; i++)
	{
		if (_naventry[i].url == thisurl) navhtml += _navselect.replace('#NAME#', _naventry[i].name);
		else navhtml += _navlink.replace('#NAME#', _naventry[i].name).replace('#URL#', _naventry[i].url);
	}

	document.write(navhtml);
}
