real analysis on max min and boundedness 
Possible Duplicate:
Real Analysis Boundedness of continuous function 

I have a real analysis question that I am having trouble with:
Suppose that $f:\Bbb R\to\Bbb R$ is continuous on $\Bbb R$ and $\lim\limits_{x\to-\infty}f(x) = 0$ and $\lim\limits_{x\to\infty}f(x) = 0$. Prove that $f$ is bounded on $\Bbb R$ and attains either a max or a min on $\Bbb R$. 
Should I do this by contradiction, perhaps using the fact that if $f(x)$ is unbounded on $\Bbb R$, then WLOG, suppose that it contains a max. Then there exists $s:=\max f(x)$ where $s>f(x)$ for all $x$ in $\Bbb R$. Then $s>f(x_m)>M$ meaning $f(x_m)$ is bounded on $\Bbb R$. 
I just don't think this will work since I also have to prove it has a max or min. I can't just assume it has one.

Hint: The limit conditions you gave for $f$ are equivalent to the following: For every $\epsilon > 0$, there exists $N > 0$ such that $|f(x)| < \epsilon$ whenever $x \in \mathbb{R} \setminus [-N, N]$.
Then, use the fact that when restricted to the closed interval $[-N,N]$, $f(x)$ attains both a max and min. What remains is to show how to relate this local max/min to the global behavior.
