﻿$(document).ready(function() {

    $('#topNavContainer').corners("bottom-left 5px");

    $('#breadCrum span span a').each(function(index) {
        $(this).attr('title', $(this).text());
        if (index > 1 && index != $('#breadCrum span span a').length - 1) {

            $(this).text($(this).text().substring(0, 6) + " ...");
        }


    });

    $('#breadCrum span span').each(function(index) {
        if ($(this).text().indexOf('.aspx') > -1) {
            $(this).text($(this).text().substring(0, $(this).text().indexOf('.aspx')));
        }
    });

    $('div.rigthWebpart td[id*=MSOZoneCell_]').each(function() {

        if ($(this).find('div.latestNewsItems ul li').length == 0) {
            
            if ($(this).find('.slm-layout-main').length < 2 && $(this).find('.ms-toolbarContainer').length == 0) {
                $(this).css('display', 'none');
            }
        }
    });

    $('.ms-formfieldvaluecontainer div.rtMid').each(function(index) {

        if ($(this).children('.rtPlus,.rtMinus').length == 0) {
            $(this).children('input').css('margin-left', '16px');
        }

    });

    $('.ms-formfieldvaluecontainer ul.rtUL li.rtLI ul.rtUL div.rtMid ').each(function(index) {

        $(this).children('input').css('margin-left', '5px');

    });

    if ($('.allGroups ~ div').text() == "") {
        $('.allGroups').parent().css('display', 'none');
    }

    if ($('.sponserText ~ div').text() == "") {
        $('.sponserText').parent().css('display', 'none');
    }

    if ($('.sponserText ~ div').text() == "") {
        $('.sponserText').parent().css('display', 'none');
    }

    if ($('.eloAndSponsers ~ div').text() == "") {
        $('.eloAndSponsers').parent().css('display', 'none');
    }

    //    if ($('.articleBlue ~ div').text() == "") {
    //        $('.articleBlue').parent().css('display', 'none');
    //    }


    if ($('#ctl00_PlaceHolderMain_RichHtmlField4__ControlWrapper_RichHtmlField').text() == "") {
        $('#ctl00_PlaceHolderMain_RichHtmlField4__ControlWrapper_RichHtmlField').css('display', 'none');
        $('.furtherInformation').css('display', 'none');
    }

    if ($('#ctl00_PlaceHolderMain_RichHtmlField5__ControlWrapper_RichHtmlField').text() == "") {
        $('#ctl00_PlaceHolderMain_RichHtmlField5__ControlWrapper_RichHtmlField').css('display', 'none');
        $('.relUrkoArticles').css('display', 'none');
    }

    if ($('.ExpectedCallDateDiv').html() != null && $('.ClosingDateDiv').html() != null) {
        if ($('.ExpectedCallDateDiv').html().trim() == '&nbsp;') {
            $('.ExpectedCallDateClass').css('display', 'none');
        }

        if ($('.ClosingDateDiv').html().trim() == '&nbsp;') {
            $('.ClosingDateClass').css('display', 'none');
        }
    }


    if ($('.ms-WPTitle span').text() == "Sitemap") {

        $('.rtFirst > ul > li ul li a').css('font-weight', 'normal');
        $('.rtFirst > ul > li > div a').css('font-weight', 'bold');
    }

    $('h3.ms-standardheader').parent().css('max-width', '200px');    

    $('li.items a').each(function(index) {
       
       
       
    });
});
