﻿// JScript File
var scrollableGalleryPopupTop=0;
var scrollableGalleryPopupLeft=0;
var scrollableGalleryPopupCssClass='';

function ScrollableGalleryPopupHover(gallery,index)
{
    try
    {
        var divPopup = document.getElementById('divScrollableGalleryPopupHover');
        var imgPopup = document.getElementById('imgScrollableGalleryPopupHover');

        if(divPopup == null)
        {
            divPopup = document.createElement('div');
            divPopup.id = 'divScrollableGalleryPopupHover';
            divPopup.style.position = 'absolute';
            divPopup.style.top = scrollableGalleryPopupTop + "px";
            divPopup.style.left = scrollableGalleryPopupLeft + "px";
            
            imgPopup = new Image();
            imgPopup.id = 'imgScrollableGalleryPopupHover';
            imgPopup.className = scrollableGalleryPopupCssClass;
            
            divPopup.appendChild(imgPopup);
            document.forms[0].appendChild(divPopup);
        }

        imgPopup.src = gallery.images[index].path;
        imgPopup.style.width = gallery.images[index].width;
        imgPopup.style.height = gallery.images[index].height;
        divPopup.style.display = 'block';
    }
    catch(err)
    {
        alert(err.message);
    }
}

function ScrollableGalleryPopupHoverStop(gallery)
{
    var divPopup = document.getElementById('divScrollableGalleryPopupHover');

    if(divPopup != null)
    {
        divPopup.style.display = 'none';
    }
}

function ScrollableGalleryPopupInit(gallery,top,left,cssClass)
{
    scrollableGalleryPopupTop = top;
    scrollableGalleryPopupLeft = left;
    scrollableGalleryPopupCssClass = cssClass;
    gallery.onHover = ScrollableGalleryPopupHover;
    gallery.onHoverStop = ScrollableGalleryPopupHoverStop;
}
