    if (typeof(com) == 'undefined') {
    com = {};
}
if (typeof(com.is_a) == 'undefined') {
    com.is_a = {};
}

com.is_a.ImagePopup = function(domId, imageUrl, imageTitle, popupContainerClass)
{
    this.popupObj = null;
    
    this.init = function()
    {
        var domObj = document.getElementById(domId);
        var self = this;
        domObj.onmouseover = function(e) {if (typeof(e) == 'undefined') {e = window.event; } self.showPopup(e);}
        domObj.onmousemove = function(e) {if (typeof(e) == 'undefined') {e = window.event; } self.movePopup(e);}
        domObj.onmouseout  = function(e) {if (typeof(e) == 'undefined') {e = window.event; } self.hidePopup(e);}
    }
    
    this.showPopup = function(e)
    {
        this.createPopup();
        this.popupObj.style.display = 'inline';
    }
    
    this.hidePopup = function(e)
    {
        this.createPopup();
        this.popupObj.style.display = 'none';
    }
    
    this.movePopup = function(e)
    {
        this.createPopup();
        if (e.pageX) {
            this.movePopupInternal(e.pageX + 10, e.pageY + 10);
        }
        else {
            var obj1 = e.srcElement;
            var ox = 0;
            var oy = 0;
            for(ox = oy = 0; obj1; obj1 = obj1.offsetParent) {
                ox += obj1.offsetLeft;
                oy += obj1.offsetTop;
            }
            this.movePopupInternal(ox + e.offsetX + 10, oy + e.offsetY + 10);
        }
    }
    
    this.createPopup = function(e)
    {
        if (this.popupObj == null) {
            this.popupObj = document.createElement('div');
            this.popupObj.style.display = 'none';
            this.popupObj.style.position = 'absolute';
            this.popupObj.style.left = 0 + 'px';
            this.popupObj.style.top = 0 + 'px';
            this.popupObj.style.zIndex = 1000;
            
            if (typeof(popupContainerClass) != 'undefined' && popupContainerClass != null) {
                this.popupObj.className = popupContainerClass;
            }
            
            if (typeof(imageTitle) != 'undefined' && imageTitle != null) {
                var titleObj = document.createElement('div');
                titleObj.className = 'title';
                titleObj.innerHTML = imageTitle;
                this.popupObj.appendChild(titleObj);
            }
            
            var imageObj = document.createElement('img');
            imageObj.className = 'image';
            imageObj.alt = imageTitle;
            imageObj.src = imageUrl;
            this.popupObj.appendChild(imageObj);
            
            document.body.appendChild(this.popupObj);
        }
    }
    
    this.movePopupInternal = function(x, y)
    {
        this.createPopup();
        this.popupObj.style.left = x + 'px';
        this.popupObj.style.top = y + 'px';
    }
    
    this.isVisible = function()
    {
        if (this.popupObj != null && this.popupObj.style.display != 'none') {
            return true;
        }
        return false;
    }
    
    this.init();
}
