document.write("<style>#lNavPhoto img, #bannerArea { visibility:hidden; }</style>");
document.write("<style>#L1title, #L2title, #L3title { visibility:hidden; }</style>");

var bannerImage = "community";

var MenuArray = new Array(
	{pageid : 121235,hoffset:253,voffset:-12},
	{pageid : 121236,hoffset:253,voffset:-12},
	{pageid : 121237,hoffset:253,voffset:-8},
	{pageid : 123143,hoffset:253,voffset:-12,forceLeft:true},
	{pageid : 121239,hoffset:253,voffset:-12,forceLeft:true},
	{pageid : 121240,hoffset:188,voffset:-20,forceLeft:true}
);

willow.ready(function($){

	var menu_options = {
		sid:416,
		direction:"down",
		settings:MenuArray,
		currentL1:pdGlobal.currentPages[0].id
	};
	$('#nav').menu(menu_options);
	
	$('#search').pdSearch({showButton:true, showButtonClass:'searchSubmit',showButtonText:''});

	$("body").bulletin({sid:416,gid:11389,emButton:true});
	//CSP sdb 071610 was $("<img>")
	//CSP sdb 071910 was $("img")
	if($("#lNavPhoto img").length==0){ 
		//CSP sdb 092010 added the height attribute
		$("<img>").attr("src","/images/defaultTaskPhoto.jpg").attr("width","248").attr("height","243").appendTo("#lNavPhoto"); 
	}
	
	$("#lNavPhoto img").css("visibility","visible");
	$("#lNavPhoto").height($("#lNavPhoto img").height());
	
	if(pdGlobal){
		switch(pdGlobal.currentPages[0].id){
			case 121235: bannerImage = "community"; break;
			case 121236: bannerImage = "admission"; break;
			case 121237: bannerImage = "program"; break;
			case 123143: bannerImage = "community"; break;
			case 121239: bannerImage = "giving"; break;
			case 121240: bannerImage = "contact"; break;
			case 1300: $("#bannerArea").css("visibility","visible");break;
		}
		if(pdGlobal.currentPages[pdGlobal.currentPageLevel-1].type == "content"){
			switch(pdGlobal.currentPageLevel){
				default:
				case 3: $("h4#L3title").html(pdGlobal.currentPages[2].title).css("visibility","visible");
				case 2: $("h3#L2title").html(pdGlobal.currentPages[1].title).css("visibility","visible");
				case 1: $("h2#L1title").html(pdGlobal.currentPages[0].title).css("visibility","visible");
			}
		}else{
			$("h2#L1title").html("Community").css("visibility","visible");
		}

		$(".banner").css({
			"background-image":"url(/ftpimages/416/podium/Style518/images/banner/"+bannerImage+".png)",
			"visibility":"visible"
		});

		//initMenu("nav","down",MenuArray,pdGlobal.currentPages[0].id);
		//$("#L2_121240 #menu-header").css("cursor","pointer").click(function(){ 
			//window.location = $("#nav_121240").attr("href"); 
		//});
	}
	
	willow.smButtons($("#icon_area"),18964);
	 
});

willow.smButtons = function($obj,id){
    willow.getLinks(id,function(data){
        var links = data.link;
        if(links.length === 0){return;}
        var lstring = "<ul class='icons'>";
        for(var i = 0; i < links.length; i++){
            lstring += "<li><a href='"+links[i].url+"'" + ((links[i].target == "true") ? " target='_blank'" : "") + ">"+
            ((typeof links[i].image !== "undefined") ? "<img src='"+links[i].image.path+"' border='0'/>" : links[i].title)+"</a></li>";
        }
        lstring += "</ul>";
        $obj.html(lstring);
    });
}

/*function submitSearch(){ window.location = "/podium/default.aspx?t=52392&q="+document.getElementById("search").value+"&pt=Georgetown Day School Search"; }
function SubmitOnEnter(evt){
	var charCode = (evt.which) ? evt.which : event.keyCode;
	if(charCode == "13" || charCode == "26"){ submitSearch(); return false; }
}*/
