// JavaScript Document
	$(document).ready(function () {

		//transitions
		//for more transition, goto http://gsgd.co.uk/sandbox/jquery/easing/
		var style = 'easeOutExpo';
		var default_left = Math.round($('#menu li.selected').offset().left - $('#menu').offset().left)-305;
		//var default_top = $('#menu li.selected').height();
		var default_top = -195;

		//Set the default position and text for the tooltips
		$('#box').css({left: default_left, top: default_top});
		$('#box .head').html($('#menu li.selected').find('img').attr('alt'));				
		
		//if mouseover the menu item
		$('#menu li').click(function () {
			
			left = (Math.round($(this).offset().left - $('#menu').offset().left)) - 305;

			//Set it to current item position and text
			$('#box .head').html($(this).find('img').attr('alt'));
			$('#box').stop(false, true).animate({left: left},{duration:500, easing: style});	

		
		//if user click on the menu
		}).click(function () {
			
			//reset the selected item
			$('#menu li').removeClass('selected');
			
			$('#box').css("display", "block");	
			
			//select the current item
			$(this).addClass('selected');
	
		});
		
		$('#fechartool').click(function(){
			$("#box").animate({height: 'toggle', opacity: 'toggle'},"slow");
			$(this).fadeOut("slow");
			//$('#box').css("display", "none");
		});
		
		//If the mouse leave the menu, reset the floating bar to the selected item
		$('#menu').mouseleave(function () {

			default_left = Math.round($('#menu li.selected').offset().left - $('#menu').offset().left)-305;

			//Set it back to default position and text
			//$('#box .head').html($('#menu li.selected').find('img').attr('alt'));				
			$('#box').stop(false, true).animate({left: default_left},{duration:1500, easing: style});	
			
		});
		
	});

	


