﻿var topflopBoxWidths = new Object();

if(jQuery("#startPageAjaxMode").val() == "True")
    addWPTips();

function makeEllipsis(event, jqEvent, panel) {

    if(typeof panel == "undefined"){
        panel = jqEvent.panel;
    }
    
    $(panel).find(".trexTable tbody td.first a:not(:has(p))").wrapInner("<p class='wrap1lineSP'></p>");
    if (!(jQuery.browser.msie && jQuery.browser.version == "6.0")) {
        $(panel).find(".wrap1lineSP:not(.wrapped)").each(function(){
           //var titleAttr = this.parentNode.title == "" || this.parentNode.title == null ? true : false;
           $(this)
            .textOverflow({ "titleAttr": false, "lines": 1, "wrap": "char" })
            .addClass("wrapped"); 
        });
    }
    $(panel).find(".wrap1lineSP").css("display", "inline");
    
    $(".SPBottomContent thead td").each(function(){
        var key = jQuery.trim($(this).text());
        if(topflopBoxWidths[key])
        {
            $(this).width(topflopBoxWidths[key]);
        }
    });
}

$(document).ready(function() {
    $('.SPTopSection ul, .SPBottomSection ul').unbind('tabsload');
    $('.SPTopSection ul, .SPBottomSection ul').bind('tabsload', function(event, jqEvent) {
        $(jqEvent.panel.parentNode).find(".ui-tabs-panel").addClass("ui-tabs-hide");
    }).tabs('option', 'spinner', '...');
    
    if (jQuery.browser.msie && jQuery.browser.version == "6.0") {
        $(".last-tab").removeAttr("style");
    }
    
    $(".singleTab").each(function(){makeEllipsis(null,null,this)});
    
    $(".SPBottomContent thead td").each(function(){
        var key = jQuery.trim($(this).text());
        topflopBoxWidths[key] = $(this).width();
    });

});