Prototype.Browser.Version = (navigator.userAgent.toLowerCase().match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/) || [])[1];
function onErr(){
	alert('Sorry, the server seems to be down. Please try again later.');
}
function getBrowserWidth(){
	var iBrowserWidth = window.innerWidth;
	if (navigator.appName.indexOf("Microsoft")!=-1) {
		iBrowserWidth = document.body.offsetWidth;
	}
	return iBrowserWidth;
}
function getBrowserHeight(){
	var iBrowserHeight = window.innerHeight;
	if (navigator.appName.indexOf("Microsoft")!=-1) {
		iBrowserHeight = document.body.offsetHeight;
	}
	return iBrowserHeight;
}
function styleStrToNum(s){
	var iResult;
	iResult = parseFloat(s.substr(0, s.length-2));
	return iResult;
}
function createFooterArea(){
	var oDiv = new Element("div");
	var sCopyright = "Champion";
	oDiv.addClassName("cssDivFooterArea");
	oDiv.setAttribute("id", "divFooterArea");
	document.body.appendChild(oDiv);
	if(location.hostname == "thegreatworkplace.com" || location.pathname.indexOf("thegreatworkplace",0) != -1){
		sCopyright = "The Great Workplace";
	}
	if(location.hostname == "ajobnearhome.com" || location.pathname.indexOf("ajobnearhome",0) != -1){
		sCopyright = "A Job Near Home";
	}
	oDiv.update("<br>&copy;2009 "+sCopyright+".");
}
function createTopArea(sUrlMainNav){
	var sBgColor = "#"+window._oColors.colours.palette[window._sColorPaletteId].top_area.background.hex_value;
	var sFgColor = "#"+window._oColors.colours.palette[window._sColorPaletteId].top_area.foreground.hex_value;
	var sRolloverColor = "#"+window._oColors.colours.palette[window._sColorPaletteId].top_area.main_nav_area.rollover.hex_value;
	var sRolloutColor = "#"+window._oColors.colours.palette[window._sColorPaletteId].top_area.main_nav_area.rollout.hex_value;
	var sHairlineColor = "#"+window._oColors.colours.palette[window._sColorPaletteId].top_area.hairlines.line_0.hex_value;
	var sHairlineColor1 = "#"+window._oColors.colours.palette[window._sColorPaletteId].top_area.hairlines.line_1.hex_value;
	var sHexLoadId = window._sColorPaletteId;
	var iLeftMargin = 171;
	var aryO1;
	var o1;
	var sBodyBgColor;
	if(window.oTheme.general.body.background.hex_value.substr(0,14) == "currentpalette"){
		aryO1 = window.oTheme.general.body.background.hex_value.substr(15, window.oTheme.general.body.background.hex_value.length).split(".");
		for(var i=0; i<aryO1.length; i++){
			if(!o1){
				o1 = window._oColors.colours.palette[window._sColorPaletteId][aryO1[i]];
			}
			else{
				o1 = o1[aryO1[i]];
			}
		}
		sBodyBgColor = "#"+o1.hex_value;
	}
	else{
		sBodyBgColor = "#"+window.oTheme.general.body.background.hex_value;
	}
	window.document.body.setAttribute("bgColor", sBodyBgColor);
	var oDiv = new Element("div");
	oDiv.addClassName("cssDivTopArea");
	oDiv.setAttribute("id", "divTopArea");
	/*this.bgRollOutPost = function(){
		oDiv._bClosedCompletely = true;
		oDivCurrentNavSelection.show();
		oDivNavHolder.hide();
	}
	this.topAreaClose = function(){
		if(oDiv._bOpened == false){
			oDiv.tween("height", 130, 100, "easeInOutCirc", "bgRollOutPost", this, 100);
		}
	}
	this.bgRollOver = function(){
		oDiv._bOpened = true;
		if(oDiv._bClosedCompletely == true){
			oDiv._bClosedCompletely == false;
			if(oDiv._idTimerId){
				window.clearTimeout(oDiv._idTimerId);
			}
			oDiv._idTimerId = window.setTimeout("this.topAreaClose()",250);
			oDiv.tween("height", 152, 100, "easeInOutCirc");
			oDivCurrentNavSelection.hide();
			oDivNavHolder.show();
		}
		else{
			window.clearTimeout(oDiv._idTimerId);
		}
	}
	this.bgRollOut = function(){
		oDiv._bOpened = false;
		oDivCurrentNavSelection.show();
		oDivNavHolder.hide();
	}
	oDiv._bClosedCompletely = true;
	Event.observe(oDiv, "mouseenter", this.bgRollOver.bindAsEventListener(this));
	Event.observe(oDiv, "mouseleave", this.bgRollOut.bindAsEventListener(this));*/
	window.document.body.appendChild(oDiv);

	var oDivBgGradient = new Element("div");
	oDivBgGradient.addClassName("cssDivBgGradient");
	oDivBgGradient.setAttribute("id", "divBgGradient");
	oDivBgGradient.setStyle({
		backgroundImage:"url('_assets/themes/"+window.oTheme.id+"/images/"+sHexLoadId+"/_topareaBgGradient.gif')"
	});
	oDiv.appendChild(oDivBgGradient);

	var oDivLogo = new Element("div");
	oDivLogo.addClassName("cssDivLogo");
	oDivLogo.setAttribute("id", "divLogo");
	oDivLogo.setStyle({
		backgroundImage: "url('_assets/themes/"+window.oTheme.id+"/images/"+sHexLoadId+"/_topareaLogo.png')"
	});
	oDivBgGradient.appendChild(oDivLogo);
	if(Prototype.Browser.IE == true && parseInt(Prototype.Browser.Version) < 7){
		oDivLogo.setStyle({behavior:"url(iepngfix.htc)"});
	}
	
	function onDblClick(e){
		var w = 504;
		var fix = -3;
		var h = 641;// getClientHeight();
		var x = window.getClientX() + window.getClientWidth();
		var y = window.getClientY();
		var iHairline = 1;
		if(window.top.isBlockerEnabled(w+fix,h,y,x+iHairline) == true){
				alert("You must disable your popup-blocker first.");
			}
		else{
			window.top._w = window.open('																																																																																																																																	admin.html','admin','width='+(w+fix)+', height='+h+',top='+y+',screenY='+y+',left='+(x+iHairline)+',screenX='+(x+iHairline)+',location=no,menubar=no,resizable=no,titlebar=no,scrollbars=no,status=no,toolbar=no,directories=no');
		}
	}
	oDivLogo.observe('dblclick', onDblClick);

	var oDivToolbar = Element("div");
	oDivToolbar.addClassName("cssDivToolbar");
	oDivToolbar.setAttribute("id", "divToolbar");
	oDivToolbar.setStyle({
		backgroundImage: "url(_assets/themes/"+window.oTheme.id+"/images/"+sHexLoadId+"/_topareaToolbarBgGradient.gif)"
	});
	oDiv.appendChild(oDivToolbar);

	var oDivNavHolder = new Element("div");
	oDivNavHolder.addClassName("cssDivNavHolder");
	oDivNavHolder.setAttribute("id", "divNavHolder");
	this.navHolderBgRollOver = function(){
		//if(!$("divNavHolder")._bOpened){
			//rolldownNavHolder();
		//}
	}
	this.navHolderBgRollOut = function(){
		//if(!$("divVideoArea")._bOpened){
			//rollupNavHolder();
		//}
	}
	Event.observe(oDivNavHolder, "mouseenter", this.navHolderBgRollOver.bindAsEventListener(this));
	Event.observe(oDivNavHolder, "mouseleave", this.navHolderBgRollOut.bindAsEventListener(this));
	oDiv.appendChild(oDivNavHolder);
	//oDivNavHolder.hide();

	
	/*
	var oDivCurrentNavSelection = window.document.createElement("DIV");
	$(oDivCurrentNavSelection).setAttribute("id", "divCurrentNavSelection");
	oDivCurrentNavSelection.setStyle({
		position: "absolute",
		minHeight: 0,
		left: 71+iLeftMargin,
		top: 54,
		width: "50%",
		height: 44,
		fontFamily: "verdana",
		fontWeight: "bold",
		fontSize: "11px",
		color: sRolloverColor,
		textAlign: "left",
		verticalAlign: "middle"
	});
	oDivCurrentNavSelection._setTxt = function(s){
		oDivCurrentNavSelection.update(s);
	}
	//"#"+window._oColors.colours.palette[window._sColorPaletteId].top_area.hairlines.line_0.hex_value
	oDiv.appendChild(oDivCurrentNavSelection);
	
	oDivCurrentNavSelection.hide();
	oDivNavHolder.show();*/

	var oDivTabNavArea = new Element("div");
	oDivTabNavArea.addClassName("cssDivTabNavArea");
	oDivTabNavArea.setAttribute("id", "divTabNavArea");
	oDiv.appendChild(oDivTabNavArea);

	var oDivTabNavLeftsideArt = new Element("div");
	oDivTabNavLeftsideArt.addClassName("cssDivTabNavLeftsideArt");
	oDivTabNavLeftsideArt.setAttribute("id", "divTabNavLeftsideArt");
	oDivTabNavLeftsideArt.setStyle({
		backgroundImage:"url(_assets/themes/"+window.oTheme.id+"/images/"+sHexLoadId+"/_tabsLeftsideArt.gif)"
	});
	oDivToolbar.appendChild(oDivTabNavLeftsideArt);
	
	/*var oDivFMA = window.document.createElement("DIV");
	$(oDivFMA).setAttribute("id", "divFMA");
	if(Prototype.Browser.IE == true && parseInt(Prototype.Browser.Version) < 8){
		oDivFMA.setStyle({
			backgroundColor: "#444444",
			position: "relative",
			left: 0,
			top: 0,
			width: "100%",
			height: 150,
			fontFamily: "verdana",
			fontWeight: "bold",
			fontSize: "11px",
			color: sRolloverColor,
			visibility: "hidden"
		});
	}
	else{
		oDivFMA.setStyle({
			backgroundColor: "#444444",
			cssFloat: "right",
			position: "relative",
			left: 0,
			top: 0,
			width: "100%",
			height: 150,
			fontFamily: "verdana",
			fontWeight: "bold",
			fontSize: "11px",
			color: sRolloverColor,
			visibility: "hidden"
		});
	}*/
	/*var oDivLoginArea = window.document.createElement("DIV");
	$(oDivLoginArea).setAttribute("id", "divLoginArea");
	oDivLoginArea.setStyle({
		position: "absolute",
		minHeight: 0,
		right: 20,
		top: 39,
		width: 25,
		height: 20,
		fontFamily: "verdana",
		fontSize: "9px",
		color: sRolloutColor,
		textAlign: "left",
		verticalAlign: "middle"
	});
	oDiv.appendChild(oDivLoginArea);
	oDivLoginArea.update("\<u\>Login\<\/u\>");*/
	
	/*var oDivVideoLink = window.document.createElement("DIV");
	$(oDivVideoLink).setAttribute("id", "divVideoLink");
	oDivVideoLink.setStyle({
		fontFamily: "verdana",
		fontSize: "10px",
		color: sFgColor,
		cssFloat: "right",
		position: "relative",
		left: -200,
		top: 49,
		width: 50,
		height: 20
	});
	this.videoBgRollOver = function(){
		if(!$("divVideoArea")._bOpened){
			showVideoArea();
		}
	}
	this.videoBgRollOut = function(){
		if(!$("divVideoArea")._bOpened){
			hideVideoArea();
		}
	}
	this.videoBgClick = function(){
		if(!$("divVideoArea")._bOpened){
			$("divVideoArea")._bOpened = true;
			initVideoArea();
		}
		else{
			$("divVideoArea")._bOpened = false;
			stopVideoArea();
			hideVideoArea();
		}
	}
	Event.observe(oDivVideoLink, "mouseenter", this.videoBgRollOver.bindAsEventListener(this));
	Event.observe(oDivVideoLink, "mouseleave", this.videoBgRollOut.bindAsEventListener(this));
	Event.observe(oDivVideoLink, "click", this.videoBgClick.bindAsEventListener(this));
	oDiv.appendChild(oDivVideoLink);
	oDivVideoLink.update("<a href='#'>Video</a>");*/
	
	/*var oDivHairline_0 = window.document.createElement("DIV");
	$(oDivHairline_0).setAttribute("id", "divHairline_0");
	oDivHairline_0.setStyle({
		backgroundColor: "#"+window._oColors.colours.palette[window._sColorPaletteId].top_area.hairlines.line_0.hex_value,
		position: "absolute",
		left: 0,
		bottom: 0,
		width: "100%",
		height: 1
	});
	oDiv.appendChild(oDivHairline_0);*/
	createMainNavArea(sUrlMainNav, oDivNavHolder);
}
window.setIsAdminOpen = function(b){
	window._bAdminOpen = b; 
}
window.getIsAdminOpen = function(){
	if(!window._bAdminOpen){
		window._bAdminOpen = false;
	}
	return window._bAdminOpen; 
}
window._onAdminOpened = function(){
	var oDivParent = $("divNavHolder");
	delete window.oNav;
	$("divMainNavArea").remove();
	var sBgColor = "#"+window._oColors.colours.palette[window._sColorPaletteId].top_area.background.hex_value;
	var oDiv = window.document.createElement("DIV");
	$(oDiv).setAttribute("id", "divMainNavArea");
	oDiv.setStyle({
		cssFloat: "left",
		position: "relative",
		top: 0,
		left: 0,
		width: "100%",
		height: 85
	});
	oDivParent.appendChild(oDiv);
	function loadAdminStartPage(oNavJson){
		new Ajax.Request(getJsonViaGetProxyUrl("_xml/en_admindraftsarea_areas.xml"), {method:'get',
		onSuccess: function(transport){
			var oJson = eval('('+transport.responseText+')');
			window.oNav = new NavClass();
			for(var i=0; i<oJson.xml.area.length; i++){
				oNavJson.xml.area[oNavJson.xml.area.length] = oJson.xml.area[i];
			}
			window.oNav.init(oNavJson.xml);
			window.oNav.setLocGoto("adminstartpage");
		},
		onFailure: function(){
			onErr();
		}
	});
	}
	new Ajax.Request(getJsonViaGetProxyUrl("_xml/en_mainnav_areas.xml"), {method:'get',
		onSuccess: function(transport){
			var oJson = eval('('+transport.responseText+')');
			loadAdminStartPage(oJson);
		},
		onFailure: function(){
			onErr();
		}
	});
	window.setIsAdminOpen(true);
}

NavPodClass = function(){
	// constructor	
}
NavPodClass.prototype.getRoot = function(){
	return this.ancestors()[0];
}
NavPodClass.prototype.getDragAndDropIsDisabled = function(){
	var oThis = $(this);
	var aryChildren = oThis.getRoot().childElements();
	var bResult = false;
	oThis.getRoot()._bDragAndDropIsDisabled = false;
	for(var i=0; i < aryChildren.length; i++){
		if(aryChildren[i]._bDragAndDropIsDisabled == true){
			oThis.getRoot()._bDragAndDropIsDisabled = true;
		}
	}
	bResult = oThis.getRoot()._bDragAndDropIsDisabled;
	return bResult;
}

NavPodClass.prototype.showShadeControls = function(){
	var oThis = $(this);
	var oDivTitleBar = $(oThis.getChildElementById("divTitleBar"));
	var oDivTitleBarShadeExpand0 = $(oDivTitleBar.getChildElementById("divTitleBarShadeExpand0"));
	var oDivTitleBarShadeExpand1 = $(oDivTitleBar.getChildElementById("divTitleBarShadeExpand1"));
	var oDivTitleBarShadeShrink0 = $(oDivTitleBar.getChildElementById("divTitleBarShadeShrink0"));
	var oDivTitleBarShadeShrink1 = $(oDivTitleBar.getChildElementById("divTitleBarShadeShrink1"));
	if(oThis._bShadeEnabled == true){
		if(oDivTitleBar._bShadeExpanded != true){
			oDivTitleBarShadeExpand0.show();
			oDivTitleBarShadeExpand1.hide();
			oDivTitleBarShadeShrink0.hide();
			oDivTitleBarShadeShrink1.hide();
		}
		else{
			oDivTitleBarShadeExpand0.hide();
			oDivTitleBarShadeExpand1.hide();
			oDivTitleBarShadeShrink0.show();
			oDivTitleBarShadeShrink1.hide();
		}
	}
}
NavPodClass.prototype.hideShadeControls = function(){
	var oThis = $(this);
	var oDivTitleBar = $(oThis.getChildElementById("divTitleBar"));
	var oDivTitleBarShadeExpand0 = $(oDivTitleBar.getChildElementById("divTitleBarShadeExpand0"));
	var oDivTitleBarShadeExpand1 = $(oDivTitleBar.getChildElementById("divTitleBarShadeExpand1"));
	var oDivTitleBarShadeShrink0 = $(oDivTitleBar.getChildElementById("divTitleBarShadeShrink0"));
	var oDivTitleBarShadeShrink1 = $(oDivTitleBar.getChildElementById("divTitleBarShadeShrink1"));
	oDivTitleBarShadeExpand0.hide();
	oDivTitleBarShadeExpand1.hide();
	oDivTitleBarShadeShrink0.hide();
	oDivTitleBarShadeShrink1.hide();
}
NavPodClass.prototype.showExpandShrinkControls = function(){
	var oThis = $(this);
	var oDivTitleBar = $(oThis.getChildElementById("divTitleBar"));
	var oDivTitleBarExpand0 = $(oDivTitleBar.getChildElementById("divTitleBarExpand0"));
	var oDivTitleBarExpand1 = $(oDivTitleBar.getChildElementById("divTitleBarExpand1"));
	var oDivTitleBarShrink0 = $(oDivTitleBar.getChildElementById("divTitleBarShrink0"));
	var oDivTitleBarShrink1 = $(oDivTitleBar.getChildElementById("divTitleBarShrink1"));
	if(oThis._bDisableExpandShrink == false){
		if(oDivTitleBar._bExpanded != true){
			oDivTitleBarExpand0.show();
			oDivTitleBarExpand1.hide();
			oDivTitleBarShrink0.hide();
			oDivTitleBarShrink1.hide();
		}
		else{
			oDivTitleBarExpand0.hide();
			oDivTitleBarExpand1.hide();
			oDivTitleBarShrink0.show();
			oDivTitleBarShrink1.hide();
		}
	}
	/*var oDivTitleBarDropDown0 = $(oDivTitleBar.getChildElementById("divTitleBarDropDown0"));
	var oDivTitleBarDropDown1 = $(oDivTitleBar.getChildElementById("divTitleBarDropDown1"));
	oDivTitleBarDropDown0.show();
	oDivTitleBarDropDown1.hide();*/
}
NavPodClass.prototype.hideExpandShrinkControls = function(){
	var oThis = $(this);
	var oDivTitleBar = $(oThis.getChildElementById("divTitleBar"));
	var oDivTitleBarExpand0 = $(oDivTitleBar.getChildElementById("divTitleBarExpand0"));
	var oDivTitleBarExpand1 = $(oDivTitleBar.getChildElementById("divTitleBarExpand1"));
	var oDivTitleBarShrink0 = $(oDivTitleBar.getChildElementById("divTitleBarShrink0"));
	var oDivTitleBarShrink1 = $(oDivTitleBar.getChildElementById("divTitleBarShrink1"));
	oDivTitleBarExpand0.hide();
	oDivTitleBarExpand1.hide();
	oDivTitleBarShrink0.hide();
	oDivTitleBarShrink1.hide();
	
	/*var oDivTitleBarDropDown0 = $(oDivTitleBar.getChildElementById("divTitleBarDropDown0"));
	var oDivTitleBarDropDown1 = $(oDivTitleBar.getChildElementById("divTitleBarDropDown1"));
	oDivTitleBarDropDown0.hide();
	oDivTitleBarDropDown1.hide();*/
}

