$(document).ready(function(){	 
	var imgPath = $(".sitetph").children().attr("src");
	var imgHeight = $(".sitetph").children().attr("height");
	//alert(imgHeight + "this is the width");
	if(imgPath != undefined){
		$(".sitetph").children().remove();
		$(".sitelcol").css("padding-top",imgHeight + 138);
		$("#PagePhotoBox img").attr("src",imgPath);
		$("#PagePhotoBox img").attr("width",254);
		$("#PagePhotoBox img").attr("height",imgHeight);
		$("#PagePhotoBox").css("display","block");
	}	
	
	 
	 //build the menus
	var MenuArray = new Array(
		{pageid : 116402,hoffset: 3,voffset: 1,animate:"true"},
		{pageid : 116403,voffset: 1,animate:"true"},
		{pageid : 116404,voffset: 1,animate:"true"},
		{pageid : 116406,voffset: 1,animate:"true"},
		{pageid : 116405,hoffset: -116,voffset: 1,animate:"true"},
		{pageid : 116407,hoffset: -98,voffset: 1,animate:"true"}	
	);

	var L1_on = pdGlobal.currentPages[0].id;
	//initMenu("L1","down",MenuArray,L1_on);

	var options = {
			xml_path:"/xml/default.asp",
			sid:395,
			direction:"down",
			hOffset:0,
			vOffset:0,
			settings:MenuArray,
			currentL1:L1_on,
			showL3s:true,
			debug:false
		};
		$('#L1').menu(options);


});

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);
}