$(document).ready(function(){
	$(".accordRow").click(function(){
		var _this = $(this);
		var thisRow = _this.next().css("display");
		var bod = $("body");
		$(".accordText").each(function(i){
			$(this).slideUp();
		});
		if (thisRow != "block") _this.next().slideDown(function(){
			var documentScroll = Math.max(document.documentElement.scrollTop, document.body.scrollTop);
			var thisBot = parseInt(_this.offset().top) + parseInt(_this.height()) + parseInt(_this.next().height());
			var bodyScrollTop = documentScroll + parseInt($(window).height());
			
			if (thisBot > bodyScrollTop) {
				window.scroll(0, parseInt(_this.offset().top) - 20);
			}
		});
	});
});