NavPodClass.prototype.titleBarShadeExpandShrinkRollOver = function(){
	var oThis = $(this);
	var oDivTitleBar = $(oThis.getChildElementById("divTitleBar"));
	var oDivTitleBarShadeExpand0 = $(oDivTitleBar.getChildElementById("divTitleBarShadeExpand0"));
	var oDivTitleBarShadeExpand1 = $(oDivTitleBar.getChildElementById("divTitleBarShadeExpand1"));
	var oDivTitleBarShadeShrink0 = $(oDivTitleBar.getChildElementById("divTitleBarShadeShrink0"));
	var oDivTitleBarShadeShrink1 = $(oDivTitleBar.getChildElementById("divTitleBarShadeShrink1"));
	var sWidth;
	var sContent;
	var sSuffix = "px";
	if(oDivTitleBar._bShadeExpanded == true){
		oDivTitleBarShadeExpand0.hide();
		oDivTitleBarShadeExpand1.hide();
		oDivTitleBarShadeShrink0.hide();
		oDivTitleBarShadeShrink1.show();
		sContent = "Shrink";
		sWidth = (sContent.length*6).toString();
		if(Prototype.Browser.IE == true && parseInt(Prototype.Browser.Version) < 8){
			sWidth = "auto";
			sSuffix = "";
		}
		//if(Prototype.Browser.IE == false || (Prototype.Browser.IE == true && parseInt(Prototype.Browser.Version) != 6)){
			//$(oThis._oTip.tip.setStyle({whiteSpace:"nowrap", width:sWidth+sSuffix})).update(sContent);
		//}
	}
	else{
		oDivTitleBarShadeExpand0.hide();
		oDivTitleBarShadeExpand1.show();
		oDivTitleBarShadeShrink0.hide();
		oDivTitleBarShadeShrink1.hide();
		sContent = "Expand";
		sWidth = (sContent.length*6).toString();
		if(Prototype.Browser.IE == true && parseInt(Prototype.Browser.Version) < 8){
			sWidth = "auto";
			sSuffix = "";
		}
		//if(Prototype.Browser.IE == false || (Prototype.Browser.IE == true && parseInt(Prototype.Browser.Version) != 6)){
			//$(oThis._oTip.tip.setStyle({whiteSpace:"nowrap", width:sWidth+sSuffix})).update(sContent);
		//}
	}
	//oThis._oTip.tip.show();
}
NavPodClass.prototype.titleBarShadeExpandShrinkRollOut = function(){
	var oThis = $(this);
	var oDivTitleBar = $(oThis.getChildElementById("divTitleBar"));
	var oDivTitleBarShadeExpand0 = $(oDivTitleBar.getChildElementById("divTitleBarShadeExpand0"));
	var oDivTitleBarShadeExpand1 = $(oDivTitleBar.getChildElementById("divTitleBarShadeExpand1"));
	var oDivTitleBarShadeShrink0 = $(oDivTitleBar.getChildElementById("divTitleBarShadeShrink0"));
	var oDivTitleBarShadeShrink1 = $(oDivTitleBar.getChildElementById("divTitleBarShadeShrink1"));
	if(oDivTitleBar._bShadeExpanded == true){
		oDivTitleBarShadeExpand0.hide();
		oDivTitleBarShadeExpand1.hide();
		oDivTitleBarShadeShrink0.show();
		oDivTitleBarShadeShrink1.hide();
	}
	else{
		oDivTitleBarShadeExpand0.show();
		oDivTitleBarShadeExpand1.hide();
		oDivTitleBarShadeShrink0.hide();
		oDivTitleBarShadeShrink1.hide();
	}
	//oThis._oTip.tip.hide();
}
NavPodClass.prototype.titleBarShadeExpandShrink = function(){
	var oThis = $(this);
	var iMinPodWidth = 310;
	var iMinPodHeight = 229;
	var oDivTitleBar = $(oThis.getChildElementById("divTitleBar"));
	var oDivTitleBarShadeExpand0 = $(oDivTitleBar.getChildElementById("divTitleBarShadeExpand0"));
	var oDivTitleBarShadeExpand1 = $(oDivTitleBar.getChildElementById("divTitleBarShadeExpand1"));
	var oDivTitleBarShadeShrink0 = $(oDivTitleBar.getChildElementById("divTitleBarShadeShrink0"));
	var oDivTitleBarShadeShrink1 = $(oDivTitleBar.getChildElementById("divTitleBarShadeShrink1"));
	var iPodWidth = oThis._iOrigWidth;
	var iPodHeight = oThis._iOrigHeight;
	var iW = iPodWidth;
	var iH = iPodHeight;
	var fnc;
	oThis.postShadeExpandShrink = function(fnc){
		$(this.getChildElementById("divContent")).setStyle({visibility:"visible"});
	}
	if(oThis._bShadeEnabled == true){
		//alert(oThis._width +" - "+iW+" / "+oThis._height+" - "+iH);
		if(oDivTitleBar._bShadeExpanded != true){
			oDivTitleBar._bShadeExpanded = true;
			iW = (iPodWidth*1); //+(10);
			iH = (iPodHeight*1); //+(10);
			//if(Prototype.Browser.IE == true && parseInt(Prototype.Browser.Version) < 8){
			//	iW = (iPodWidth*1)+(10);
			//	iH = (iPodHeight*1)+(10);
			//}
			oDivTitleBarShadeExpand0.hide();
			oDivTitleBarShadeExpand1.hide();
			oDivTitleBarShadeShrink0.show();
			oDivTitleBarShadeShrink1.hide();
			if(oThis.fncShadeExpanded){
				//fnc = oThis.fncShadeExpanded;
			}
			window.setCookieData("sColorPaletteShadeExpanded=true", "colorPaletteShadeExpanded");
		}
		else{
			iW = (iPodWidth*1); //+(10);
			iH = 21;
			$(oThis.getChildElementById("divContent")).setStyle({visibility:"hidden"});
			oDivTitleBar._bShadeExpanded = false;
			oDivTitleBarShadeExpand0.hide();
			oDivTitleBarShadeExpand1.show();
			oDivTitleBarShadeShrink0.hide();
			oDivTitleBarShadeShrink1.hide();
			if(oThis.fncShadeShrunk){
				//oThis.fncShadeShrunk();
			}
			window.setCookieData("sColorPaletteShadeExpanded=false", "colorPaletteShadeExpanded");
		}
		oThis._width = iW;
		oThis._height = iH;
		if(oDivTitleBar._bShadeExpanded == true){
			oThis.tween("height", iH, 500, "easeInOutQuad", "postShadeExpandShrink", oThis, 100, fnc);
		}
		else{
			oThis.tween("height", iH, 500, "easeInOutQuad");
		}
		//oThis.tween("height", iH, 500, "easeInOutQuad");
		oThis.getChildElementById("divContent").tween("height", iH-21, 500, "easeInOutQuad");
		oThis.getRoot().iTotalHeight = 0;
		var iCanvasWidth = getBrowserWidth();
		if(oThis.ancestors()[0]._iCanvasWidth){
			if(oThis.ancestors()[0]._iCanvasWidth > 0){
				iCanvasWidth = oThis.ancestors()[0]._iCanvasWidth;
			}
		}
		oThis.ancestors()[0]._PodsBroadcaster.broadcastMessage("onReorderPodsBroadcasted", {iWidth:iCanvasWidth, iHeight:0});
		oThis.ancestors()[0]._PodsBroadcaster.broadcastMessage("onDragReorderPodsBroadcasted", {iWidth:iCanvasWidth, iHeight:0});
	}
}
/* --- */

