willow.fixPodiumNav();

document.write("<style>#afPlugin { visibility:hidden; }</style>")
document.write("<style>#lNavPhoto { display:none; }</style>")

var	JavaScriptSchoolID = 396, EM_ID = 11728
	//MenuArray = new Array(
		//{pageid:117444,hoffset:14,voffset:-7,animate:"true"},
		//{pageid:117445,hoffset:6,voffset:-7,animate:"true"},
		//{pageid:117446,hoffset:7,voffset:-7,animate:"true"},
		//{pageid:117447,hoffset:7,voffset:-7,animate:"true"},
		//{pageid:117448,hoffset:-67,voffset:-7,animate:"true"}
	//)
	;

willow.ready(function($) {
    var options = {
        direction:"down",
		currentL1: pdGlobal.currentPages[0].id,
		showL3s:false,
		debug:true
    };

    willow.getMenu("117444|117445|117446|117447|135048|117448",function(data){
		$("#nav").menu(data.menu,options);
     });
     
    var inputFix = [136502,136504];
    for(var i = 0; i < inputFix.length; i++){
    	if(inputFix[i] === pdGlobal.currentPages[pdGlobal.currentPageLevel-1].id){
    		$("input").css("width","104px");
    	}
    }
	
	willow.smButtons($("#buttons"),17402);

	$("body").bulletin({sid:JavaScriptSchoolID,gid:EM_ID,emButton:true});

	$(".afPlugin").create_annual_fund({
		transWindowOverlay:true,
		dropDecimals:true,
		html:"/afBar.html",
		callback:function(obj){
			if($.browser.msie){ obj.addClass("IE6_ver"); }
			obj.css("visibility","visible");
		}
	});

	//$(window).load(function(){ initMenu("nav","down",MenuArray,pdGlobal.currentPages[0].id); make_pdL("nav"); });
	$("#lNavPhoto").css("display",(($("#lNavPhoto img").length<1)?"none":"block"));

	//change background images based on page type, to show full background
	if(pdGlobal.currentPages[pdGlobal.currentPageLevel-1].type == "portal" || pdGlobal.currentPages[pdGlobal.currentPageLevel-1].type == "application"){
		$("#lOutTblLCell").css("background-image","url(/ftpimages/396/podium/style506/images/lInTblBack_full.png)");
		$("#lInTblRCell").css("background-image","url(/ftpimages/396/podium/style506/images/page_top_full.png)");
		$(".nav").css("background-image","url(/ftpimages/396/podium/style506/images/nav_full_v2.png)");
		$("#positionNav").css("margin","32px 0px 0px 0px");
		$("#footerArea").css("width","980px");
		$("#footerArea").css("background-image","url(/ftpimages/396/podium/style506/images/footer_full_v2.png)");
	}
	
	//CSP sdb 032210 added this section
	if(pdGlobal.currentPages[pdGlobal.currentPageLevel-1].id == 204 && pdGlobal.currentPageLevel == 3){
		$(".ndob").css("width","750px");
		$(".ptWrap").css("width","680px");
		$("td.cchtxt > div").css("width","265px");
	}else if(pdGlobal.currentPages[pdGlobal.currentPageLevel-1].id == 204 && pdGlobal.currentPageLevel == 4){
		$(".ndob").css("width","750px");
		$(".ptWrap").css("width","680px");
	}
});


/* Search Functions */
function submitSearch(){ __pdSiteSearch('SCHOOL NAME HERE', document.getElementById("search").value); }
function SubmitOnEnter(evt){
	var charCode = (evt.which) ? evt.which : event.keyCode
	if(charCode == "13" || charCode == "26"){ submitSearch(); return false; }
}

/* Set Up Podium Style Linking */
function make_pdL(ulID){
	if(pdGlobal){
		$("#"+ulID+" li a").each(
			function(){
				var pageID = $(this).attr("href").split("=")[1];
				if(pageID.indexOf("&")>-1 && $(this).attr("href").indexOf("podium")>-1){ pageID = pageID.split("&")[0]; }
				$(this).attr("href",(pdGlobal.userLoggedIn && !$(this).hasClass("noPDL"))?"javascript:__pdL('"+pageID+"','"+$(this).text()+"', '2', '', 'pbContent', 'True', '0', '', 'default.aspx')":$(this).attr("href"));
			}
		);
		$("a.subMenuItemsdown", $("#"+ulID).parent()).each(
			function(){
				if(pdGlobal.userLoggedIn && !$(this).hasClass("noPDL") && $(this).attr("href").indexOf("podium")){
					$(this).attr("href","javascript:__pdL('"+$(this).attr("href").split("=")[1]+"','"+$(this).text()+"', '2', '', 'pbContent', 'True', '0', '', 'default.aspx')");
				}
			}
		);
	}
}

/* Self Manged Links */
willow.smButtons = function($obj,id){
	willow.getLinks(id,function(data){
		var links = data.link;
		if(links.length === 0){return;}
		var linksString = "<ul class='smbuttons_"+id+"'>";
		for(var i = 0; i < links.length; i++){
			linksString += "<li><a href='"+links[i].url+"' target='"+((links[i].target == "true")?"_blank":"_self")+"'>"+((typeof links[i].image !== "undefined") ? "<img src='"+links[i].image.path+"' border='0'/>" : links[i].title)+"</a></li>";
		}
		linksString += "</ul>";
		$obj.html(linksString);
	});
}

