
    var theList = new Array(38,38,40,40,37,39,37,39,66,65);
    var currentPos = 0;
    function showImage() {
        var theMainCont = document.getElementById("theMainContainer");
        var newDiv = document.createElement("div");
        var availHeight = screen.availHeight;
        var availWidth = screen.availWidth;
        var imageHeight = availHeight * 0.9;
        var imageWidth = availWidth * 0.9;
        var topCoord = (availHeight - imageHeight) / 2;
        var leftCoord = (availWidth - imageWidth) / 2;
        var divStyle ="position:absolute;width:" + imageWidth + "px;height:" + imageHeight + "px;"
        divStyle += "margin:0;padding:0;z-index:1;text-align:center;background-color:#A0A0A0;top:" + topCoord + "px;left:" + leftCoord + "px;border:2px solid #FFFFFF;"
        var theHTML = "<br/><h2>&iexcl;TATACHAN CODE!</h3> <br/>";
        theHTML += "<img src='http://www.tatachan.com/img/tatachanos/aleatorio.jpg' height='496' width='421' alt='tatachan Code' style='margin:0 auto;border:none;'/>";
        theHTML += "<br/><p style='background-color:#A0A0A0;'>Enhorabuena por usar el c&oacute;digo. Eres uno de los nuestros. <br/><br/>"
        theHTML += "&iexcl;Pulsa en cualquier parte para cerrar la imagen,<br/> y luego publica tus im&aacute;genes y comentarios";
        theHTML += " en <a href='http://www.tatachan.com'>tatachan.com!</a></p>";
        newDiv.setAttribute("style", divStyle);
        newDiv.setAttribute("onclick", "this.style.display='none';");
        newDiv.innerHTML = theHTML;
        theMainCont.appendChild(newDiv);
        window.scroll(0, 0);
    }
    function handleKeyPress(e) {
        // keydown to catch scroll arrows in IE
        var theEvent = (window.event) ? event : e;
        var unicode = (theEvent.keyCode) ? theEvent.keyCode : theEvent.charCode;        
        var currentListItem = theList[currentPos];
        if(currentListItem != unicode) {
            currentPos = 0;
        } else {
            currentPos++;
        }
        if(currentPos >= theList.length) {
            currentPos = 0;
            showImage();
        }        
    }
    
    document.onkeydown = handleKeyPress;