﻿var navrollover = function()
{
    var _this = this;
    var _images = new Array();
    
    _this.Init = function()
    {
        var imgs = document.getElementById("navbuttons").getElementsByTagName("img");
        var imgCount = 0;
        
        if(imgs && imgs.length && imgs.length > 0)
        {
            for(x=0; x < imgs.length; x++)
            {
                if(imgs[x].className == "navimg")
                {
                    _images[imgCount] = imgs[x];
                    _this.HookUpRollover(imgs[x]);
                    imgCount++;
                }
            }
        }
    }
    
    _this.HookUpRollover = function(img)
    {
        var activeSrc = img.getAttribute("activesrc");
        var inactiveSrc = img.getAttribute("inactivesrc");
        if(activeSrc && inactiveSrc)
        {
            Common.AddEvent(img, "mouseover", function(){_this.SwapImg(img, activeSrc)}, false)
            Common.AddEvent(img, "mouseout", function(){_this.SwapImg(img, inactiveSrc)}, false)
        }
    }
    
    _this.SwapImg = function(el, imgSrc)
    {
        el.src = imgSrc;
    }
}
var NavRollover = new navrollover();
Common.RegisterOnLoad(NavRollover.Init);