Okey, so I did what you suggested.
I took my script out of sidebar.php and into a new file, myjquery.js inside the js-directory.
Then, I posted this in my functions.php-file:
function my_scripts_method() {
wp_deregister_script( 'jquery' );
wp_register_script( 'google-jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js');
wp_enqueue_script( 'google-jquery' );
wp_register_script( 'my-jquery', get_template_directory_uri() . 'js/myjquery.js', 'google-jquery');
wp_enqueue_script( 'my-jquery' );
}
add_action('wp_enqueue_scripts', 'my_scripts_method');
I also tried seperating it into its own PHP-tag. It didn’t work unfortunaly.