/*** Configurable options ***/
//URL and querystring for XML content request
var contenturl = '/getpage/?pid=';
//URL and querystring for XML search request
var searchurl = '/search/?q=';
//Static or AJAX/dynamic site: turns on or off "ajaxified" links and content loading.
//Used for testing static links and URL rewriting.
var staticsite = false;
//Artificial delay time (in milliseconds). 4000 is recommended value. May be set lower for faster testing.
//Note that after artificial delay runs out, the site will check every half second to see if the content has loaded yet.
//The transition will always remain open until loading is complete.
var transitiondelay = 4000;


/*** Gagen JS functions and classes ***/
window.addEvent("domready",function(){var ae=new Element("span",{id:"gagenlink",html:"Gagen MacDonald"}).replaces($("gagenlink"));if(Browser.Features.xhr&&!staticsite){var H=document.URL;H=H.split("/");if(H[H.length-1]!=""){H=H[H.length-1];}else{H=H[H.length-2];}if(H.indexOf(".")>=0){H="r";}var z=H;top.location.href=top.location.href+"#"+z;}var I,L,c,af;var ac=true;getpage=function(al){ac=false;var am=new Request({url:(contenturl+al),method:"get",onSuccess:function(aq,ap){z=al;pages=ap.getElementsByTagName("page");if(pages.length>0){for(i=0;i<pages.length;i++){L=pages[i].getAttribute("class");c=pages[i].getElementsByTagName("content")[0].firstChild.nodeValue;if(pages[i].getElementsByTagName("sidebar")[0]){c+='<div id="sidebar">'+pages[i].getElementsByTagName("sidebar")[0].firstChild.nodeValue+"</div>";}if(pages[i].getElementsByTagName("transition")[0]){I=pages[i].getElementsByTagName("transition")[0].firstChild.nodeValue;}}c=c.replace(/<object/gi,'<object style="visibility:hidden"');c=c.replace(/<embed/gi,'<embed style="visibility:hidden"');if(Browser.Engine.trident4){c=c.replace(/<select/gi,'<select style="visibility:hidden"');}af=pages[0].getElementsByTagName("title")[0].firstChild.nodeValue;}else{window.location.replace("http://"+window.location.hostname+"/content/"+al);}var ao=["/images/"+L+".jpg","/images/"+L+"-home_mg.png","/images/"+L+"-fg.png","/images/"+L+"-mg.png"];var an=new Asset.images(ao,{onComplete:function(){ac=true;},onFailure:function(){var ar=new Asset.images(ao);ac=true;}.bind(this)});},onFailure:function(){window.location.replace("http://"+window.location.hostname+"/content/"+al);}});am.send();};ajaxlinks=function(ao){if(Browser.Features.xhr&&!staticsite){var al=ao.getElementsByTagName("a");for(i=0;i<al.length;i++){var am=al[i].href;var ap=document.domain;var an=am.split("/");if(am.match(ap)&&an[an.length-1].indexOf(".")<0){$(al[i]).addEvent("click",function(at){new Event(at).stop();if(!P&&!V){an=this.href.split("/");var ar=an[an.length-1];if(ar=="search"){if(a){$("q").focus();$("q").highlight("#fff","#FEFFAF");}else{ag();var aq=function(){$("q").highlight("#fff","#FEFFAF");};aq.delay(600);}}else{j=true;d.to(ar);}}});}}}};var l=new Element("div",{id:"mastbg"}).injectInside($(document.body));var a=false;var h=new Fx.Morph("mastbg");var F=new Fx.Morph("mast");var s=new Fx.Morph("menu");$("menu").style.left="-"+window.getSize().x+"px";$("menu").style.display="block";$("menu").style.width=window.getSize().x-112+"px";$("menucontent").style.height=window.getSize().y-96+"px";$("credits").fade("hide");function ag(){var al=window.getSize();clearTimeout(G);if(a){P=false;F.start({left:"0px"});h.chain(function(){$("mast").className="";h.clearChain();});h.start({width:"56px"});s.start({left:"-"+window.getSize().x+"px"}).chain(function(){$("shell").set("title","");$("mast").set("title","Navigate + Search");a=false;$$("object").each(function(an){an.style.visibility="visible";});$$("embed").each(function(an){an.style.visibility="visible";});if(Browser.Engine.trident4){$$("select").each(function(an){an.style.visibility="visible";});}if(Browser.Engine.trident4){$("shell").focus();}s.clearChain();});$(document.body).style.overflow="auto";if(Browser.Engine.webkit){$(document.body).style.overflowY="scroll";}$("mastbg").fade("0.7");}else{$(document.body).style.overflow="hidden";var am=function(){$$("object").each(function(an){an.style.visibility="hidden";});$$("embed").each(function(an){an.style.visibility="hidden";});if(Browser.Engine.trident4){$$("select").each(function(an){an.style.visibility="hidden";});}$("mastbg").fade("show");$("transition").fade("hide");$("transition").style.display="none";$("menucontent").style.borderWidth="1px";$("menucontent").style.display="block";if(u){$("searchresults").style.display="block";$("menulist").style.display="none";q.fade("hide");q.style.display="none";S.style.display="block";}else{$("searchresults").style.display="none";$("menulist").style.display="block";q.fade("show");q.style.display="block";S.style.display="none";}if(al.x-112<875){$("credits").style.display="none";}else{$("credits").style.display="block";}$("search").style.display="block";$("credits").fade("show");$("search").fade("show");$("menucontent").style.height=al.y-96+"px";al=window.getSize();$("menu").style.width=al.x-112+"px";$("menu").style.left="-"+al.x+"px";if(al.x-112<875){$("credits").style.display="none";}else{$("credits").style.display="block";}s.start({left:"0px"}).chain(function(){$("menucontent").style.overflow="auto";$("q").focus();s.clearChain();});F.start({left:al.x-112+"px"});$("mast").className="open";$("mast").set("title","Close Menu");$("shell").set("title","Close Menu");h.start({width:al.x-57+"px"});a=true;};am.delay(300);}}function n(){var al=window.getSize();if(ad){C.elements.each(function(an){an.style.height="auto";});}else{C.elements[R].style.height="auto";}if(a){$("menucontent").style.height=al.y-96+"px";if(!P){$("mastbg").style.width=al.x-56+"px";$("mast").style.left=al.x-112+"px";$("menu").style.width=al.x-112+"px";if(al.x-112<875){$("credits").style.display="none";}else{$("credits").style.display="block";}}else{var am=((window.getSize().y-$$("#transition div")[0].getSize().y)/2)-10;if($$("#transition div")[0].getSize().y+am>=window.getSize().y){am=0;}$("transition").style.marginTop=am+"px";$("menu").style.width=al.x-57+"px";$("mast").style.left=al.x-57+"px";$("mastbg").style.width=al.x-1+"px";}}}$("mast").addEvent("click",function(){if(!V){ag();}});$("mast").set("title","Navigate + Search");var aa,y;var A=new Element("div",{id:"bg"}).injectInside($(document.body));var Q=new Asset.image("/images/"+$(document.body).className+".jpg",{onload:function(){Q.injectInside(A);ah();if(Browser.Engine.gecko){aa=A.getSize().x;y=A.getSize().y;T();}}});function ah(){Q.style.width="100%";Q.style.height="auto";if(Q.getSize().y<window.getSize().y){Q.style.width="auto";if(Browser.Engine.trident4){Q.style.height=window.getSize().y+"px";}else{Q.style.height="100%";}}var al=(Browser.Engine.webkit)?A:window;gh=((Q.getSize().y-al.getSize().y)/2);gw=((Q.getSize().x-al.getSize().x)/2);Q.style.top=0-gh+"px";Q.style.left=0-gw+"px";}function T(){var al=A.getSize().x;var am=A.getSize().y;if(al!==aa||am!==y){aa=A.getSize().x;y=A.getSize().y;if($$(".spotgroup")[0]){N();}else{w($("content"));}ah();n();}setTimeout(T,150);}var W=new Element("img",{src:"/images/bg-pathselect.png",id:"contentbg"});$("shell").grab(W);var J=new Element("h1",{html:"a"}).injectInside($("content"));var v=J.getSize().y;J.dispose();var ak=0;function w(al){if($("sidebar")){var am=($("content").getSize().y>($("sidebar").getSize().y+290))?$("content").getSize().y:($("sidebar").getSize().y+290);}else{var am=$("content").getSize().y;}ak=((window.getSize().y-am)/2)-10;if(am+ak>=window.getSize().y){ak=0;}al.style.marginTop=ak+"px";W.style.top=ak+"px";W.style.width=($(document.body).getSize().x>960)?"100%":"904px";if(Browser.Engine.trident4){W.style.width=W.getSize().x-10+"px";}if($("sidebar")&&$$(".content")[0]){var an=(am>$(document.body).getSize().y)?am:$(document.body).getSize().y;W.style.height=an-ak-145+"px";}if($$(".content")[0]){var ao=(Browser.Engine.trident4)?3:0;if($$("h1")[0]&&$$("h1")[0].getSize().y>v){$$("h1")[0].style.marginTop=0-$$("h1")[0].getSize().y-3+ao+v+"px";}else{$$("h1")[0].style.marginTop=0-3+ao+"px";}}}function p(al){B.tween("top",(al.getPosition().y-ak-2+$(document.body).scrollTop+"px"));al.set("morph",{duration:"short"});al.morph("."+$(document.body).className+"_over");}var j=false;$("transition").fade("hide");if($$("#transition div")[0]){var O=new Element("span",{id:"spinner",html:"Loading requested page"}).injectInside($$("#transition div")[0]);}O.fade("hide");var r=new Fx.Morph("mastbg");var G;var P=false;var V=false;function U(al,ap){V=true;var am=window.getSize();if(al=="in"){clearTimeout(G);P=true;if(a){$("credits").fade("out");$("search").fade("out");q.fade("out");s.start({opacity:"0",width:am.x-57+"px"}).chain(function(){$("menucontent").scrollTo(0,0);$("menucontent").style.borderWidth="0";$("menulist").style.display="none";$("searchresults").style.display="none";s.set({opacity:"1"});$("credits").style.display="none";$("search").style.display="none";q.style.display="none";S.style.display="none";$("transition").style.display="block";var aq=((window.getSize().y-$$("#transition div")[0].getSize().y)/2)-10;if($$("#transition div")[0].getSize().y+aq>=window.getSize().y){aq=0;}$("transition").style.marginTop=aq+"px";$("transition").fade("in");O.fade("0.25");V=false;s.clearChain();});}else{$(document.body).style.overflow="hidden";am=window.getSize();$$("object").each(function(aq){aq.style.visibility="hidden";});$$("embed").each(function(aq){aq.style.visibility="hidden";});if(Browser.Engine.trident4){$$("select").each(function(aq){aq.style.visibility="hidden";});}$("menulist").style.display="none";$("credits").style.display="none";$("search").style.display="none";q.style.display="none";$("searchresults").style.display="none";S.style.display="none";$("menucontent").style.borderWidth="0";$("menucontent").style.display="block";$("menucontent").style.height=am.y-96+"px";$("menu").style.width=am.x-57+"px";$("menu").style.left="-"+am.x+"px";$$("#transition div")[0].style.display=j?"block":"none";$$("#transition .spot")[0].style.display=j?"block":"none";$$("#transition .spot img")[0].style.display=j?"block":"none";$("transition").style.display="block";var an=((am.y-$$("#transition div")[0].getSize().y)/2)-10;if($$("#transition div")[0].getSize().y+an>=am.y){an=0;}$("transition").style.marginTop=an+"px";$("transition").fade("show");s.start({left:"0px"}).chain(function(){$("menucontent").style.overflow="auto";a=true;O.fade("0.25");V=false;s.clearChain();});F.start({left:am.x-57+"px"});$("mast").className="open";$("mast").set("title","Close Menu");$("shell").set("title","Close Menu");h.set({opacity:"1"});h.start({width:am.x-1+"px"});}F.start({left:am.x-57+"px"});h.start({width:am.x-1+"px"});getpage(ap);var ao=j?transitiondelay:0;j=false;G=setTimeout(function(){if(ac){U("out");}else{G=setInterval(function(){if(ac){U("out");clearInterval(G);}},500);}},ao);}else{if(al=="out"){$("content").set("html",c);w($("content"));window.scroll(0,0);ajaxlinks($("content"));f();Q.src="/images/"+L+".jpg";O.fade("out");$("transition").fade("out");r.start("."+L+"morph");F.start("."+L+"border").chain(function(){F.clearChain();$(document.body).style.overflow="auto";if(Browser.Engine.webkit){$(document.body).style.overflowY="scroll";}$(document.body).className=L;$("menucontent").style.overflow="hidden";F.start({left:"0px"});h.chain(function(){$("mast").className="";D.delay(100);h.clearChain();});h.start({width:"56px"});s.start({left:"-"+window.getSize().x+"px"}).chain(function(){$("shell").set("title","");$("mast").set("title","Navigate + Search");a=false;$("transition").set("html",I);O=new Element("span",{id:"spinner",html:"Loading requested page"}).injectInside($$("#transition div")[0]);O.fade("hide");$$("object").each(function(aq){aq.style.visibility="visible";});$$("embed").each(function(aq){aq.style.visibility="visible";});if(Browser.Engine.trident4){$$("select").each(function(aq){aq.style.visibility="visible";});}if(Browser.Engine.trident4){$("shell").focus();}document.title=af;if(d.history){d.history.setValue(0,z);}D.delay(100);s.clearChain();});$("mastbg").fade("0.7");});}}}function D(){$("mastbg").setStyle("width","56px");V=false;P=false;}$("search").addEvent("submit",function(al){new Event(al).stop();Y();});function Y(){if($("q").value==""){g();}else{loadsearch($("q").value);}}var X=new Element("div",{id:"searchresults",html:"<h3>Search results</h3><ul></ul>"}).injectInside($("menucontent"));$("searchresults").fade("hide");var S=new Element("span",{id:"searchreturn",html:"&middot;&nbsp;&nbsp;Return to menu&nbsp;&nbsp;&middot;"}).injectInside($("menu"));S.addEvent("click",function(){g();});S.fade("hide");var ai=new Element("span",{id:"searchspinner",html:"Loading search results",styles:{display:"none"}}).injectInside($("search"));ai.fade("0.25");ai.style.display="none";var k=new Element("img",{src:"/images/searchclose.gif",title:"Clear search",id:"searchclose"}).injectInside($("search"));k.addEvent("click",function(){g();});var u=false;function Z(){u=true;if(a){var al=function(){q.style.display="none";S.style.display="block";$("menulist").style.display="none";$("searchresults").style.display="block";$("searchresults").fade("in");S.fade("in");};al.delay(400);q.fade("out");$("menulist").fade("out");}else{ag();Z();}}function g(){$("q").value="";var al=function(){$("searchresults").style.display="none";$("menulist").style.display="block";q.style.display="block";$("menulist").fade("in");q.fade("in");S.style.display="none";};al.delay(400);S.fade("out");$("searchresults").fade("out");u=false;}var x=0;loadsearch=function(am){ai.style.display="block";var al=new Request({url:(searchurl+am),method:"get",onSuccess:function(ap,ao){results=ao.getElementsByTagName("result");var an="";if(results.length>0){for(i=0;i<results.length;i++){an+="<li>";an+='<a href="'+results[i].getElementsByTagName("link")[0].firstChild.nodeValue+'" class="title">'+results[i].getElementsByTagName("title")[0].firstChild.nodeValue+"</a>";an+="<p>"+results[i].getElementsByTagName("summary")[0].firstChild.nodeValue+"</p>";an+="</li>";}}else{an+="<li><h2>The search request failed.</h2></li>";}an+='<li><span class="title" id="returntomenu"><span>&larr;</span>Return to menu</span></li>';$$("#searchresults ul")[0].set("html",an);$("returntomenu").addEvent("click",g);$$("#searchresults h3")[0].set("html","Search results for &ldquo;"+am+"&rdquo;");ajaxlinks(X);ai.style.display="none";Z();x=0;},onFailure:function(){if(x<1){loadsearch(am);x++;}else{x=0;resultshtml+="<li><h2>The search request failed.</h2></li>";$$("#searchresults ul")[0].set("html",resultshtml);}ai.style.display="none";}});al.send();};featurerotate=function(){m[aj].fade("out");ab=setTimeout(nextfeature,1100);};nextfeature=function(){m[aj].className="hide";aj=(aj+1<m.length)?aj+1:0;m[aj].className="";m[aj].fade("in");};var aj,m,B,o,ab;function f(){clearInterval(o);clearTimeout(ab);if($$(".home")[0]){$$("#pathselect li a").addEvent("mouseover",function(){p(this);});$$("#pathselect li a").addEvent("mouseout",function(){this.morph(".patha");});$$("#pathselect li a").addEvent("focus",function(){p(this);});$$("#pathselect li a").addEvent("blur",function(){this.morph(".patha");});B=new Element("div",{id:"pointer",styles:{top:($$("#pathselect li a")[0].getPosition().y-ak-1+"px")}}).injectInside($$(".home")[0]);B.set("tween",{duration:"short"});W.className="homebg";aj=0;o=setInterval(featurerotate,8000);m=$$("#featured div");m.each(function(am,al){am.set("tween",{duration:"1100"});if(al==0){am.className="";am.fade("show");}else{am.fade("hide");am.className="hide";}});}else{if($$(".bios")[0]||$$(".clients")[0]){W.className="spotpage";M();}else{W.className="";}}}var E;function M(){if($$(".spotgroup").length>0){E=0;$("content").style.marginTop="0px";for(i=0;i<$$(".spotgroup").length;i++){if(i>0){$$(".spotgroup")[i].set("styles",{opacity:"0",display:"none"});}}$$(".spotgroup")[E].getParent("div").setStyle("top",((window.getSize().y-$$(".spotgroup")[E].getSize().y)/2)-25);W.setStyle("top",((window.getSize().y-$$(".spotgroup")[E].getSize().y)/2)-25);$$(".spotgroup")[E].getParent("div").tween("height",$$(".spotgroup")[E].getSize().y);W.style.height=$$(".spotgroup")[0].getParent("div").getSize().y+"px";var al=new Element("ul",{id:"spotnav",html:'<li id="showallbut">Show all</li><li id="prevbut">Previous</li><li id="nextbut">Next</li>'}).injectInside($$(".spotgroup")[0].getParent("div"));$("nextbut").addEvent("click",function(){N("next");});$("prevbut").addEvent("click",function(){N("prev");});$("showallbut").addEvent("click",function(){t();});}}function t(){if($$(".spotgroup")[0].getParent("div").hasClass("showall")){N();}else{if($$(".bios")[0]){var al=255;}else{var al=395;}$$(".spotgroup")[0].getParent("div").morph({top:((window.getSize().y-al)/2)-25,height:al});W.morph({top:((window.getSize().y-(al+43))/2)-3,height:(al+43)});$$(".spotgroup")[0].getParent("div").className+=" showall";for(i=0;i<$$(".spotgroup").length;i++){$$(".spotgroup")[i].set("styles",{opacity:"1",display:"block"});}}}function N(am){if($$(".spotgroup")[0].getParent("div").hasClass("showall")){$$(".spotgroup")[0].getParent("div").removeClass("showall");for(i=0;i<$$(".spotgroup").length;i++){if(i!=E){$$(".spotgroup")[i].set("styles",{opacity:"0",display:"none"});}}$$(".spotgroup")[E].getParent("div").morph({top:((window.getSize().y-$$(".spotgroup")[E].getSize().y)/2)-25,height:$$(".spotgroup")[E].getSize().y});W.morph({top:((window.getSize().y-$$(".spotgroup")[E].getSize().y)/2)-25,height:$$(".spotgroup")[E].getSize().y+43});}else{if(am=="prev"){$$(".spotgroup")[E].tween("opacity",0);if(E-1<0){E=$$(".spotgroup").length-1;}else{E--;}}else{if(am=="next"){$$(".spotgroup")[E].tween("opacity",0);if(E+2>$$(".spotgroup").length){E=0;}else{E++;}}}var al=function(){for(i=0;i<$$(".spotgroup").length;i++){$$(".spotgroup")[i].setStyle("display","none");}$$(".spotgroup")[E].setStyle("display","block");$$(".spotgroup")[E].getParent("div").morph({top:((window.getSize().y-$$(".spotgroup")[E].getSize().y)/2)-25,height:$$(".spotgroup")[E].getSize().y});W.morph({top:((window.getSize().y-$$(".spotgroup")[E].getSize().y)/2)-25,height:$$(".spotgroup")[E].getSize().y+43});var an=(Browser.Engine.trident)?0.99:1;$$(".spotgroup")[E].tween("opacity",1);};al.delay(500);}}$("shell").addEvent("click",function(al){if(a){al.stop();ag();}});Accordion.implement({showAll:function(){var al={};this.previous=-1;this.elements.each(function(an,am){al[am]={};this.fireEvent("onActive",[this.togglers[am],an]);for(var ao in this.effects){al[am][ao]=an[this.effects[ao]];}},this);return this.start(al);},hideAll:function(){var al={};this.previous=-1;this.elements.each(function(an,am){al[am]={};this.fireEvent("onBackground",[this.togglers[am],an]);for(var ao in this.effects){al[am][ao]=0;}},this);return this.display(0);}});var R;var C=new Accordion($("menulist"),"span.navsection","#menulist ul",{onActive:function(am,al){am.className="navover";R=this.elements.indexOf(al);},onBackground:function(am,al){ad=false;am.className="navsection";}});var ad=false;function b(){if(ad){ad=false;C.hideAll();q.set("html","&middot;&nbsp;&nbsp;Expand sections&nbsp;&nbsp;&middot;");}else{ad=true;C.showAll();q.set("html","&middot;&nbsp;&nbsp;Collapse sections&nbsp;&nbsp;&middot;");}}var q=new Element("span",{id:"menuexp",html:"&middot;&nbsp;&nbsp;Expand sections&nbsp;&nbsp;&middot;"}).injectInside($("menu"));q.addEvent("click",function(){b();});ajaxlinks($(document.body));f();if($$(".spotgroup")[E]){$$(".spotgroup")[E].getParent("div").setStyle("top",((window.getSize().y-$$(".spotgroup")[E].getSize().y)/2)-25);W.setStyle("top",((window.getSize().y-$$(".spotgroup")[E].getSize().y)/2)-25);N();}else{w($("content"));}if(Browser.Engine.trident4){$("shell").focus();}window.addEvent("resize",ah);window.addEvent("resize",function(){if($$(".spotgroup")[0]){N();}else{w($("content"));}});window.addEvent("resize",n);var K=new Element("span",{id:"nav",html:"Navigate + Search"}).injectInside($("mast"));var e=new Class({initialize:function(){this.history=HistoryManager.register("",[0],function(al){this.to(al);}.bind(this),false,false);},to:function(al){if(al==""){al=z;}if(al!=z){if(al!="r"){if(al=="home"){var am="/";}else{var am="/content/"+al+"/";}pageTracker._trackPageview(am);U("in",al);}else{window.location.replace("http://"+window.location.hostname+window.location.pathname);}}else{if(a){ag();window.scroll(0,0);}}}});if(Browser.Features.xhr&&!staticsite){HistoryManager.initialize();var d=new e();HistoryManager.start();}});