/**
 * http://smoothscroller.netas.eu
 * 
 * Animated page scroller to replace default browser functionality to scroll up/down
 * 2011 Linas M. ( linas(at)netas.eu }
 * 
 * Licensed under GNU GPL 2 or later and GNU LGPL 2 or later, see license.txt.
 */
$(function(){function SmoothScrollTop(){$('html,body').animate({scrollTop:0},'slow');}function SmoothScrollBottom(){var PosDes=$(document).height()-$(window).height();if($(window).scrollTop()<PosDes){$('html,body').animate({scrollTop:PosDes},'slow');}}var FIF=false;$(document).ready(function(){$('input,textarea,select').focus(function(){FIF=true;});$('input,textarea,select').blur(function(){FIF=false;});});$(window).keypress(function(e){
// <CONFIG>
var PosOff = parseInt($(window).height()/100*60); // Page up/down offset by percentage of the window. Replace '90' to write your own percentage
//var PosOff = 500; // Page up/down offset by points
// </CONFIG>
switch(e.keyCode){case 33:var CurPos=$(window).scrollTop();var PosDes=CurPos-PosOff;if(PosDes<0){PosDes=0;}if(PosDes<CurPos){$('html,body').animate({scrollTop:PosDes},'slow');}return false;break;case 34:var CurPos=$(window).scrollTop();var PosDes=CurPos+PosOff;var MaxPos=$(document).height()-$(window).height();if(PosDes>MaxPos){PosDes=MaxPos;}if(PosDes>CurPos){$('html,body').animate({scrollTop:PosDes},'slow');}return false;break;case 35:if(!FIF){SmoothScrollBottom();return false;}break;case 36:if(!FIF){SmoothScrollTop();return false;}break;}});});