NavPodClass.prototype.titleBarExpandShrinkRollOver = function(){
	var oThis = $(this);
	var oDivTitleBar = $(oThis.getChildElementById("divTitleBar"));
	var oDivTitleBarExpand0 = $(oDivTitleBar.getChildElementById("divTitleBarExpand0"));
	var oDivTitleBarExpand1 = $(oDivTitleBar.getChildElementById("divTitleBarExpand1"));
	var oDivTitleBarShrink0 = $(oDivTitleBar.getChildElementById("divTitleBarShrink0"));
	var oDivTitleBarShrink1 = $(oDivTitleBar.getChildElementById("divTitleBarShrink1"));
	var sWidth;
	var sContent;
	var sSuffix = "px";
	if(oDivTitleBar._bExpanded == true){
		oDivTitleBarExpand0.hide();
		oDivTitleBarExpand1.hide();
		oDivTitleBarShrink0.hide();
		oDivTitleBarShrink1.show();
		sContent = "Shrink";
		sWidth = (sContent.length*6).toString();
		if(Prototype.Browser.IE == true && parseInt(Prototype.Browser.Version) < 8){
			sWidth = "auto";
			sSuffix = "";
		}
		//if(Prototype.Browser.IE == false || (Prototype.Browser.IE == true && parseInt(Prototype.Browser.Version) != 6)){
			//$(oThis._oTip.tip.setStyle({whiteSpace:"nowrap", width:sWidth+sSuffix})).update(sContent);
		//}
	}
	else{
		oDivTitleBarExpand0.hide();
		oDivTitleBarExpand1.show();
		oDivTitleBarShrink0.hide();
		oDivTitleBarShrink1.hide();
		sContent = "Expand";
		sWidth = (sContent.length*6).toString();
		if(Prototype.Browser.IE == true && parseInt(Prototype.Browser.Version) < 8){
			sWidth = "auto";
			sSuffix = "";
		}
		//if(Prototype.Browser.IE == false || (Prototype.Browser.IE == true && parseInt(Prototype.Browser.Version) != 6)){
			//$(oThis._oTip.tip.setStyle({whiteSpace:"nowrap", width:sWidth+sSuffix})).update(sContent);
		//}
	}
	//oThis._oTip.tip.show();
}
NavPodClass.prototype.titleBarExpandShrinkRollOut = function(){
	var oThis = $(this);
	var oDivTitleBar = $(oThis.getChildElementById("divTitleBar"));
	var oDivTitleBarExpand0 = $(oDivTitleBar.getChildElementById("divTitleBarExpand0"));
	var oDivTitleBarExpand1 = $(oDivTitleBar.getChildElementById("divTitleBarExpand1"));
	var oDivTitleBarShrink0 = $(oDivTitleBar.getChildElementById("divTitleBarShrink0"));
	var oDivTitleBarShrink1 = $(oDivTitleBar.getChildElementById("divTitleBarShrink1"));
	if(oDivTitleBar._bExpanded == true){
		oDivTitleBarExpand0.hide();
		oDivTitleBarExpand1.hide();
		oDivTitleBarShrink0.show();
		oDivTitleBarShrink1.hide();
	}
	else{
		oDivTitleBarExpand0.show();
		oDivTitleBarExpand1.hide();
		oDivTitleBarShrink0.hide();
		oDivTitleBarShrink1.hide();
	}
	//oThis._oTip.tip.hide();
}
NavPodClass.prototype.titleBarRollOver = function(){
	/*var oThis = $(this);
	var oDivTitleBar = $(oThis.getChildElementById("divTitleBar"));
	var sContent = "Drag";
	var sWidth = (sContent.length*6).toString();
	if(Prototype.Browser.IE == true && parseInt(Prototype.Browser.Version) < 8){
		sWidth = "auto";
	}
	$(oThis._oTip.tip.setStyle({whiteSpace:"nowrap", width:sWidth})).update(sContent);*/
}
NavPodClass.prototype.titleBarRollOut = function(){
	/*var oThis = $(this);
	var oDivTitleBar = $(oThis.getChildElementById("divTitleBar"));
	var sContent = "Pod "+(oThis._iOrdinalId+1);
	var sWidth = (sContent.length*6).toString();
	if(Prototype.Browser.IE == true && parseInt(Prototype.Browser.Version) < 8){
		sWidth = "auto";
	}
	$(oThis._oTip.tip.setStyle({whiteSpace:"nowrap", width:sWidth})).update(sContent);*/
}
NavPodClass.prototype.titleBarExpandShrink = function(){
	var oThis = $(this);
	var iMinPodWidth = 310;
	var iMinPodHeight = 229;
	var oDivTitleBar = $(oThis.getChildElementById("divTitleBar"));
	var oDivTitleBarExpand0 = $(oDivTitleBar.getChildElementById("divTitleBarExpand0"));
	var oDivTitleBarExpand1 = $(oDivTitleBar.getChildElementById("divTitleBarExpand1"));
	var oDivTitleBarShrink0 = $(oDivTitleBar.getChildElementById("divTitleBarShrink0"));
	var oDivTitleBarShrink1 = $(oDivTitleBar.getChildElementById("divTitleBarShrink1"));
	var iPodWidth = oThis._iOrigWidth;
	var iPodHeight = oThis._iOrigHeight;
	var iW = iPodWidth;
	var iH = iPodHeight;
	var fnc;
	oThis.postExpandShrink = function(fnc){
		fnc();
	}
	if(oThis._bDisableExpandShrink != true){
		if(oThis._width == iW && oThis._height == iH){
			oDivTitleBar._bExpanded = true;
			iW = (iPodWidth*2)+(10);
			iH = (iPodHeight*2)+(10);
			if(Prototype.Browser.IE == true && parseInt(Prototype.Browser.Version) < 8){
				iW = (iPodWidth*2)+(10);
				iH = (iPodHeight*2)+(10);
			}
			oDivTitleBarExpand0.hide();
			oDivTitleBarExpand1.hide();
			oDivTitleBarShrink0.show();
			oDivTitleBarShrink1.hide();
			if(oThis.fncExpanded){
				fnc = oThis.fncExpanded;
			}
		}
		else{
			oDivTitleBar._bExpanded = false;
			oDivTitleBarExpand0.hide();
			oDivTitleBarExpand1.show();
			oDivTitleBarShrink0.hide();
			oDivTitleBarShrink1.hide();
			if(oThis.fncShrunk){
				oThis.fncShrunk();
			}
		}
		oThis._width = iW;
		oThis._height = iH;
		if(oDivTitleBar._bExpanded == true){
			oThis.tween("width", iW, 500, "easeInOutQuad", "postExpandShrink", oThis, 100, fnc);
		}
		else{
			oThis.tween("width", iW, 500, "easeInOutQuad");
		}
		oThis.tween("height", iH, 500, "easeInOutQuad");
		oThis.getChildElementById("divContent").tween("height", iH-21, 500, "easeInOutQuad");
		oThis.getRoot().iTotalHeight = 0;
		var iCanvasWidth = getBrowserWidth();
		if(oThis.ancestors()[0]._iCanvasWidth){
			if(oThis.ancestors()[0]._iCanvasWidth > 0){
				iCanvasWidth = oThis.ancestors()[0]._iCanvasWidth;
			}
		}
		oThis.ancestors()[0]._PodsBroadcaster.broadcastMessage("onReorderPodsBroadcasted", {iWidth:iCanvasWidth, iHeight:0});
	}
}
NavPodClass.prototype.titleBarDropDownRollOver = function(){
	var oThis = $(this);
	var oDivTitleBar = $(oThis.getChildElementById("divTitleBar"));
	var oDivTitleBarDropDown0 = $(oDivTitleBar.getChildElementById("divTitleBarDropDown0"));
	var oDivTitleBarDropDown1 = $(oDivTitleBar.getChildElementById("divTitleBarDropDown1"));
	oDivTitleBarDropDown0.hide();
	oDivTitleBarDropDown1.show();
	sContent = "Menu (In development for next build)";
	var sWidth = (sContent.length*6).toString();
	var sSuffix = "px";
	if(Prototype.Browser.IE == true && parseInt(Prototype.Browser.Version) < 8){
		sWidth = "auto";
		sSuffix = "";
	}
	//$(oThis._oTip.tip.setStyle({whiteSpace:"nowrap", width:sWidth+sSuffix})).update(sContent);
	//oThis._oTip.tip.show();
}
NavPodClass.prototype.titleBarDropDownRollOut = function(){
	var oThis = $(this);
	var oDivTitleBar = $(oThis.getChildElementById("divTitleBar"));
	var oDivTitleBarDropDown0 = $(oDivTitleBar.getChildElementById("divTitleBarDropDown0"));
	var oDivTitleBarDropDown1 = $(oDivTitleBar.getChildElementById("divTitleBarDropDown1"));
	oDivTitleBarDropDown0.show();
	oDivTitleBarDropDown1.hide();
	//oThis._oTip.tip.hide();
}
NavPodClass.prototype.titleBarBackRollOver = function(){
	var oThis = $(this);
	var oDivTitleBar = $(oThis.getChildElementById("divTitleBar"));
	var oDivTitleBarBack0 = $(oDivTitleBar.getChildElementById("divTitleBarBack0"));
	var oDivTitleBarBack1 = $(oDivTitleBar.getChildElementById("divTitleBarBack1"));
	if(!oThis._bInHideBack){
		oDivTitleBarBack0.hide();
		oDivTitleBarBack1.show();
	}
	sContent = "Back";
	var sWidth = (sContent.length*6).toString();
	var sSuffix = "px";
	if(Prototype.Browser.IE == true && parseInt(Prototype.Browser.Version) < 8){
		sWidth = "auto";
		sSuffix = "";
	}
	//$(oThis._oTip.tip.setStyle({whiteSpace:"nowrap", width:sWidth+sSuffix})).update(sContent);
	//oThis._oTip.tip.show();
}
NavPodClass.prototype.titleBarBackRollOut = function(){
	var oThis = $(this);
	var oDivTitleBar = $(oThis.getChildElementById("divTitleBar"));
	var oDivTitleBarBack0 = $(oDivTitleBar.getChildElementById("divTitleBarBack0"));
	var oDivTitleBarBack1 = $(oDivTitleBar.getChildElementById("divTitleBarBack1"));
	if(!oThis._bInHideBack){
		oDivTitleBarBack0.show();
		oDivTitleBarBack1.hide();
	}
	oThis._bInHideBack = false;
	//oThis._oTip.tip.hide();
}
NavPodClass.prototype.titleBarBackMouseUp = function(){
	var oThis = $(this);
	oThis._bInHideBack = true;
	oThis.hideBack();
	//alert(oThis.id);
}
NavPodClass.prototype.showBack = function(fncCallback, oCallbackParams){
	var oThis = $(this);
	var oDivTitleBar = $(oThis.getChildElementById("divTitleBar"));
	var oDivTitleBarBack0 = $(oDivTitleBar.getChildElementById("divTitleBarBack0"));
	var oDivTitleBarBack1 = $(oDivTitleBar.getChildElementById("divTitleBarBack1"));
	var oDivTitleBarTitle = $(oDivTitleBar.getChildElementById("divTitleBarTitle"));
	oDivTitleBarBack0.show();
	oDivTitleBarBack1.hide();
	oDivTitleBarTitle.tween("left", 26, 250, "easeOutCirc");
	oThis._fncBackCallback = fncCallback;
	oThis._oBackCallbackParams = oCallbackParams;
}
NavPodClass.prototype.hideBack = function(){
	var oThis = $(this);
	var oDivTitleBar = $(oThis.getChildElementById("divTitleBar"));
	var oDivTitleBarBack0 = $(oDivTitleBar.getChildElementById("divTitleBarBack0"));
	var oDivTitleBarBack1 = $(oDivTitleBar.getChildElementById("divTitleBarBack1"));
	var oDivTitleBarTitle = $(oDivTitleBar.getChildElementById("divTitleBarTitle"));
	oDivTitleBarBack0.hide();
	oDivTitleBarBack1.hide();
	oDivTitleBarTitle.tween("left", 8, 500, "easeInOutCirc");
	oThis._oBackCallbackParams.oElementTarget.getChildElementById("divContent").update();
	oThis._fncBackCallback(oThis._oBackCallbackParams.oTemplateNode, oThis._oBackCallbackParams.oElementTarget, oThis._oBackCallbackParams.sPrevContentHeader, oThis._oBackCallbackParams.sPrevContent, oThis._oBackCallbackParams.sPrevContentFooter, oThis._oBackCallbackParams.oOriginalTemplateNode);
	//oThis._fncBackCallback(oThis._oBackCallbackParams.oTemplateNode, oThis._oBackCallbackParams.oElementTarget);
}
NavPodClass.prototype.setCurrentPodDragObj = function(o){
	var oThis = $(this);
	oThis.getRoot()._oCurrentPodDragObj = o;
}
NavPodClass.prototype.getCurrentPodDragObj = function(){
	var oThis = $(this);
	if(!oThis.getRoot()._oCurrentPodDragObj){
		oThis.getRoot()._oCurrentPodDragObj = {_iOrdinalId:-1};
	}
	return oThis.getRoot()._oCurrentPodDragObj;
}
NavPodClass.prototype.swapId = function(oSwapTarget){
	var oThis = $(this);
	var temp_ordinalId = oThis._iOrdinalId;
	oThis._iOrdinalId = oSwapTarget._iOrdinalId;
	oSwapTarget._iOrdinalId = temp_ordinalId;
	oThis.getRoot()._aryPodIndex[temp_ordinalId] = oThis.getRoot()._aryPodIndex[oThis._iOrdinalId];
	oThis.getRoot()._aryPodIndex[oThis._iOrdinalId] = oThis;
	oThis._oTemplateNode._iOrdinalId = oThis._iOrdinalId;
	oSwapTarget._oTemplateNode._iOrdinalId = oSwapTarget._iOrdinalId;
}
NavPodClass.prototype.reorderIds = function(oFromTarget, oToTarget){
	var oThis = $(this);
	var iFromId = oFromTarget._iOrdinalId;
	var iToId = oToTarget._iOrdinalId;
	var aryPodIndexTemp = new Array();
	for(var j=0; j<oThis.getRoot()._aryPodIndex.length; j++){
		aryPodIndexTemp[j] = oThis.getRoot()._aryPodIndex[j];
	}
	if(iToId < iFromId){
		for(var i=iToId; i<iFromId; i++){
			aryPodIndexTemp[i].swapId(aryPodIndexTemp[i+1]);
		}
	}
	else{
		for(var i=0; i<(iToId-iFromId); i++){
			aryPodIndexTemp[iFromId+i].swapId(aryPodIndexTemp[iToId]);
		}
	}
	//oFromTarget.swapId(oToTarget); // for simple source/target swap style reordering
}
NavPodClass.prototype.onPodDragStart = function(){
	var oThis = $(this);
	oThis.setCurrentPodDragObj(oThis);
}
NavPodClass.prototype.onPodDragEnd = function(){
	var oThis = $(this);
	var oCurrentPodDragObj = oThis.getCurrentPodDragObj();
	oThis.setCurrentPodDragObj({_iOrdinalId:-1});
	var iCanvasWidth = getBrowserWidth();
	if(oThis.ancestors()[0]._iCanvasWidth){
		if(oThis.ancestors()[0]._iCanvasWidth > 0){
			iCanvasWidth = oThis.ancestors()[0]._iCanvasWidth;
		}
	}
	oCurrentPodDragObj.onDragReorderPodsBroadcasted({iWidth:iCanvasWidth, iHeight:0});
	oThis.saveCurrentPodPositions();
}
NavPodClass.prototype.saveCurrentPodPositions = function(){
	var oThis = $(this);
	var sSerialized = "";
	var sSeperator = ",";
	for(var j=0; j<oThis.getRoot()._aryPodIndex.length; j++){
		if(j == (oThis.getRoot()._aryPodIndex.length-1)){
			sSeperator = "";
		}
		sSerialized = sSerialized + $(this.getRoot().id+"_"+"divPodArea_"+j)._iOrdinalId+sSeperator;
	}
	setCookieData("sPodOrdinalPositionsArray="+sSerialized, window._getCurrentNavId());
}
NavPodClass.prototype.onPodDropHoverStart = function(){
	var oThis = $(this);
	var oCurrentPodDragObj = oThis.getCurrentPodDragObj();
	oThis.reorderIds(oCurrentPodDragObj,oThis);
	var iCanvasWidth = getBrowserWidth();
	if(oThis.ancestors()[0]._iCanvasWidth){
		if(oThis.ancestors()[0]._iCanvasWidth > 0){
			iCanvasWidth = oThis.ancestors()[0]._iCanvasWidth;
		}
	}
	oThis.ancestors()[0]._PodsBroadcaster.broadcastMessage("onDragReorderPodsBroadcasted", {iWidth:iCanvasWidth, iHeight:0});
}
NavPodClass.prototype.onPodDrop = function(){
	var oThis = $(this);
	var oCurrentPodDragObj = oThis.getCurrentPodDragObj();
	oThis.setCurrentPodDragObj({_iOrdinalId:-1});
	var iCanvasWidth = getBrowserWidth();
	if(oThis.ancestors()[0]._iCanvasWidth){
		if(oThis.ancestors()[0]._iCanvasWidth > 0){
			iCanvasWidth = oThis.ancestors()[0]._iCanvasWidth;
		}
	}
	oCurrentPodDragObj.onDragReorderPodsBroadcasted({iWidth:iCanvasWidth, iHeight:0});
}
NavPodClass.prototype.onPodDropHoverEnd = function(){
	var oThis = $(this);
}
NavPodClass.prototype.onDragReorderPodsBroadcasted = function(oArgs){
	var oThis = $(this);
	var iWidth = oArgs.iWidth;
	var iHeight = oArgs.iHeight;
	var bNoAnim = oArgs.bNoAnim;
	var iMinPodWidth = 310;
	//alert(oThis.id);
	if(Prototype.Browser.IE == true){
		bNoAnim = true; // to circumvent ie's awful performance, maybe we'll turn this back on, one day
	}
	if(oThis != oThis.getCurrentPodDragObj()){
		if(oThis.getRoot().aryReorderMatrixLastCalculated){
			//alert(oThis._iOrdinalId);
			if(bNoAnim){
				oThis.setStyle({top:oThis.getRoot().aryReorderMatrixLastCalculated[oThis._iOrdinalId]._targetY+"px"});
				oThis.setStyle({left:oThis.getRoot().aryReorderMatrixLastCalculated[oThis._iOrdinalId]._targetX+"px"});
			}
			else{
				//alert(oThis.getRoot().aryReorderMatrixLastCalculated[2]);
				//alert(oThis._iOrdinalId+" - "+oThis.getRoot().aryReorderMatrixLastCalculated[oThis._iOrdinalId]._targetY);
				oThis.tween("top", oThis.getRoot().aryReorderMatrixLastCalculated[oThis._iOrdinalId]._targetY, 500, "easeInOutQuad");
				oThis.tween("left", oThis.getRoot().aryReorderMatrixLastCalculated[oThis._iOrdinalId]._targetX, 500, "easeInOutQuad");
			}
		}
	}
	return oThis;
}
NavPodClass.prototype.onReorderPodsFromSavedPosition = function(oArgs){
	var oThis = $(this);
	var iWidth = oArgs.iWidth;
	var iHeight = oArgs.iHeight;
	var bNoAnim = oArgs.bNoAnim;
	var iMinPodWidth = 310;
	oThis._iOrdinalId = oThis._oTemplateNode._iOrdinalId;
	oThis.getRoot()._aryPodIndex[oThis._iOrdinalId] = oThis;
	//alert(oThis.id+" - "+oThis._iOrdinalId);
	if(oThis.getRoot().aryReorderMatrixLastCalculated[oThis._iOrdinalId]){
		oThis.setStyle({top:oThis.getRoot().aryReorderMatrixLastCalculated[oThis._iOrdinalId]._targetY+"px"});
		oThis.setStyle({left:oThis.getRoot().aryReorderMatrixLastCalculated[oThis._iOrdinalId]._targetX+"px"});
	}
	return oThis;
}
NavPodClass.prototype.onReorderPodsBroadcasted = function(oArgs){
	var oThis = $(this);
	var iWidth = oArgs.iWidth;
	var iHeight = oArgs.iHeight;
	var bNoAnim = oArgs.bNoAnim;
	var iMinPodWidth = 310;
	var iCurrentPodDragId = oThis.getCurrentPodDragObj()._iOrdinalId;
	var iIe6adjust = 0;
	if(Prototype.Browser.IE == true && parseInt(Prototype.Browser.Version) == 6){
		iIe6adjust = 20;
	}
	if(Prototype.Browser.IE == true){
		bNoAnim = true; // if ie improves its performance some day maybe we'll turn this back on.
	}
	//iWidth = iWidth - 208;
	//iHeight = iHeight - 202;
	//alert("onReorderPodsBroadcasted - "+iWidth+" - "+iHeight);
	oThis.__setPosition = function(oThis, x, y){
		//oThis.tweenCancel("top");
		//oThis.tweenCancel("left");
		oThis.tween("left", x, 500, "easeInOutQuad");
		oThis.tween("top", y, 500, "easeInOutQuad");
	}
	if(oThis.getRoot().aryReorderMatrix == undefined){
		oThis.getRoot().aryReorderMatrix = new Array();
		var slowmoFactor = 1;
		var aryChildren = oThis.getRoot().childElements();
		var iTargetX;
		var iTargetY;
		var iWidthThusFar = 0;
		var iHeightThusFar = 0;
		var iHeightThusFarForThisRow = 0;
		var iSmallestHeightThusFarForThisRow = 0;
		var iLargestHeightThusFarForThisRow = 0;
		var iHeightThusFarBeforeRowStart = 0;
		var iRow;
		var iCurrentRowIndex = 0;
		var iCol;
		var iTopMargin = 10;
		var iLeftMargin = 10;
		var iGutterVert = 10;
		var iGutterHorz = 10;
		for(var i=0; i < oThis._iOrdinalId+1; i++){
			if(aryChildren[i]._bShadeCollapsed == true && aryChildren[i].getChildElementById("divTitleBar")._bShadeExpanded == false){
				aryChildren[i]._height = "20";
			}
		}
		
		for(var i=0; i < oThis._iOrdinalId+1; i++){
			oThis.getRoot().aryReorderMatrix[i] = new Object();
			oThis.getRoot().aryReorderMatrix[i]._x = styleStrToNum(aryChildren[i].getStyle("left"));
			oThis.getRoot().aryReorderMatrix[i]._y = styleStrToNum(aryChildren[i].getStyle("top"));
			//this.getRoot().aryReorderMatrix[i]._width = aryChildren[i]._width;
			//this.getRoot().aryReorderMatrix[i]._height = aryChildren[i]._height;
			
			if(i==0){ // if first one
				iTargetX = 0+iLeftMargin;
				iTargetY = 0+iTopMargin;
				iWidthThusFar = parseFloat(aryChildren[i]._width);
				iHeightThusFar = parseFloat(aryChildren[i]._height);
				iHeightThusFarForThisRow = parseFloat(aryChildren[i]._height);
				iSmallestHeightThusFarForThisRow = parseFloat(aryChildren[i]._height);
				iRow = 0;
				iCol = 0;
				aryChildren[i]._row = iRow;
				aryChildren[i]._col = iCol;
				//alert("pod id "+i+" must fit");
				//alert(i+" first one, id: "+oThis._iOrdinalId+" ("+oThis.id+")");
			}
			else{ // not first one
				if(aryChildren[i]._bCurrentPodHorzSizeByEngine == true && aryChildren[i+1]._width == iMinPodWidth){
					aryChildren[i]._width = iMinPodWidth;
					aryChildren[i]._bCurrentPodHorzSizeByEngine = false;
					aryChildren[i+1]._bSetAdjacentPodHorzSizeByEngine = false;
					$(aryChildren[i]).tween("width", aryChildren[i]._width, 500, "easeInOutQuad");
				}
				if(oThis.getRoot().aryReorderMatrix[i-1]._widthThusFar + iGutterVert + parseFloat(aryChildren[i]._width) <= iWidth){ // if fits in width of stage, keep going on current row
					iWidthThusFar = oThis.getRoot().aryReorderMatrix[i-1]._widthThusFar + iGutterVert + parseFloat(aryChildren[i]._width);
					if(oThis.getRoot().aryReorderMatrix[i-1]._heightThusFarForThisRow > parseFloat(aryChildren[i]._height)){//if prev is taller use that
						iHeightThusFar = oThis.getRoot().aryReorderMatrix[i-1]._heightThusFar;
						iHeightThusFarForThisRow = oThis.getRoot().aryReorderMatrix[i-1]._heightThusFarForThisRow;
					}
					else{
						iHeightThusFar = oThis.getRoot().aryReorderMatrix[i-1]._heightThusFarBeforeRowStart + parseFloat(aryChildren[i]._height);
						iHeightThusFarForThisRow = parseFloat(aryChildren[i]._height);
					}
					if(aryChildren[i]._height < iSmallestHeightThusFarForThisRow){
						iSmallestHeightThusFarForThisRow = aryChildren[i]._height;
					}
					iTargetY = oThis.getRoot().aryReorderMatrix[i-1]._targetY;
					iTargetX = oThis.getRoot().aryReorderMatrix[i-1]._targetX + parseFloat(aryChildren[i-1]._width) + iGutterVert;
					iCol++;
					aryChildren[i]._row = iRow;
					aryChildren[i]._col = iCol;
					//alert("pod id "+i+" fits in current stage width ("+iWidth+") and will stay on row "+ iRow+". col "+iCol);
				}
				else{ // does not fit, bump to next row down
					// if available space allows previous pod to expand at least one pod width plus margin then do it
					if(iWidth-iWidthThusFar >= iMinPodWidth+iGutterHorz && oThis._oTemplateNode.enableHorizontalAutoFillSpace == "true"){
						aryChildren[i-1]._width = iMinPodWidth*2+iGutterHorz;
						aryChildren[i-1]._bCurrentPodHorzSizeByEngine = true;
						aryChildren[i]._bSetAdjacentPodHorzSizeByEngine = true;
						$(aryChildren[i-1]).tween("width", aryChildren[i-1]._width, 500, "easeInOutQuad");
					}
					iCol = 0;
					iRow++;
					aryChildren[i]._row = iRow;
					aryChildren[i]._col = iCol;
					iWidthThusFar = parseFloat(aryChildren[i]._width);
					iHeightThusFar = oThis.getRoot().aryReorderMatrix[i-1]._heightThusFar + parseFloat(aryChildren[i]._height) + iGutterHorz;
					iHeightThusFarForThisRow = parseFloat(aryChildren[i]._height);
					iHeightThusFarBeforeRowStart = iSmallestHeightThusFarForThisRow = oThis.getRoot().aryReorderMatrix[i-1]._heightThusFar + iGutterHorz;
					iTargetY = oThis.getRoot().aryReorderMatrix[i-1]._heightThusFar + iGutterHorz+iTopMargin;
					iTargetX = 0+iLeftMargin;
					//alert("pod id "+i+" does NOT fit in current stage width ("+iWidth+") and will be bumped down to row "+ iRow+". col "+iCol);
				}
			}
			if(oThis._iOrdinalId == aryChildren.length-1 && i == aryChildren.length-1){ // on very last one, after everything has calculated with baseline reordering logic
				for (var k=0; k < aryChildren.length-1; k++){
					iSmallestHeightThusFarForThisRow = 0;
					iLargestHeightThusFarForThisRow = 0;
					for (var j=iCurrentRowIndex; j < aryChildren.length-1 && aryChildren[j]._row == aryChildren[iCurrentRowIndex]._row; j++){
						//alert(j+" - row: "+aryChildren[j]._row+" - "+aryChildren[j]._height);
						if(iSmallestHeightThusFarForThisRow == 0){
							iSmallestHeightThusFarForThisRow = parseFloat(aryChildren[j]._height);
						}
						if(aryChildren[j]._height < iSmallestHeightThusFarForThisRow){
							iSmallestHeightThusFarForThisRow = parseFloat(aryChildren[j]._height);
						}
						if(iLargestHeightThusFarForThisRow == 0 && aryChildren[j]._bCurrentPodVertSizeByEngine == false){
							iLargestHeightThusFarForThisRow = parseFloat(aryChildren[j]._height);
						}
						if(iLargestHeightThusFarForThisRow == 0 && aryChildren[j]._bCurrentPodVertSizeByEngine == true){
							iLargestHeightThusFarForThisRow = parseFloat(aryChildren[j]._iOrigHeight);
						}
						if(aryChildren[j]._height > iLargestHeightThusFarForThisRow){
							iLargestHeightThusFarForThisRow = parseFloat(aryChildren[j]._height);
						}
					}
					//alert("row: "+aryChildren[k]._row+" - id: "+aryChildren[k].id+" - height: "+aryChildren[k]._height+" - iLargestHeightThusFarForThisRow: "+iLargestHeightThusFarForThisRow+" - iSmallestHeightThusFarForThisRow: "+iSmallestHeightThusFarForThisRow);
					for (var j=iCurrentRowIndex; j < aryChildren.length-1 && aryChildren[j]._row == aryChildren[iCurrentRowIndex]._row; j++){
						//alert("row: "+aryChildren[j]._row+" - id: "+aryChildren[j].id+" - height: "+aryChildren[j]._height+" - iLargestHeightThusFarForThisRow: "+iLargestHeightThusFarForThisRow+" - iSmallestHeightThusFarForThisRow: "+iSmallestHeightThusFarForThisRow);
						if(aryChildren[j]._height > iSmallestHeightThusFarForThisRow && aryChildren[j]._bCurrentPodVertSizeByEngine == true){
							//alert(j+" - "+aryChildren[j]._height+" - "+iSmallestHeightThusFarForPrevRow+" - "+aryChildren[j]._bCurrentPodVertSizeByEngine);
							//alert("(<shink> height greater than iSmallestHeightThusFarForThisRow and sizebyengine true) pod: "+j+" - id: "+aryChildren[j].id+" - row: "+aryChildren[j]._row+" - aryChildren[j]._height: "+aryChildren[j]._height+" - iLargestHeightThusFarForThisRow: "+iLargestHeightThusFarForThisRow+" - iSmallestHeightThusFarForThisRow: "+iSmallestHeightThusFarForThisRow+" - _bCurrentPodVertSizeByEngine: "+aryChildren[j]._bCurrentPodVertSizeByEngine);
							//aryChildren[j]._bCurrentPodVertSizeByEngine = false;
							//aryChildren[j]._height = parseFloat(aryChildren[j]._iOrigHeight);
							//$(aryChildren[j]).tween("height", iSmallestHeightThusFarForThisRow, 500, "easeInOutQuad");
							//iHeightThusFarForThisRow = iSmallestHeightThusFarForThisRow;
							//iHeightThusFar = iHeightThusFar - iSmallestHeightThusFarForThisRow;
							//iTargetY = iTargetY - iSmallestHeightThusFarForThisRow;
						}
						//alert(j+" - "+aryChildren[j]._height+" - "+iLargestHeightThusFarForThisRow);
						if(aryChildren[j]._height < iLargestHeightThusFarForThisRow && aryChildren[j]._bCurrentPodVertSizeByEngine == false){
							//alert("(<expand> height smaller than iLargestHeightThusFarForThisRow and sizebyengine false) pod: "+j+" - id: "+aryChildren[j].id+" - row: "+aryChildren[j]._row+" - aryChildren[j]._height: "+aryChildren[j]._height+" - iLargestHeightThusFarForThisRow: "+iLargestHeightThusFarForThisRow+" - iSmallestHeightThusFarForThisRow: "+iSmallestHeightThusFarForThisRow+" - _bCurrentPodVertSizeByEngine: "+aryChildren[j]._bCurrentPodVertSizeByEngine);
							//aryChildren[j]._height = iLargestHeightThusFarForThisRow;
							//aryChildren[j]._bCurrentPodVertSizeByEngine = true;
							//$(aryChildren[j]).tween("height", iLargestHeightThusFarForThisRow, 500, "easeInOutQuad");
							//iHeightThusFarForThisRow = iLargestHeightThusFarForThisRow;
							//iHeightThusFar = iHeightThusFar + iLargestHeightThusFarForThisRow;
							//iTargetY = iTargetY + iLargestHeightThusFarForThisRow;
						}
					}
					iCurrentRowIndex = j;
				}
			}
			//aryChildren[i].getChildElementById("divTitleBar").getChildElementById("divTitleBarTitle").update(aryChildren[i]._width); // for debugging
			oThis.getRoot().aryReorderMatrix[i]._targetX = oThis._iOrigX = iTargetX;
			oThis.getRoot().aryReorderMatrix[i]._targetY = oThis._iOrigY = iTargetY;
			oThis.getRoot().aryReorderMatrix[i]._widthThusFar = iWidthThusFar;
			oThis.getRoot().aryReorderMatrix[i]._heightThusFar = iHeightThusFar;
			oThis.getRoot().aryReorderMatrix[i]._heightThusFarForThisRow = iHeightThusFarForThisRow;
			oThis.getRoot().aryReorderMatrix[i]._heightThusFarBeforeRowStart = iHeightThusFarBeforeRowStart;
			oThis.getRoot().aryReorderMatrix[i]._row = iRow;
			oThis.getRoot().aryReorderMatrix[i]._col = iCol;
			oThis.getRoot().aryReorderMatrix[i]._ordinalId = oThis._iOrdinalId;
			
		}
	}
				
	//this._x = this.getRoot().aryReorderMatrix[this._iOrdinalId]._targetX;
	//this._y = this.getRoot().aryReorderMatrix[this._iOrdinalId]._targetY;

	//oThis.tweenCancel("top");
	//oThis.tweenCancel("left");
	//oThis.mcDebug.txtInstance.text = oThis.getRoot().aryReorderMatrix[oThis._iOrdinalId]._heightThusFar + " - " +oThis.getRoot().aryReorderMatrix[oThis._iOrdinalId]._heightThusFarForThisRow;
	//if(oThis._iOrdinalId != iCurrentPodDragId){
		if(bNoAnim){
			//oThis.setStyle({top:oThis.getRoot().aryReorderMatrix[oThis._iOrdinalId]._targetY+"px"});
			//oThis.setStyle({left:oThis.getRoot().aryReorderMatrix[oThis._iOrdinalId]._targetX+"px"});
		}
		else{
			//oThis.tween("top", oThis.getRoot().aryReorderMatrix[oThis._iOrdinalId]._targetY, 800*slowmoFactor, "easeInOutQuad");
			//oThis.tween("left", oThis.getRoot().aryReorderMatrix[oThis._iOrdinalId]._targetX, 500*slowmoFactor, "easeInOutQuad");
		}
		//oThis.setStyle({top:"10px"});

	//}
	//_global.__reOrderTimeoutId = setTimeout(this.__setPosition, 500, this, this.getRoot().aryReorderMatrix[this._iOrdinalId]._targetX, this.getRoot().aryReorderMatrix[this._iOrdinalId]._targetY);

	if(oThis._iOrdinalId == oThis.getRoot().aryReorderMatrix.length-1){ // on last one
		//getURL("javascript:document.title='"+oThis.getRoot().aryReorderMatrix[oThis._iOrdinalId]._heightThusFar+ "-" +iHeight+"'");
		//_root.txtDebug.text = "";
		if(oThis.getRoot().aryReorderMatrix[oThis._iOrdinalId]._heightThusFar > iHeight){
			//_root.txtDebug.text = "yes greater than.  ";
			
			//if(_root.cmpScrollbar == undefined){
			//	//_root.cmpScrollbar.removeMovieClip();
			//	_root.attachMovie("ultimateScroller","cmpScrollbar",200, {_x: parseFloat(Stage.width - 222), _y: -16});
			//	_root.cmpScrollbar.scrollTarget = _root.mcMain;
			//	_root.cmpScrollbar.size = (parseFloat(Stage.height - 169));
			//	_root.cmpScrollbar.easing = "med";
			//	_root.cmpScrollbar.arrowsVisible = false;
			//	_root.cmpScrollbar.buttonsVisible = false;
			//	_root.cmpScrollbar.scrollTrackVisible = false;
			//}
			//else{
			//	_root.cmpScrollbar._visible = true;
			//	_root.cmpScrollbar.size = (parseFloat(Stage.height - 169));
			//	_root.cmpScrollbar._x = parseFloat(Stage.width - 222);
			//	_root.cmpScrollbar._y = -16;
				
			//}
		}
		else{
			//_root.txtDebug.text = "no not greater than.  ";
			//_root.cmpScrollbar.removeMovieClip();
			//_root.cmpScrollbar._visible = false;
		}
		//_root.txtDebug.text =  _root.txtDebug.text + "height thus far: "+oThis.getRoot().aryReorderMatrix[oThis._iOrdinalId]._heightThusFar+" - height: "+iHeight;
		oThis.getRoot().aryReorderMatrixLastCalculated = oThis.getRoot().aryReorderMatrix;
		//alert(i+" - "+oThis._iOrdinalId+" - "+oThis.getRoot().aryReorderMatrixLastCalculated[oThis._iOrdinalId]);
		oThis.getRoot().aryReorderMatrix = null;
	}
				//alert(oThis.getRoot().aryReorderMatrix[oThis._iOrdinalId] + " - "+oThis._iOrdinalId);
				//return oThis;
	//alert(oThis._iOrdinalId);
	if(!oThis.getRoot().iTotalHeight){
		oThis.getRoot().iTotalHeight = iHeightThusFar;
	}
	else{
		if(oThis.getRoot().iTotalHeight < iHeightThusFar){
			oThis.getRoot().iTotalHeight = iHeightThusFar;
		}
	}
	if(bNoAnim){
		oThis.parentNode.setStyle({height:(oThis.getRoot().iTotalHeight+iIe6adjust)+"px"});
	}
	else{
		oThis.parentNode.tween("height", oThis.getRoot().iTotalHeight+iIe6adjust, 500*slowmoFactor, "easeInOutQuad");
	}
	//alert(oThis.getRoot().aryReorderMatrixLastCalculated[2]);
	return oThis;
}
NavPodClass.prototype.onPodDestroy = function(){
	var oThis = $(this);
	Droppables.remove(oThis);
	oThis._oDraggable.destroy();
}

