The smoothness of distance function

$(M,g)$ is a Riemannian manifold and $N$ is a submanifold of $M$, then is the function $r(x)=\mathop {\min }\limits_{y \in N} d(x,y)$ smooth near $N$? ($d(x,y)$ is the distance function induced by Riemannian metric $g$ )

I think a possible proof may involve the tubular neighborhood of $N$, that is, the normal bundle of $N$ is diffeomorphic to a neighborhood of $N$ in $M$. But I am not sure how to prove that $r(x)$ is equal to the length of the normal vector $v$ where exp$(y,v)=x$ for some $y$ in $N$.

Note: Here we say $r(x)$ is smooth "near" $N$ means that $r(x)$ is smooth on $U-N$ where $U$ is a neighborhood of $N$. For example, when $M$ is $\mathbb R$, $N$ is $\{0\}$, the function $\left| x \right|$ is smooth near $0$.

-

No the function $r$ is not smooth near $N$.
The simplest counter-example is $M=\mathbb R$ with its usual riemannian metric and $N=\lbrace 0\rbrace$, since $r(x)=\mid x\mid$ which is not differentiable in any neighbourhood of $0$.
By "near" I mean $r(x)$ is smooth in a small neighborhood of $N$ except on $N$. – Hezudao Sep 20 '12 at 12:05
Dear Hezudao, I suggest you add this definition of "near" in your question, so as to remove all ambiguity ("near $N$" often means "in a neighbourhood of $N$" and thus does not exclude $N$). – Georges Elencwajg Sep 20 '12 at 14:24