			$(function(){
				// Left & Right arrows
				var sPath = window.location.pathname;
				var thispage = sPath.substring(sPath.lastIndexOf('/') + 1);

				// Set up an array with page names
				pages = new Array("index.html","experience.html", "lead.html", "team.html", "coach.html","casestudies.html");
				var prev = "";
				var next = "";
				for (var x=0;x<pages.length;x++) {
					if (thispage==pages[x]) {
						if (x==0) {
							prev = pages[pages.length-1];
						} else {
							prev = pages[x-1];
						}
						if (x==pages.length-1) {
							next = pages[0];
						} else {
							next = pages[x+1];
						}
					}
				}
				if (prev=="") {prev=pages[pages.length-1]}
				if (next=="") {next=pages[1]}
				
				$("#accent").append("<a id=\"leftarrow\" href=\"" + prev + "\" title=\"Click here to go to the previous page\">&lt;</a>");
				$("#accent").append("<a id=\"rightarrow\" href=\"" + next + "\" title=\"Click here to go to the next page\">&gt;</a>");	
				
				// makes forms nice and friendly
				
				$("label.hoverme").mouseover(function(){$(this).addClass("hover");}).mouseout(function(){$(this).removeClass("hover")});
				
				
				// Inspirational quote thing
				
				var quotetext = "<h2><span>When you have walked&nbsp;<br />&nbsp;a mile in my shoes&nbsp;<br />&nbsp;then I shall call you my friend&nbsp;</span><br />AN Other</h2>";
				//$("#accent").append(quotetext);
				
				
				// Team page
				
				$("#people").each(function(){
						$("#columns").wrapInner("<div class=\"halfcol\">").append("<div class=\"halfcol last\"><div id=\"personcontent\">");
						htmlcontent = $(".person:first").html();
						$("#personcontent").html(htmlcontent);
						$("#columns").hover(function(){},function(){
							$("li",this).css({opacity:1}).find(".personinner").css({backgroundColor:"#ebe8ee"});
						});
						$(".person").css("float","none").wrapInner("<div class=\"personinner\">");
						$(".person .personinner").each(function(){
							var htmlcontent = $(this).html();
							var firstpara = $("p",this).text();
							var teaser = /^([^.!?]+)/.exec(firstpara)[1]; 
							$("p, form, h4, ul",this).hide();
							$(this).append("<p>" + teaser + "...</p>");
							$(this).mouseover(function(){
								$(".personinner").parents("li").css({opacity:1}).end().css({backgroundColor:"#ebe8ee"}).not($(this)).parents("li").css({opacity:0.2});
								$(this).css({backgroundColor:"#dad4e1"});
								$("#personcontent").html(htmlcontent);
							});
						});
						
						var boxname = "#personcontent";  
						var boxYloc = null;  
						boxYloc = parseInt($(boxname).offset().top);
						$(window).scroll(function () {   
							if ($(document).scrollTop()>boxYloc) {
								var offset = $(document).scrollTop()+10-boxYloc+"px";  
							} else {
								var offset = "0px";
							}
							//alert(offset + "px");
							$(boxname).animate({top:offset},{duration:700,queue:false});  
						});  
					});
				
					$("#closeit").click(function(){
						$(this).parent("div").css({display:"none"});							 
					});
					
					$("#showvidpanel").click(function(){
						$("#videopanel").css({display:"block"});								  					})
				
					$("#news").each(function(){
						$("#columns").wrapInner("<div class=\"halfcol\">").append("<div class=\"halfcol last\"><div id=\"newscontent\">");
						htmlcontent = $("li:first", this).html();
						$("#newscontent").html(htmlcontent);
						$("#columns").hover(function(){},function(){
							$("li",this).css({opacity:1}).find(".newsinner").css({backgroundColor:"#ebe8ee"});
						});
						$("li",this).css("float","none").wrapInner("<div class=\"newsinner\">");
						$("li .newsinner").each(function(){
							var htmlcontent = $(this).html();
							var firstpara = $("p",this).text();
							var teaser = /^([^.,!?]+)/.exec(firstpara)[1]; 
							$("p",this).hide();
							$(this).append("<p>" + teaser + "...</p>");
							$(this).mouseover(function(){
								$(".newsinner").parents("li").css({opacity:1}).end().css({backgroundColor:"#ebe8ee"}).not($(this)).parents("li").css({opacity:0.2});
								$(this).css({backgroundColor:"#dad4e1"});
								$("#newscontent").html(htmlcontent);
							});
						});
						
						var boxname = "#newscontent";  
						var boxYloc = null;  
						boxYloc = parseInt($(boxname).offset().top);
						$(window).scroll(function () {   
							if ($(document).scrollTop()>boxYloc) {
								var offset = $(document).scrollTop()+10-boxYloc+"px";  
							} else {
								var offset = "0px";
							}
							//alert(offset + "px");
							$(boxname).animate({top:offset},{duration:700,queue:false});  
						});  
					});
				
					   
				// All the nice little popup bubbles	   
				$('#nav ul li').each(function() {
					var hideDelayTimer = null;
					var beingShown = false;
					var visible = false;
					var distance = 10;
					var hideDelay = 500;
					var trigger = $(".trigger",this);
					var triggerOffset = trigger.offset();
					var triggerLeft = triggerOffset.left-$("#container").offset().left;
					var popup = $(".infobubble",this).css({opacity:0});
					if(trigger) {
						$([trigger.get(0), popup.get(0)]).mouseover(function(){
							if (hideDelayTimer) clearTimeout(hideDelayTimer);
							if (beingShown || visible) {
								return
							} else {
								beingShown = true;
								popup.css({
									zIndex: 100,
									display: 'block',
									top: 20,
									left: triggerLeft - 11
								}).animate({
									opacity:1,
									top: '+=' + distance + 'px'
								},'',function(){
									beingShown = false;
									visible = true;
								});
							}
						}).mouseout(function(){
							if (hideDelayTimer) clearTimeout(hideDelayTimer);
							hideDelayTimer = setTimeout(function() {
								if (visible) {
									popup.animate({
										top: '+=' + distance + 'px',
										opacity:0
									},'',function() { 
										visible = false;
										$(this).css({display:'none'})
									});
									
								} else {
									return
								}		
							},hideDelay);			
						});
					}
				});
			});