Можно проще. Вопрос поднимался уже:
http://forum.finam.ru/index.php?showtopic=5751