(function($) {

$(document).ready(function(){

    $.ajaxSetup({cache: false});

    $("div#foxboro_content").prepend("<div id='content-bg-top' />").append("<div id='content-bg-bottom' />");

    $("div#foxboro_three-column, div#foxboro_two-column, div#foxboro_two-column-right").prepend("<div id='three-column-top-padding' />");

    // FORM STYLING
    $(".rugs-analysis-title").closest(".ContactFormWrapper").wrapAll("<div id='rugs-analysis-form' />");

    $("#rugs-analysis-form input.FormSubmitButton").before("<div class='clear' />");


    /* *** CENTERING MAIN NAVIGATION *** */
    var w = $("#foxboro_menu ul").first().width(); //get width of menu
    var w5 = w+5;
    var totalW = 944;
    var leftM = (totalW-w)/2;

    $("#foxboro_menu ul").first().css({"width": + w5 +"px"});
    $("#foxboro_menu ul").first().css({"margin-left": + leftM +"px"});


    // INSERT SITE FOOTER
    $("#foxboro_footer").prepend("<div class='site-footer' />");

        $.get('/Portals/56632/footer-stuff.html', function(data) {
               $('.site-footer').prepend(data);
        });

    // INSERT SIDE NAVIGATION
    if ( $("#foxboro_menu a.selectedtab ~ div.slide").html() != null ) {

        $("#foxboro_col1 .pad:first").prepend("<div id='side-menu' />"),
        $("#foxboro_menu a.selectedtab ~ div.slide ul.level1").clone().prependTo("#foxboro_col1 #side-menu"),
        $("#foxboro_col1 #side-menu li.separator").remove();

    }


    // SHOW BLOG NAVIGATION IF LOGGED IN
    if( $("#hsnavigation").length) {
        $("p.hk_menu").show();
    }

});

})(jQuery);