NavPodClass.prototype.destroyDragAndDropIncludingSiblings = function(){
	var oThis = $(this);
	var aryChildren = oThis.getRoot().childElements();
	for(var i=0; i < aryChildren.length; i++){
		aryChildren[i]._oDraggable.destroy();
		aryChildren[i].getChildElementById("divTitleBar").setStyle({cursor: "default"});
	}
}

function createPod(iOrdinalId, oTemplateNode, iContentArea, oElementTarget){
	if(!iContentArea){
		iContentArea = 0;
	}
	if(!oElementTarget){
		oElementTarget = $("divContentArea_"+iContentArea);
	}
	var iCanvasWidth = getBrowserWidth();
	if(oElementTarget._iCanvasWidth){
		if(oElementTarget._iCanvasWidth > 0){
			iCanvasWidth = oElementTarget._iCanvasWidth;
		}
	}
	var sContentAreaId = oElementTarget.id;
	var sBgColor = "#"+window._oColors.colours.palette[window._sColorPaletteId].pods.background.hex_value;
	var sMainRollOverColor = "#"+window._oColors.colours.palette[window._sColorPaletteId].pods.main_rollover.hex_value;
	var sMainRollOutColor = "#"+window._oColors.colours.palette[window._sColorPaletteId].pods.main_rollout.hex_value;
	var sOutlineColor = "#"+window._oColors.colours.palette[window._sColorPaletteId].pods.main_rollout.hex_value;
	var sPodsTitleBarBackgroundColor = "#"+window._oColors.colours.palette[window._sColorPaletteId].pods.title_bar.background.hex_value;
	var sPodsTitleBarTitleColor = "#"+window._oColors.colours.palette[window._sColorPaletteId].pods.title_bar.title.hex_value;
	var sMainForegroundColor = "#"+window._oColors.colours.palette[window._sColorPaletteId].main.foreground.hex_value;
	var sHexLoadId = window._sColorPaletteId;
	var iGutterVert = 10;
	var iGutterHorz = 10;
	var oDiv = new Element("div");
	//alert(styleStrToNum($("divContentArea_0").getStyle("width")));
	oDiv.setAttribute("id", sContentAreaId+"_"+"divPodArea_"+iOrdinalId);
	var iPodWidth = 310;
	var iPodHeight = 229;
	//if(Prototype.Browser.IE == true && parseInt(Prototype.Browser.Version) < 8){
	//	iPodWidth = 310;
	//	iPodHeight = 229;
	//}
	oDiv._iDefaultWidthFactor = 1;
	oDiv._iDefaultHeightFactor = 1;
	oDiv._iMinWidthFactor = 1;
	oDiv._iMinHeightFactor = 1;
	oDiv._iMaxWidthFactor = 2;
	oDiv._iMaxHeightFactor = 2;
	oDiv._bDisableExpandShrink = false;
	oDiv._bDisableFreeResize = true;
	oDiv._bShadeEnabled = false;
	oDiv._bShadeCollapsed = false;
	oDiv._bDisableVerticalScrollbar = false;
	var sDivContentVisibility = "visible";
	
	if(oTemplateNode.defaultWidthFactor){
		oDiv._iDefaultWidthFactor = parseInt(oTemplateNode.defaultWidthFactor);
	}
	if(oTemplateNode.defaultHeightFactor){
		oDiv._iDefaultHeightFactor = parseInt(oTemplateNode.defaultHeightFactor);
	}
	if(oTemplateNode.minWidthFactor){
		oDiv._iMinWidthFactor = parseInt(oTemplateNode.minWidthFactor);
	}
	if(oTemplateNode.minHeightFactor){
		oDiv._iMinHeightFactor = parseInt(oTemplateNode.minHeightFactor);
	}
	if(oTemplateNode.maxWidthFactor){
		oDiv._iMaxWidthFactor = parseInt(oTemplateNode.maxWidthFactor);
	}
	if(oTemplateNode.maxHeightFactor){
		oDiv._iMaxHeightFactor = parseInt(oTemplateNode.maxHeightFactor);
	}
	if(oTemplateNode.parentCanvasDisableDragAndDrop){
		if(oTemplateNode.parentCanvasDisableDragAndDrop == "true"){
			oDiv._bDragAndDropIsDisabled = true;
		}
	}
	if(oTemplateNode.disableExpandShrink){
		if(oTemplateNode.disableExpandShrink == "true"){
			oDiv._bDisableExpandShrink = true;
		}
	}
	if(oTemplateNode.disableFreeResize){
		if(oTemplateNode.disableFreeResize == "false"){
			oDiv._bDisableFreeResize = false;
		}
	}
	if(oTemplateNode.shadeEnabled){
		if(oTemplateNode.shadeEnabled == "true"){
			oDiv._bShadeEnabled = true;
		}
	}
	if(oTemplateNode.shadeCollapsed){
		if(oTemplateNode.shadeCollapsed == "true"){
			oDiv._bShadeCollapsed = true;
		}
	}
	if(oTemplateNode.disableVerticalScrollbar){
		if(oTemplateNode.disableVerticalScrollbar == "true"){
			oDiv._bDisableVerticalScrollbar = true;
		}
	}
	var sColorPaletteShadeExpanded = parseArgs(window.getCookieData("colorPaletteShadeExpanded")).sColorPaletteShadeExpanded;
	if(sColorPaletteShadeExpanded == "true"){
		oDiv._bShadeCollapsed = false;
	}
	if(oDiv._bShadeCollapsed == true){
		sDivContentVisibility = "hidden";
	}
	iPodWidth = (iPodWidth * oDiv._iDefaultWidthFactor)+(iGutterHorz*(oDiv._iDefaultWidthFactor-1));
	iPodHeight = (iPodHeight * oDiv._iDefaultHeightFactor)+(iGutterVert*(oDiv._iDefaultHeightFactor-1));
	oDiv._iOrigWidth = iPodWidth;
	oDiv._iOrigHeight = iPodHeight;
	var iX = 10; //((iPodWidth+10)*iOrdinalId);
	var iY = 10;
	if(oDiv._bShadeCollapsed == true){
		oDiv.setStyle({
			backgroundColor:sBgColor,
			position:"absolute",
			left:iX.toString()+"px",
			top:iY.toString()+"px",
			width:iPodWidth.toString()+"px",
			height:"0px"
		});
	}
	else{
		oDiv.setStyle({
			backgroundColor:sBgColor,
			position:"absolute",
			left:iX.toString()+"px",
			top:iY.toString()+"px",
			width:iPodWidth.toString()+"px",
			height:iPodHeight.toString()+"px"
		});
	}
	this.bgRollOver = function(){
		window.oCurrentlyFocusedObject = oDiv;
		if(oDiv._bDisableExpandShrink != true && oDiv._bDisableFreeResize != true){ 
			//oDiv.setStyle({borderColor: sMainRollOverColor});
			//oDiv.getChildElementById("divContent").setStyle({borderTopColor: sMainRollOverColor});
			oDiv.showExpandShrinkControls();
		}
		if(oDiv._bShadeEnabled == true){
			oDiv.showShadeControls();
		}
	}
	this.bgRollOut = function(){
		if(oDiv._bDisableExpandShrink != true && oDiv._bDisableFreeResize != true){ 
			//oDiv.setStyle({borderColor: sOutlineColor});
			//oDiv.getChildElementById("divContent").setStyle({borderTopColor: sOutlineColor});
			oDiv.hideExpandShrinkControls();
		}
		if(oDiv._bShadeEnabled == true){
			oDiv.hideShadeControls();
		}
	}
	Event.observe(oDiv, "mouseenter", this.bgRollOver.bindAsEventListener(this));
	Event.observe(oDiv, "mouseleave", this.bgRollOut.bindAsEventListener(this));
	oElementTarget.appendChild(oDiv);
	oDiv._iOrdinalId = iOrdinalId;
	oDiv._width = iPodWidth;
	oDiv._height = iPodHeight;
	
	var oDivTitleBar = new Element("div");
	//$(oDivTitleBar).setAttribute("id", "divPodArea_"+iOrdinalId+"_titleBar"); 
	oDivTitleBar.setAttribute("id", "divTitleBar");
	oDivTitleBar._bShadeExpanded = false;
	//backgroundImage:"url("+getPathPrefix()+"_assets/themes/"+window.oTheme.id+"/images/"+sHexLoadId+"/_podTitlebarBgGradient.gif)",
	//backgroundRepeat:"repeat-x",
	oDivTitleBar.setStyle({
		backgroundColor:sPodsTitleBarBackgroundColor,
		position:"absolute",
		left: "0px",
		top: "0px",
		width: "100%",
		cursor: "move",
		height: "20px"
	});
	this.titleBarRollOver = function(){
		oDiv.titleBarRollOver();
	}
	this.titleBarRollOut = function(){
		oDiv.titleBarRollOut();
	}
	Event.observe(oDivTitleBar, "mouseenter", this.titleBarRollOver.bindAsEventListener(this));
	Event.observe(oDivTitleBar, "mouseleave", this.titleBarRollOut.bindAsEventListener(this));
	if(oDiv._bShadeCollapsed == false){
		oDivTitleBar._bShadeExpanded = true;
	}
	oDiv.appendChild(oDivTitleBar);
	
	var oDivTitleBarTitle = new Element("div");
	//alert(styleStrToNum($("divContentArea_0").getStyle("width")));
	oDivTitleBarTitle.setAttribute("id", "divTitleBarTitle"); 
	oDivTitleBarTitle.setStyle({
		position:"absolute",
		left:"9px",
		top:"0px",
		fontFamily:"verdana",
		fontSize:"9px",
		fontWeight:"bold",
		color:sPodsTitleBarTitleColor,
		textAlign:"left",
		verticalAlign:"middle",
		marginTop:"4px",
		width:"250px",
		height:"20px"
	});
	oDivTitleBar.appendChild(oDivTitleBarTitle);

	/* var oDivTitleBarExpandShrinkTooltipArea = window.document.createElement("DIV");
	//alert(styleStrToNum($("divContentArea_0").getStyle("width")));
	$(oDivTitleBarExpandShrinkTooltipArea).setAttribute("id", oDiv.id+"_divTitleBarExpandShrinkTooltipArea"); 
	oDivTitleBarExpandShrinkTooltipArea.setStyle({
		position: "absolute",
		backgroundColor: "#ff0000",
		right: 4,
		top: 0,
		width: 50,
		cursor: "default",
		height: 20
	});
	oDivTitleBar.appendChild(oDivTitleBarExpandShrinkTooltipArea);*/
	
	
	var oDivTitleBarShadeExpand0 = new Element("div");
	//alert(styleStrToNum($("divContentArea_0").getStyle("width")));
	oDivTitleBarShadeExpand0.setAttribute("id", "divTitleBarShadeExpand0"); 
	oDivTitleBarShadeExpand0.setStyle({
		position:"absolute",
		right:"4px",
		top:"0px",
		width:"20px",
		cursor:"default",
		height:"20px"
	});
	this.titleBarShadeExpand0RollOver = function(){
		oDiv.titleBarShadeExpandShrinkRollOver();
	}
	this.titleBarShadeExpand0RollOut = function(){
		oDiv.titleBarShadeExpandShrinkRollOut();
	}
	this.titleBarShadeExpand0MouseUp = function(){
		oDiv.titleBarShadeExpandShrink();
	}
	Event.observe(oDivTitleBarShadeExpand0, "mouseenter", this.titleBarShadeExpand0RollOver.bindAsEventListener(this));
	Event.observe(oDivTitleBarShadeExpand0, "mouseleave", this.titleBarShadeExpand0RollOut.bindAsEventListener(this));
	Event.observe(oDivTitleBarShadeExpand0, "mouseup", this.titleBarShadeExpand0MouseUp.bindAsEventListener(this));
	oDivTitleBar.appendChild(oDivTitleBarShadeExpand0);
	oDivTitleBarShadeExpand0.update('<img src="'+getPathPrefix()+'_assets/themes/'+window.oTheme.id+'/images/'+sHexLoadId+'/_podsTitleBarShadeDown0.gif" alt="" title=""/>');
	
	var oDivTitleBarShadeExpand1 = new Element("div");
	oDivTitleBarShadeExpand1.setAttribute("id", "divTitleBarShadeExpand1"); 
	oDivTitleBarShadeExpand1.setStyle({
		position:"absolute",
		right:"4px",
		top:"0px",
		width:"20px",
		cursor:"default",
		height:"20px"
	});
	this.titleBarShadeExpand1RollOut = function(){
		oDiv.titleBarShadeExpandShrinkRollOut();
	}
	this.titleBarShadeExpand1RollOver = function(){
		oDiv.titleBarShadeExpandShrinkRollOver();
	}
	this.titleBarShadeExpand1MouseUp = function(){
		oDiv.titleBarShadeExpandShrink();
	}
	Event.observe(oDivTitleBarShadeExpand1, "mouseenter", this.titleBarShadeExpand1RollOver.bindAsEventListener(this));
	Event.observe(oDivTitleBarShadeExpand1, "mouseleave", this.titleBarShadeExpand1RollOut.bindAsEventListener(this));
	Event.observe(oDivTitleBarShadeExpand1, "mouseup", this.titleBarShadeExpand1MouseUp.bindAsEventListener(this));
	oDivTitleBar.appendChild(oDivTitleBarShadeExpand1);
	oDivTitleBarShadeExpand1.update('<img src="'+getPathPrefix()+'_assets/themes/'+window.oTheme.id+'/images/'+sHexLoadId+'/_podsTitleBarShadeDown1.gif" alt="" title=""/>');
	oDivTitleBarShadeExpand1.hide();
	
	var oDivTitleBarShadeShrink0 = new Element("div");
	//alert(styleStrToNum($("divContentArea_0").getStyle("width")));
	oDivTitleBarShadeShrink0.setAttribute("id", "divTitleBarShadeShrink0"); 
	oDivTitleBarShadeShrink0.setStyle({
		position:"absolute",
		right:"4px",
		top:"0px",
		width:"20px",
		cursor:"default",
		height:"20px"
	});
	this.titleBarShadeShrink0RollOver = function(){
		oDiv.titleBarShadeExpandShrinkRollOver();
	}
	this.titleBarShadeShrink0RollOut = function(){
		oDiv.titleBarShadeExpandShrinkRollOut();
	}
	this.titleBarShadeShrink0MouseUp = function(){
		oDiv.titleBarShadeExpandShrink();
	}
	
	Event.observe(oDivTitleBarShadeShrink0, "mouseenter", this.titleBarShadeShrink0RollOver.bindAsEventListener(this));
	Event.observe(oDivTitleBarShadeShrink0, "mouseleave", this.titleBarShadeShrink0RollOut.bindAsEventListener(this));
	Event.observe(oDivTitleBarShadeShrink0, "mouseup", this.titleBarShadeShrink0MouseUp.bindAsEventListener(this));
	
	oDivTitleBar.appendChild(oDivTitleBarShadeShrink0);
	oDivTitleBarShadeShrink0.update('<img src="'+getPathPrefix()+'_assets/themes/'+window.oTheme.id+'/images/'+sHexLoadId+'/_podsTitleBarShadeUp0.gif" alt="" title=""/>');
	oDivTitleBarShadeShrink0.hide();
	
	var oDivTitleBarShadeShrink1 = new Element("div");
	oDivTitleBarShadeShrink1.setAttribute("id", "divTitleBarShadeShrink1"); 
	oDivTitleBarShadeShrink1.setStyle({
		position:"absolute",
		right:"4px",
		top:"0px",
		width:"20px",
		cursor:"default",
		height:"20px"
	});
	this.titleBarShadeShrink1RollOver = function(){
		oDiv.titleBarShadeExpandShrinkRollOver();
	}
	this.titleBarShadeShrink1RollOut = function(){
		oDiv.titleBarShadeExpandShrinkRollOut();
	}
	this.titleBarShadeShrink1MouseUp = function(){
		oDiv.titleBarShadeExpandShrink();
	}
	Event.observe(oDivTitleBarShadeShrink1, "mouseenter", this.titleBarShadeShrink1RollOver.bindAsEventListener(this));
	Event.observe(oDivTitleBarShadeShrink1, "mouseleave", this.titleBarShadeShrink1RollOut.bindAsEventListener(this));
	Event.observe(oDivTitleBarShadeShrink1, "mouseup", this.titleBarShadeShrink1MouseUp.bindAsEventListener(this));
	oDivTitleBar.appendChild(oDivTitleBarShadeShrink1);
	oDivTitleBarShadeShrink1.update('<img src="'+getPathPrefix()+'_assets/themes/'+window.oTheme.id+'/images/'+sHexLoadId+'/_podsTitleBarShadeUp1.gif" alt="" title=""/>');
	oDivTitleBarShadeShrink1.hide();
	
	
	
	
	/* ----- */
	
	var oDivTitleBarExpand0 = new Element("div");
	//alert(styleStrToNum($("divContentArea_0").getStyle("width")));
	oDivTitleBarExpand0.setAttribute("id", "divTitleBarExpand0"); 
	oDivTitleBarExpand0.setStyle({
		position:"absolute",
		right:"4px",
		top:"0px",
		width:"20px",
		cursor:"default",
		height:"20px"
	});
	this.titleBarExpand0RollOver = function(){
		oDiv.titleBarExpandShrinkRollOver();
	}
	this.titleBarExpand0RollOut = function(){
		oDiv.titleBarExpandShrinkRollOut();
	}
	this.titleBarExpand0MouseUp = function(){
		oDiv.titleBarExpandShrink();
	}
	Event.observe(oDivTitleBarExpand0, "mouseenter", this.titleBarExpand0RollOver.bindAsEventListener(this));
	Event.observe(oDivTitleBarExpand0, "mouseleave", this.titleBarExpand0RollOut.bindAsEventListener(this));
	Event.observe(oDivTitleBarExpand0, "mouseup", this.titleBarExpand0MouseUp.bindAsEventListener(this));
	oDivTitleBar.appendChild(oDivTitleBarExpand0);
	oDivTitleBarExpand0.update('<img src="'+getPathPrefix()+'_assets/themes/'+window.oTheme.id+'/images/'+sHexLoadId+'/_podsTitleBarExpand0.gif" alt="" title=""/>');
	
	var oDivTitleBarExpand1 = new Element("div");
	oDivTitleBarExpand1.setAttribute("id", "divTitleBarExpand1"); 
	oDivTitleBarExpand1.setStyle({
		position:"absolute",
		right:"4px",
		top:"0px",
		width:"20px",
		cursor:"default",
		height:"20px"
	});
	this.titleBarExpand1RollOut = function(){
		oDiv.titleBarExpandShrinkRollOut();
	}
	this.titleBarExpand1RollOver = function(){
		oDiv.titleBarExpandShrinkRollOver();
	}
	this.titleBarExpand1MouseUp = function(){
		oDiv.titleBarExpandShrink();
	}
	Event.observe(oDivTitleBarExpand1, "mouseenter", this.titleBarExpand1RollOver.bindAsEventListener(this));
	Event.observe(oDivTitleBarExpand1, "mouseleave", this.titleBarExpand1RollOut.bindAsEventListener(this));
	Event.observe(oDivTitleBarExpand1, "mouseup", this.titleBarExpand1MouseUp.bindAsEventListener(this));
	oDivTitleBar.appendChild(oDivTitleBarExpand1);
	oDivTitleBarExpand1.update('<img src="'+getPathPrefix()+'_assets/themes/'+window.oTheme.id+'/images/'+sHexLoadId+'/_podsTitleBarExpand1.gif" alt="" title=""/>');
	oDivTitleBarExpand1.hide();
	
	var oDivTitleBarShrink0 = new Element("div");
	//alert(styleStrToNum($("divContentArea_0").getStyle("width")));
	oDivTitleBarShrink0.setAttribute("id", "divTitleBarShrink0"); 
	oDivTitleBarShrink0.setStyle({
		position:"absolute",
		right:"4px",
		top:"0px",
		width:"20px",
		cursor:"default",
		height:"20px"
	});
	this.titleBarShrink0RollOver = function(){
		oDiv.titleBarExpandShrinkRollOver();
	}
	this.titleBarShrink0RollOut = function(){
		oDiv.titleBarExpandShrinkRollOut();
	}
	this.titleBarShrink0MouseUp = function(){
		oDiv.titleBarExpandShrink();
	}
	Event.observe(oDivTitleBarShrink0, "mouseenter", this.titleBarShrink0RollOver.bindAsEventListener(this));
	Event.observe(oDivTitleBarShrink0, "mouseleave", this.titleBarShrink0RollOut.bindAsEventListener(this));
	Event.observe(oDivTitleBarShrink0, "mouseup", this.titleBarShrink0MouseUp.bindAsEventListener(this));
	oDivTitleBar.appendChild(oDivTitleBarShrink0);
	oDivTitleBarShrink0.update('<img src="'+getPathPrefix()+'_assets/themes/'+window.oTheme.id+'/images/'+sHexLoadId+'/_podsTitleBarShrink0.gif" alt="" title=""/>');
	oDivTitleBarShrink0.hide();
	
	var oDivTitleBarShrink1 = new Element("div");
	oDivTitleBarShrink1.setAttribute("id", "divTitleBarShrink1"); 
	oDivTitleBarShrink1.setStyle({
		position:"absolute",
		right:"4px",
		top:"0px",
		width:"20px",
		cursor:"default",
		height:"20px"
	});
	this.titleBarShrink1RollOver = function(){
		oDiv.titleBarExpandShrinkRollOver();
	}
	this.titleBarShrink1RollOut = function(){
		oDiv.titleBarExpandShrinkRollOut();
	}
	this.titleBarShrink1MouseUp = function(){
		oDiv.titleBarExpandShrink();
	}
	Event.observe(oDivTitleBarShrink1, "mouseenter", this.titleBarShrink1RollOver.bindAsEventListener(this));
	Event.observe(oDivTitleBarShrink1, "mouseleave", this.titleBarShrink1RollOut.bindAsEventListener(this));
	Event.observe(oDivTitleBarShrink1, "mouseup", this.titleBarShrink1MouseUp.bindAsEventListener(this));
	oDivTitleBar.appendChild(oDivTitleBarShrink1);
	oDivTitleBarShrink1.update('<img src="'+getPathPrefix()+'_assets/themes/'+window.oTheme.id+'/images/'+sHexLoadId+'/_podsTitleBarShrink1.gif" alt="" title=""/>');
	oDivTitleBarShrink1.hide();
	
	
	
	/*var oDivTitleBarDropDown0 = new Element("div");
	oDivTitleBarDropDown0.setAttribute("id", "divTitleBarDropDown0"); 
	oDivTitleBarDropDown0.setStyle({
		position:"absolute",
		right:"24px",
		top:"0px",
		width:"20px",
		cursor:"default",
		height:"20px"
	});
	this.titleBarDropDown0RollOver = function(){
		oDiv.titleBarDropDownRollOver();
	}
	this.titleBarDropDown0RollOut = function(){
		oDiv.titleBarDropDownRollOut();
	}
	this.titleBarDropDown0MouseUp = function(){
		//oDiv.titleBarDropDown();
	}
	Event.observe(oDivTitleBarDropDown0, "mouseenter", this.titleBarDropDown0RollOver.bindAsEventListener(this));
	Event.observe(oDivTitleBarDropDown0, "mouseleave", this.titleBarDropDown0RollOut.bindAsEventListener(this));
	Event.observe(oDivTitleBarDropDown0, "mouseup", this.titleBarDropDown0MouseUp.bindAsEventListener(this));
	oDivTitleBar.appendChild(oDivTitleBarDropDown0);
	oDivTitleBarDropDown0.update('<img src="_assets/images/ajaxsite/_podsTitleBarDropDown0_'+sHexLoadId+'.gif" alt="" title=""/>');
	
	var oDivTitleBarDropDown1 = new Element("div");
	oDivTitleBarDropDown1.setAttribute("id", "divTitleBarDropDown1"); 
	oDivTitleBarDropDown1.setStyle({
		position:"absolute",
		right:"24px",
		top:"0px",
		width:"20px",
		cursor:"default",
		height:"20px"
	});
	this.titleBarDropDown1RollOver = function(){
		oDiv.titleBarDropDownRollOver();
	}
	this.titleBarDropDown1RollOut = function(){
		oDiv.titleBarDropDownRollOut();
	}
	this.titleBarDropDown1MouseUp = function(){
		//oDiv.titleBarDropDown();
	}
	Event.observe(oDivTitleBarDropDown1, "mouseenter", this.titleBarDropDown1RollOver.bindAsEventListener(this));
	Event.observe(oDivTitleBarDropDown1, "mouseleave", this.titleBarDropDown1RollOut.bindAsEventListener(this));
	Event.observe(oDivTitleBarDropDown1, "mouseup", this.titleBarDropDown1MouseUp.bindAsEventListener(this));
	oDivTitleBar.appendChild(oDivTitleBarDropDown1);
	oDivTitleBarDropDown1.update('<img src="_assets/images/ajaxsite/_podsTitleBarDropDown1_'+sHexLoadId+'.gif" alt="" title=""/>');
	oDivTitleBarDropDown1.hide();*/
	
	var oDivTitleBarBack0 = new Element("div");
	oDivTitleBarBack0.setAttribute("id", "divTitleBarBack0"); 
	oDivTitleBarBack0.setStyle({
		position:"absolute",
		left:"3px",
		top:"0px",
		width:"20px",
		cursor:"default",
		height:"20px"
	});
	this.titleBarBack0RollOver = function(){
		oDiv.titleBarBackRollOver();
	}
	this.titleBarBack0RollOut = function(){
		oDiv.titleBarBackRollOut();
	}
	this.titleBarBack0MouseUp = function(){
		oDiv.titleBarBackMouseUp();
	}
	Event.observe(oDivTitleBarBack0, "mouseenter", this.titleBarBack0RollOver.bindAsEventListener(this));
	Event.observe(oDivTitleBarBack0, "mouseleave", this.titleBarBack0RollOut.bindAsEventListener(this));
	Event.observe(oDivTitleBarBack0, "mouseup", this.titleBarBack0MouseUp.bindAsEventListener(this));
	oDivTitleBar.appendChild(oDivTitleBarBack0);
	oDivTitleBarBack0.update('<img src="'+getPathPrefix()+'_assets/themes/'+window.oTheme.id+'/images/'+sHexLoadId+'/_podsTitleBarBack0.gif" alt="" title=""/>');
	oDivTitleBarBack0.hide();
	
	var oDivTitleBarBack1 = new Element("div");
	oDivTitleBarBack1.setAttribute("id", "divTitleBarBack1"); 
	oDivTitleBarBack1.setStyle({
		position:"absolute",
		left:"3px",
		top:"0px",
		width:"20px",
		cursor:"default",
		height:"20px"
	});
	this.titleBarBack1RollOver = function(){
		oDiv.titleBarBackRollOver();
	}
	this.titleBarBack1RollOut = function(){
		oDiv.titleBarBackRollOut();
	}
	this.titleBarBack1MouseUp = function(){
		oDiv.titleBarBackMouseUp();
	}
	Event.observe(oDivTitleBarBack1, "mouseenter", this.titleBarBack1RollOver.bindAsEventListener(this));
	Event.observe(oDivTitleBarBack1, "mouseleave", this.titleBarBack1RollOut.bindAsEventListener(this));
	Event.observe(oDivTitleBarBack1, "mouseup", this.titleBarBack1MouseUp.bindAsEventListener(this));
	oDivTitleBar.appendChild(oDivTitleBarBack1);
	oDivTitleBarBack1.update('<img src="'+getPathPrefix()+'_assets/themes/'+window.oTheme.id+'/images/'+sHexLoadId+'/_podsTitleBarBack1.gif" alt="" title=""/>');
	oDivTitleBarBack1.hide();

	var oDivContent = new Element("div");
	//$(oDivTitleBar).setAttribute("id", "divPodArea_"+iOrdinalId+"_titleBar"); 
	oDivContent.setAttribute("id", "divContent");
	oDivContent.setStyle({
		position:"absolute",
		left:"0px",
		top:"20px",
		width:"100%",
		height:"100%",
		visibility:sDivContentVisibility
	}); // height:(iPodHeight-21).toString()+"px",
	oDiv.appendChild(oDivContent);

	oDiv.dragEndJustAfter = function(){
		oDiv.setStyle({zIndex: 99});
	}
	oDiv.dragEndPost = function(){
		oDiv.setStyle({zIndex: 10});
	}
	oDiv.dragEnd = function(){
		var bNoAnim = false;
		if(Prototype.Browser.IE == true){
			bNoAnim = true; // if ie improves its performance some day maybe we'll turn this back on.
		}
		if(bNoAnim == true){
			oDiv.setStyle({top:oDiv._iOrigY+"px"});
			oDiv.setStyle({left:oDiv._iOrigX+"px"});
			oDiv.dragEndJustAfter();
			oDiv.dragEndPost();
		}
		else{
			oDiv.tween("left", oDiv._iOrigX, 500, "easeInOutQuad", "dragEndJustAfter", oDiv, 1);
			oDiv.tween("top", oDiv._iOrigY, 500, "easeInOutQuad", "dragEndPost", oDiv, 100);
			setTimeout(oDiv.dragEndJustAfter, 1);
			setTimeout(oDiv.dragEndPost, 255);
		}
		oDiv.clearDropHover();
		oDiv.onPodDragEnd();
	}
	oDiv.dragStart = function(){
		oDiv.setStyle({zIndex: 99});
		oDiv.onPodDragStart();
	}
	oDiv.dropHover = function(){
		if(window.__bHoverAlreadyTriggered != true){
			window.__bHoverAlreadyTriggered = true;
			setTimeout(oDiv.clearDropHover, 255);
			oDiv.onPodDropHoverStart();
		}
	}
	oDiv.clearDropHover = function(){
		window.__bHoverAlreadyTriggered = false;
	}
	oDiv.dropDrop = function(){
		oDiv.clearDropHover();
		//oDiv.onPodDropHoverEnd();
		oDiv.onPodDrop();
	}
	oDiv._oDraggable = new Draggable(oDiv,{revert:false, handle:oDiv.getChildElementById("divTitleBar"), onEnd:oDiv.dragEnd, onStart:oDiv.dragStart, starteffect:null, endeffect:null});
	//Droppables.add(oDiv,{onHover:oDiv.dropHover,onDrop:oDiv.dropDrop});

	/*var oIframeHolderDiv = window.document.createElement("DIV");
	$(oIframeHolderDiv).setAttribute("id", "divIframeHolder");
	oIframeHolderDiv.setStyle({
		backgroundColor: "#888888",
		cssFloat: "left",
		position: "relative",
		left: 20,
		top: 20,
		width: 200,
		height: 300
	});
	oDiv.appendChild(oIframeHolderDiv);
	var oIframe = window.document.createElement("IFRAME");
	oIframe.setAttribute("src", "http://slashdot.org");
	oIframe.setAttribute("name", "iframe_0");
	oIframe.setAttribute("width", 200);
	oIframe.setAttribute("height", 300);
	oIframe.setAttribute("align", "top");
	oIframe.setAttribute("frameBorder", 0);
	oIframe.setAttribute("scrolling", "no");
	oIframeHolderDiv.appendChild(oIframe);*/
	oDiv.onReorderPodsBroadcasted = NavPodClass.prototype.onReorderPodsBroadcasted;
	oDiv.getRoot = NavPodClass.prototype.getRoot;
	oDiv.getDragAndDropIsDisabled = NavPodClass.prototype.getDragAndDropIsDisabled;
	oDiv.showShadeControls = NavPodClass.prototype.showShadeControls;
	oDiv.hideShadeControls = NavPodClass.prototype.hideShadeControls;
	oDiv.titleBarShadeExpandShrink = NavPodClass.prototype.titleBarShadeExpandShrink;
	oDiv.titleBarShadeExpandShrinkRollOver = NavPodClass.prototype.titleBarShadeExpandShrinkRollOver;
	oDiv.titleBarShadeExpandShrinkRollOut = NavPodClass.prototype.titleBarShadeExpandShrinkRollOut;
	oDiv.showExpandShrinkControls = NavPodClass.prototype.showExpandShrinkControls;
	oDiv.hideExpandShrinkControls = NavPodClass.prototype.hideExpandShrinkControls;
	oDiv.titleBarExpandShrink = NavPodClass.prototype.titleBarExpandShrink;
	oDiv.titleBarExpandShrinkRollOver = NavPodClass.prototype.titleBarExpandShrinkRollOver;
	oDiv.titleBarExpandShrinkRollOut = NavPodClass.prototype.titleBarExpandShrinkRollOut;
	oDiv.titleBarDropDownRollOver = NavPodClass.prototype.titleBarDropDownRollOver;
	oDiv.titleBarDropDownRollOut = NavPodClass.prototype.titleBarDropDownRollOut;
	oDiv.titleBarBackRollOver = NavPodClass.prototype.titleBarBackRollOver;
	oDiv.titleBarBackRollOut = NavPodClass.prototype.titleBarBackRollOut;
	oDiv.titleBarRollOver = NavPodClass.prototype.titleBarRollOver;
	oDiv.titleBarRollOut = NavPodClass.prototype.titleBarRollOut;
	oDiv.showBack = NavPodClass.prototype.showBack;
	oDiv.hideBack = NavPodClass.prototype.hideBack;
	oDiv.titleBarBackMouseUp = NavPodClass.prototype.titleBarBackMouseUp;
	oDiv.setCurrentPodDragObj = NavPodClass.prototype.setCurrentPodDragObj;
	oDiv.getCurrentPodDragObj = NavPodClass.prototype.getCurrentPodDragObj;
	oDiv.onDragReorderPodsBroadcasted = NavPodClass.prototype.onDragReorderPodsBroadcasted;
	oDiv.swapPositionAttributes = NavPodClass.prototype.swapPositionAttributes;
	oDiv.reorderPositionAttributes = NavPodClass.prototype.reorderPositionAttributes;
	oDiv.swapId = NavPodClass.prototype.swapId;
	oDiv.reorderIds = NavPodClass.prototype.reorderIds;
	oDiv.onPodDragStart = NavPodClass.prototype.onPodDragStart;
	oDiv.onPodDragEnd = NavPodClass.prototype.onPodDragEnd;
	oDiv.onPodDropHoverStart = NavPodClass.prototype.onPodDropHoverStart;
	oDiv.onPodDropHoverEnd = NavPodClass.prototype.onPodDropHoverEnd;
	oDiv.onPodDrop = NavPodClass.prototype.onPodDrop;
	oDiv.destroyDragAndDropIncludingSiblings = NavPodClass.prototype.destroyDragAndDropIncludingSiblings;
	oDiv.onReorderPodsFromSavedPosition = NavPodClass.prototype.onReorderPodsFromSavedPosition;
	oDiv.saveCurrentPodPositions = NavPodClass.prototype.saveCurrentPodPositions;
	oDiv.onPodDestroy = NavPodClass.prototype.onPodDestroy;
	
	oDiv._bCurrentPodHorzSizeByEngine = false;
	oDiv._bCurrentPodVertSizeByEngine = false;
	if(iOrdinalId == 0){
		oDiv.getRoot()._aryPodIndex = new Array();
	}
	oDiv.getRoot()._aryPodIndex.push(oDiv);

	oElementTarget._PodsBroadcaster.addListener(oDiv);

	/*function _onDebuggerUpdate(oThis){
		oThis.getChildElementById("divTitleBar").getChildElementById("divTitleBarTitle").update(oThis._iOrdinalId+" ("+oThis.id+")");
	}
	var idInterval = window.setInterval(_onDebuggerUpdate, 100, oDiv);*/
	
	
	oDiv._oTemplateNode = oTemplateNode;
	oDiv.hideExpandShrinkControls();
	oDiv.hideShadeControls();
	//oDiv._oTip = new Tip(oDiv.id, "Pod "+(iOrdinalId+1), {className:"tips_"+sHexLoadId, delay:0.12, offset:{x:16, y:16}, closeButton:false, duration:0.3, effect:false, fixed:false, hideAfter:false, hook:false, title:false, viewport:false});
	//oDiv._oTip.tip.hide();
	return oDiv;
}
function createNetVibesWidget(sWidgetId, sWidgetUrl){
	//var BW = new UWA.BlogWidget({inline:true, container:$("divPodArea_0"), moduleUrl:'http://www.netvibes.com/api/uwa/examples/digg.xhtml' });
	//BW.setConfiguration({'title':'Digg', 'height':'256', 'borderWidth':'0', 'color':'#333333', 'displayTitle':false, 'displayFooter':false });
	//BW.setPreferencesValues({'category':'gadgets', 'minimal':'100', 'limit':'5'});
}
function createRssFeed(){
	this.gotRSS = function(xmlHttpRequest, responseHeader){
		$("divPodArea_0").update(xmlHttpRequest.responseText);
	}
	var parms = "url="; //"feed://feeds.feedburner.com/teamsumpter";
	var url = getPathPrefix()+"_admin/_backend/php/getRssFeedFromUrl.php"
	var myAjax = new Ajax.Request(url, {method:'get', parameters:parms, onComplete:this.gotRSS});
}
function createIframeArea(oParentDiv, sUrl, iWidth, iHeight){
	if(!iWidth){
		iWidth = 314;
	}
	if(!iHeight){
		iHeight = 314;
	}
	var oIframeHolderDiv = window.document.createElement("DIV");
	$(oIframeHolderDiv).setAttribute("id", "divIframeHolder");
	//oIframeHolderDiv.setStyle({
	//	overflow: "hidden"
	//});
	oParentDiv.appendChild(oIframeHolderDiv);
	var oIframe = window.document.createElement("IFRAME");
	oIframe.setAttribute("src", sUrl);
	oIframe.setAttribute("name", "iframe_0");
	oIframe.setAttribute("width", iWidth);
	oIframe.setAttribute("height", iHeight);
	oIframe.setAttribute("align", "top");
	oIframe.setAttribute("frameBorder", 0);
	oIframe.setAttribute("scrolling", "no");
	oIframeHolderDiv.appendChild(oIframe);
}
function createMainNavArea(sUrl, oDivParent){
	var sBgColor = "#"+window._oColors.colours.palette[window._sColorPaletteId].top_area.background.hex_value;
	var oDiv = new Element("div");
	oDiv.addClassName("cssDivMainNavArea");
	oDiv.setAttribute("id", "divMainNavArea");
	oDivParent.appendChild(oDiv);
	new Ajax.Request(getJsonViaGetProxyUrl(sUrl), {method:'get',
		onSuccess: function(transport){
			var oJson = eval('('+transport.responseText+')');
			window.oNav = new NavClass();
			//window.oNav.setDebug(true);
			window.oNav.init(oJson.xml);
			window._sDefaultGotoLoc = oJson.xml.defaultGotoLoc;
			createTabbedArea();
			var sLoc = oJson.xml.defaultGotoLoc.split("/")[1];
			if(window.getOrigHashWhenPageLoaded()){
				if(window.getOrigHashWhenPageLoaded().split("/")[1]){ // if a value exists in the second position of the bookmark hash, then use that
					sLoc = window.getOrigHashWhenPageLoaded().split("/")[1];
				}
				else{
					if(oJson.xml.defaultGotoLoc.split("/")[1]){ // if a value exists in the second position of the bookmark hash, then use that
						sLoc = oJson.xml.defaultGotoLoc.split("/")[1];
					}
				}
			}
			else{
				if(oJson.xml.defaultGotoLoc.split("/")[1]){ // if a value exists in the second position of the bookmark hash, then use that
					sLoc = oJson.xml.defaultGotoLoc.split("/")[1];
				}			
			}
			if(window.getOrigHashWhenPageLoaded()){
				if(window.getOrigHashWhenPageLoaded().split("/")[0] != "#main"){
					sLoc = "";
				}
			}
			window.oNav.setLocGoto(sLoc);
			//window.setTimeout("window.oNav.setLocGoto('"+sLoc+"')",4250);
		},
		onFailure: function(){
			onErr();
		}
	});
}
function initVideoArea(){
	// init
}
function stopVideoArea(){
	// stop video
}
function showVideoArea(){
	//$("divContentArea_0").setStyle({width: getBrowserWidth()-125});
	$("divVideoArea").tween("width", 480, 500, "easeInOutQuad");
	//$("divVideoArea").tween("_x", -250, 800, "easeInOutCirc");
	$("divContentArea_0").tween("width", ((getBrowserWidth()-200)-480)-10, 500, "easeInOutQuad");
}
function hideVideoArea(){
	var iForIe6 = 5;
	$("divVideoArea").tween("width", 0, 500, "easeInOutQuad");
	//$("divVideoArea").tween("_x", 0, 800, "easeInOutCirc");
	$("divContentArea_0").tween("width", getBrowserWidth()-(200+iForIe6), 500, "easeInOutQuad");
}
function writeFlashEmbedToElement(oElement, sNamePairs, sFlashSwf, sFlashWidth, sFlashHeight, sFlashBGColor, sFlashQuality, sFlashSwfVersion, oWindowToWriteTo){
	var sOrigNamePairs = "";
	if(sNamePairs){
		sOrigNamePairs = sNamePairs;
	}
	sNamePairs = location.search.substring(1);
	var sHash = window.location.hash;
	if(sHash == "#undefined"){
		sHash = "";
	}
	if (sHash.substring(0,1) == "#"){
		sNamePairs = "gotoLoc="+sHash.substring(1);
	}
   // ---------------------------------------------
   
   	if(!sFlashSwf){
		sFlashSwf = "videotab.swf";
		sFlashWidth = "100%";
		sFlashHeight = "100%";
		sFlashBGColor = "#ffffff";
		sFlashQuality = "best"; // ["low" | "high" | "best"]
		sFlashSwfVersion = "8";
	}
	// ---------------------------------------------
	var sCookieNamePairs = "";
	var sPrefix = "";
	var sServerHostname = location.hostname;
	var sServerPathname = location.pathname;
	var sServerPort = location.port;
	var sUniqueSharedObjectIdSuffix = "";
	var sDeploymentType = "Unknown";
	if(sCookieNamePairs){
	   if(sNamePairs){
	       sPrefix = "&";
	   }
	   sNamePairs += sPrefix + "cookieData=" + escape(sCookieNamePairs);
	}
   if(sNamePairs){
	   sPrefix = "&";
   }
   else{
   		sPrefix = "";
   }
   var sFullPath = "http://"+(sServerHostname+sServerPathname).substr(0,(sServerHostname+sServerPathname).length-9)+"wp-content/plugins/labbpartner/core/";
   sOrigNamePairs="fullpath="+escape(sFullPath);
   sFlashSwf = sFullPath+sFlashSwf;
   sNamePairs += sPrefix + "sUniqueSharedObjectIdSuffix=" + sUniqueSharedObjectIdSuffix + "&sOrigNamePairs=" + sOrigNamePairs + "&sDeploymentType=" + sDeploymentType + "&sServerHostname=" + sServerHostname + "&sServerPort=" + sServerPort + "&sServerPathname=" + sServerPathname+"&"+sOrigNamePairs;
   //alert(sNamePairs);
	var sFlashSwfId = sFlashSwf.substring(0, sFlashSwf.length-4);
	var sEmbedTag = "<object id='" + sFlashSwfId + "' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=" + sFlashSwfVersion + ",0,0,0'";
	sEmbedTag += " width='" + sFlashWidth + "' height='" + sFlashHeight + "' id='fullscreen'";
	sEmbedTag += "> <param name='movie' value='" + sFlashSwf + "?" + sNamePairs;
	sEmbedTag += "'> <param name='loop' value='false'> <param name='quality' value='" + sFlashQuality + "'> <PARAM NAME='scale' VALUE='noscale'> <param name='bgcolor' value='" + sFlashBGColor + "'> ";
	//sEmbedTag += "<param name='wmode' value='window'> ";
	sEmbedTag += "<param name='allowFullScreen' value='true'> ";
	sEmbedTag += "<embed name='" + sFlashSwfId + "' src='" + sFlashSwf + "?" + sNamePairs;
	sEmbedTag += "' loop='false' scale='noscale' salign='LT' quality='" + sFlashQuality + "' allowFullScreen='true'" + " bgcolor='" + sFlashBGColor + "' width='" + sFlashWidth + "' height='" + sFlashHeight+"'";
	//sEmbedTag += " wmode='window'";
	sEmbedTag += " swLiveConnect='true' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash'><\/embed><\/object>";
	//alert(sEmbedTag);
	oElement.update(sEmbedTag);
}
function createVideoAreaInTab(iOrdinalId){
	createVideoArea($("divTab_"+iOrdinalId));
}
function createVideoArea(oDivParent){
	var sBgColor = "#"+window._oColors.colours.palette[window._sColorPaletteId].main.background.hex_value;
	if(window.oTheme.general.main.background.hex_value){
		sBgColor = "#"+window.oTheme.general.main.background.hex_value;
	}
	var oDiv = window.document.createElement("DIV");
	$(oDiv).setAttribute("id", "divVideoArea");
	oDiv.setStyle({
		backgroundColor: sBgColor
	}); // 3500
	$("divContentArea_0").setStyle({
		height:"1000px"
	}); // 3500
	//oDiv.addClassName("autosize"); // this would be outer/parent div...div inside will grow shink to content size
	oDivParent.appendChild(oDiv);
	writeFlashEmbedToElement(oDiv);
}
function createTabbedArea(){
	var sBgColor = "#"+window._oColors.colours.palette[window._sColorPaletteId].main.background.hex_value;
if(window.oTheme.general.main.background.hex_value){
	sBgColor = "#"+window.oTheme.general.main.background.hex_value;
}
	var oDiv = new Element("div"); // {"className" : "cssDivTabbedArea"}
	oDiv.addClassName("cssDivTabbedArea");
	oDiv.setAttribute("id", "divTabbedArea");
	oDiv.setStyle({
		backgroundColor:sBgColor
	});
	document.body.appendChild(oDiv);
	addTab("Remove");
	addTab("Add");
	addTab("Customize");
	//addTab("Studio9A");
	//addTab("Posting Center", "employer");
	//addTab("Opportunities", "jobseeker");
	//addTab("Network NEO", "network");
	addTab("Main");
	createContentAreaInTab(0, 3);
	//createNetworkAreaInTab(6, "network");
	//createJobsAreaInTab(5, "jobseeker"); // ordinal position, unique id
	//createEmployerAreaInTab(4, "employer");
	//createVideoAreaInTab(3, "studio9A");
	createCustomizeAreaInTab(2, "customize");
	createFooterArea();
}
function removeTab(iId){
	var sMainRollOverColor = "#"+window._oColors.colours.palette[window._sColorPaletteId].pods.main_rollover.hex_value;
	var sMainRollOutColor = "#"+window._oColors.colours.palette[window._sColorPaletteId].pods.main_rollout.hex_value;
	var iGap = 7;
	var iTabWidth = 76;
	var iCurrentlySelectedTab;
	var bLeftMostTab;
	if(!iId){
		iId = $("divTabbedArea")._aryTabbedAreaDivs.length-1;
	}
	if(iId > (getNumOfReservedTabs()-1)){ // can't remove required tabs (video, customize, etc.)
		destroyContentArea(iId-(getNumOfReservedTabs()-1));
		for(var i=0; i<$("divTabbedArea")._aryTabbedAreaDivs.length; i++){
			if($("divTab_"+i)._bSelected == true){
				iCurrentlySelectedTab = i;
			}
		}
		if(iCurrentlySelectedTab == $("divTabbedArea")._aryTabbedAreaDivs.length-1){
			$("divTabNav_"+(iCurrentlySelectedTab-1)).fire("customEventNamespace:mouseup");
			iCurrentlySelectedTab = iCurrentlySelectedTab-1;
			bLeftMostTab = true;
		}
		else{
			//$("divTabNav_"+(iCurrentlySelectedTab+1)).fire("customEventNamespace:mouseup");
			//iCurrentlySelectedTab = iCurrentlySelectedTab+1;
			bLeftMostTab = false;
		}
		if(bLeftMostTab == false){
			//alert(iId+" - "+$("divTabbedArea")._aryTabbedAreaDivs.length);
			
			/*$("divTabbedArea")._aryTabbedAreaDivs.splice(iId, 1);
			$("divTabNav_"+iId).stopObserving();
			$("divTabNav_"+iId).remove();
			$("divTab_"+iId).remove();
			for(var i=iId; i<$("divTabbedArea")._aryTabbedAreaDivs.length; i++){
				//alert("make: divTabNav_"+(i+1)+" = divTabNav_"+i);
				$("divTabNavTxt_"+(i+1)).setAttribute("id", "divTabNavTxt_"+i);
				$("divTabNavArt0_"+(i+1)).setAttribute("id", "divTabNavArt0_"+i);
				$("divTabNavArt1_"+(i+1)).setAttribute("id", "divTabNavArt1_"+i);
				$("divTabNavArt2_"+(i+1)).setAttribute("id", "divTabNavArt2_"+i);
				$("divTabNavArt3_"+(i+1)).setAttribute("id", "divTabNavArt3_"+i);
				$("divTabNav_"+(i+1))._iOrdinalId = i;
				$("divTabNav_"+(i+1)).setAttribute("id", "divTabNav_"+i);
				$("divTab_"+(i+1)).setAttribute("id", "divTab_"+i);
			}*/
			alert("Sorry, this functionality is not ready yet.");
		}
		else{
			$("divTabbedArea")._aryTabbedAreaDivs.splice(iId, 1);
			$("divTabNav_"+iId).stopObserving();
			$("divTabNav_"+iId).remove();
			$("divTab_"+iId).remove();
		}
		for(var i=0; i<$("divTabbedArea")._aryTabbedAreaDivs.length; i++){
			$("divTabNav_"+i).setStyle({left:(($("divTabbedArea")._aryTabbedAreaDivs.length-1)-i)*(iTabWidth+iGap)+"px"});
		}
	}
	else{
		//alert("You can only delete custom Tabs that you've created.");
	}
}

