

/*!
* jQuery JavaScript Library v1.4.2
* http://jquery.com/
*
* Copyright 2010, John Resig
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* Includes Sizzle.js
* http://sizzlejs.com/
* Copyright 2010, The Dojo Foundation
* Released under the MIT, BSD, and GPL Licenses.
*
* Date: Sat Feb 13 22:33:48 2010 -0500
*/


/*To add classes of the same name to the top nav control*/

$(document).ready(function () {


    /*Take the Left Navigation the selected class for it to highlight on selected*/
    var current = window.location.pathname + window.location.search;
    $("a[href='" + current + "']").parent().parent().show();
    $("a[href='" + current + "']").parent("li").addClass("selected");



    /*
    $('#main-nav ul ul li > a span.menu-item-text').each(function () {
    $(this).parent().parent().parent().addClass($(this).html().toLowerCase());
    });*/

    /*There are for the Main Global Nav - incrementing the class name*/
    $('#main-nav ul ul li.static > a span.menu-item-text').each(function (i) {
        $(this).parent().parent().parent().addClass("maintetleyNav" + i);
    });

    /*There are for the Main Global Sub Nav - incrementing the class name*/
    $('#main-nav ul ul li.static ul.dynamic li.dynamic> a span.menu-item-text').each(function (i) {
        $(this).parent().parent().parent().addClass("MaintetlySubNav" + i);
    });

    /*To prevent the default href*/
    $('#main-nav ul ul li.static > a').click(function (event) {
        event.preventDefault();
    });

    /* this is for footer - Adding | between each item in footer
    $('.footer-links ul li:not(:last)').after('<li class="spacerLine">|<li>');*/
    $('.footer-links ul li:last-child .link-item').css('border-right', 'none');


    /*There are for the left tea bags - incrementing the class name*/
    $('.quick-links .general-Quick-Links ul li div.link-item > a').each(function (i) {
        $(this).parent().parent().parent().addClass("LeftBubble" + i);
    });
    /*There are for the Right tea bags - incrementing the class name*/
    $('.quick-links .social-Quick-Links ul li div.link-item > a').each(function (i) {
        $(this).parent().parent().parent().addClass("RightBubble" + i);
    });

    /*Left Nav - Incrementing class name*/
    $('#s4-leftpanel ul.root > li.static > a span.menu-item-text').each(function (i) {
        $(this).parent().parent().parent().addClass("maintetleyLeftNav" + i);
    });

    /*Left Nav - Incrementing class name*/
    $('#s4-leftpanel ul.root > li.static > ul.static li > a span.menu-item-text').each(function (i) {
        $(this).parent().parent().parent().addClass("maintetleyLeftNavSubMenus" + i);
    });

    $('#s4-leftpanel ul.root > li.static').each(function (i) {
        $(this).before("<div class=beforeli" + i + "></div>");
        $(this).after("<div class=afterli" + i + "></div>");

    });


    $('#s4-leftpanel ul.root > li > a').click(function (event) {
        event.preventDefault();
    });


    $('#main-nav ul.root li.selected ul.static li').hover(function () { $(this).children('ul').addClass('navHoverBlock') }, function () { $(this).children('ul').removeClass('navHoverBlock') });
    $('ul .maintetleyNav0 ul.dynamic li').hover(function () { $(this).css('background-color', '#739ece') }, function () { $(this).css('background-color', 'transparent'); });
    $('ul .maintetleyNav1 ul.dynamic li').hover(function () { $(this).css('background-color', '#c9b7d8') }, function () { $(this).css('background-color', 'transparent'); });
    $('ul .maintetleyNav2 ul.dynamic li').hover(function () { $(this).css('background-color', '#7BC7A5') }, function () { $(this).css('background-color', 'transparent'); });
    $('ul .maintetleyNav3 ul.dynamic li').hover(function () { $(this).css('background-color', '#F7BA84') }, function () { $(this).css('background-color', 'transparent'); });

    if ($('.userLogout').length > 0) {
        $('.social-Quick-Links').css('margin-top', '18px');
    }

    if ($('.tetley-bottom-area').children().length <= 0) {
        $('.tetley-bottom-area').css('display', 'none');
    }
    if ($('.tetley-center-area').children().length <= 0) {
        $('.tetley-center-area').css('padding-top', '0px');
    }

});



