﻿
    function zxcMapPopUp(o) {
        this.img = document.getElementById(o.ImageID);
        var hotspot = document.getElementById(o.HotSpotID);
        var coords = hotspot.coords.split(',');
        this.oslft = coords[0] * 1 + o.OffsetLeft;
        this.ostop = coords[1] * 1 + o.OffsetTop;
        this.pop = document.getElementById(o.PopID);
        this.oop = new zxcAnimate('height', this.pop, 0);
        this.max = this.pop.offsetHeight;
        this.ms = o.Duration;
        this.to = null;
        var oop = this;
        hotspot['on' + o.EventType] = function () { oop.Show(); }
        this.pop.onmouseout = function (e) { oop.Hide(e); }
        this.pop.onmouseover = function (e) { clearTimeout(oop.to); }
    }

    zxcMapPopUp.prototype = {

        Show: function () {
            this.pop.style.visibility = 'visible';
            this.oop.animate(this.oop.data[0], this.max, this.ms)
            this.pop.style.left = this.Pos(this.img)[0] + this.oslft + 'px';
            this.pop.style.top = this.Pos(this.img)[1] + this.ostop + 'px';
        },

        Hide: function (e) {
            var oop = this;
            this.to = setTimeout(
   function () {
       oop.oop.data[0] = 0;
       oop.pop.style.visibility = 'hidden';
   }, 200);
        },

        Pos: function (obj) {
            var rtn = [0, 0];
            while (obj) {
                rtn[0] += obj.offsetLeft;
                rtn[1] += obj.offsetTop;
                obj = obj.offsetParent;
            }
            return rtn;
        }



    }


    new zxcMapPopUp({
        ImageID: 'grey_menu',
        HotSpotID: 'season_link',
        PopID: 'submenu1',
        OffsetLeft: -118,
        OffsetTop: 32,
        Duration: 0,
        EventType: 'mouseover'
    });