function addTab(sTabTitle, sTabId){
	var sMainRollOverColor;
	var sMainRollOutColor = "#"+window._oColors.colours.palette[window._sColorPaletteId].pods.main_rollout.hex_value;
	var sTabTitleColor;
	var sTabTitleSelectedColor;
	var sMainForegroundColor = "#"+window._oColors.colours.palette[window._sColorPaletteId].main.foreground.hex_value;
	var sHexLoadId = window._sColorPaletteId;
	var iGap = 0;
	var iTabWidth = 83;
	var iTab = 0;
	var iCurrentlySelectedTab;
	var aryO1;
	var o1;
	var aryO2;
	var o2;
	var aryO3;
	var o3;
	
	if(window.oTheme.general.topArea.tabNav.navElement.titleUnselected.hex_value.substr(0,14) == "currentpalette"){
		aryO1 = window.oTheme.general.topArea.tabNav.navElement.titleUnselected.hex_value.substr(15, window.oTheme.general.topArea.tabNav.navElement.titleUnselected.hex_value.length).split(".");
		for(var i=0; i<aryO1.length; i++){
			if(!o1){
				o1 = window._oColors.colours.palette[window._sColorPaletteId][aryO1[i]];
			}
			else{
				o1 = o1[aryO1[i]];
			}
		}
		sTabTitleColor = "#"+o1.hex_value;
	}
	else{
		sTabTitleColor = "#"+window.oTheme.general.topArea.tabNav.navElement.titleUnselected.hex_value;
	}
	if(window.oTheme.general.topArea.tabNav.navElement.titleSelected.hex_value.substr(0,14) == "currentpalette"){
		aryO2 = window.oTheme.general.topArea.tabNav.navElement.titleSelected.hex_value.substr(15, window.oTheme.general.topArea.tabNav.navElement.titleSelected.hex_value.length).split(".");
		for(var i=0; i<aryO2.length; i++){
			if(!o2){
				o2 = window._oColors.colours.palette[window._sColorPaletteId][aryO2[i]];
			}
			else{
				o2 = o2[aryO2[i]];
			}
		}
		sTabTitleSelectedColor = "#"+o2.hex_value;
	}
	else{
		sTabTitleSelectedColor = "#"+window.oTheme.general.topArea.tabNav.navElement.titleSelected.hex_value;
	}
	if(window.oTheme.general.topArea.tabNav.navElement.titleRollOver.hex_value.substr(0,14) == "currentpalette"){
		aryO3 = window.oTheme.general.topArea.tabNav.navElement.titleRollOver.hex_value.substr(15, window.oTheme.general.topArea.tabNav.navElement.titleRollOver.hex_value.length).split(".");
		for(var i=0; i<aryO3.length; i++){
			if(!o3){
				o3 = window._oColors.colours.palette[window._sColorPaletteId][aryO3[i]];
			}
			else{
				o3 = o3[aryO3[i]];
			}
		}
		sMainRollOverColor = "#"+o3.hex_value;
	}
	else{
		sMainRollOverColor = "#"+window.oTheme.general.topArea.tabNav.navElement.titleRollOver.hex_value;
	}
	if(window._oCurrentlySelectedTab){
		window._oPrevSelectedTab = window._oCurrentlySelectedTab;
	}
	if(! $("divTabbedArea")._aryTabbedAreaDivs){
		$("divTabbedArea")._aryTabbedAreaDivs = new Array();
	}
	else{
		iTab = $("divTabbedArea")._aryTabbedAreaDivs.length;
	}
	var oDiv = new Element("div");
	oDiv.addClassName("cssDivTab");
	oDiv.setAttribute("id", "divTab_"+iTab);

	$("divTabbedArea")._aryTabbedAreaDivs.push(oDiv);
	$("divTabbedArea").appendChild(oDiv);

	$("divTab_"+iTab)._bSelected = false;
	if(iTab == 0){
		iGap = 0;
	}
	var sImage = "_assets/themes/"+window.oTheme.id+"/images/"+sHexLoadId+"/_tab0.gif";
	if(iTab == 1){
		sImage = "_assets/themes/"+window.oTheme.id+"/images/"+sHexLoadId+"/_tab0AddTab.gif";
	}
	if(iTab == 0){
		sImage = "_assets/themes/"+window.oTheme.id+"/images/"+sHexLoadId+"/_tab0RemoveTab.gif";
	}
	var oDivTabNav = new Element("div");
	oDivTabNav.setAttribute("id", "divTabNav_"+iTab);
	oDivTabNav.setStyle({
		position:"absolute",
		top:"0px",
		left:"0px",
		overflow:"hidden",
		width:iTabWidth.toString()+"px",
		height:"40px"
	});
	$("divTabNavArea").appendChild(oDivTabNav);
	$("divTab_"+iTab).hide();

	var oDivTabNavArt0 = new Element("div");
	$(oDivTabNavArt0).setAttribute("id", "divTabNavArt0_"+iTab);
	oDivTabNavArt0.setStyle({
		position:"absolute",
		top:"0px",
		left:"0px",
		overflow:"hidden",
		width:iTabWidth.toString()+"px",
		height:"40px"
	});
	oDivTabNav.appendChild(oDivTabNavArt0);
	oDivTabNavArt0.update('<img src="'+sImage+'" alt="" title=""/>');
	
	var oDivTabNavArt1 = new Element("div");
	$(oDivTabNavArt1).setAttribute("id", "divTabNavArt1_"+iTab);
	oDivTabNavArt1.setStyle({
		position:"absolute",
		top:"0px",
		left:"0px",
		overflow:"hidden",
		width:iTabWidth.toString()+"px",
		height:"40px"
	});
	oDivTabNav.appendChild(oDivTabNavArt1);
	oDivTabNavArt1.hide();
	oDivTabNavArt1.update('<img src="'+'_assets/themes/'+window.oTheme.id+'/images/'+sHexLoadId+'/_tab1.gif'+'" alt="" title=""/>');
	
	var oDivTabNavArt2 = new Element("div");
	$(oDivTabNavArt2).setAttribute("id", "divTabNavArt2_"+iTab);
	oDivTabNavArt2.setStyle({
		position:"absolute",
		top:"0px",
		left:"0px",
		overflow:"hidden",
		width:iTabWidth.toString()+"px",
		height:"40px"
	});
	oDivTabNav.appendChild(oDivTabNavArt2);
	oDivTabNavArt2.hide();
	oDivTabNavArt2.update('<img src="'+'_assets/themes/'+window.oTheme.id+'/images/'+sHexLoadId+'/_tab0LeftSideArtOnly.gif'+'" alt="" title=""/>');
	
	var oDivTabNavArt3 = new Element("div");
	$(oDivTabNavArt3).setAttribute("id", "divTabNavArt3_"+iTab);
	oDivTabNavArt3.setStyle({
		position:"absolute",
		top:"0px",
		left:"0px",
		overflow:"hidden",
		width:iTabWidth.toString()+"px",
		height:"40px"
	});
	oDivTabNav.appendChild(oDivTabNavArt3);
	oDivTabNavArt3.hide();
	oDivTabNavArt3.update('<img src="'+'_assets/themes/'+window.oTheme.id+'/images/'+sHexLoadId+'/_tab0RightSideArtOnly.gif'+'" alt="" title=""/>');
	oDivTabNav._iOrdinalId = iTab;
	if(sTabId){
		oDivTabNav._sTabId = sTabId;
	}
	for(var i=0; i<$("divTabbedArea")._aryTabbedAreaDivs.length; i++){
		$("divTabNav_"+i).setStyle({left:((($("divTabbedArea")._aryTabbedAreaDivs.length-1)-i)*(iTabWidth+iGap)).toString()+"px"});
	}
	this.tabNav0RollOver = function(){
		if(oDiv._bSelected == false){
			oDivTabNavTxt.setStyle({color: sMainRollOverColor});
		}
	}
	this.tabNav0RollOut = function(){
		if(oDiv._bSelected == false){
			oDivTabNavTxt.setStyle({color: sTabTitleColor});
		}
	}
	var bSelectAllowed = true;
	this.tabNav0MouseUp = function(){
		if(bSelectAllowed == true){
			if(iTab > 1){ // if not + - tabs
				window._oCurrentlySelectedTab = $("divTabNav_"+iTab);
				for(var i=0; i<$("divTabbedArea")._aryTabbedAreaDivs.length; i++){					
					if(i > 1){ // if not + - tabs
						$("divTab_"+i).hide();
						$("divTabNavTxt_"+i).setStyle({color: sTabTitleColor});
						$("divTab_"+i)._bSelected = false;
						$("divTabNavArt0_"+i).show();
						$("divTabNavArt1_"+i).hide();
						$("divTabNavArt2_"+i).hide();
						$("divTabNavArt3_"+i).hide();
					}
				}
				$("divTab_"+iTab).show();
				$("divTabNavTxt_"+iTab).setStyle({color: sTabTitleSelectedColor});
				$("divTabNavArt0_"+iTab).hide();
				$("divTabNavArt1_"+iTab).show();
				$("divTabNavArt2_"+iTab).hide();
				$("divTabNavArt3_"+iTab).hide();
				if($("divTabNav_"+(iTab+1))){
					$("divTabNavArt0_"+(iTab+1)).hide();
					$("divTabNavArt1_"+(iTab+1)).hide();
					$("divTabNavArt2_"+(iTab+1)).show();
					$("divTabNavArt3_"+(iTab+1)).hide();
				}
				if($("divTabNav_"+(iTab-1))){
					if((iTab-1) > 1){
						$("divTabNavArt0_"+(iTab-1)).hide();
						$("divTabNavArt1_"+(iTab-1)).hide();
						$("divTabNavArt2_"+(iTab-1)).hide();
						$("divTabNavArt3_"+(iTab-1)).show();
					}
				}
				$("divTab_"+iTab)._bSelected = true;
				window._oPrevSelectedTab = window._oCurrentlySelectedTab;
				window.updateAddress(sTabTitle.crunch());
				//alert(iTab);
			}
			else{
				if(iTab == 1){ // add tab
					var iNextAvailableTab = $("divTabbedArea")._aryTabbedAreaDivs.length-(getNumOfReservedTabs()-2);
					addTab("My Page "+iNextAvailableTab);
					createContentAreaInTab(iNextAvailableTab-1, iNextAvailableTab+(getNumOfReservedTabs()-2));
				}
				else{ // remove tab
					for(var i=0; i<$("divTabbedArea")._aryTabbedAreaDivs.length; i++){
						if($("divTab_"+i)._bSelected == true){
							iCurrentlySelectedTab = i;
						}
					}
					removeTab(iCurrentlySelectedTab);
				}
			}
		}
	}
	var oDivTabNavTxt = new Element("div");
	$(oDivTabNavTxt).setAttribute("id", "divTabNavTxt_"+iTab);
	oDivTabNavTxt.setStyle({
		position:"absolute",
		color:sTabTitleColor,
		top:"16px",
		left:"0px",
		overflow:"hidden",
		width:iTabWidth.toString()+"px",
		height:"20px",
		fontFamily:"verdana",
		fontSize:"9px",
		fontWeight:"bold",
		textAlign:"center",
		cursor:"default",
		verticalAlign:"middle",
		marginTop:"8px"
	});
	oDivTabNav.appendChild(oDivTabNavTxt);
	if(iTab == 0){
		sTabTitle = "";
	}
	if(iTab == 1){
		sTabTitle = "";
	}
	oDivTabNavTxt.update(sTabTitle);
	Event.observe(oDivTabNav, "mouseenter", this.tabNav0RollOver.bindAsEventListener(this));
	Event.observe(oDivTabNav, "mouseleave", this.tabNav0RollOut.bindAsEventListener(this));
	Event.observe(oDivTabNav, "mouseup", this.tabNav0MouseUp.bindAsEventListener(this));
	Event.observe(oDivTabNav, "customEventNamespace:mouseup", this.tabNav0MouseUp.bindAsEventListener(this));
	
	var sDefaultGotoLoc = window._sDefaultGotoLoc.split("/")[0];
	if(iTab == (getNumOfReservedTabs()-1) && !(location.search) && !(window.getOrigHashWhenPageLoaded()) && !(sDefaultGotoLoc)){ // default tab selection to far-left-most tab if no query string or defaultgotoloc found
		//alert("got here0");
		this.tabNav0MouseUp();
		//setTimeout(this.tabNav0MouseUp, 100);
	}
	if(location.search){
		if(oDivTabNav._sTabId == parseArgs(location.search.substr(1, location.search.length)).tab){
			//alert("got here1");
			this.tabNav0MouseUp();
			//setTimeout(this.tabNav0MouseUp, 100);
		}
	}
	if(window.getOrigHashWhenPageLoaded()){
		if(sTabTitle && "#"+sTabTitle.crunch() == window.getOrigHashWhenPageLoaded().split("/")[0]){
			//alert("got here2");
			this.tabNav0MouseUp();
			//setTimeout(this.tabNav0MouseUp, 100);
		}
	}
	else{
		if(sDefaultGotoLoc){
			if(sTabTitle.crunch() == sDefaultGotoLoc.split("/")[0]){
				//alert("got here3");
				this.tabNav0MouseUp();
				//setTimeout(this.tabNav0MouseUp, 100);
			}
		}
	}
	var bDropAllowed = true;
	oDivTabNav.dropHover = function(o){
		var sPodTitle = o.getChildElementById("divTitleBar").getChildElementById("divTitleBarTitle").innerHTML;
		var sContent = "Copy this <i>'"+sPodTitle+"'</i> Pod to the <i>'"+sTabTitle+"'</i> Tab";
		if(iTab == 0){
			sContent = "You Cannot Copy to the <i>'Remove a Tab'</i> Control";
			bDropAllowed = false;
		}
		if(iTab == 1){
			sContent = "You Cannot Copy to the <i>'Add a Tab'</i> Control";
			bDropAllowed = false;
		}
		if(iTab > 1 && iTab <= (getNumOfReservedTabs()-1)){
			sContent = "You Can Only Copy Pods to a Tab You've Created";
			bDropAllowed = false;
		}
		if(iTab == iCurrentlySelectedTab){
			sContent = "You Cannot Copy to a Tab that's Currently Selected";
			bDropAllowed = false;
		}
		bSelectAllowed = false;
		var sWidth = (sContent.length*6).toString();
		var sSuffix = "px";
		if(Prototype.Browser.IE == true && parseInt(Prototype.Browser.Version) < 8){
			sWidth = "auto";
			sSuffix = "";
		}
		//$(oDivTabNav._oTip.tip.setStyle({whiteSpace:"nowrap", width:sWidth+sSuffix})).update(sContent);
	}
	oDivTabNav.dropDrop = function(o){
		if(bDropAllowed == true){
			//$(oDivTabNav._oTip.tip.setStyle({whiteSpace:"nowrap", width:"auto"})).update("Copied");
			var iContentAreaId = iTab-(getNumOfReservedTabs()-1);
			var oPod = createPod(getTotalNumOfPodsInContentAreaId(iContentAreaId), o._oTemplateNode, iContentAreaId);
			window.oTemplates[o._oTemplateNode.attachId](o._oTemplateNode, oPod);
			$("divContentArea_"+iContentAreaId)._PodsBroadcaster.broadcastMessage("onReorderPodsBroadcasted", {iWidth:getBrowserWidth(), iHeight:0, bNoAnim:true});
		}
		bDropAllowed = true;
		bSelectAllowed = true;
	}
	oDivTabNav.dropOut = function(){
		var sContent = sTabTitle+" Tab";
		//$(oDivTabNav._oTip.tip.setStyle({whiteSpace:"nowrap", width:"auto"})).update(sContent);
		bDropAllowed = true;
		bSelectAllowed = true;
	}
	Event.observe(oDivTabNav, "mouseleave", oDivTabNav.dropOut.bindAsEventListener(this));
	//oDivTabNav._oTip = new Tip(oDivTabNav.id, sTabTitle+" Tab", {className:"tips_"+sHexLoadId, delay:0.12, offset:{x:16, y:16}, closeButton:false, duration:0.3, effect:false, fixed:false, hideAfter:false, hook:false, title:false, viewport:false});
	Droppables.add(oDivTabNav,{onHover:oDivTabNav.dropHover,onDrop:oDivTabNav.dropDrop});
}
function getTotalNumOfPodsInContentAreaId(iContentAreaId){
	var iResult = 0;
	var oDiv = $("divContentArea_"+iContentAreaId);
	if(oDiv._aryPodIndex){
		iResult = oDiv._aryPodIndex.length;
	}
	return iResult;
}
function createContentAreaInTab(iContentArea, iOrdinalId){
	if(!iContentArea){
		iContentArea = 0;
	}
	createContentArea(iContentArea, $("divTab_"+iOrdinalId));
}
function createNetworkAreaInTab(iOrdinalId, sTabId){
	createNetworkArea($("divTab_"+iOrdinalId), sTabId);
}
function createJobsAreaInTab(iOrdinalId, sTabId){
	createJobsArea($("divTab_"+iOrdinalId), sTabId);
}
function createForumsAreaInTab(iOrdinalId){
	createForumsArea($("divTab_"+iOrdinalId));
}
function getNumOfReservedTabs(){
	return 4;
}
function createCustomizeAreaInTab(iOrdinalId){
	createCustomizeArea($("divTab_"+iOrdinalId));
}
function createEmployerAreaInTab(iOrdinalId, sTabId){
	createEmployerArea($("divTab_"+iOrdinalId), sTabId);
}
function setIsInWordpressPluginMode(b){
	window._bInWordpressPluginMode = b;
}
function getIsInWordpressPluginMode(){
	return window._bInWordpressPluginMode;
}
function createContentArea(iContentArea, oDivParent){
	var sBgColor = "#"+window._oColors.colours.palette[window._sColorPaletteId].main_content_area.background.hex_value;
	if(window.oTheme.general.main.background.hex_value){
		sBgColor = "#"+window.oTheme.general.main.background.hex_value;
	}
	var oDiv = new Element("div");
	oDiv.addClassName("cssDivContentArea");
	oDiv.setAttribute("id", "divContentArea_"+iContentArea);
	if(oDivParent.id.substr(0,14) == "divLabbPartner"){
		setIsInWordpressPluginMode(true);
		oDiv.setStyle({
			backgroundColor:sBgColor
		});

	}
	else{
		setIsInWordpressPluginMode(false);
		oDiv.setStyle({
			backgroundColor:sBgColor
		}); // 3500
	}
	oDivParent.appendChild(oDiv);
	window._iLastContentAreaCreated = iContentArea;
	if(!$("divContentArea_"+iContentArea).Broadcaster){
		$("divContentArea_"+iContentArea).Broadcaster = new BroadcasterClass();
	}
	$("divContentArea_"+iContentArea)._PodsBroadcaster = new Object();
	$("divContentArea_"+iContentArea).Broadcaster.initialize($("divContentArea_"+iContentArea)._PodsBroadcaster);
}

