var animateBlock = function(el, hiddenEl, exec, attr) {
	jQuery.easing.def = attr.easeType;
	
	if (attr.containerHeight == undefined) {
		attr.containerHeight = 0;
	}
	
	var h = $(el).height() + attr.containerHeight;
	
	$(exec).click(function() {
		$(el).animate({
			bottom: -h
		},{ queue:false,
			duration:attr.time - 300,
			complete:function() {
				$(hiddenEl).show(100).animate({ bottom:0 }, {duration:attr.time});
			}
		});
		
		return false;
	});
	
};

function hideAll (speed) {
	
	
	$('#item-1').hide(speed);
	$('#item-2').hide(speed);
	$('#item-3').hide(speed);
	$('#item-4').hide(speed);
	$('#item-5').hide(speed);
	$('#item-6').hide(speed);
}

$(document).ready(
	function() {
		$('#commercial-lending a:first').attr('id', 'click-animate');
		$('#hidden-item a:first').attr('id', 'click-close');
		
		animateBlock('#commercial-lending', '#hidden-item', '#click-animate',{easeType: 'easeInOutExpo', time:1500});
		animateBlock('#hidden-item', '#commercial-lending', '#click-close',{easeType: 'easeInOutExpo', containerHeight: 20, time:1500});
		
		hideAll("");	
		
		$("a#line-1").click(function () {
			hideAll("fast");	
			$('#item-1').show("slow");
			return false;
		});
		
		$("a#line-2").click(function () {
			hideAll("fast");	
			$('#item-2').show("slow");
			return false;
		});
		
		$("a#line-3").click(function () {
			hideAll("fast");	
			$('#item-3').show("slow");
			return false;
		});
		
		$("a#line-4").click(function () {
			hideAll("fast");	
			$('#item-4').show("slow");
			return false;
		});
		
		$("a#line-5").click(function () {
			hideAll("fast");	
			$('#item-5').show("slow");
			return false;
		});
		
		$("a#line-6").click(function () {
			hideAll("fast");	
			$('#item-6').show("slow");
			return false;
		});
		
		$("p.hideAll").click(function () {
			hideAll("fast");	
			return false;
		});

	
	}
);