Is it possible to pass a variable as the parameter into a getElementById()? I've been trying to find answers on google and not having much luck. I've heard some say you can but with no examples.

This is what I'm trying to do.

Code:
    function showImage(file1) {
        var largeImage = document.getElementById(file1);

        largeImage.style.display = 'block';
        largeImage.style.width=500+"px";
        largeImage.style.height="auto";

        var url=largeImage.getAttribute('src');
        window.open(url,'Image','width=largeImage.stylewidth,height=largeImage.style.height,resizable=1');
    }
Thanks,