(function($) {

$.extend($.easing, {
	easeOutExpo: function (x, t, b, c, d) {
		return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
	}
});

$(document).ready(function() {
	$('#bodycontainer').append('<div id="bottomboxes">');

	$('#bottomboxes').append($('#bodyfloat .box').not('#toolbox').clone());

	$('#bodycell').append('<div id="bottomnav">');

	$('#bottomnav').append('<div id="searchcell">');
	$('#bottomnav #searchcell').append($('#searchcell > *').clone());

	$('#bottomnav').append('<div id="navcell">');
	$('#bottomnav #navcell').append($('#navcell > *').clone());
	
	$('#gotonav').click(function() {
		$('html,body').animate({scrollTop: $('#bottomnav').offset().top}, 1000, 'easeOutExpo');
		return false;
	});
	
	// fix for iOS orientation change issue
	if (navigator.userAgent.match(/iPhone/i)) {
		$('meta[name=viewport]').attr('content', 'width=device-width, minimum-scale=1.0, maximum-scale=1.0');
		$('body').get(0).addEventListener('gesturestart', function() {
			$('meta[name=viewport]').attr('content', 'device-width, minimum-scale=0.25, maximum-scale=1.6');
		}, false);
	}
});

})(jQuery);

