sharing cookies for dyanmic domain

Hi folks, i have two websites example.com and a mob version m.example.com so waht i want is that if a user is logged in example.com then when he switches to m.example.com he wont have to login again.... Is there any method that anyone can suggest i have tried with some techniques available on net but they are not working out... Thanks, Atin