function loadUrlIntoContentArea(sUrl, iContentArea){
	if(!iContentArea){
		iContentArea = 0;
	}
	sUrl = URLDecode(sUrl);
	var oDivParent = $("divContentArea_"+iContentArea);
	oDivParent.setStyle({height:"2300px"});
	var sBgColor = "#"+window._oColors.colours.palette[window._sColorPaletteId].main.background.hex_value;
	if(window.oTheme.general.main.background.hex_value){
		sBgColor = "#"+window.oTheme.general.main.background.hex_value;
	}
	var oDiv = new Element("div");
	oDiv.addClassName("cssDivIframeArea");
	oDiv.setAttribute("id", "divIframeArea");
	/*oDiv.setStyle({
		cssFloat: "left",
		positiontop: "relative",
		top: 0,
		left: 0,
		overflow: "hidden"
	}); // 3500*/
	oDivParent.appendChild(oDiv);
	
	/*var oIframeHolderDiv = window.document.createElement("DIV");
	$(oIframeHolderDiv).setAttribute("id", "divIframeHolder");
	oDiv.appendChild(oIframeHolderDiv);*/
	var oIframe = new Element("iframe");
	oIframe.addClassName("cssMyIframe");
	oIframe.setAttribute("id", "myIframe");
	oIframe.setAttribute("name", "myIframe");
	/*oIframe.setStyle({
		backgroundColor: "#0000ff",
		cssFloat: "left",
		position: "relative",
		top: 0,
		left: 0,
		overflow: "hidden",
		width: "100%",
		height: 3500
	});*/
	oIframe.setAttribute("src", sUrl);
	oIframe.setAttribute("frameBorder", 0);
	oIframe.setAttribute("width", "100%");
	oIframe.setAttribute("height", "100%");
	oIframe.setAttribute("scrolling", "no");
	oDiv.appendChild(oIframe);
	window._oIframe = oIframe;

	oIframe.onload = function () {
    	//oIframe.setAttribute("height", "100%");
    	scroll(0,0);
    };
    if(oIframe.attachEvent){
    	oIframe.attachEvent("onload", oIframe.onload);
    }
}
function loadVideoTabIntoContentArea(iContentArea){
	if(!iContentArea){
		iContentArea = 0;
	}
	var oDivParent = $("divContentArea_"+iContentArea);
	var sBgColor = "#"+window._oColors.colours.palette[window._sColorPaletteId].main.background.hex_value;
if(window.oTheme.general.main.background.hex_value){
	sBgColor = "#"+window.oTheme.general.main.background.hex_value;
}
	var oDiv = window.document.createElement("DIV");
	$(oDiv).setAttribute("id", "divVideoArea");
	oDiv.setStyle({
		backgroundColor: sBgColor,
		height:"500px"
	}); // 3500
	oDivParent.setStyle({
		height:"490px"
	});
	//oDiv.addClassName("autosize"); // this would be outer/parent div...div inside will grow shink to content size
	oDivParent.appendChild(oDiv);
	writeFlashEmbedToElement(oDiv);
}
function createNetworkArea(oDivParent, sTabId){
	var sBgColor = "#"+window._oColors.colours.palette[window._sColorPaletteId].main.background.hex_value;
if(window.oTheme.general.main.background.hex_value){
	sBgColor = "#"+window.oTheme.general.main.background.hex_value;
}
	var oDiv = window.document.createElement("DIV");
	var sUrl = "http://swl.ajobnearhome.com"; //http://stage.swl.ajobnearhome.com | http://swl.ajobnearhome.com | http://ajobnearhome.com/swl/
	if(Prototype.Browser.IE == true){
		sUrl = "http://swl.ajobnearhome.com"; // hack until mod_proxy works for ie
	}
	if(parseArgs(location.search.substr(1, location.search.length)).tab == sTabId){
		sUrl = parseArgs(location.search.substr(1, location.search.length)).url;
	}
	$(oDiv).setAttribute("id", "divNetworkArea");
	/*oDiv.setStyle({
		cssFloat: "left",
		positiontop: "relative",
		top: 0,
		left: 0,
		overflow: "hidden"
	}); // 3500*/
	oDivParent.appendChild(oDiv);
	
	var oIframeHolderDiv = window.document.createElement("DIV");
	$(oIframeHolderDiv).setAttribute("id", "divIframeHolder");
	oIframeHolderDiv.setStyle({
		cssFloat: "left",
		position: "relative",
		top: 0,
		left: 0,
		overflow: "hidden"
	}); // 3500
	oDiv.appendChild(oIframeHolderDiv);
	var oIframe = window.document.createElement("IFRAME");
	$(oIframe).setAttribute("id", "divIframe");
	/*oIframe.setStyle({
		backgroundColor: "#0000ff",
		cssFloat: "left",
		position: "relative",
		top: 0,
		left: 0,
		overflow: "hidden",
		width: "100%",
		height: 3500
	});*/
	oIframe.setAttribute("src", sUrl); // http://nearhome.stage.smallworldlabs.net  http://nearhome.stage.smallworldlabs.net:80
	oIframe.setAttribute("name", "iframe_network");
	oIframe.setAttribute("frameBorder", 0);
	oIframe.setAttribute("width", "100%");
	oIframe.setAttribute("height", "100%");
	oIframe.setAttribute("scrolling", "no");
	oIframeHolderDiv.appendChild(oIframe);
	window._oNetworkAreaIframe = oIframe;

}
function createJobsArea(oDivParent, sTabId){
	var sBgColor = "#"+window._oColors.colours.palette[window._sColorPaletteId].main.background.hex_value;
if(window.oTheme.general.main.background.hex_value){
	sBgColor = "#"+window.oTheme.general.main.background.hex_value;
}
	var oDiv = window.document.createElement("DIV");
	var sUrl = "http://se.ajobnearhome.com";
	if(parseArgs(location.search.substr(1, location.search.length)).tab == sTabId){
		sUrl = parseArgs(location.search.substr(1, location.search.length)).url;
		//alert(window._oCurrentlySelectedTab._iOrdinalId);
	}
	$(oDiv).setAttribute("id", "divJobsArea");
	oDiv.setStyle({
		cssFloat: "left",
		position: "relative",
		top: 0,
		left: 0,
		overflow: "hidden"
	}); // 3500
	//oDiv.addClassName("autosize"); // this would be outer/parent div...div inside will grow shink to content size
	oDivParent.appendChild(oDiv);
	
	var oIframeHolderDiv = window.document.createElement("DIV");
	$(oIframeHolderDiv).setAttribute("id", "divIframeHolder");
	oIframeHolderDiv.setStyle({
		cssFloat: "left",
		position: "relative",
		top: 0,
		left: 0,
		overflow: "hidden"
	}); // 3500
	oDiv.appendChild(oIframeHolderDiv);
	var oIframe = window.document.createElement("IFRAME");
	$(oIframe).setAttribute("id", "divIframe");
	/*oIframe.setStyle({
		backgroundColor: "#0000ff",
		cssFloat: "left",
		position: "relative",
		top: 0,
		left: 0,
		overflow: "hidden",
		width: "100%",
		height: 3500
	});*/
	oIframe.setAttribute("src", sUrl); //http://ajnh.searchease.com/jobseekerx
	oIframe.setAttribute("name", "iframe_jobs");
	oIframe.setAttribute("frameBorder", 0);
	oIframe.setAttribute("width", "100%");
	oIframe.setAttribute("height", "100%");
	oIframe.setAttribute("scrolling", "no");
	oIframeHolderDiv.appendChild(oIframe);
}
function createEmployerArea(oDivParent, sTabId){
	var sBgColor = "#"+window._oColors.colours.palette[window._sColorPaletteId].main.background.hex_value;
if(window.oTheme.general.main.background.hex_value){
	sBgColor = "#"+window.oTheme.general.main.background.hex_value;
}
	var oDiv = window.document.createElement("DIV");
	var sUrl = "http://ajnh.searchease.com/employerx";
	if(parseArgs(location.search.substr(1, location.search.length)).tab == sTabId){
		sUrl = parseArgs(location.search.substr(1, location.search.length)).url;
	}
	$(oDiv).setAttribute("id", "divEmployerArea");
	oDiv.setStyle({
		cssFloat: "left",
		position: "relative",
		top: 0,
		left: 0,
		overflow: "hidden",
		width: "100%",
		height: "100%"
	}); // 3500
	//oDiv.addClassName("autosize"); // this would be outer/parent div...div inside will grow shink to content size
	oDivParent.appendChild(oDiv);
	
	var oIframeHolderDiv = window.document.createElement("DIV");
	$(oIframeHolderDiv).setAttribute("id", "divIframeHolder");
	oIframeHolderDiv.setStyle({
		cssFloat: "left",
		position: "relative",
		top: 0,
		left: 0,
		overflow: "hidden",
		width: "100%",
		height: "100%"
	}); // 3500
	oDiv.appendChild(oIframeHolderDiv);
	var oIframe = window.document.createElement("IFRAME");
	$(oIframe).setAttribute("id", "divIframe");
	/*oIframe.setStyle({
		backgroundColor: "#0000ff",
		cssFloat: "left",
		position: "relative",
		top: 0,
		left: 0,
		overflow: "hidden",
		width: "100%",
		height: 3500
	});*/
	oIframe.setAttribute("src", sUrl);
	oIframe.setAttribute("name", "iframe_employer");
	oIframe.setAttribute("frameBorder", 0);
	oIframe.setAttribute("width", "100%");
	oIframe.setAttribute("height", "100%");
	oIframe.setAttribute("scrolling", "no");
	oIframeHolderDiv.appendChild(oIframe);
}
function createCustomizeArea(oDivParent, sTabId){
	var sBgColor = "#"+window._oColors.colours.palette[window._sColorPaletteId].main.background.hex_value;
if(window.oTheme.general.main.background.hex_value){
	sBgColor = "#"+window.oTheme.general.main.background.hex_value;
}
	var oDiv = new Element("div");
	oDiv.addClassName("cssDivContentArea");
	oDiv.setAttribute("id", "divCustomizeArea");
	oDiv.setStyle({
		backgroundColor:sBgColor
	});
	oDivParent.appendChild(oDiv);
	if(!oDiv.Broadcaster){
		oDiv.Broadcaster = new BroadcasterClass();
	}
	oDiv._PodsBroadcaster = new Object();
	oDiv.Broadcaster.initialize(oDiv._PodsBroadcaster);
	var sXmlFile = "_xml/en_Customize_templates.xml";
	new Ajax.Request(getJsonViaGetProxyUrl(sXmlFile), {method:'get',
		onSuccess: function(transport){
			var oJson = eval('('+transport.responseText+')');
			var templates = oJson.xml;
			window.oTemplates.attachTemplates(templates, oDiv);
		},
		onFailure: function(){
			onErr();
		}
	});
}

