$.debug=false;
$(document).ready(function() {
	$.bounceheight = 10;
	
  $('#menubuttons').find(".clickmap").each(
	  function()
	  {
			//$("#output").append($(this).attr("author") + "<br />");
			if ( $(this).attr('link')==$('#menubuttons').attr('activepage') )
			{
				$(this).css('backgroundImage', 'url(../images/menu_orange.png)');
			}
	  }
  );

	$('#logo').bind('mouseover', function()
	{
		clapboard.Play();
	});
 
	$('#menubuttons .clickmap').bind('mouseover', function() {
		$(this).css('backgroundImage', 'url(../images/menu_orange.png)');
		$(this).animate({
		marginTop: '-='+$.bounceheight
		}, 
		300,
		function() {
			$(this).animate({
			marginTop: '+='+(($.bounceheight*.55)*.5)
			}, 
			100,
			function() {
				$(this).animate({
				marginTop: '-='+(($.bounceheight*.55)*.5)
				}, 
				100);
			});
		});
		
		$('#menubuttonsreflections #'+$(this).attr('id')).animate({
		marginTop: '+='+($.bounceheight*.55)
		}, 
		300,
		function() {
			$('#menubuttonsreflections #'+$(this).attr('id')).animate({
			marginTop: '-='+(($.bounceheight*.55)*.5)
			}, 
			100,
			function() {
				$('#menubuttonsreflections #'+$(this).attr('id')).animate({
				marginTop: '+='+(($.bounceheight*.55)*.5)
				}, 
				100);
			});
		});
		
	});
	
	$('#menubuttons .clickmap').bind('mouseout', function() {
		$(this).animate({
		marginTop: '+='+$.bounceheight
		}, 
		300, 
		function() {
			$(this).animate({
			marginTop: '-='+(($.bounceheight*.55)*.5)
			}, 
			100,
			function() {
				$(this).animate({
				marginTop: '+='+(($.bounceheight*.55)*.5)
				}, 
				100,
				function() {
					$(this).css('marginTop', 0);
					if ( $('#menubuttons').attr('activepage')==$(this).attr('link') )
					{
						$(this).css('backgroundImage', 'url(../images/menu_orange.png)');
					}
					else
					{
						$(this).css('backgroundImage', 'url(../images/menu.png)');	
					}
				});
			});
		});
		

		$('#menubuttonsreflections #'+$(this).attr('id')).animate({
		marginTop: '-='+($.bounceheight*.55)
		}, 
		300,
		function() {
			$('#menubuttonsreflections #'+$(this).attr('id')).animate({
			marginTop: '+='+(($.bounceheight*.55)*.5)
			}, 
			100,
			function() {
				$('#menubuttonsreflections #'+$(this).attr('id')).animate({
				marginTop: '-='+(($.bounceheight*.55)*.5)
				}, 
				100,
				function() {
					$('#menubuttonsreflections #'+$(this).attr('id')).css('marginTop', 0);
				});
			});
		});		
		
	});	

	$('#menubuttons .clickmap').bind('click', function() {
		window.location= $(this).attr('link'); 
	});

});
