function TurnStuffOn(){
	if(pdGlobal.currentPages[0]){
		if(pdimageon = pdGlobal.currentPages[0].id){
			CurrentOn = pdimageon;
			switch(pdimageon){
				case 111532:
					$('#L1_111532').css("background-position","0px -49px");
					$('#bannerPhotoContainer').css("background-color","#4a6692");
					$('#PageTitleBlock').css("background-color","#294b80");
					$('#PageTitleBlock').css("border-left-color","#355587");
					$('#L1title').css("color","#16325e");
					$('#L2title').css("color","#294b80");
					showBanner(16658);
					//setPageTitles();
					break;
				case 111540:
					$('#L1_111540').css("background-position","-116px -49px");
					$('#bannerPhotoContainer').css("background-color","#4c813a");
					$('#PageTitleBlock').css("background-color","#4c813a");
					$('#PageTitleBlock').css("border-left-color","#568845");
					$('#L1title').css("color","#285119");
					$('#L2title').css("color","#4c813a");
					showBanner(16659);
					//setPageTitles();
					break;
				case 111541:
					$('#L1_111541').css("background-position","-238px -49px");
					$('#bannerPhotoContainer').css("background-color","#c7c245");
					$('#PageTitleBlock').css("background-color","#c7c245");
					$('#PageTitleBlock').css("border-left-color","#cac54f");
					$('#L1title').css("color","#918c16");
					$('#L2title').css("color","#c4c41c");
					showBanner(16660);
					//setPageTitles();
					break;
				case 111542:
					$('#L1_111542').css("background-position","-405px -49px");
					$('#bannerPhotoContainer').css("background-color","#a67c10");
					$('#PageTitleBlock').css("background-color","#a67c10");
					$('#PageTitleBlock').css("border-left-color","#ab831d");
					$('#L1title').css("color","#7f5c03");
					$('#L2title').css("color","#a37604");
					showBanner(16661);
					//setPageTitles();
					break;
				case 111543:
					$('#L1_111543').css("background-position","-603px -49px");
					$('#bannerPhotoContainer').css("background-color","#a84e00");
					$('#PageTitleBlock').css("background-color","#a84e00");
					$('#PageTitleBlock').css("border-left-color","#ad580e");
					$('#L1title').css("color","#632e01");
					$('#L2title').css("color","#974d0d");
					showBanner(16662);
					//setPageTitles();
					break;
				default:
					$('#PageTitleBlock').css("display","none");
					showBanner(17333);
					//setPageTitles();
			}
		}
	}
}
if (pdGlobal.currentPages[0].id = 111554){
	$("#cal-filter-button").css("display","none");
}

function setPageTitles() {
	currentPageUbound = pdGlobal.currentPages.length
	isOmni = checkForOmni();

	if (pdGlobal.currentPages[0] && pdGlobal.currentPages[currentPageUbound-1].type=="content") {
		if (pdGlobal.currentPages[0]) {
			if(isOmni) {
				//they want L2 style applied to L1 for Omni pages
				document.getElementById("L2title").innerHTML = pdGlobal.currentPages[0].title;
				$('#L2title').css("display","block");
			} else {
				document.getElementById("L1title").innerHTML = pdGlobal.currentPages[0].title;
				$('#L1title').css("display","block");
			}
		}
		if (pdGlobal.currentPages[1]) {
			document.getElementById("L2title").innerHTML = pdGlobal.currentPages[1].title;
			$('#L2title').css("display","block");
		}
		if (pdGlobal.currentPages[2]) {
			document.getElementById("L3title").innerHTML = pdGlobal.currentPages[2].title;
//			$('#L3title').css("display","block");
		}
		$('#PageTitleBlock').css("display","block");
	}
}

function showBanner(photoID) {
	photoBannerString = "/managedBannerPhotos.asp?photoID=" + photoID;
	tempString = '<script type="text/javascript" src="' + photoBannerString + '"><\/script>';
	document.write(tempString);
}

function checkForOmni() {
//add a line for each omni L1 :(
	switch (pdGlobal.currentPages[0].id) {
		case 111544:
		case 111546:
		case 111547:
		case 111548:
		case 111549:
		case 111550:
		case 115968:
			return true; break;
		default: return false;
	}
	return false;
}

function MS_swap(Mitem,Mtype){
	Mitem.src=Mitem.getAttribute(Mtype || "origsrc");
}

function MS(img_swap){
	img_swap.setAttribute("origsrc",img_swap.src);
	img_swap.setAttribute("onload","");
   	img_swap.oversrc_img = new Image();
  	img_swap.oversrc_img.src=img_swap.getAttribute("oversrc");
    img_swap.onmouseover = new Function("MS_swap(this,'oversrc');");
    img_swap.onmouseout = new Function("MS_swap(this);");
	img_swap.style.cursor = 'pointer';
}

/*ripped from prototype.js*/
function M_object(element) {
	if (arguments.length > 1) {
		for (var i = 0, elements = [], length = arguments.length; i < length; i++)
			elements.push(M_object(arguments[i]));
		return elements;
	}
	if (typeof element == 'string')
		element = document.getElementById(element);
	return element;
}

//Check for added variable to podium url
function getQueryVariable(variable) {
	var query = window.location.search.substring(1);
	var vars = query.split("&");
	for (var i=0;i<vars.length;i++) {
		var pair = vars[i].split("=");
		if (pair[0] == variable) {
			return pair[1];
		}
	} 
	return -100;

}

function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			if (oldonload) {
				oldonload();
			}
			func();
		}
	}
}

function insertFooterCode(){
	var footerContainer = document.createElement("div");
	footerContainer.innerHTML = M_object("podium_footer").innerHTML;
	document.body.appendChild(footerContainer);
}
