var imgpoppaLoaded = false;

function initimgpoppa(idLinkElem, imgSrc,  debug ) {
    if (typeof(debug) != 'boolean') {
        debug = false;
    } else {
        debug = true;
    }

    if (typeof(imgSrc) != 'string') {
        if (debug) { alert('imgSrc muss string sein'); }
        return false;
    }

    if (typeof(idLinkElem) != 'string') {
        if (debug) { alert('idLinkElem muss string sein'); }
        return false;
    }

    if (typeof(mapping) != 'object') {
        mapping = { };
    }

    var ip = new ImgPoppa(imgSrc, debug);
    var node = document.getElementById(idLinkElem);
    node.onclick = function() { ip.onclick(); };
    node.style.visibility = 'visible';
}

function ImgPoppa(imgSrc, debug) {
    this.imgSrc = imgSrc;
    this.debug = debug;
	
    var _self = this;

    this.onclick = function () {
        document.getElementById('imagepoppa').style.display = 'block'; 
        document.getElementById('imagepoppaBg').style.display = 'block'; 
        document.getElementById('imagepoppaImg').src = _self.imgSrc; 
        currentImgPoppa = this;
    }

}

var currentImgPoppa = null;

function closeImagePoppa()  {
        document.getElementById('imagepoppa').style.display = 'none'; 
        document.getElementById('imagepoppaBg').style.display = 'none'; 
}
