﻿//Example to add to tag below
//onmousemove="ImagePopup('images/Jesus_Christ.jpg', event, 100, 100); return false;" onmousemove="MoveImagePopup(event); return false;" onmouseout="CloseImagePopup(); return false;"

// Set default values for popup window
var imgStyle = "position: absolute; top: 0px; left: 0px; display: none; width: 100px; height: 100px; background-color: white; border: solid 1px black; z-index: 9999999900;";
var tipStyle = "position: absolute; top: 0px; left: 0px; display: none; width: 100px; height: 100px; z-index: 9999999999; text-align: left;";
document.write("<div id='div_Sayer_ImagePopup' style='" + imgStyle + "'><table id='tbl_Sayer_ImagePopup' cellpadding='0' cellspacing='0' border='0' style='width: 100px; height: 100px;'><tr><td align='center' valign='middle'><img id='img_Sayer_ImagePopup' src='' border='0' /></td></tr></table></div><div id='div_SayerTip_ImagePopup' style='" + tipStyle + "'><img id='img_SayerTip_ImagePopup' src='images/textBalloonArrow.gif' border='0' /></div>");

//Makes the popup image window show up and sets the dimensions, start location and image to display
function ImagePopup(url, evt, width, height)
{
    return; // remove to add popup back
    window.status = url;
    var scrollTop = document.body.scrollTop;
    if (window.document.getElementById("img_SayerTip_ImagePopup") != null && url.indexOf("..") == 0)
    {
        window.document.getElementById("img_SayerTip_ImagePopup").src = "../images/textBalloonArrow.gif";
    }
    if (window.document.getElementById("img_Sayer_ImagePopup") != null)
    {
        window.document.getElementById("img_Sayer_ImagePopup").src = url;
        if (window.event)
        {
            window.document.getElementById("img_Sayer_ImagePopup").style.width = width - 10;
        }
        else
        {
            window.document.getElementById("img_Sayer_ImagePopup").style.width = (width - 10) + "px";
        }
    }
    if (window.document.getElementById("div_Sayer_ImagePopup") != null)
    {
        window.document.getElementById("div_Sayer_ImagePopup").style.display = "";
        if (window.document.getElementById("div_SayerTip_ImagePopup") != null)
        {
             window.document.getElementById("div_SayerTip_ImagePopup").style.display = "";   
        }
        if (window.document.getElementById("div_Sayer_ImagePopup") != null)
        {
            window.document.getElementById("tbl_Sayer_ImagePopup").style.pixelWidth = width;
            window.document.getElementById("tbl_Sayer_ImagePopup").style.pixelHeight = height;
        }
        if (window.event)
        {
            window.document.getElementById("div_Sayer_ImagePopup").style.pixelWidth = width;
            window.document.getElementById("div_Sayer_ImagePopup").style.pixelHeight = height;
            if (event.clientY > ((height / 3) * 2))
            {
                window.document.getElementById("div_Sayer_ImagePopup").style.pixelLeft = event.clientX + 32;
                window.document.getElementById("div_Sayer_ImagePopup").style.pixelTop = (event.clientY - ((height / 3) * 2)) + scrollTop;
                if (window.document.getElementById("div_SayerTip_ImagePopup") != null)
                {
                    window.document.getElementById("div_SayerTip_ImagePopup").style.pixelLeft = event.clientX + 3;
                    window.document.getElementById("div_SayerTip_ImagePopup").style.pixelTop = event.clientY - 25 + scrollTop;
                }
            }
            else
            {
                window.document.getElementById("div_Sayer_ImagePopup").style.pixelLeft = event.clientX + 32;
                window.document.getElementById("div_Sayer_ImagePopup").style.pixelTop = 0 + scrollTop;
                if (window.document.getElementById("div_SayerTip_ImagePopup") != null)
                {
                    window.document.getElementById("div_SayerTip_ImagePopup").style.pixelLeft = event.clientX + 3;
                    window.document.getElementById("div_SayerTip_ImagePopup").style.pixelTop = event.clientY - 25 + scrollTop;
                }
            }
        }
        else
        {
            window.document.getElementById("div_Sayer_ImagePopup").style.width = width + "px";
            window.document.getElementById("div_Sayer_ImagePopup").style.height = height + "px";
            if (window.document.getElementById("div_Sayer_ImagePopup") != null)
            {
                window.document.getElementById("tbl_Sayer_ImagePopup").style.width = width + "px";
                window.document.getElementById("tbl_Sayer_ImagePopup").style.height = height + "px";
            }
            if (evt.clientY > ((height / 3) * 2))
            {
                window.document.getElementById("div_Sayer_ImagePopup").style.left = (evt.clientX + 32)  + "px";
                window.document.getElementById("div_Sayer_ImagePopup").style.top = ((evt.clientY - ((height / 3) * 2)) + scrollTop)  + "px";
                if (window.document.getElementById("div_SayerTip_ImagePopup") != null)
                {
                    window.document.getElementById("div_SayerTip_ImagePopup").style.left = (evt.clientX + 3) + "px";
                    window.document.getElementById("div_SayerTip_ImagePopup").style.top = ((evt.clientY - 25) + scrollTop) + "px";
                }
            }
            else
            {
                window.document.getElementById("div_Sayer_ImagePopup").style.left = (evt.clientX + 32) + "px";
                window.document.getElementById("div_Sayer_ImagePopup").style.top = (0 + scrollTop) + "px";
                if (window.document.getElementById("div_SayerTip_ImagePopup") != null)
                {
                    window.document.getElementById("div_SayerTip_ImagePopup").style.left = (evt.clientX + 3) + "px";
                    window.document.getElementById("div_SayerTip_ImagePopup").style.top = (evt.clientY - 25 + scrollTop) + "px";
                }
            }
        }
    }
}

