var reset, distance;



function windowOpen(imageLocation, imageWidth, imageHeight)

{

        displayWindow=window.open("","dynamicWindow","toolbar=no,width=100,height=100,directories=no,status=no,scrollbars=no,resizable=no,menubar=no");

        displayWindow.document.write('<html><head><title>Temple Israel</title><meta http-equiv="Content-Type" content="text/html; charset=windows-1254"></head><body onblur="window.self.close()"; leftmargin="0" topmargin="0"></body></html>');

        displayWindow.document.write('<div style="position:absolute; top:0px; left:0px; z-index:3;">');

        displayWindow.document.write('<a href="javascript:window.close();"><img src="'+imageLocation+'" width="'+imageWidth+'" height="'+imageHeight+'" border="0" alt=""></a>');

        displayWindow.document.write('</div>');

        displayWindow.document.bgColor = '#ffffff';

        displayWindow.document.close();

        displayWindow.window.focus();

        resizeStart(imageWidth,imageHeight);

}



function resizeStart(targetWidth,targetHeight)

{

        if (reset) { clearTimeout(reset); }

        var currentWidth = (window.innerWidth) ? displayWindow.window.innerWidth : parseInt(displayWindow.document.body.clientWidth);

        var currentHeight = (window.innerHeight) ? displayWindow.window.innerHeight : parseInt(displayWindow.document.body.clientHeight);

        resizeCycle(targetWidth+14,targetHeight+32,currentWidth,currentHeight);

}





function resizeCycle(targetWidth,targetHeight,currentWidth,currentHeight)

{

        if ((currentWidth != targetWidth) && (currentHeight != targetHeight))

        {

                if (currentWidth < targetWidth)

                { distance = targetWidth - currentWidth;

                        distance = (distance/10);

                        distance = Math.round(distance);

                        distance = (distance<1)?1:distance;

                        currentWidth += distance;

                }

                else

                { distance = currentWidth - targetWidth;

                        distance = (distance/10);

                        distance = Math.round(distance);

                        distance = (distance<1)?1:distance;

                        currentWidth -= distance;

                }

                if (currentHeight < targetHeight)

                { distance = targetHeight - currentHeight;

                        distance = (distance/10);

                        distance = Math.round(distance);

                        distance = (distance<1)?1:distance;

                        currentHeight += distance;

                }

                else

                { distance = currentHeight - targetHeight;

                        distance = (distance/10);

                        distance = Math.round(distance);

                        distance = (distance<1)?1:distance;

                        currentHeight -= distance;

                }

                displayWindow.window.resizeTo(currentWidth,currentHeight);

                reset = setTimeout('resizeCycle('+targetWidth+','+targetHeight+','+currentWidth+','+currentHeight+')','30');

        }

        return;

}



function findObj(n,d)

// searches document for object id tags

{

        var p,i,x

        if(!d)d=document;

        if(document.all)

        { x = eval("document.all."+n);

                return x;

        }

        if((p=n.indexOf("?"))>0&&parent.frames.length)

        { d=parent.frames[n.substring(p+1)].document

                n=n.substring(0,p)

        }

        if(!(x=d[n])&&d.all) x=d.all[n]

        if(!(x=d[n])&&d.getElementById) x=d.getElementById(n)

        for (i=0;!x&&i<d.forms.length;i++)x=d.forms[i][n]

        for(i=0;!x&&d.layers&&i<d.layers.length;i++)x=findObj(n,d.layers[i].document, '0')

        return x

}