(function(){var grid=window.grid=function(){return new grid()};grid.init=function(){};grid.showPreview=function(obj,img){if(!obj||!img)return false;var td=obj.parentNode;if(!td)return false;var pos=first.getElementPosition(td);if(!pos)return false;var imgPath='http://'+window.location.host+img; if(!grid.getContainer(pos.left,pos.top))return false;grid.container.innerHTML='<table><tr><td style="width:100px height:100px" align=center><img style="height:100%" src="'+imgPath+'" alt=""/></td></td></table>';document.body.appendChild(grid.container)};grid.hidePreview=function(){if(grid.container===undefined)return true;document.body.removeChild(grid.container);grid.container=undefined};grid.container=undefined;grid.getContainer=function(posLeft,posTop){if(grid.container||!posLeft||!posTop)return false;var div=document.createElement('DIV');div.style.position='absolute';div.style.zIndex='2';div.style.border='1px solid #ddd';div.style.padding='15px';div.style.background='#fff';div.style.width='100px';div.style.left=posLeft-100-31+'px';div.style.top=posTop+'px';grid.container=div;return grid.container}})();
