floorAnimSpeed = 450;

$(document).ready(function(){
	$('#panel-building').addClass("js-enabled").lavaLamp({
		fx: 'easeOutQuad',
		speed: 350,
		returnHome: true,
		homeLeft: 3,
		homeTop: 291,
		homeWidth:323,
		homeHeight:80
	});
	
	$('ul.floors li').each(function(i) {
		$(this)
			.bind("mouseenter focus", function() {				
				$(this).siblings()
					.stop()
					.animate({ 'opacity' : 0.50 }, 250, 'easeOutQuad');
					
				currFloor = $(this).attr("class");
				
				if(currFloor=="floor-ground"){
					$(".backLava").stop().animate({
						top: 205,
						height: 86
					}, floorAnimSpeed, 'easeOutQuad');

				} else if(currFloor=="floor-first") {
					$(".backLava").stop().animate({
						top: 146,
						height: 59
					}, floorAnimSpeed, 'easeOutQuad');
				} else if(currFloor=="floor-bar") {
					$(".backLava").stop().animate({
						top: 5,
						height: 77
					}, floorAnimSpeed, 'easeOutQuad');
				}
			})
			.bind("mouseleave blur", function() {
				$(this).siblings()
					.stop()
					.animate({ 'opacity' : 1}, 250, 'easeOutQuad');
				$(".backLava").stop().animate({
						top: 291,
						height: 80
					}, floorAnimSpeed, 'easeOutQuad');
			})
	});

	$('#panel-building li[id]').each(function(i) {
		$(this)
			.bind("mouseenter focus", function() {				
				$('ul.floors li.floor-'+$(this).attr("id")).siblings()
					.stop()
					.animate({ 'opacity' : 0.50 }, 250, 'easeOutQuad');
			})
			.bind("mouseleave blur", function() {
				$('ul.floors li.floor-'+$(this).attr("id")).siblings()
					.stop()
					.animate({ 'opacity' : 1}, 250, 'easeOutQuad');
			})
	});

	$('#news-list li').each(function(i) {
		$(this).find("a").attr("title","");
		$(this)
			.bind("mouseenter focus", function() {				
				$(this).siblings()
					.stop()
					.animate({ 'opacity' : 0.45 }, 250, 'easeOutQuad');
			})
			.bind("mouseleave blur", function() {
				$(this).siblings()
					.stop()
					.animate({ 'opacity' : 1}, 250, 'easeOutQuad');
			})
	});
	
	/* Add hover colour change to header links*/
	$(".panel-news > h3 > a").bind("mouseenter focus", function() {				
								$(this).children("span")
									.stop()
									.animate({'color':'#999999'},250);
							})
							.bind("mouseleave blur", function() {
								$(this).children("span")
									.stop()
									.animate({'color':'#990600'},200);
							});
	
});
