soundManager.url = '../soundmanager2.swf';
soundManager.debugMode = false;
soundManager.consoleOnly = false;
soundManager.onload = function() {

soundManager.createSound({
id: 'bell',
url: '/audio/bell.mp3',
volume: 10
});

soundManager.createSound({
id: 'seagull',
url: '/audio/seagull.mp3'
});

soundManager.createSound({
id: 'foghorn',
url: '/audio/foghorn.mp3',
volume: 10
});

soundManager.createSound({
id: 'water',
url: '/audio/water.mp3',
volume: 5
});

}

function playit() {
soundManager.play('bell');
}

function playhome() {
soundManager.play('foghorn');
}


function startup(which_bird) {
bird_top = document.getElementById(which_bird).offsetTop;
bird_left = document.getElementById(which_bird).offsetLeft;
bird_x = new Array(new Array(-1,-2,-3,-2,-1,0),new Array(1,2,1,0),new Array(-1,-2,-3,-2,-1,0),new Array(1,2,1,0));
bird_y = new Array(new Array(0,-1,-2,-1,0,0),new Array(0,0,0,0),new Array(0,1,2,1,0,0),new Array(1,2,1,0));
which_array = Math.floor(Math.random()*3);
bird_clicker = 0;
this_bird = which_bird;
this_int = setInterval("float_bird(this_bird)",300);
}


function float_bird(which_bird) {

up_and_down = bird_top + bird_x[which_array][bird_clicker] + "px";
bird = document.getElementById(which_bird);
bird.style.top = up_and_down;
left_and_right = bird_left + bird_y[which_array][bird_clicker] + "px";
birds = document.getElementById(which_bird);
birds.style.left = left_and_right;

bird_clicker++;

if (bird_clicker >= bird_x[which_array].length) {
bird_clicker = 0;
which_array = Math.floor(Math.random()*3);
clearInterval(this_int);
new_bird = "bird_" + (Math.floor(Math.random()*4) + 1);

if (new_bird == "bird_1" && which_array == "1") {
soundManager.play('seagull',{volume:5,pan:(Math.floor(Math.random()*201) - 100)});
}

startup(new_bird);
}

}




function bob_setup(div_id, direction) {
h = document.getElementById(div_id);
h.style.display = "inline";
bob_object_div_name = div_id;
bob_object_moving = direction;
bob_object_top_position = document.getElementById(div_id).offsetTop;
bob_object_left_position = document.getElementById(div_id).offsetLeft;
bob_object_how_wide = document.getElementById(div_id).offsetWidth;
bob_object_move_x = new Array(-1,0,1,2,1,0,-1,0,1,2,1,0);
bob_object_clicker = Math.floor(Math.random()*(bob_object_move_x.length+1));
that_int=setInterval("bob_start()", 350);
}
 





function bob_start() {

up_and_down = bob_object_top_position + bob_object_move_x[bob_object_clicker] + "px";

f = document.getElementById(bob_object_div_name);
f.style.top = up_and_down;

bob_object_clicker++;

if (bob_object_clicker >= bob_object_move_x.length) {
bob_object_clicker = 0;
soundManager.play('water');
}

bob_object_left_position = bob_object_left_position + bob_object_moving;

left_and_right = bob_object_left_position + "px";

bobbing = document.getElementById(bob_object_div_name)
bobbing.style.left = left_and_right;

if (bob_object_left_position < (bob_object_how_wide * -1)) {
bob_object_left_position = window.outerWidth;
}

if (bob_object_left_position > window.outerWidth) {
bob_object.left_position = (bob_object_how_wide * -1);
}

}