(function($) {

$.ajaxSetup({cache: false});

$(document).ready(function() {

//add footer information
$("#footer").appendTo("#foxboro_body");
$.get('/Portals/86473/footerStuff.html', function(data) {
	$('#footer').append(data);
});

//google search box
$("#googlesearchbox").prependTo("#foxboro_header .search");
$("#googlesearchbox .googlesearch").val("Search...");
$("#googlesearchbox .googlesearch").click(function() {
	if($(this).val() == "Search...") $(this).val("");
	$(this).addClass("focused");
});
$("#googlesearchbox .googlesearch").blur(function() {
	if($(this).val() == "") $(this).val("Search...");
	$(this).removeClass("focused");
});

// SHOW BLOG NAVIGATION OPTIONS IF LOGGED IN
if( $("#hsnavigation").length) {
    $("p.hk_menu").show();
}

// NAVIGATION MENU
$("#foxboro_menu li.separator").remove();
$("#foxboro_menu ul.level1 li").removeClass("last");
$("#foxboro_menu ul.level1 li").removeClass("first");
$("#foxboro_menu ul.level1 li").each(function(){
    var html = $(this).children(".slide").html();
    $(this).append(html);
    $(this).children(".slide").remove();
});

$("#foxboro_menu div.slide").each(function() {
    var n = $(this).find("ul.vertical.level1").children().has("a").length; //get number of child items
    var w = $(this).width();
    var itemWidth = (w-28);
    var listWidth = (w*2+1);

    $(this).find("ul.vertical.level1").children().has("a").addClass("parent").width(itemWidth);
    $(this).find("li.parent:even").addClass("col1");
    $(this).find("li.parent:odd").addClass("col2");
    $(this).find("li.parent").removeClass("parent");

    $(this).addClass("lw");

    if( n > 1) {
        var dropWidth = (w*2+1);
    }
    $(this).width(dropWidth);
});

// TWO COLUMN RIGHT BOTTOM BACKGROUND
if( $("#foxboro_two-column-right").length) {
    $("#foxboro_bottom").addClass("twocolright");
}

$("div.block:has(.feedreader_box):contains('Axiom Blog')").addClass("blog-block");
$("div.block:has(.feedreader_box):contains('My Recent Blogs')").addClass("blog-block");

});

})(jQuery);
