var resized_images_width = new Array(); 
var resized_images_height = new Array();

        function fullscreen(){ 
                scrollbars = 0; 
                var oSource = this.src;
                var urlhost = window.name;
                oSource = oSource.replace(urlhost, "")
                width = resized_images_width[oSource];
                height = resized_images_height[oSource]; 

                url = urlhost+"/image.php?src="+oSource+"&width="+width+"&height="+height;

                if(width > screen.availWidth){
                        width = screen.availWidth; 
                        scrollbars = 1; 
                } 

                if(height > screen.availHeight){ 
                        height = screen.availHeight; 
                        scrollbars = 1; 
                } 

                fullscr = window.open(url);
        } 

        function resize(image){ 
                if(!image){ 
                        var image = window.event.srcElement.src;
                } 

                width = image.width; 
                height = image.height; 
                var url = image.src; 

                if(width>480){ 
                        resized_images_width[url] = width; 
                        resized_images_height[url] = height; 
                        image.width = 480; 
                        image.alt = 'Originele grootte: '+width+'x'+height; 
                        image.style.border = "dashed 1px red"; 
                        image.style.cursor = "pointer";
                        image.onclick = fullscreen;
                        image.height = Math.floor(height/(width/500)); 
                } 
        } 

        function check_images(){ 
                count = document.images.length; 
                i = 0; 

                while(count>i){ 
                        url = document.images[i].src; 

                        if(!url.match(/test/)){ 
                                if(document.images[i].complete){ 
                                        resize(document.images[i]); 
                                }else{ 
                                        document.images[i].onload = resize; 
                                } 
                        } 
                        i++; 
                } 
        }
        

