document.write("<style>#bannerPhoto {visibility:hidden;}</style>");
JavaScriptSchoolID = 70;
switch(pdGlobal.currentPages[0].id){	
	case 115176: bannerImageID = 20334; document.write("<link rel='stylesheet' type='text/css' href='/css/red.css'/>"); break;
	case 115177: bannerImageID = 20336; document.write("<link rel='stylesheet' type='text/css' href='/css/blue.css'/>"); break;
	case 115178: bannerImageID = 20337; document.write("<link rel='stylesheet' type='text/css' href='/css/green.css'/>"); break;
	case 115179: bannerImageID = 20339; document.write("<link rel='stylesheet' type='text/css' href='/css/purple.css'/>"); break;
	default: bannerImageID = 21395; document.write("<link rel='stylesheet' type='text/css' href='/css/scds.css'/>"); break;
	}
	
var preloadImages = [
	'/images/dd_red.png',
	'/images/dd_red_on.png',
	'/images/dd_red_footer.png',
	'/images/dd_blue.png',
	'/images/dd_blue_on.png',
	'/images/dd_blue_footer.png',
	'/images/dd_green.png',
	'/images/dd_green_on.png',
	'/images/dd_green_footer.png',
	'/images/dd_purple.png',
	'/images/dd_purple_on.png',
	'/images/dd_purple_footer.png'
	];

var imgs = [];
for (var i=0; i<preloadImages.length;i++){
	imgs[i] = new Image();
	imgs[i].src = preloadImages[i];
}

$(document).ready(function(){

	//CSP sdb 011411 added this so as to change the font size on the event page
	if(pdGlobal.currentPages[pdGlobal.currentPageLevel-1] != undefined){
		if(pdGlobal.currentPages[pdGlobal.currentPageLevel-1].title=="Register for Event"){
			$(".maintext").css("font-size","11px");
			$(".maintext").css("font-family","Verdana");
			$(".maintext li").css("font-size","11px");
			$(".maintext li span").css("font-size","11px");
			$(".maintext a").css("font-size","11px");
			$(".maintext #btn").css("font-size","11px");
		}
	}


	//emergency bulletin
	$('body').bulletin({sid:70,gid:11222});
	//Head of School "Previous Posts"
	$('.previousPost').newsHeadline({maxNews: 9,callback:function(){insertDate();morePosts()}});
	
	var MenuArray = new Array(
		{pageid : 115176,hoffset:-6,voffset:0,animate:"true"},
		{pageid : 115177,hoffset:-6,voffset:0,animate:"true"},
		{pageid : 115178,hoffset:-6,voffset:0,animate:"true"},
		{pageid : 115179,hoffset:-6,voffset:0,animate:"true"}		
	);

	var L1_on = pdGlobal.currentPages[0].id;
	initMenu("L1","down",MenuArray,L1_on);

	var defaultBannerImage = $("#bannerPhoto").html();
	$("#bannerPhoto").attr("pid",bannerImageID).html("").getPhotoAlbums({
		randomizePhotos:0,
		maxItems:1,
		hardPhotoWidth:729,
		callback2:function(){
			if($("#bannerPhoto li").length==0){ $("#bannerPhoto").html(defaultBannerImage); }
			$("#bannerPhoto").css("visibility","visible");
			}
		});
// code to change button style on Head of School page for Comments
if(pdGlobal.currentPages[pdGlobal.currentPageLevel-1] != undefined){
	if(pdGlobal.currentPages[pdGlobal.currentPageLevel-1].id==116912){
		$(".cchbtnt-12358:contains('Comments')").each(function(){
			$(this).parent().css("background","none");
			$(".cchbtnl-12358",$(this).parent().parent()).css({"background":"none","width":"0px"});
			$(".cchbtnr-12358",$(this).parent().parent()).css({"background":"none","width":"0px"});
			$(this).css({"font":"italic 12px 'Trebuchet MS'","text-transform":"none","color":"#4b85bd","text-decoration":"underline","padding-top":"5px"});
		})
	}
}
if(pdGlobal.currentPages[pdGlobal.currentPageLevel-1] != undefined){
	if(pdGlobal.currentPages[pdGlobal.currentPageLevel-1].id==116912){
		$(".cchtxt-12358 td img").css("border","2px solid #000000");
	}
}
/* below is code to add in a left column top button on content pages, instead of the login box, but the client has changed their mind
if(pdGlobal.currentPages[pdGlobal.currentPageLevel-1] != undefined){
if(pdGlobal.currentPages[pdGlobal.currentPageLevel-1].type!="content") { 	 	
		$("#lNavTop").css("display","none");
		}
	 }
if(pdGlobal.currentPages[pdGlobal.currentPageLevel-1] != undefined){
if(pdGlobal.currentPages[pdGlobal.currentPageLevel-1].type=="content"||pdGlobal.currentPages[pdGlobal.currentPageLevel-1].id==118){
	 $("#lNavTop").css("display","block");
	 $("#lNavTop").append("<a href='/podium/default.aspx'>mySCDS</a>");
	 }
}
end left column top button code*/
});

function insertDate(){
	$('.newsItem').each(function(){		
		$('.headlineLink',this).prepend($('.pubDate',this).html()+' ');
	});		
}
// adding More Posts button
function morePosts(){
if ($('.storyNum_9').length>0 && $("div").filter("#btn:contains('More News')").length>0){	
	$("<div>")
		.addClass("morePost")
		.css("cursor","pointer")
		.html("MORE POSTS")
		.wrapInner("<span></span>")
		.click(function(){
			$("div:contains('More News')").parent().parent().parent().parent().parent().click();	
		})
		.insertAfter('.newsReturn');
	}
	//$("div:contains('More News')").parent().parent().parent().parent().parent().hide();
	 $("div").filter("#btn:contains('More News')").parent().parent().parent().parent().parent().hide();
}

function GetPhotos(pID){	
	$.ajax({
		type: "GET",
		url: "/xml/default.asp?sid=70&type=photoall&id="+pID,
		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");
		}
	});		
}
