﻿function cImageMap() 
{
    this.init = function(imID, bgID) {
        var map, i, im;
        im = document.getElementById(imID);
        if (im != null) 
        {
            // get array of map area tags
            map = im.getElementsByTagName('area');
            for(i=0;i<map.length;i++)
            {
                map[i].onmouseover = new Function('ImageMap.shift(this, \'' + bgID + '\');');
                map[i].onmouseout = new Function('ImageMap.shift(this, \'' + bgID + '\');');
            }
        }
    }
    this.shift = function(o, bgID) {
        var mapbg, id;
        id = o.id;
        mapbg = document.getElementById(bgID);
        if(id == mapbg.className){
            mapbg.className = ''; 
        }else{
            mapbg.className = id;
        }
    }
}
