Dynamic page layouts with Smarty

Hello everyone!,
I am a php student and i am also new to smarty.I know smarty syntax
for some extent and I can use it for very basic needs.I am currently
planning on a social networking project and as it will be a quite a
complex project I don’t have a clear understanding of following
questions before starting to code :

QUESTION 1:
how to use different layouts for different sections of a web
application. for example say facebook.com. It uses one layout for its index page and another
for its login page and another different one for its profile page. How to do this with smarty
templates? How to reuse templates and separate them and use them?

QUESTION 2:
How to display dynamic error messages on smarty templates based on
various programming decisions. For example, again lets take a look at facebook.com. When
you visit facebook.com with javascript disabled it displays a message asking to enable
javascript. When you visit someone’s profile without logged in it displays a different header and
a sign up bar at the top. when you supplied wrong login credentials it displays an error message
in the same template. When facebook.com needs to do some announcement
to its users it gets displayed when we logged into our home page? How to do these things with smarty?

QUESTION 3: How to handle the css styling of different templates. How
to use javascript with different templates?

These scenarios might sound like like ordinary but to me that
information will be like gold.I greatly appreciate any help from anyone of you seeing this. If you
can explain these stuff with some good example code it will be an enormous support for me.

[A detailed explanation will be greatly appreciated]

Thank you