var menuYloc = null;
var alYloc = null;
function floating(id) {
	menuYloc = parseInt($('#' + id).css("top").substring(0, $('#' + id).css("top").indexOf("px")));
	$(window).scroll(function() {
		offset = menuYloc + $(document).scrollTop() + "px";
		$('#' + id).animate(
			{ top : offset },
			{ duration : 500, queue : false }
		);
	});
}

function floating_al(id) {
	$('#' + id).css('top', $('#sub_menu_div').height() + 150);
	$(window).scroll(function() {
		alYloc = $('#sub_menu_div').height();
		var offset_b = $('#fa_links').offset();
		offset = 150 + alYloc + $(document).scrollTop();
		if(offset > (offset_b.top - 150)){
			offset = offset_b.top - 150;
		}
		offset += 'px';
		$('#' + id).animate(
			{ top : offset },
			{ duration : 1000, queue : false }
		);
	});
}

function refresh_al(){
	alYloc = $('#sub_menu_div').height();
	var offset_b = $('#fa_links').offset();
	offset = 150 + alYloc + $(document).scrollTop();
	offset += 'px';
	$('#floating_al').animate(
		{ top : offset },
		{ duration : 500, queue : true }
	);
}
