* TSX up 17.19 points, or 0.13 pct, at 12,570.32
* Eight of 10 main groups higher; energy, techs down
* RIM down 20 percent on disappointing earnings (Updates to afternoon, adds comments)
By Trish Nixon
TORONTO, June 17 (Reuters) - Toronto's main stock index was little changed Friday afternoon, giving back most of its early gains, as a sharp selloff in Research In Motion RIM.TO and soft energy issues weighed on an otherwise advancing market.
RIM plunged almost 20 percent to C$27.68 after reporting disappointing results and forecasts late Thursday, prompting analysts to downgrade the BlackBerry maker's stock and cut price targets. [ID:nL3E7HH1AW]
"I think RIM set the tone for Canada pretty much," said John Kinsey, portfolio manager at Caldwell Securities. "They disappointed pretty much everybody and it's certainly showing in the stock performance."
Shares of Celestica CLS.TO, whose major customer is Research In Motion, slid 6.5 percent to C$7.98 after Paradigm Capital lowered its share price target on the contract electronics manufacturer. [ID:nL3E7HH263]
Energy issues fell 0.1 percent, as U.S. crude futures slumped on fears about Greece's debt crisis and a slowing U.S. economic recovery. [O/R]
Suncor Energy (SU.TO), down 0.4 percent at C$37.38, and Canadian Natural Resources (CNQ.TO), off 0.6 percent at C$38.13, were among the heaviest laggards.
"Energy just continues to be beaten down and I guess the bears have come out of the woods," added Kinsey.
At 2:48 p.m. (1848 GMT), the Toronto Stock Exchange's S&P/TSX composite index .GSPTSE was up 17.19 points, or 0.13 percent, at 12,870.32, after briefly turning negative. Technology stocks were down 4 percent, dragged lower by RIM.
Eight of the index's 10 main groups were higher, including heavyweight materials, up 0.1 percent, and financials, ahead 0.2 percent.
Royal Bank of Canada (RY.TO) was the most influential gainer, climbing 1.7 percent to C$54.59 after reports said it may have found a buyer for its U.S. retail banking operations. [ID:nN17173029]
Canadian National Railway (CNR.TO) was up 1.8 percent at C$74.40, making it the second most influential gainer on the index. Canada's biggest railway rebounded after its shares fell on Thursday on news that it will sell assets of an indirect subsidiary and enter a 10-year coal transportation agreement. [ID nL3E7HG284]
Earlier in the session the TSX rallied along with global investor sentiment after leaders of France and Germany said they were united behind a new aid deal to save Greece from default. [MKTS/GLOB]
"It will be interesting if in fact they do come up with something on the weekend, then we might have a better day on Monday. I think the market liked what they heard but there wasn't enough concrete news to sustain it," said Kinsey.
Also weighing on market confidence was data showing U.S. consumer sentiment fell this month, while the IMF cut its forecast for U.S. growth. [ID:nN17179878]
($1=$0.98 Canadian) (Additional reporting by Claire Sibonney; editing by Rob Wilson)