(function($) {
			$(document).ready(function() {
				$('#logo').click(function() {
					document.location.href = 'http://www.spritely.net/';
				});
			
				$('#bird')
					.sprite({fps: 9, no_of_frames: 3})
					.spRandom({top: 50, bottom: 200, left: 300, right: 320})
					.isDraggable()
					.activeOnClick()
					.active();
				$('#clouds').pan({fps: 30, speed: 0.7, dir: 'left', depth: 10});
				$('#hill2').pan({fps: 30, speed: 2, dir: 'left', depth: 30});
				$('#hill1').pan({fps: 30, speed: 3, dir: 'left', depth: 70});
                                $('#balloons').pan({fps: 30, speed: 3, dir: 'up', depth: 70});
				$('#hill1, #hill2, #clouds').spRelSpeed(8);
				
				window.actions = {
					fly_slowly_forwards: function() {
						$('#bird')
							.fps(10)
							.spState(1);
						$('#hill1, #hill2, #clouds')
							.spRelSpeed(10)
							.spChangeDir('left');
					},
					fly_slowly_backwards: function() {
						$('#bird')
							.fps(10)
							.spState(2);
						$('#hill1, #hill2, #clouds')
							.spRelSpeed(10)
							.spChangeDir('right');
					},
					fly_quickly_forwards: function() {
						$('#bird')
							.fps(20)
							.spState(1);
						$('#hill1, #hill2, #clouds')
							.spRelSpeed(30)
							.spChangeDir('left');
					},
					fly_quickly_backwards: function() {
						$('#bird')
							.fps(20)
							.spState(2);
						$('#hill1, #hill2, #clouds')
							.spRelSpeed(30)
							.spChangeDir('right');
					},
					fly_like_lightning_forwards: function() {
						$('#bird')
							.fps(25)
							.spState(1);
						$('#hill1, #hill2, #clouds')
							.spSpeed(40)
							.spChangeDir('left');
					},
					fly_like_lightning_backwards: function() {
						$('#bird')
							.fps(25)
							.spState(2);
						$('#hill1, #hill2, #clouds')
							.spSpeed(40)
							.spChangeDir('right');
					}
				};
				
				window.page = {
					hide_panels: function() {
						$('.panel').hide(300);
					},
					show_panel: function(el_id) {
						this.hide_panels();
						$(el_id).show(300);
					}
				}
				
			});
		})(jQuery);

	var name = ".floatMenu:not(.doNotFloat)";
	var menuYloc = null;
	
		$(document).ready(function(){
			//menuYloc = parseInt($(name).css("top").substring(0,$(name).css("top").indexOf("px")))
			$(window).scroll(function () { 
        var position = $(document).scrollTop();
				var offset = menuYloc+$(document).scrollTop()+"px";
        if (position < 350)
        {
          $(name).animate({top:0},{duration:500,queue:false});
          return;
        }
        offset = $(document).scrollTop() -350 + "px";
        $(name).animate({top:offset},{duration:500,queue:false});
				
			});
		}); 

