﻿var compassMultiport = compassMultiport || {};

compassMultiport = {
    config: {
        container: '#multiport-compass',
        container_links: '#multiport-compass-links'
    },
    init: function() {
        var compass_obj = this;
        jQuery(this.config.container_links + ' > a').each(function(i, item) {
            var obj_index = i,
                obj_link = jQuery(this);
            obj_link.mouseover(function() {
                compass_obj.showToolTip.call(compass_obj, obj_index);
            });
            obj_link.mouseout(function() {
                compass_obj.showToolTip.call(compass_obj, -1);
            });
        });
    },
    showToolTip: function(link_index) {
        var css_bg = '',
            obj_links = jQuery(this.config.container_links),
            obj_text = (link_index > -1 ? jQuery('#compass-text-' + (link_index + 1)) : jQuery('.compass-text:visible')),
            y_index = (link_index * 191);
        if (link_index === -1) {
            css_bg = '';
            obj_links.css('background', '');
            obj_text.css('display', 'none');
        }
        else {
            css_bg = 'url(/_common/img/multiport-compass-points.gif) 3px -' + y_index + 'px no-repeat';
            obj_links.css('background', css_bg);
            obj_text.show();
        }
    }
};
jQuery(document).ready(function() {
    "use strict";
    compassMultiport.init();
});
