﻿function Utilities()
{
    this.InitializeHover = function()
    {
        $(function()
        {
            $("img[hover]").each(function(index, domElement)
            {
                domElement.onmouseover = function()
                {
                    domElement.oldSrc = domElement.src;
                    domElement.src = domElement.getAttribute("hover");
                }
                domElement.onmouseout = function()
                {
                    if (domElement.oldSrc)
                    {
                        domElement.src = domElement.oldSrc;
                        domElement.oldSrc = null;
                    }
                }
            });
        });
    }
    
    this.GetBaseURL = function()
    {
        var baseTag = $(document).find("head base");
        if (baseTag.length == 1)
            return baseTag.attr("href");
        else
        {
            var path = window.location.pathname.substring(0, window.location.pathname.lastIndexOf('/'));
            return window.location.protocol + "//" + window.location.host + path + "/";
        }
    }
}

var Utilities = new Utilities();
