Your brew is doing fine. The foam and crud on the top of the beer is krausen which is a good thing. It is basically bubbles, protiens, bitter hop oils, and yeast residue. This means your yeast is chugging along converting sugar to alcohol and CO2.

I would make sure your lid is snapped on tight, my bucket lit takes a lot of force to snap it on tight. Also, like you said, check your airlock seal. It should fit very snug. Also, be sure your airlock has enough liquid in it.

Your beer is doing well, and in no time at all, you'll be enjoying a nice mug of your own brew...

I find that its really hard to ruin a batch of beer. And most of the time that beer is ruined, it's because of poor sanitation.

Most of the krausen would eventually clump and settle to the bottom anyways, likewise the crud on the sides would just hang out there or settle to the bottom. You might have reintroduced some bitter oils or off flavors but not near enough to be concerned about. Relax and don't worry.

A few tips,
Once the yeast has started to work and formed krausen, don't stir or disturb the beer. All the undesirable stuff will settle to the bottom eventually. There's still plenty of time for that stuff to settle in your case.

Also, stirring or agitating the beer will allow oxygen into the beer which can oxydize it and add off flavors. A good rule of thumb is to oxygenate the beer when you first add the yeast, (because the yeast needs oxygen to start working) then leave it alone. (The yeast will use up all the oxygen, and that's a good thing.)

Be sure that when you siphon the beer out of the fermenter into the bottling bucket, you are careful to siphon as little of the slurry at the bottom as possible. That slurry is made of dormant yeast and protiens that are not desirable. It's impossible to avoid siphoning some of it, just try to keep it to a minimum.

Again, try to avoid splashing (oxygenating) when siphoning and bottling. It's impossible to be completely "splashless" but keep it to a minimum.

Even if you did EVERYTHING wrong, you'd still probably turn out with good beer. (So don't worry.)

If you have a second bucket, you might want to carefully siphon the beer into it after 10-14 days and put the lid/airlock on it. This is called 2 stage or secondary fermentation. This gets the beer off of the "yeast cake" or slurry. It helps the beer clarify and helps prevent off flavors that come from the slurry breaking down. This step isn't necessary, but I've noticed a difference when I do it.

The only time I "ruined" a batch of beer, it was because I bottled too soon. That leads to very foamy beer or even exploding bottles. If you have a hydrometer, take a reading after about two weeks of fermentation. The gravity should read in the 1.006-1.015 range depending on what you're brewing. If it is higher than that, your beer probably needs to ferment a while longer.

If you don't have a hydrometer, don't worry. Let the beer brew for a total of 3 weeks (primary and secondary) in a warm (70-75 degree) location. Taste the beer, if it tastes sweet, it probably still has some fermenting to do.

Boil the priming sugar in a few cups of water and then allow it to cool before adding it to the beer/bottling bucket. This ensures that no bacteria is living on the sugar and contaminates the beer.

I find that 3/4 cup of priming sugar will carbonate 5 gallons of beer just fine. If you're using a kit, go ahead and measure it out, the kits I used to use tend to be overcarbonated.

Active yeast is still suspended in the beer so when you add the priming sugar and bottle it, don't worry, it will carbonate.