willow.fixPodiumNav();

var isiPad = navigator.userAgent.match(/iPad/i) != null;
var isiPod = navigator.userAgent.match(/iPod/i) != null;
var isiPhone = navigator.userAgent.match(/iPhone/i) != null;



willow.ready(function($) {
	//menu code
	var options = {
		showL3s: false,
		debug: false,
		closeDelay:100,
		currentL1:pdGlobal.currentPages[0].id
    };
	var $sitemap = $(".sitemap");
    willow.getMenu("132080|132082|132083|132084",function(data){
		//drop down menus
		$('#L1').menu(data.menu,options);
		//sitemap
		if($sitemap.length > 0){
			$sitemap.sitemap(data);
		}
	});
	
	$('#search').pdSearch({showButton:true, showButtonClass:'searchSubmit',showButtonText:''});

	//pulling in footer buttons using pack.writeLinks.js, see jquery.json.writeLinks.js for unpacked version
	$("#footerButtons").writeLinks({maxLinks:3, linkImage: 1,hardPhotoWidth: 0, hardPhotoHeight: 49});
 
	//adding height to user nav footer if there's no school nav
	if(pdGlobal.currentPages[pdGlobal.currentPageLevel-1] != undefined){
		if(pdGlobal.currentPages[pdGlobal.currentPageLevel-1].type!="content") {
			$(".unftr").css("height","9px");
		}
		if(pdGlobal.currentPages[pdGlobal.currentPageLevel-1].id==132079){
			$("body").addClass("homePage");
			
			if(isiPad || isiPod || isiPhone){
				$("#getFlash").hide();
			}else{
				flashembed("flashContainer", {src: "/flash/millbrook_home_BC4.swf", wmode: 'transparent'});
			}
			
			//checking page level for news archive, which has same pageID when following link from homepage
			if(pdGlobal.currentPageLevel == 2){
				$("body").removeClass("homePage");
			}
		}
		if(pdGlobal.currentPages[pdGlobal.currentPageLevel-1].id!=132079){
			$("body").removeClass("homePage");
		}
	}
  
	//emergency bulletin
	var bullOptions = {
       	emButton: false
	};
	willow.getNews("12462",function(data){$('#Form1').bulletin(data,bullOptions);},{"backlink":window.location});
  
});	
