--- zogiLib/js/dllib.js 2010/06/18 19:45:08 1.9 +++ zogiLib/js/dllib.js 2011/02/14 16:33:43 1.10 @@ -178,11 +178,20 @@ function bestPicSize(elem, inset) { inset = 25; } var ws = getWinSize(); + var wsold = ws.copy(); var es = getElementPosition(elem); if (es) { - ws.width = ws.width - es.x - inset; - ws.height = ws.height - es.y - inset; + if ((es.x > ws.width)||(es.y > ws.height)) { + alert("es="+es+" is outside ws="+ws+" fixing..."); + ws.width = ws.width - inset; + ws.height = ws.height - inset; + } else { + ws.width = ws.width - es.x - inset; + ws.height = ws.height - es.y - inset; + } } + alert("ws="+wsold+" es="+es+" -> ws="+ws); + //alert("ws="+ws+"("+typeof(ws)+") es="+es); return ws; }