function loadMore() {
		var threshold, target = $("body");
		if(!target.length) return;

		threshold = $(window).scrollTop() + $(window).height() - target.height();

		// target.height() calculate the height of overall document body
		// window height() calculate the height of browser client area (document), substracted to remove the gap from top edge scrollbar to bottom of document body height
		var distance = target.height() - $(window).height();

		// console.log("DIST:"+distance+
		// 	" BODY:"+  target.height() +
		// 	" SCROLLTOP:"+$(window).scrollTop() +
		// 	" WINDOW:"+ $(window).height()+
		// 	" OFFSET:"+ target.offset().top+
		// 	" DOC:" + $(document).height()+
		// 	" POINT:" + ($(document).height() - $(window).height())
		// 	);

		// if(target.offset().top < threshold) {
		// 	console.log("TRIGGER LOAD");
		// 	Session.set("stocks_limit", Session.get("stocks_limit") + slaves_expansion);
		// }
		// else {
		// 	if(target.data("visible")) {
		// 		target.data("visible", false);
		// 	}
		// }

		if($(window).scrollTop() == $(document).height() - $(window).height()) {
			Session.set("stocks_limit", Session.get("stocks_limit") + slaves_expansion);
		}
	}
// whenever #showMoreResults becomes visible, retieve more results
whenever #showMoreResults becomes visible, retieve more results
whenever #showMoreResults becomes visible retieve more results
function loadMore() {
		var threshold, target = $("body");
		if(!target.length) return;
		threshold = $(window).scrollTop() + $(window).height() - target.height();
		var distance = target.height() - $(window).height();
		if($(window).scrollTop() == $(document).height() - $(window).height()) {
			Session.set("stocks_limit", Session.get("stocks_limit") + slaves_expansion);
		}
	}
function loadMore ( ) { var threshold , target = $ ( "body" ) ; if ( ! target . length ) return ; threshold = $ ( window ) . scrollTop ( ) + $ ( window ) . height ( ) - target . height ( ) ; var distance = target . height ( ) - $ ( window ) . height ( ) ; if ( $ ( window ) . scrollTop ( ) == $ ( document ) . height ( ) - $ ( window ) . height ( ) ) { Session . set ( "stocks_limit" , Session . get ( "stocks_limit" ) + slaves_expansion ) ; } }
whenever #showMoreResults becomes visible, retieve more results
whenever #showMoreResults becomes visible retieve more results
// target.height() calculate the height of overall document body // window height() calculate the height of browser client area (document), substracted to remove the gap from top edge scrollbar to bottom of document body height // console.log("DIST:"+distance+ // 	" BODY:"+  target.height() + // 	" SCROLLTOP:"+$(window).scrollTop() + // 	" WINDOW:"+ $(window).height()+ // 	" OFFSET:"+ target.offset().top+ // 	" DOC:" + $(document).height()+ // 	" POINT:" + ($(document).height() - $(window).height()) // 	); // if(target.offset().top < threshold) { // 	console.log("TRIGGER LOAD"); // 	Session.set("stocks_limit", Session.get("stocks_limit") + slaves_expansion); // } // else { // 	if(target.data("visible")) { // 		target.data("visible", false); // 	} // }