function adjustDiv(pDiv, pPlaceHolder, pLeftAdj, pTopAdj)
{
var par=document.getElementById(pPlaceHolder);
var left=document.getElementById(pPlaceHolder).offsetLeft;
var top=document.getElementById(pPlaceHolder).offsetTop;
var div=document.getElementById(pDiv);
while (par.tagName!=document.getElementById(pDiv).offsetParent.tagName)
{
par=par.offsetParent;
left+=par.offsetLeft;
top+=par.offsetTop;
}
div.style.left=left+pLeftAdj;
div.style.top=top+pTopAdj;
}
DIV={
adjust:function(pDiv, pPlaceHolder, pLeftAdj, pTopAdj) {
var par=pPlaceHolder;
var left=pPlaceHolder.offsetLeft;
var top=pPlaceHolder.offsetTop;
var div=pDiv;
while (par.tagName!=pDiv.offsetParent.tagName) {
par=par.offsetParent;
left+=par.offsetLeft;
top+=par.offsetTop;
}
div.style.left=left+pLeftAdj;
div.style.top=top+pTopAdj;
}
};
DIV.Zoomer=function(pInstance,pMaxSize,pPosTop,pPosLeft,pPixelWidth,pPixelHeight) {
if (!pMaxSize) {
pMaxSize=150;
}
if (!pPosTop) {
pPosTop=2;
}
if (!pPosLeft) {
pPosLeft=2;
}
if (!pPixelWidth) {
pPixelWidth=4;
}
if (!pPixelHeight) {
pPixelHeight=4;
}
this.timeout=0;
this.scale=function(pImg,pDiv) {
if (pImg.style.pixelWidth<pMaxSize) {
pDiv.style.posTop -= pPosTop;
pDiv.style.posLeft -= pPosLeft;
pImg.style.pixelWidth += pPixelWidth;
pImg.style.pixelHeight += pPixelHeight;
this.timeout=window.setTimeout(pInstance+".scale(document.getElementById('"+pImg.id+"'),document.getElementById('"+pDiv.id+"'));", 1);
}else {
if (this.timeout) {
clearTimeout(this.timeout);
this.timeout=0;
}
}
}
this.oculta=function(pImg,pDiv) {
if (this.timeout) {
clearTimeout(this.timeout);
this.timeout=0;
}
pDiv.style.display="none";
}
this.mostraDiv=function(pImg,pDiv) {
pDiv.innerHTML='<img id="DIVZoomerImagem" src="'+pImg.src+'" style="width:'+pImg.width+'px;height:'+pImg.height+'px;"'
+' onMouseOver="'+pInstance+'.scale(this,this.parentNode);"'
+' onMouseOut="'+pInstance+'.oculta(this,this.parentNode);"'
+'">';
DIV.adjust(pDiv, pImg, 0, 0);
pDiv.style.display="block";
}
}
