
willow.ready(function($){	
	willow.getMenu("124030|124031|124032|124033|124034",function(data){
  	 	$('#nav').menu(data.menu,{currentL1:pdGlobal.currentPages[0].id, showL3s:false});
		
		if($sitemap.length > 0){
			$sitemap.sitemap(data);
		}

  	 });	
	var options = {
		xml_path:"/xml/default.asp",
		sid:439,
		gid:11114
	};
	$('body').bulletin(options);
		
	switch(pdGlobal.currentPages[0].id){
		case 124030: GetPhotos(18127); break; //student life
		case 124031: GetPhotos(18129); break; //about
		case 124032: GetPhotos(18130); break; //admissions
		case 124033: GetPhotos(18131); break; //support
		case 124034: GetPhotos(18132); break; //community
		default: GetPhotos(18132); break;
	} 
	
	if(pdGlobal.currentPages[pdGlobal.currentPages.length-1].id === 204){
		//04/29/2011 - Added to make news detail page match when directed from news page or home page - NRM 
		if(pdGlobal.currentPageLevel === 1){
			$(".ndob .cchtxt:first").css("width","299px");
		}
	}
});

//banner photo function
function GetPhotos(pID){	
	var hasPhotos = false;
	$.ajax({
		type: "GET",
		url: "/xml/default.asp?sid=439&type=photoall&id="+pID+"&dPhoto=/ftpimages/439/podium/Style753/images/banner_photo.jpg",
		dataType: "xml",
		success: function(xml) {
			//alert(lphotos);		
				var totalphotos = parseInt($(xml).find('item').attr("totalphotos"));
				var randomNum = Math.floor(Math.random() * (totalphotos-1));
				var randCount = 0;
				$(xml).find('image').each(function(){
					if(randCount == randomNum){
						//set my photo					
						var path = $(this).find("path").text();												
						$("#bannerPhoto").css("background","url("+path+") no-repeat");						
					}
					randCount++;
				});			
		},
		error: function(request,tStatus,eThrown){
			//alert("Cant Get Photos");
		}
	});		
}
