﻿$(document).ready(function () {
    var mapScroll = function() {
        var self = this;
        var init = function() {
            for (var i = 2; i < 7; i++) {
                $('<img id="mapImg' + i + '" src="/WEFiles/css/images/abroad/map/' + i + '.jpg" style="display: none;" alt="" />').appendTo($('#mapHolder'));
            }
            $('#globalmap area').each(function(i) {
                $(this).mouseover(function() { self.show(i + 2); });
                $(this).mouseout(function() { self.show(1); });
            });
        };

        this.show = function(idx) {
            for (var i = 1; i < 7; i++) {
                if (i == idx) {
                    $('#mapImg' + i).css('display', '');
                }
                else {
                    $('#mapImg' + i).css('display', 'none');
                }
            }
        };

        init();
    };
    var _mapscroll = new mapScroll();

    var tablist = tabList($('#pager_icons a'), $('#dCourseList table'));

    var Institutions = [
                '维伯教育南宁中心|民族大道泰安大厦8楼|0771-5888088 5888188',
                '维伯教育大学路中心|南宁火炬路1号城市便捷酒店4楼|0771-3847752 3847795',
                '维伯教育柳州中心|中山中路2号兴隆大厦9楼|0772-2839777 2830532',
                '维伯教育桂林中心|中山中路33号康美大厦503室|0773-5634518 2807728',
                '维伯教育北海中心|北京路中环广场2楼|0779-3079255 3200079',
                '维伯教育梧州中心|文澜路13号文澜大厦2楼|0774-2281358'
            ];
    (function() {
        $('#mapIdxCMap area').each(function(i) {
            $(this).mouseover(function() {
                var d = Institutions[i].split('|');
                var des = '';
                for (var ii = 0; ii < d.length; ii++) {
                    des += '<p>' + d[ii] + '</p>';
                }
                $('#idxCMapIntro').html(des);
            });
            $(this).mousemove(function(e) {
                var pnl_h = $('#idxCMapIntro').outerHeight(true);
                var pnl_w = $('#idxCMapIntro').outerWidth(true);
                $('#idxCMapIntro').css({ "left": (e.pageX - parseInt(pnl_w / 2)) + "px", "top": (e.pageY - pnl_h - 5) + "px" });
            });
            $(this).mouseout(function() {
                $('#idxCMapIntro').css({ "left": "-1000px", "top": "-1000px" });
            });
        });
    })();
});