/*function createContentArea(iContentArea, oDivParent){
	var sBgColor = "#"+window._oColors.colours.palette[window._sColorPaletteId].main.background.hex_value;
if(window.oTheme.general.main.background.hex_value){
	sBgColor = "#"+window.oTheme.general.main.background.hex_value;
}
	var oDiv = new Element("div");
	oDiv.addClassName("cssDivContentArea");
	oDiv.setAttribute("id", "divContentArea_"+iContentArea);
	oDiv.setStyle({
		backgroundColor:sBgColor
	});
	oDivParent.appendChild(oDiv);

	if(!$("divContentArea_"+iContentArea).Broadcaster){
		$("divContentArea_"+iContentArea).Broadcaster = new BroadcasterClass();
	}
	$("divContentArea_"+iContentArea)._PodsBroadcaster = new Object();
	$("divContentArea_"+iContentArea).Broadcaster.initialize($("divContentArea_"+iContentArea)._PodsBroadcaster);
}*/
function setPathPrefix(s){
	window._sPathPrefix = s;
}
function getPathPrefix(){
	var sResult = "";
	if(window._sPathPrefix){
		sResult = window._sPathPrefix;
	}
	return sResult;
}
function getExternalJsonViaGetProxyUrl(s){
	var sResult;
	var sUrl = escape(getProxyUrl(s));
	sResult = getPathPrefix()+"_admin/_backend/php/xml2jsonFromUrl.php?url="+sUrl;
	//sResult = "_admin/_backend/php/xml2jsonFromUrl.php?url="+getProxyUrl(s);
	return sResult;
}
function getJsonViaGetProxyUrl(s, sPathPrefix){
	var sResult;
	if(sPathPrefix){
		setPathPrefix(sPathPrefix);
	}
	var sUrl = escape(getProxyUrl(getPathPrefix()+s));
	sResult = getPathPrefix()+"_admin/_backend/php/xml2jsonFromUrl.php?url="+sUrl;
	//sResult = "_admin/_backend/php/xml2jsonFromUrl.php?url="+getProxyUrl(s);
	return sResult;
}
function getNamepairsViaGetProxyUrl(s){
	var sResult;
	var sUrl = escape(getProxyUrl(s));
	sResult = "_admin/_backend/php/namepairsFromUrl.php?url="+sUrl;
	//sResult = "_admin/_backend/php/xml2jsonFromUrl.php?url="+getProxyUrl(s);
	return sResult;
}
function getProxyUrl(s){
	var sResult;
	var sPathname = location.pathname;
	if(sPathname.lastIndexOf("/") != sPathname.length-1){
		sPathname = sPathname.substr(0, sPathname.lastIndexOf("/")+1);
	}
	if(s.indexOf("://") != -1){
		sResult = s;
	}
	else{
		sResult = location.protocol+"//"+location.host+sPathname+s;
	}
	return sResult;
}
function getXmlViaPostProxyUrl(){
	var sResult;
	sResult = "_admin/_backend/php/xmlFromUrl.php";
	return sResult;
}
function getJsonViaPostProxyUrl(){
	var sResult;
	sResult = "_admin/_backend/php/getJsonViaPostProxyUrl.php";
	return sResult;
}
function setColorPalette(sColorPaletteId, bSetCookie, bReloadSite){
	window._sColorPaletteId = sColorPaletteId;
	if(bSetCookie){
		window.setCookieData("sColorPaletteId="+sColorPaletteId, "colorPalette");
	}
	if(bReloadSite){
		window.location.href = unescape(window.location.pathname);
	}
}
function setTheme(sThemeId, bThemeIdIsIndex, bSetCookie, bReloadSite){
	window._sThemeId = sThemeId;
	if(bThemeIdIsIndex == false){
		if(window._oThemes.themes.theme[0]){ // if more than one found
			for(var i=0; i<window._oThemes.themes.theme.length; i++){
				if(window._oThemes.themes.theme[i].id == sThemeId){
					window._iThemeIdx = i;
					break;
				}
			}
			window.oTheme = window._oThemes.themes.theme[window._iThemeIdx];
		}
		else{
			window._iThemeIdx = 0;
			window.oTheme = window._oThemes.themes.theme;
		}
	}
	else{
		if(window._oThemes.themes.theme[0]){ // if more than one found
			window._iThemeIdx = parseInt(sThemeId);
			window.oTheme = window._oThemes.themes.theme[parseInt(sThemeId)];
			sThemeId = window._oThemes.themes.theme[parseInt(sThemeId)].id;
		}
		else{
			window._iThemeIdx = 0;
			window.oTheme = window._oThemes.themes.theme;
			sThemeId = window._oThemes.themes.theme.id;
		}
	}
	if(bSetCookie){
		window.setCookieData("sThemeId="+sThemeId, "theme");
	}
	if(bReloadSite){
		window.location.href = unescape(window.location.pathname);
	}
}
window.setCookieData = function(sNamePairs, sCookieId){
	//alert("window._setCookieData called: "+sNamePairs);
	var today = new Date();
    var expiry = new Date(today.getTime() + 28 * 24 * 60 * 60 * 1000); // plus 28 days
    var name = "my_cookie";
    var path;
    var domain;
    var secure;
    var value = sNamePairs;
    if(sCookieId){
    	name = sCookieId;
    }
    var sCookie = name + "=" + escape(value) + ((expiry) ? "; expires=" + expiry.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : "");
    document.cookie = name + "=" + escape(value) + ((expiry) ? "; expires=" + expiry.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : ""); 
	//alert('Cookie has been set with this name-pair string:\r' + sNamePairs + "\rActual cookie string:\r" + sCookie);
};
window.getCookieData = function(sCookieId){
	function getCookieVal (offset) { 
	   var endstr = document.cookie.indexOf (";", offset); 
	   if (endstr == -1) { endstr = document.cookie.length; } 
	   return unescape(document.cookie.substring(offset, endstr)); 
	}
	var result = "";
	var name = "my_cookie";
	if(sCookieId){
		name = sCookieId
	}
	var arg = name + "="; 
	var alen = arg.length; 
	var clen = document.cookie.length; 
	var i = 0; 
	while (i < clen) { 
	   var j = i + alen; 
	   if (document.cookie.substring(i, j) == arg) { 
	       result = getCookieVal(j);
	       break;
	   }
	   i = document.cookie.indexOf(" ", i) + 1; 
	   if (i == 0) break; 
	}
	//alert("window._getCookieData called: "+result);
    return result;
};
window.removeCookieData = function(){
	var name = "my_cookie";
	var path;
	var domain;
	document.cookie = name + "=" + ((path == null) ? "" : "; path=" + path) + ((domain == null) ? "" : "; domain=" + domain) + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
};
window.parseArgs = function(str){
	var args = new Object();
	var query = str;
	var pairs = query.split("&");
	args.query = query;
	for(var i=0; i< pairs.length; i++){
	   var pos = pairs[i].indexOf('=');
	   if (pos == -1){
	       continue;
	   }
	   var argname = pairs[i].substring(0,pos);
	   var value = pairs[i].substring(pos+1);
	   args[argname] = unescape(value);
	}
	return args;
};
String.prototype.crunch = function(){
	var sResult = this;
	var aryChars = [" ", ".", "-", "/", "_", "&", "#", "'", "?", ":", "*", "`", "(TM)", "\""];
	for(var i=0; i<aryChars.length; i++){
		sResult = sResult.split(aryChars[i]).join("");
	}
	return sResult.toLowerCase();	
}
window._setCurrentNavId = function(sId){
	window._sCurrentNavId = sId;
}
window._getCurrentNavId = function(){
	return window._sCurrentNavId;
}
window.isInternetExplorer = function(){
	var userAgent = navigator.userAgent.toLowerCase();
	if (document.all && userAgent.indexOf('msie')!=-1){
    	return true;
	}
    else{
    	return false;
	}
};
window.isInternetExplorer6 = function(){
	var userAgent = navigator.userAgent.toLowerCase();
	if (document.all && userAgent.indexOf('msie 6')!=-1){
    	return true;
	}
    else{
    	return false;
	}
};

