﻿

// ALT Background Color JS Plug-in TEMPORARY Placement


(function(a){a.fn.alternate=function(b,c){var d=a.extend({},a.fn.alternate.defaults,b);return this.each(function(e){var f=a(this),g=a.meta?a.extend({},d,f.data()):d;if(e%2==0&&d.even.length){f.removeClass(d.odd).addClass(d.even)}else{if(d.odd.length){f.removeClass(d.even).addClass(d.odd)}}if(c){f.click(c)}if(d.hover){f.bind("mouseenter mouseleave",function(h){a(this).toggleClass("hover")})}})};a.fn.alternate.defaults={odd:"odd",even:"even",hover:false}})(jQuery);

function showHelp()
{
    document.getElementById("SearchHelp").style.visibility = "visible";
}

//------------------------------------------------------------
// onMouseOut fix on nested elements.
//------------------------------------------------------------
function is_Child_Of(parent, child)
{
    if (child != null)
    {
        while (child.parentNode)
        {
            if ((child = child.parentNode) == parent)
            {
                return true;
            }
        }
    }
    return false;
}

function hideHelp(element, event)
{
    var current_mouse_target = null;
    if (event.toElement)
    {
        current_mouse_target = event.toElement;
    }
    else if (event.relatedTarget)
    {
        current_mouse_target = event.relatedTarget;
    }
    if (!is_Child_Of(element, current_mouse_target) && element != current_mouse_target)
    {
        document.getElementById("SearchHelp").style.visibility = "hidden";
    }
}

function showPhoto(imagePath, oElement)
{
    var parentDiv = document.body;
    var ypos = parentDiv.offsetTop;
    var xpos = parentDiv.offsetLeft;
    while (oElement != null)
    {
        ypos += oElement.offsetTop;
        xpos += oElement.offsetLeft;
        oElement = oElement.offsetParent;
    }
    
    var newDiv = document.createElement("div");
    newDiv.setAttribute("id", "idFloatingDiv");
    newDiv.setAttribute("class", "clsFloatingDiv");
    newDiv.setAttribute("className", "clsFloatingDiv");
    newDiv.style.top = ypos + "px";
    newDiv.style.left = xpos + "px";
    newDiv.innerHTML = "<img src=\"" + imagePath + "\" alt=\"\" />";
    
    parentDiv.appendChild(newDiv);
}

function hidePhoto()
{
    var container = document.body;

    for (i = container.childNodes.length - 1; i >= 0; i--) {
        if (container.childNodes[i].id == "idFloatingDiv") {
            container.removeChild(container.childNodes[i]);
        }
    }
}
