As a general rule, you should obviously avoid catling into an attack, but I've never heard any general rule saying that you should not castle into an opposing fianchetto. In fact, several standard openings feature this; eg white often castles queenside in a Sicilian Dragon and kingside in a Queens Indian.
I suppose one way of countering the other side's fianchetto if you are worried about it, is to set up an opposing fianchetto of your own and then castle behind that. Then the worst that might happen is that the two bishops will be exchanged for each other.
Now for the standard disclaimer: it always comes down to the specifics of the postion. Your results may vary :-)
I was just wondering if there is a general rule about castling when the opponent fianchetto's. Should one not castle to the opposite side of a fianchetto considering that opponents bishop will control that long diagonal. It would seem to have some merit but I've never heard of it. Thanks! Happy Trails, Scut