document.write("<style>#bannerPhotoMain img, #bottomPiece { visibility:hidden; } .u1h{visibility: hidden;}</style>");

var	JavaScriptSchoolID = 90, bannerPhotoID = 20617, tabSuffix = "",
	MenuArray = new Array(
		{pageid:115098,hoffset:0,voffset:0,animate:"true"},
		{pageid:115112,hoffset:-36,voffset:0,animate:"true"},
		{pageid:115113,hoffset:-36,voffset:0,animate:"true"},
		{pageid:115114,hoffset:-36,voffset:0,animate:"true"},
		{pageid:115115,hoffset:-36,voffset:0,animate:"true"},
		{pageid:115116,hoffset:-40,voffset:0,animate:"true"},
		{pageid:115117,hoffset:-50,voffset:0,animate:"true"}
	);


willow.ready(function($){
	willow.smButtons($("#levelList"),16481);

	//emergency bulletin
	$('body').bulletin({sid:90,gid:11294});	
	
	if($.browser.msie && $.browser.version < 7){ $("#bannerTab").addClass("IE6"); }
	$(window).load(function(){
		initMenu("nav","down",MenuArray,pdGlobal.currentPages[0].id);
		$("#nav_115512").atoz({schoolid:JavaScriptSchoolID,groupid:$("#nav_115512").attr("linkID"),hoffset:-626,debug:false});
	});
	
	if(pdGlobal.userLoggedIn == false){
		$(".u1h").css({"background-image":"url(/ftpimages/90/podium/style512/images/portalLoginHeader.png)","background-repeat":"no-repeat"});
		$(".u1h td").css("text-indent","-9999px");
		}
	
	if(pdGlobal.currentPages[0]){
		switch(pdGlobal.currentPages[0].id){
			case 115098: bannerPhotoID = 20609; tabSuffix = "_about"; break;
			case 115112: bannerPhotoID = 20610; tabSuffix = "_admis"; break;
			case 115113: bannerPhotoID = 20611; tabSuffix = "_acad"; break;
			case 115114: bannerPhotoID = 20613; tabSuffix = "_board"; break;
			case 115115: bannerPhotoID = 20614; tabSuffix = "_ath"; break;
			case 115116: bannerPhotoID = 20615; tabSuffix = "_arts"; break;
			//CSP sdb 120810 added font-size condition
			case 115117: bannerPhotoID = 20616; tabSuffix = "_giving"; $("div#L_c1i0_cb282547_ct282547_pnlDisplay .tblcell").css("font-size","12px"); break;
		}
	}
	
	$("#bannerTab").css("background-image",$("#bannerTab").css("background-image").split(".png")[0]+tabSuffix+".png)").html(pdGlobal.currentPages[0].title);

	var defaultBannerPhoto = $("#bannerPhotoMain").html();
	$("#bannerPhotoMain")
		.attr("pid",bannerPhotoID)
		.html("")
		.getPhotoAlbums({
			maxAlbums:1,
			maxItems:1,
			photosPerItem:1,
			hardPhotoWidth:954,
			callback2:function(){
				if($("#bannerPhotoMain img").length==0){ $("#bannerPhotoMain").html(defaultBannerPhoto); }
				$("#bannerPhotoMain img").css("visibility","visible");
				$("#bottomPiece").css("background-image","url("+$("#bannerPhotoMain img").attr("src")+")").css("visibility","visible");
			}
		});
	$(".u1h").css("visibility","visible");
	
	$('#search').pdSearch({showButton:true, showButtonClass:'search_button',showButtonText:''});
	
	//curriculum landing page and Bording pages - redoing layout, etc.
	/* 	115114 = Boarding L1 landing page
		115516 = Meet Our Girls
		115113 = Academic L1 landing page
	*/
	if(pdGlobal.currentPages[pdGlobal.currentPageLevel-1].id==115113){
		$("#lInTblLCell").css("display","none");
		$("#bannerPhotoStuff").css("display","none");
		$("#lInTblRCell").css({"padding-top":"5px","width":"979px"});
		$("#lOutTbl").css("background-image","url(/images/wideBackground.gif)");
		$("#if115113").css("width","979px");
		$("#footerArea").css("background","url(/ftpimages/90/podium/style512/images/footer_fullWidth.png) no-repeat")
	}

	if(pdGlobal.currentPages[pdGlobal.currentPageLevel-1].id==115516){
		$("#bannerPhotoStuff").css("display","none");
		$("#lInTblRCell").css({"padding-top":"5px"});
		$("#meetOurGirlsPosition").css("display","block");
	}
	
	//i had to add a few
	/*if(pdGlobal.currentPages[pdGlobal.currentPageLevel-1].id==115114 || pdGlobal.currentPages[pdGlobal.currentPageLevel-1].id==116439 || pdGlobal.currentPages[pdGlobal.currentPageLevel-1].id==116440 || pdGlobal.currentPages[pdGlobal.currentPageLevel-1].id==116441){
		$("#lOutTbl").css("background-image","url(/ftpimages/90/podium/style512/images/layoutBack_2.png)");
		$("#bannerPhotoStuff").css("display","none");
		$("#lInTblRCell").css({"padding-top":"5px"});
		$("#boardingPosition").css("display","block");
	}*/
	
	if($(".sitetph").html().length>0) { 
		document.write("<style>#lNavPhoto {border:3px solid #F4F4F4;}</style>");
	}
});

function submitSearch(){
	window.location = "/podium/default.aspx?t=52392&q="+document.getElementById("search").value+"&pt=search";
}
function SubmitOnEnter(evt){
	var charCode = (evt.which) ? evt.which : event.keyCode
	if(charCode == "13" || charCode == "26"){
		submitSearch();
		return false;
	}
}
function clearDefault(search) {
	if (search.defaultValue==search.value) search.value = ""
}


willow.smButtons = function($obj,id){
    willow.getLinks(id,function(data){
        var links = data.link;
        if(links.length === 0){return;}
		$("#lowerSchoolButton").attr("href", links[0].url);
		$("#middleSchoolButton").attr("href", links[1].url);
		$("#upperSchoolButton").attr("href", links[2].url);
    });
}
//function translatePage(languagePair){
	//var e = ( document.charset || document.characterSet ), currentURL = location.href;
	//location.href='http://translate.google.com/translate?u='+escape(currentURL)+'&hl=en&langpair=' + escape(languagePair) + '&tbb=1&ie='+e;
//}