//Moves the popup image window as the mouse moves
function MoveImagePopup(evt)
{
    return; // remove to add popup back
    var scrollTop = document.body.scrollTop;
    if (window.document.getElementById("div_Sayer_ImagePopup") != null)
    {
        if (window.event)
        {
            if (event.clientY > ((window.document.getElementById("div_Sayer_ImagePopup").style.pixelHeight / 3) * 2))
            {
                window.document.getElementById("div_Sayer_ImagePopup").style.pixelLeft = event.clientX + 32;
                window.document.getElementById("div_Sayer_ImagePopup").style.pixelTop = (event.clientY - ((window.document.getElementById("div_Sayer_ImagePopup").style.pixelHeight / 3) * 2) + scrollTop);
                if (window.document.getElementById("div_SayerTip_ImagePopup") != null)
                {
                    window.document.getElementById("div_SayerTip_ImagePopup").style.pixelLeft = event.clientX + 3;
                    window.document.getElementById("div_SayerTip_ImagePopup").style.pixelTop = event.clientY - 25 + scrollTop;
                }
            }
            else
            {
                window.document.getElementById("div_Sayer_ImagePopup").style.pixelLeft = event.clientX + 32;
                window.document.getElementById("div_Sayer_ImagePopup").style.pixelTop = 0 + scrollTop;
                if (window.document.getElementById("div_SayerTip_ImagePopup") != null)
                {
                    window.document.getElementById("div_SayerTip_ImagePopup").style.pixelLeft = event.clientX + 3;
                    window.document.getElementById("div_SayerTip_ImagePopup").style.pixelTop = event.clientY - 25 + scrollTop;
                }
            }
        }
        else
        {
            if (evt.clientY > ((parseInt(window.document.getElementById("div_Sayer_ImagePopup").style.height) / 3) * 2))
            {
                window.document.getElementById("div_Sayer_ImagePopup").style.left = (evt.clientX + 32) + "px";
                window.document.getElementById("div_Sayer_ImagePopup").style.top = ((evt.clientY - ((parseInt(window.document.getElementById("div_Sayer_ImagePopup").style.height) / 3) * 2)) + scrollTop) + "px";
                if (window.document.getElementById("div_SayerTip_ImagePopup") != null)
                {
                    window.document.getElementById("div_SayerTip_ImagePopup").style.left = (evt.clientX + 3) + "px";
                    window.document.getElementById("div_SayerTip_ImagePopup").style.top = (evt.clientY - 25 + scrollTop) + "px";
                }
            }
            else
            {
                window.document.getElementById("div_Sayer_ImagePopup").style.left = (evt.clientX + 32) + "px";
                window.document.getElementById("div_Sayer_ImagePopup").style.top = (0 + scrollTop) + "px";
                if (window.document.getElementById("div_SayerTip_ImagePopup") != null)
                {
                    window.document.getElementById("div_SayerTip_ImagePopup").style.left = (evt.clientX + 3) + "px";
                    window.document.getElementById("div_SayerTip_ImagePopup").style.top = (event.clientY - 25 + scrollTop) + "px";
                }
            }
        }      
    }
}

//Hides the popup image window
function CloseImagePopup()
{
    return; // remove to add popup back
    if (window.document.getElementById("div_Sayer_ImagePopup") != null)
    {
        window.document.getElementById("div_Sayer_ImagePopup").style.display = "none";
        if (window.document.getElementById("div_SayerTip_ImagePopup") != null)
        {
            window.document.getElementById("div_SayerTip_ImagePopup").style.display = "none";
        }
    }
}