functions bothering me

functions bothering me

The syntax for functions in jquery is causing me problems

I have two questions

1)

with normal javascript use of a function looks like this

function(){ }

but with jquery it looks like this

(function(){ });

the difference being the ( at the start and the ); at the end

why does jquery require this. this is unlike regular JS and php and constantly confuses me.

2)

I have seen examples of jquery code in tutorials which call a function by placing it immediately after the code which calls it like this.

$("#animate").click(function() {

$("#content").animate(

{"height": "80px"},

"fast");

});

however when i use regular javascript i have my list of functions in the script and call them using html events, like this

<div onclick="dothis()">

<script>function dothis() { alert=("this is a simple function") }</script>

how can i do it this way with jquery.

the reason i want to know this is because if i want to string lots of animations together i will want to use the callback option of the animate function and it will get very messy if i have all the animate functions inside each other, i would rather be able to just have each animation as a seperate function which is called when its preceeding animation finishes