var showPage = 2,
	delay,
	temp = 0,
	eof = false;

window.onload = window.onscroll = function(){

	if (!eof){

		var items = document.getElementsByTagName('li'),
			len = items.length,
			pageHeight = document.documentElement.scrollHeight,
			windowHeight = document.documentElement.clientHeight;

		clearTimeout(delay);

		delay = setTimeout(function(){

			var scrollTop = document.documentElement.scrollTop || window.pageYOffset;
			//console.info(len);
			for (var i=temp,j=len; i<j; i++){

				if (windowHeight * showPage + scrollTop > items[i].offsetTop){

					var img = items[i].getElementsByTagName('img')[0];
					if (img.getAttribute('data-src')){
						img.src = img.getAttribute('data-src');
						img.setAttribute('data-src', '');
					}

					if (i==len-1) eof = true;
				}
				else{
					temp = i;
					break;
				}
				//console.log(i+'|'+eof);
			}
		}, 200);
	}
};
