function setTopNavLinksSingle(currBod) {
	setTopNavLinks('#topNav li.' + currBod + ' a.index');
}

function contBodCleanUp(currBod) {
	$$('#content div.slider').each(function(s) {
		s.remove();
	});
	$("contBod").setStyle({
		height: "auto"
	});
	setTopNavLinksSingle(currBod);
}

function changeWrapp(wrappHeight, directory, newBod) {
	var currBod = $$("body")[0].readAttribute("class");
	var currHref = null;
	var currTitle = null;
	switch (currBod) {
		case "intro" : 
			currHref = rootPath + "index.html";
			currTitle = "Introduction";
			break;
		case "skills" : 
			currHref = rootPath + "skills-experience/index.html";
			currTitle = "Skills and Experience";
			break;
		case "projects" : 
			currHref = rootPath + "project-examples/index.html";
			currTitle = "Project Examples";
			break;
		case "code" : 
			currHref = rootPath + "code-techniques/index.html";
			currTitle = "Code Techniques";
			break;
		case "bio" : 
			currHref = rootPath + "bio-contact-info/index.html";
			currTitle = "Bio and Contact Info.";
			break;
	}
	var h1Text = null;
	switch (newBod) {
		case "intro" : 
			h1Text = "Introduction: Why Broader Than Broadway?";
			break;
		case "skills" : 
			h1Text = "Skills &amp; Experience";
			break;
		case "projects" : 
			h1Text = "Project Examples";
			break;
		case "code" : 
			h1Text = "Code Techniques";
			break;
		case "bio" : 
			h1Text = "Bio &amp; Contact Information";
			break;
	}
	$("headingOne").update(h1Text);
	$$('#topNav li.' + currBod + ' img.offOnButton').each(function(img) {
		img.writeAttribute({
			src: rootPath + "images/button_topNav_" + currBod + "_off.gif",
			alt: "'" + currTitle + "' button"
		}).wrap("a", {
			href: currHref,
			title: currTitle,
			"class": "index"
		});
	});
	$$("body")[0].writeAttribute("class", newBod);
	setButtonHovers();
	$("wrapp").remove();
	$("contBod").insert("<div id='wrapp'></div>");
	new Ajax.Updater("wrapp", directory + "index_ajax.html", {
		onSuccess: function() {
			if (newBod == 'skills') 
				setTimeout('altTableRows();', 1);
			else if (newBod == 'bio') 
				setTimeout('prepareForm();', 1);
			else if (newBod == 'projects') {
				if (projectsOpened == false) 
					setTimeout('openSubLinksSlider("projects");', 1);
			} else if (newBod == 'code') {
				if (codeOpened == false) 
					setTimeout('openSubLinksSlider("code");', 1);
			}
		}
	});
	new Effect.Parallel([
		new Effect.Scale("sliderTop", 0, {
			scaleX: false,
			scaleY: true,
			scaleContent: false,
			scaleMode: {
				originalHeight: wrappHeight / 2
			},
			scaleFrom: 100.0
		}),
		new Effect.Scale("sliderBottom", 0, {
			scaleX: false,
			scaleY: true,
			scaleContent: false,
			scaleMode: {
				originalHeight: wrappHeight / 2
			},
			scaleFrom: 100.0
		}),
		new Effect.Move("headingOne", {
			x: 0,
			y: 60,
			mode: "relative"
		})
	], {
		duration: 0.2
	});
	setTimeout('contBodCleanUp("' + currBod + '");', 200);
}

function setTopNavLinks(cssPath) {
	$('contBod').setStyle({
		height: '1120px'
	});
	$('wrapp').setStyle({
		width: '693px',
		height: '1120px',
		display: 'block',
		position: 'absolute',
		left: '0',
		top: '62px'
	});
	$$(cssPath).each(function(a) {
		a.observe("click", function(a) {
			if ((!btbCookies.get("myTabbedSettings")) || (btbCookies.get("myTabbedSettings").tabbing != true)) {
				var ajaxPath = null;
				if (this.readAttribute('href') == 'index.html') 
					ajaxPath = '';
				else if (this.readAttribute('href').split('/')[0] != '..') 
					ajaxPath = this.readAttribute("href").split("/")[0] + '/';
				else if (this.readAttribute('href') == '../index.html') 
					ajaxPath = '../';
				else 
					ajaxPath = '../' + this.readAttribute("href").split("/")[1] + '/';
				var newBod = this.up().readAttribute("class");
				var wrappHeight = Math.round($("wrapp").getStyle("height").split("px")[0]);
				$("contBod").setStyle({
					height: wrappHeight + "px"
				}).insert("<div class='slider' id='sliderTop'>&nbsp;</div><div class='slider' id='sliderBottom'>&nbsp;</div>");
				new Effect.Parallel([
					new Effect.Scale("sliderTop", 100, {
						scaleX: false,
						scaleY: true,
						scaleContent: false,
						scaleMode: {
							originalHeight: wrappHeight / 2
						},
						scaleFrom: 0.0,
						transition: Effect.Transitions.spring
					}),
					new Effect.Scale("sliderBottom", 100, {
						scaleX: false,
						scaleY: true,
						scaleContent: false,
						scaleMode: {
							originalHeight: wrappHeight / 2
						},
						scaleFrom: 0.0,
						transition: Effect.Transitions.spring
					}),
					new Effect.Move("headingOne", {
						x: 0,
						y: -60,
						mode: "relative"
					})
				], {
					duration: 0.5
				});
				setTimeout("changeWrapp(" + wrappHeight + ", '" + ajaxPath + "', '" + newBod + "');", 500);
				a.stop();
			}
		});
	});
}
function setTopNavLinksStart() {
	setTopNavLinks('#topNav li a.index');
}