function elemInViewport(elem,full) {
var box = elem.getBoundingClientRect();
var top = box.top;
var left = box.left;
var bottom = box.bottom;
var right = box.right;
var width = document.documentElement.clientWidth;
var height = document.documentElement.clientHeight;
var maxWidth = 0;
var maxHeight = 0;
if(full) { maxWidth = right - left; maxHeight = bottom - top};
return Math.min(height,bottom)- Math.max(0,top) >= maxHeight && Math.min(width,right)- Math.max(0,left)>= maxWidth
}
getCoord = function (elem)
{
var box = elem.getBoundingClientRect();
var body = document.body;
var docEl = document.documentElement;
var scrollTop = window.pageYOffset || docEl.scrollTop || body.scrollTop;
var scrollLeft = window.pageXOffset || docEl.scrollLeft || body.scrollLeft;
var clientTop = docEl.clientTop || body.clientTop || 0;
var clientLeft = docEl.clientLeft || body.clientLeft || 0;
var top = box.top + scrollTop - clientTop;
var left = box.left + scrollLeft - clientLeft;
return { top: Math.round(top), left: Math.round(left) };
};