function show_cash_office(currency)
{
	level = false;

	if(show_cash_office.arguments.length > 1)
		level = show_cash_office.arguments[1];

	if(!level)
	{
		map.removeAllOverlays();

		cash_office_mark = new Array();
	}

	PlaceMark_counter = 0;

	for(i=0;i<cash_office.length;i++)
	{
		if(!level)
		{
			cash_office_mark[i] = new YMaps.Placemark( new YMaps.GeoPoint(cash_office[i].lng, cash_office[i].lat), {style:cash_office[i].marker} );

			cash_office_mark[i].description = "<div class='kurs-table'>" +
							"<img src='/image/icon/bank/" + cash_office[i].owner + ".gif' width='16' height='16' class='icon' />" +
							"<strong>" + cash_office[i].name + "</strong>" +
							"<table><tbody>" +
							"<tr>" +
								"<td class='date'>" + cash_office[i].date + "</td>" +
								"<td class='title'>USD</td>" +
								"<td class='title'>EUR</td>" +
							"</tr>" +
							"<tr>" +
								"<td class='type'>покупка</td>" +
								"<td class='value" + ((currency == 1) ? ' bold' : '') + "'>" + cash_office[i][1] + "</td>" +
								"<td class='value" + ((currency == 3) ? ' bold' : '') + "'>" + cash_office[i][3] + "</td>" +
							"</tr>" +
							"<tr>" +
								"<td class='type'>продажа</td>" +
								"<td class='value" + ((currency == 2) ? ' bold' : '') + "'>" + cash_office[i][2] + "</td>" +
								"<td class='value" + ((currency == 4) ? ' bold' : '') + "'>" + cash_office[i][4] + "</td>" +
							"</tr>" +
							"</tbody></table>" +
							"<span class='contacts'>" + cash_office[i].phone + "</span>" +
							"</div>";

			if(!cash_office[i].display)
				cash_office[i].display = true;

			map.addOverlay(cash_office_mark[i]);
		}
		else
		{
			if(
				( (currency == 1) || (currency == 3) ) && (cash_office[i][currency] >= level) ||
				( (currency == 2) || (currency == 4) ) && (cash_office[i][currency] <= level)
			)
			{
				if(!cash_office[i].display)
				{
					cash_office[i].display = true;
					map.addOverlay(cash_office_mark[i]);
				}

				PlaceMark_counter++;
				PlaceMark_lng = cash_office[i].lng;
				PlaceMark_lat = cash_office[i].lat;
			}
			else
			{
				if(cash_office[i].display)
				{
					cash_office[i].display = false;
					map.removeOverlay(cash_office_mark[i]);
				}
			}
		}
	}

	if(PlaceMark_counter == 1)
	{
		map.setCenter(new YMaps.GeoPoint(PlaceMark_lng, PlaceMark_lat));
//		document.getElementById("scroll").scrollTop = 0;
	}

	if(show_cash_office.arguments.length > 2)
	{
		for(i=2;i<=(currency_value_quantity[currency]+1);i++)
		{
			with(document.getElementById(currency + "_" + i))
			{
				if( show_cash_office.arguments[2] > (i-1) )
					className = "blue";

				if( show_cash_office.arguments[2] == (i-1) )
					className = "limit";

				if( show_cash_office.arguments[2] < (i-1) )
					className = "grey";

//				if( (currency_value_quantity[currency]+1) == i )
//					className = "limit bottom";
			}
		}
	}
	else
	{
		for(i=1;i<=4;i++)
		{
			for(ii=2;ii<=currency_value_quantity[i];ii++)
				document.getElementById(i + "_" + ii).className = "blue";

			document.getElementById(i + "_" + (currency_value_quantity[i]+1)).className = "limit bottom";
		}
	}
}

//////////////////////////////////////////////////

function select_currency_value(obj)
{
	document.getElementById("usd_buy_list").style.display = (obj.id == "usd_buy" ?  "" : "none");
	document.getElementById("usd_sale_list").style.display = (obj.id == "usd_sale" ?  "" : "none");
	document.getElementById("eur_buy_list").style.display = (obj.id == "eur_buy" ?  "" : "none");
	document.getElementById("eur_sale_list").style.display = (obj.id == "eur_sale" ?  "" : "none");

	show_cash_office( (obj.id == "usd_buy" ?  "1" : "") + (obj.id == "usd_sale" ?  "2" : "") + (obj.id == "eur_buy" ?  "3" : "") + (obj.id == "eur_sale" ?  "4" : "") );
}

//////////////////////////////////////////////////

window.onload = function()
{
	map = new YMaps.Map(document.getElementById('YMapsID'));
	map.setCenter(new YMaps.GeoPoint(39.883348, 57.626111), 13, YMaps.MapType.MAP);
	map.addControl(new YMaps.SmallZoom(), new YMaps.ControlPosition(YMaps.ControlPosition.TOP_LEFT, new YMaps.Size(235, 2)));

	document.getElementById("tools").style.display = "";
}
