var footerBlock = false;
var footerStatus = false;

$(function() {
	$('#boxFooter').css({
		height: "102px",
		bottom: "4px"
	});
});

function footerEvent(e) {
	var childs = $("#boxFooter *");
	if (jQuery.inArray(e.target, childs) >= 0 || jQuery.inArray(e.relatedTarget, childs) >= 0) {
		return;
	}

	if (e.type == "mouseover") {
		footerStatus = true;
		
		if (footerBlock) return;
		footerBlock = true;

		//window.scrollTo(0, 9000);
		
		$("#footerContent").show();
		$('#boxFooter').animate({
			height: "230px",
			bottom: "130px"
		}, {
			queue: false,
			duration: 500,
			complete: function() {
				footerBlock = false;
				updateFooter(true);
			},
			easing: "easeOutBack"
		});
	} else {
		footerStatus = false;
		
		if (footerBlock) return;
		footerBlock = true;
		
		$('#boxFooter').animate({
			height: "102px",
			bottom: "2px"
		}, {
			queue: false,
			complete: function() {
				$("#footerContent").hide();
				footerBlock = false;
				updateFooter(false);
				//window.scrollTo(0, 9000);
			},
			easing: "easeOutBack",
			duration: 500
		});
	}
}

function updateFooter(isUp) {
	if (isUp && !footerStatus) {
		$('#boxFooter').mouseout();
	} else if (!isUp && footerStatus) {
		$('#boxFooter').mouseover();
	}
}