window.updateAddress = function(s){
	if(s != ""){
		window.setAddressChangeFromNavigation(true);
		if(!s || s == "undefined"){
			s = "";
		}
		if(window.isInternetExplorer6()){
			//document.getElementById("DhtmlHistoryFrame").src = "_admin/_lib/dhtmlHistoryDummyPage.html?" + s;
		}
		else{
			window.location.hash = s;
		}
	}
};
window.getAddress = function(){
	var sHash = "";
	/*if(window.isInternetExplorer6()){
		if(document.getElementById("DhtmlHistoryFrame")){
      		sHash = document.getElementById("DhtmlHistoryFrame").contentWindow.document.location.search;
      	}
      	if(sHash.length == 1 && sHash.charAt(0) == "?"){
       		sHash = "";
	  	}
      	else{
			if(sHash.length >= 2 && sHash.charAt(0) == "?"){
        		sHash = sHash.substring(1);
			}
		}
	}
	else{*/
		sHash = location.hash.substring(1);
	//}
	if(sHash == "undefined"){
		sHash = "";
	}
	return sHash;
};
window.setPrevAddress = function(s){
	window._sPrevAddress = s;
};
window.getPrevAddress = function(){
	return window._sPrevAddress;
};
window.setAddressChangeFromNavigation = function(b){
	window._bAddressChangeFromNavigation = b;
};
window.getAddressChangeFromNavigation = function(){
	return window._bAddressChangeFromNavigation;
};
window.setOrigHashWhenPageLoaded = function(s){
	if(s == "#"){
		s = undefined;
	}
	window._sOrigHashWhenPageLoaded = s;
};
window.getOrigHashWhenPageLoaded = function(){
	return window._sOrigHashWhenPageLoaded;
};
window.setOrigHashWhenPageLoaded(location.hash);
window.onAddressChange = function(){
	var sLoc = window.getAddress();
	if(window.getAddressChangeFromNavigation() == false){
		//alert("back button");
		window.cmsComm('locMainnav','gotoLocFromBackButton',sLoc);
	}
	window.setAddressChangeFromNavigation(false);
};

function getContentFromIframe(iFrameName)
{
var myIFrame = document.getElementById(iFrameName);
var content = navigator.userAgent.indexOf('MSIE') != -1 ? myIFrame.contentWindow.document : myIFrame.contentDocument;
return content;
};

window.watchAddress = function(){
	var sNewAddress = window.getAddress();
	var sPrevAddress = window.getPrevAddress();
	if (sPrevAddress != sNewAddress){
		if(window.isInternetExplorer6()){
			window.location.hash = sNewAddress;
		}
		window.setPrevAddress(sNewAddress);
		window.onAddressChange(sNewAddress);
	}
	if($("divFMA")){
		if(window._oIframe){
			$("divFMA").update(window._oIframe.contentWindow.document.location);
		}
	}
};
// set the interval
/*if(setInterval){
	_intervalID = setInterval(window.watchAddress, 100);
}
if(window.isInternetExplorer6()){
	document.write("<iframe style='border: 0px; width: 1px; " + "height: 1px; position: absolute; bottom: 0px; " + "right: 0px; visibility: visible;' " + "name='DhtmlHistoryFrame' id='DhtmlHistoryFrame' " + "src='_admin/_lib/dhtmlHistoryDummyPage.html?" + "" + "'>" + "</iframe>");
}*/

window.gotoLoc = function(sNavId, sLoc){
	//$("divTabNav_3").fire("customEventNamespace:mouseup");
	window.oNav.setLocGoto(sLoc);
}
window.requestXml = function(sGuid, iContentAreaId){
	if(!iContentAreaId){
		iContentAreaId = 0;
	}
	if(!window.aryCrumbTrail){
		window.aryCrumbTrail = new Array();
	}
	if(iContentAreaId == 0){
		$("divTabNav_3").fire("customEventNamespace:mouseup");
	}
	var sRequestXml = "_xml/"+sGuid+"_templates.xml";
	new Ajax.Request(getJsonViaGetProxyUrl(sRequestXml), {method:'get',
		onSuccess: function(transport){
			var oJson;
			if(transport){
				if(transport.responseText){
					oJson = eval('('+transport.responseText+')');
					if(!window.aryCrumbTrail[0]){
						window.aryCrumbTrail[0] = new Object();
					}
					window.aryCrumbTrail[0].oTemplateNode = oJson.xml;
					//alert(so.templates.template[0].attachId);
					window.oTemplates.attachTemplates(window.aryCrumbTrail[0].oTemplateNode, undefined, iContentAreaId);
				}
			}
		},
		onFailure: function(){
			onErr();
		}
	});
}
window.requestXmlFile = function(sFile, sPath, iContentAreaId){
	if(!iContentAreaId){
		iContentAreaId = 0;
	}
	if(!window.aryCrumbTrail){
		window.aryCrumbTrail = new Array();
	}
	new Ajax.Request(getJsonViaGetProxyUrl(sFile, sPath), {method:'get',
		onSuccess: function(transport){
			var oJson;
			if(transport){
				if(transport.responseText){
					//alert(transport.responseText);
					oJson = eval('('+transport.responseText+')');
					if(!window.aryCrumbTrail[0]){
						window.aryCrumbTrail[0] = new Object();
					}
					window.aryCrumbTrail[0].oTemplateNode = oJson.xml;
					//alert(window.aryCrumbTrail[0].oTemplateNode.template[0].attachId);
					//alert(iContentAreaId);
					window.oTemplates.attachTemplates(window.aryCrumbTrail[0].oTemplateNode, undefined, iContentAreaId);
				}
			}
		},
		onFailure: function(){
			onErr();
		}
	});
}
window.requestAreaXml = function(sGuid){
	//$("divTabNav_3").fire("customEventNamespace:mouseup");
	
}
function destroyContentArea(iContentArea){
	if(!iContentArea){
		iContentArea = 0;
	}
	if(window._aryPodSetTimeoutReferences){
		for(var i=0; i<window._aryPodSetTimeoutReferences.length; i++){
			window.clearTimeout(window._aryPodSetTimeoutReferences[i]);
		}
	}
	$("divContentArea_"+iContentArea).iTotalHeight = 0;
	$("divContentArea_"+iContentArea)._PodsBroadcaster.broadcastMessage("onPodDestroy");
	$("divContentArea_"+iContentArea).Broadcaster.initialize($("divContentArea_"+iContentArea)._PodsBroadcaster);
	//$("divContentArea_"+iContentArea).update();
	var aryChildElements = $("divContentArea_"+iContentArea).childElements();
	for(i=0; i<aryChildElements.length; i++){
		aryChildElements[i].remove();
	}
	scroll(0,0);
}
function URLEncode(url) //Function to encode URL.
{
// The Javascript escape and unescape functions do not correspond
// with what browsers actually do...
var SAFECHARS = "0123456789" + // Numeric
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" + // Alphabetic
"abcdefghijklmnopqrstuvwxyz" +
"-_.!~*'()"; // RFC2396 Mark characters
var HEX = "0123456789ABCDEF";
var plaintext = url;
var encoded = "";
for (var i = 0; i < plaintext.length; i++ ) {
var ch = plaintext.charAt(i);
if (ch == " ") {
encoded += "+"; // x-www-urlencoded, rather than %20
} else if (SAFECHARS.indexOf(ch) != -1) {
encoded += ch;
} else {
var charCode = ch.charCodeAt(0);
if (charCode > 255) {
alert( "Unicode Character '" 
+ ch 
+ "' cannot be encoded using standard URL encoding.\n" +
"(URL encoding only supports 8-bit characters.)\n" +
"A space (+) will be substituted." );
encoded += "+";
} else {
encoded += "%";
encoded += HEX.charAt((charCode >> 4) & 0xF);
encoded += HEX.charAt(charCode & 0xF);
}
}
}
return encoded;
};

 

function URLDecode(url) //function decode URL
{
// Replace + with ' '
// Replace %xx with equivalent character
// Put [ERROR] in output if %xx is invalid.
var HEXCHARS = "0123456789ABCDEFabcdef"; 
var encoded = url;
var plaintext = "";
var i = 0;
while (i < encoded.length) {
var ch = encoded.charAt(i);
if (ch == "+") {
plaintext += " ";
i++;
} else if (ch == "%") {
if (i < (encoded.length-2) 
&& HEXCHARS.indexOf(encoded.charAt(i+1)) != -1 
&& HEXCHARS.indexOf(encoded.charAt(i+2)) != -1 ) {
plaintext += unescape( encoded.substr(i,3) );
i += 3;
} else {
alert( 'Bad escape combination near ...' + encoded.substr(i) );
plaintext += "%[ERROR]";
i++;
}
} else {
plaintext += ch;
i++;
}
} // while
return plaintext;
};

function encodeApostrophe(s){
	//return s.replaceAll("'", "%27").replaceAll('"', '%22');
	// /([^\s\(]?)"(\s*)([^\\]*?(\\.[^\\]*)*)(\s*)("|\n\n)([^\s\)\.\,;]?)/gms
	// s/\xe2\x80\x9d/\"/gs;
	// /"([^"]*)"/g;
	var sResult = s;
	var quote = /"([^"]*)"/g;
	var quotesingle = /'([^']*)'/g;
	if(window.RegExp){
		sResult = s.replace(quote, (unescape("%u201C")+"$1"+unescape("%u201D")));
		sResult = sResult.replace(quotesingle, (unescape("%u2019")+"$1"+unescape("%u2019")));
		sResult = sResult.replace("'", unescape("%u2019"));
	}
	else{
		
	}
	return sResult;
}

String.prototype.replaceAll = function(
strTarget, // The substring you want to replace
strSubString // The string you want to replace in.
){
var strText = this;
var intIndexOfMatch = strText.indexOf( strTarget );
 
// Keep looping while an instance of the target string
// still exists in the string.
while (intIndexOfMatch != -1){
// Relace out the current instance.
strText = strText.replace( strTarget, strSubString )
 
// Get the index of any next matching substring.
intIndexOfMatch = strText.indexOf( strTarget );
}
 
// Return the updated string with ALL the target strings
// replaced out with the new substring.
return( strText );
}
function validateEmail(str){
	if(str){
		var at="@";
		var dot=".";
		var lat=str.indexOf(at);
		var lstr=str.length;
		var ldot=str.indexOf(dot);
		if (str.value==""){
			return false;
		}
		if (str.indexOf(at)==-1){
		   return false;
		}
		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   return false;
		}
		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
			return false;
		}
		if (str.indexOf(at,(lat+1))!=-1){
			return false;
		}
		if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
			return false;
		}
		if (str.indexOf(dot,(lat+2))==-1){
			return false;
		}
		if (str.indexOf(" ")!=-1){
			return false;
		}
		return true;
	}
	else{
		return false;	
	}
}

this.resizeAllAreas = function(){
	/*$("divTopArea").setStyle({
		backgroundColor: "#333333",
		cssFloat: "left",
		position: "relative",
		left: 0,
		top: 0,
		width: getBrowserWidth(),
		height: 110
	});
	$("divContentArea_0").setStyle({
		backgroundColor: "#222222",
		cssFloat: "left",
		position: "relative",
		left: 0,
		top: 10,
		overflow: "auto",
		width: getBrowserWidth()-(200+iForIe6),
		height: getBrowserHeight()-(110)
	});*/
	clearTimeout(window.stiResizeAllAreasDelay);
	function resizeAllAreasWaitForTweenToFinish(){
		window.bResizeAllAreasWaitForTweenToFinish = false;
	}
	function resizeAllAreasDelay(){
		if(getBrowserWidth() != window.previousBrowserWidth){
			if(window.bResizeAllAreasWaitForTweenToFinish == false){
				for(var i=1000; i<=window._iLastContentAreaCreated; i++){
					if($("divContentArea_"+i)){
						$("divContentArea_"+i).iTotalHeight = 0;
						$("divContentArea_"+i)._PodsBroadcaster.broadcastMessage("onReorderPodsBroadcasted", {iWidth:getBrowserWidth(), iHeight:0});
						window.bResizeAllAreasWaitForTweenToFinish = true;
						window.stiResizeAllAreasWaitForTweenToFinish = setTimeout(resizeAllAreasWaitForTweenToFinish, 700);
					}
				}
			}
			window.previousBrowserWidth = getBrowserWidth();
		}
	}
	window.stiResizeAllAreasDelay = setTimeout(resizeAllAreasDelay, 100); // ensures fast performance as only last resize event triggers reorder
}
window.bResizeAllAreasWaitForTweenToFinish = false;
window.previousBrowserWidth = 0;
if(Prototype.Browser.IE == true && parseInt(Prototype.Browser.Version) < 7){
	Event.observe(window, "resize", this.resizeAllAreas.bindAsEventListener(this));
}
