﻿$(document).ready(function () {



    jQuery(function ($) {
        $(".tweet").tweet({
            join_text: "auto",
            username: "bangdrumUK",
            avatar_size: 20,
            count: 2,
            auto_join_text_default: "we said,",
            auto_join_text_ed: "we",
            auto_join_text_ing: "we were",
            auto_join_text_reply: "we replied",
            auto_join_text_url: "we were checking out",
            loading_text: "loading tweets..."
        });
    });





	$('.rel-item-group').hide();





    $('.mainNavigation ul').superfish({ autoArrows: false, dropShadows: true, delay: 1500, animation: { opacity: 'show'}   }); 


    // Set the page columns
    if ($('.ptStandardPage').length > 0) {


        var hasNavigation = false;
        var hasRightImage = false;
        var hasRightContent = false;



        if ($('img.rightimage')) {

            if ($('img.rightimage').length > 0) {
                hasRightImage = true;
            }
        }


        if ($('.subcontent').html() == null && $('.subcontentsubcontent').html() == null) {
            hasRightContent = false;
        }
        else {
            if ($('.subcontent').html().length > 0 || $('.subcontentsubcontent').html().length > 0) {
                hasRightContent = true;
            }
            else {
                hasRightContent = false;
            }
        }






        if ($('ul.side-menu-level-0 li').size() > 0 || $('ul.side-menu-level-1 li').size() > 0) {
            hasNavigation = true;
        }

        if ($('.storeIntroArea').size() > 0) {
            hasNavigation = true;
        }

        if ($('.storeCats').size() > 0) {
            hasNavigation = true;
        }


        /* We always want a navigation */
        hasNavigation = true;


        if ($('.tcontainer').size() > 0) {
            hasNavigation = false;
        }

        if ($('.econtainer').size() > 0) {
            hasNavigation = false;
        }




        if (!hasRightImage && !hasRightContent) {
            $('.ptStandardPage .colc').remove();
        }



        if (!hasNavigation) {
            $('.ptStandardPage .cola').remove();
        }


        if (!hasNavigation && (hasRightImage || hasRightContent)) {
            $('.ptStandardPage .colb').addClass('colb-nonav');
            $('.ptStandardPage .colb').removeClass('colb-3col');
        }
        else if (hasNavigation && (!hasRightImage && !hasRightContent)) {
            $('.ptStandardPage .colb').addClass('colb-noimg');
            $('.ptStandardPage .colb').removeClass('colb-3col');
        }
        else if (!hasNavigation && (!hasRightImage && !hasRightContent)) {
            $('.ptStandardPage .colb').addClass('colb-1col');
            $('.ptStandardPage .colb').removeClass('colb-3col');
        }



    }

    initVerticalMenu()

});


function initVerticalMenu() {
    $('ul.vertical-collapsing-menu li').filter(function(index) {
        if (!$(this).hasClass("selected") && !$(this).hasClass("child-selected")) {
            return true;
        }
        else {
            return false;
        }
    }).find("ul:first").hide();
}
