TORONTO — The Toronto stock market turned negative early Thursday afternoon with traders largely avoiding risk in the wake of news that a Malaysian airliner with about 300 people on board crashed in Ukraine.The S&P/TSX composite index lost 5.24 points to 15,221.1. The market had been positive for much of the morning in the wake of a strong earnings report from Canadian Pacific Railway.Losses were slight on the Toronto market as gold stocks ran up sharply alongside bullion prices. The gold sector gained 2.5% as the August bullion contract in New York moved up $23.30 to US$1,323.10 an ounce.An adviser to Ukraine’s interior minister said the plane was flying at an altitude of 10,000 meters when it was hit by a missile, and Malaysian Airlines tweeted that it lost contact with one of its flights over Ukrainian airspace.The region has seen severe fighting between Ukrainian forces and pro-Russia separatist rebels in recent days.The Canadian dollar dipped 0.03 of a cent to 93.03 cents US. Traders were already cautious after the U.S. announced broader sanctions against Russia, targeting two major energy firms, a pair of powerful financial institutions, eight weapons firms and four individuals. The increased U.S. economic pressure is designed to end the insurgency in eastern Ukraine that is widely believed to be backed by the Kremlin.U.S. markets registered sharp losses in the wake of the disaster with the Dow Jones industrials down 86.42 points at 17,051.78, the Nasdaq dropped 42.07 points to 4,383.9, while the S&P 500 index declined 14.68 points to 1,966.89.Canadian Pacific posted second quarter net income of $371 million, or $2.11 per diluted share, up 48% from a year ago and beating estimates by a penny and its shares ran up $5.20 to $203.03.CP’s results also gave a lift to rival Canadian National Railways. Its shares gained 49 cents to $71.94 ahead of the release of earnings on Monday.“Both rail companies are benefiting from volume growth across most of the markets but we’re also seeing incredible strength in the grain side of the business and growth in shipments of oil by rail,” said Colum McKinley, vice president, Canadian Equities, CIBC Asset Management.“We think that the grain-based business and the crude oil shipment business are going to continue to be strong throughout the reminder of the year and into the first half of next year and that … should contribute to continued strength in their earnings.”In the U.S., Microsoft plans to eliminate up to 18,000 jobs over the next year as it works on integrating the Nokia devices business it bought in April. Microsoft anticipates charges of $1.1 billion to $1.6 billion over the next four quarters. Its stock gained 0.7% to $44.38.Loblaw Companies Ltd. says Galen Weston will become president of the retailer as part of broader changes that shake up its management structure. He replaces Vicente Trius effective immediately. Weston was formerly executive chairman of the company, which is a longtime family business and a subsidiary of George Weston Ltd. Loblaw posts financial results on July 24. Its shares were down 43 cents to $48.85.Most TSX sectors turned lower with the energy sector down 0.82% as oil prices continued to benefit from data released Wednesday showing a much larger than expected drawdown of U.S. inventories last week. The August contract on the New York Mercantile Exchange was up 95 cents to US$102.15 a barrel.The metals and mining sector was down 0.2% with September copper in New York up one cent at US$3.21 a pound.