﻿jQuery.fn.Tabs = function(options) {
    return this.each(function() {
        jQuery(this).hover(
            function() {
                if (jQuery(this).hasClass("selected-tab")) { return; }
                jQuery(this).css({ textDecoration: 'underline' });
            }, function() { jQuery(this).css({ textDecoration: 'none' }); }
        ).click(function() {
            var _col = jQuery(".content-item");
            var _target = jQuery(this).attr("rel");
            // refresh the map
            if (this.id == 'mapResultTab') {
                //if (typeof MO != 'undefined' && !jQuery(this).hasClass("selected-tab")) { MO.map.reposition(); MO.map.resize(); }
            }
            jQuery("#table-links td.tab").removeClass("selected-tab").children(".tab-left").removeClass("tab-left-hover").children(".tab-content").removeClass("tab-content-hover");
            jQuery(this).addClass("selected-tab").children(".tab-left").addClass("tab-left-hover").children(".tab-content").addClass("tab-content-hover");
            _col.each(function() { jQuery(this).removeClass("display-block"); });
            jQuery(_target).addClass("display-block");
            return false;
        });
    });
};