var elSelectedMainMenuItem;
var elContainer;
var elCurrentContent, elOldContent;
var elSubMenu;
var elDetails, elDetailsTop, elDetailsBottom;
var detailsOpacityAnim = null;
var detailsTopOpacityAnim = null;
var detailsBottomOpacityAnim = null;
var detailsOpacityState = 0;
var contentCount;
var elAnimIFrame;
var contentTop;
var animationInProgress;
var subMenuState, subMenuDivs, subMenuImages;
var elLightBoxBackground, elLightBox, lightBoxState;
var posX = new Array ();
var posY = new Array ();
var calendarAnimationInProgress;
var displayedDayID;
var detailDaemon = null;
var detailHeightAnim = null;
var currentHighLight;
var dayToHighLight = null;

var rxiArray = new Array ();
 rxiArray[2] = 105;
 rxiArray[3] = 150;
 rxiArray[4] = 185;
var rxoArray = new Array ();
 rxoArray[2] = 173;
 rxoArray[3] = 312;
 rxoArray[4] = 352;
var ryoArray = new Array ();
 ryoArray[2] = 70;
 ryoArray[3] = 110;
 ryoArray[4] = 154;

function hideAnimFrame () {
 elAnimIFrame.style.zIndex = -1;
}

function removeObstruction () {
 var opacityAnim = new YAHOO.util.Anim (elAnimIFrame, {
  opacity: { to: 0 }
 }, 1, YAHOO.util.Easing.easeOut);
 opacityAnim.duration = 0.3;
 opacityAnim.onComplete.subscribe (hideAnimFrame);
 opacityAnim.animate ();
}

function replyOfSndRequest (self) {
 if (self.http.readyState == 4) {
  if (self.http.status == 200) {
   document.getElementById ('mainContent').innerHTML = self.http.responseText;
   removeObstruction ();
   if (elSubMenu = document.getElementById ("subMenu")) {
    buildSubMenu ();
   } else {
    if (navigator.appName != "Microsoft Internet Explorer") {
     initCalendar ();
    }
   }
  } else {
   // wasntme
  }
 }
}

function sndReq () {
 var self = this;
 try {
  self.http = window.XMLHttpRequest?new XMLHttpRequest():new ActiveXObject("Microsoft.XMLHTTP");
  self.http.open ('GET', elSelectedMainMenuItem.id.substr (4) + '.php?inFrame=true');
  self.http.onreadystatechange = function () {
   replyOfSndRequest (self);
  }
  self.http.send (null);
 } catch (e) {
  // wasntme
 }
}

function obstructIFrame (menuItem) {
 elSelectedMainMenuItem.className = "";
 elAnimIFrame.style.zIndex = 42;
 elSelectedMainMenuItem = document.getElementById ("mmi_" + menuItem);
 elSelectedMainMenuItem.className = "selected";
 var opacityAnim = new YAHOO.util.Anim (elAnimIFrame, {
  opacity: { to: 1 }
 }, 1, YAHOO.util.Easing.easeOut);
 opacityAnim.duration = 0.25;
 opacityAnim.onComplete.subscribe (sndReq);
 opacityAnim.animate ();
}

function activateMainMenuAndCalendarSwitch () {
 var nodes = YAHOO.util.Selector.query ("#mainMenu a");
 YAHOO.util.Event.addListener (nodes, "click", function (evt) {
  try {
   YAHOO.util.History.navigate ("mainmenu", this.id.substr (4));
  } catch (e) {
   obstructIFrame (this.id.substr (4));
  }
  YAHOO.util.Event.preventDefault (evt);
 });
 obstructIFrame (YAHOO.util.History.getCurrentState ("mainmenu"));

 YAHOO.util.Event.addListener ("calendarNext", "click", function (evt) {
  calendarNext ();
  YAHOO.util.Event.preventDefault (evt);
 });
 YAHOO.util.Event.addListener ("calendarPrev", "click", function (evt) {
  calendarPrev ();
  YAHOO.util.Event.preventDefault (evt);
 });
}

function initializeBookmarkManager () {
 var bookmarkedSection = YAHOO.util.History.getBookmarkedState ("mainmenu");
 var querySection = YAHOO.util.History.getQueryStringParameter ("mainmenu");
 var initialSection = bookmarkedSection || querySection || "welcome";

 YAHOO.util.History.register ("mainmenu", initialSection, function (state) { 
  obstructIFrame (state);
 });

 YAHOO.util.History.onReady (function () {
  activateMainMenuAndCalendarSwitch ();
 });

 try {
  YAHOO.util.History.initialize ("yui-history-field", "yui-history-iframe");
 } catch (e) {
  alert ('doh.');
 }
}

function highLightDay (e, arg1) {
 if (e) {
  elDay = this;
 } else if (arg1) {
  elDay = document.getElementById ("day" + arg1);
 } else {
   return; // doh
 }
 var date = YAHOO.util.Selector.query (".date", elDay)[0];
 if ((date) && (date.className) && (date.className != "date grey")) {
  date = date.textContent;
  var elHighLight = document.getElementById ("highlight" + date);
  if (!elHighLight) {
    elHighLight = elDay.cloneNode (true);
    elHighLight.className = "day_detail";
    var details = YAHOO.util.Selector.query (".time > span, .description > span", elHighLight);
    for (var i in details) {
     details[i].style.display = "inline";
    }
    elDay.parentNode.parentNode.appendChild (elHighLight);
    elHighLight.id = "highlight" + date;
    elHighLight.style.position = "absolute";

    var width = elHighLight.scrollWidth - 24;
    var left = elDay.offsetLeft - (width / 2) + 23;
    if (left + width > 500) {
      left = 500 - width;
    }
    if (left < 10) {
      left = 10;
    }
    elHighLight.style.left = left + "px";
    elHighLight.style.width = width + "px";
    elHighLight.style.top = (elDay.offsetTop - 12) + "px";
    elHighLight.style.height = "70px";
    if (currentHighLight) {
     var elCurrent = document.getElementById (currentHighLight);
     elCurrent.parentNode.removeChild (elCurrent);
    }
    currentHighLight = "highlight" + date;
  }
 }
}

function initCalendar () {
 currentHighLight = null;
 var days = YAHOO.util.Selector.query (".week > div");
 YAHOO.util.Event.addListener (days, "mouseover", highLightDay);
 var currentTime = new Date();
 highLightDay (null, currentTime.getDate ());
}

function spreadOverCircle (fullSize, animate) {
 var angleStep = 80 / contentCount;
 var angle, x, y;
 var offsetX, offsetY;

 if (fullSize) {
  radiusX = rxoArray[contentCount];
  radiusY = ryoArray[contentCount];
  imageSize = 64;
  offsetX = 7;
  offsetY = 7;
 } else {
  radiusX = rxiArray[contentCount];
  radiusY = (contentCount * 25);
  imageSize = 32;
  offsetX = 3;
  offsetY = 3;
 }

 for (i = 0; i < contentCount; i++) {
  angle = angleStep * (i + 1) * Math.PI / 180;
  posX[i] = (radiusX * Math.cos (angle)); // - (subMenuImages[i].width / 2);
  posY[i] = (radiusY * Math.sin (angle)) - (imageSize / 2);
 }

 offsetX = posX[contentCount - 1] - offsetX;
 offsetY = posY[0] - offsetY;
 for (i = 0; i < contentCount; i++) {
  posX[i] = posX[i] - offsetX;
  posY[i] = posY[i] - offsetY;
 }

 for (i = 0; i < contentCount; i++) {
  if (animate) {
   var posAnim = new YAHOO.util.Anim (subMenuDivs[i], {
    left: { to: posX[i] },
    top: { to: posY[i] }
   }, 1, YAHOO.util.Easing.easeOut);
   posAnim.duration = 0.3;
   posAnim.animate ();
   var sizeAnim = new YAHOO.util.Anim (subMenuImages[i], {
    height: { to: imageSize }
   }, 1, YAHOO.util.Easing.easeOut);
   sizeAnim.duration = 0.3;
   sizeAnim.animate ();
  } else {
    subMenuDivs[i].style.left = posX[i] + "px";
    subMenuDivs[i].style.top = posY[i] + "px";
  }
 }
}

function endAnimation () {
 animationInProgress = false;
 if (subMenuState == "in") {
   YAHOO.util.Event.removeListener ('body', "mousemove");
 } else {
   YAHOO.util.Event.addListener ('body', "mousemove", function (event) {flyIn (event);});
 }
}

function flyOut (e) {
 if (!animationInProgress) {
  var posx = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
  var posy = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;

  if ((posy > 72) || (posy < contentTop + 12) || (posx > 206) || (posx < 706)) {
   animationInProgress = true;
   spreadOverCircle (true, true);
   var heightAnim = new YAHOO.util.Anim (elSubMenu, {
    height: { to: ryoArray[contentCount] + 36 }
   }, 1, YAHOO.util.Easing.easeOut);
   heightAnim.duration = 0.15;
   heightAnim.onComplete.subscribe (endAnimation);
   heightAnim.animate ();
   subMenuState = "out";
  }
 }
}

function flyIn (e) {
 if ((subMenuState == 'out') && (!animationInProgress)) {
  var posx = 0;
  var posy = 0;
  posx = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
  posy = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;

 if ((posy < 72) || (posy > ryoArray[contentCount] + 107) || (posx < 206) || (posx > 706)) {
   animationInProgress = true;
   spreadOverCircle (false, true);
   var heightAnim = new YAHOO.util.Anim (elSubMenu, {
    height: { to: contentTop }
   }, 1, YAHOO.util.Easing.easeOut);
   heightAnim.duration = 0.45;
   heightAnim.onComplete.subscribe (endAnimation);
   heightAnim.animate ();
   subMenuState = "in";
  }
 }
}

function hideOldContent () {
 elOldContent.style.display = "none";
 elContainer.style.top = (contentTop + 16) + "px";
 elCurrentContent.style.overflow = "auto";
}

function scrollToContent (el) {
 el = el.parentNode;
 document.title = el.childNodes[1].firstChild.data;
 elOldContent = elCurrentContent;
 elCurrentContent = document.getElementById (el.id.substr (2));
 if (elOldContent != elCurrentContent) {
// figure out in which direction to scroll...
  var elMenuItem = document.getElementById (el.id);
  var scrollUp = true;
  var nextChild = elMenuItem;
  while (nextChild) {
   if (nextChild.id == "m_" + elOldContent.id) {
    scrollUp = false;
    break;
   }
   nextChild = nextChild.nextSibling;
  }
  if (scrollUp) {
//   elContainer.style.top = contentTop + "px";
   finalScrollPosition = contentTop - 384; // - 400 + 16;
  } else {
   elContainer.style.top = (contentTop - 384) + "px";
   finalScrollPosition = contentTop + 16;
  }
  elOldContent.style.overflow = "hidden";
  elCurrentContent.style.overflow = "hidden";
  elCurrentContent.style.display = "block";
  var topAnim = new YAHOO.util.Anim (elContainer, {
   top: { to: finalScrollPosition }
  }, 1, YAHOO.util.Easing.easeOut);
  topAnim.duration = 0.3;
  topAnim.onComplete.subscribe (hideOldContent);
  topAnim.animate ();
 }
}

function buildSubMenu () {
 subMenuDivs = new Array ();
 subMenuImages = new Array ();
 contentCount = 0;
 elCurrentContent = null;
 elContainer = document.getElementById ("container");
 var contents = YAHOO.util.Selector.query('#container .content');
 for (var i = 0; i < contents.length; i++) {
  var innerHtml;
  var image;
  var id;
  var children = contents[i].childNodes;
  if (!elCurrentContent) {
    elCurrentContent = contents[i];
  } else {
    contents[i].style.display = "none";
  }
  for (var j = 0; j < children.length; j++) {
   if (children[j].tagName == "H2") {
    innerHtml = children[j].innerHTML;
    if (contentCount == 0) {
     document.title = innerHtml;
    }
    id = innerHtml.replace (/ /g, '');
   } else if (children[j].tagName == "IMG") {
    image = children[j].src;
   }
  }
  var newItem = document.createElement ("div");
  newItem.innerHTML = "<img id='im_" + id + "' src='" + image + "'><span id='s_" + id + "'>" + innerHtml + "</span>";
  contents[i].id = id;
  newItem.id = "m_" + id;
  newItem.style.zIndex = 12 - contentCount;
  YAHOO.util.Event.addListener ("im_" + id, "click", function () {scrollToContent (this);});
  YAHOO.util.Event.addListener ("s_" + id, "click", function () {scrollToContent (this);});
  elSubMenu.appendChild (newItem);
  YAHOO.util.Event.addListener (newItem, "mouseout", function (e) {flyIn (e);});
  subMenuDivs[contentCount] = newItem;
  subMenuImages[contentCount] = document.getElementById ("im_" + id);
  subMenuImages[contentCount].style.zIndex = 12 + contentCount;
  contentCount++;
 }
 spreadOverCircle (false, false);
 contentTop = (contentCount * 25) + 12;
 elSubMenu.style.height = contentTop + "px";
 YAHOO.util.Event.addListener (elSubMenu, "mouseover", function (e) {flyOut (e);});
 YAHOO.util.Event.addListener (elSubMenu, "mouseout", function (e) {flyIn (e);});
 document.getElementById ("container").style.top = contentTop + "px";
}

function finalizeCalendarNext () {
 document.getElementById ("calendarNext").style.display = "none";
 calendarAnimationInProgress = false;
}

function finalizeCalendarPrev () {
 document.getElementById ("calendarPrev").style.display = "none";
 calendarAnimationInProgress = false;
}

function calendarMove (switchCur, switchNew, calCur, calNew, leftCur, funcComplete) {
 if (calendarAnimationInProgress == false) {
  calendarAnimationInProgress = true;
  var elSwitchCur = document.getElementById ("calendar" + switchCur);
  var elSwitchNew = document.getElementById ("calendar" + switchNew);
  var elCalCur = document.getElementById ("calendar" + calCur);
  var elCalNew = document.getElementById ("calendar" + calNew);

  var opacityAnimCur = new YAHOO.util.Anim (elSwitchCur, {
   opacity: { to: 0 }
  }, 1, YAHOO.util.Easing.easeOut);
  opacityAnimCur.duration = 0.4;
  opacityAnimCur.onComplete.subscribe (funcComplete);
  opacityAnimCur.animate ();

  elSwitchNew.style.display = "block";
  var opacityAnimNew = new YAHOO.util.Anim (elSwitchNew, {
   opacity: { to: 1 }
  }, 1, YAHOO.util.Easing.easeOut);
  opacityAnimNew.duration = 0.4;
  opacityAnimNew.animate ();

  var posAnimCur = new YAHOO.util.Anim (elCalCur, {
   left: { to: leftCur }
  }, 1, YAHOO.util.Easing.easeOut);
  posAnimCur.duration = 0.4;
  posAnimCur.animate ();

  var posAnimNew = new YAHOO.util.Anim (elCalNew, {
   left: { to: 0 }
  }, 1, YAHOO.util.Easing.easeOut);
  posAnimNew.duration = 0.4;
  posAnimNew.animate ();
 }
}

function calendarNext () {
 calendarMove ("Next", "Prev", 1, 2, -200, finalizeCalendarNext);
}

function calendarPrev () {
 calendarMove ("Prev", "Next", 2, 1, 200, finalizeCalendarPrev);
}

function displayDay (origin) {
 var detailID = "detail" + origin.id.substr (5);
 displayedDayID = detailID;
 var newHeight = document.getElementById (detailID).clientHeight;

 var opacityAnim = new YAHOO.util.Anim (detailID, {
  opacity: { to: 1 }
 }, 1, YAHOO.util.Easing.easeOut);
 opacityAnim.duration = 0.25;
 opacityAnim.animate ();
 var colorAnim = new YAHOO.util.ColorAnim (origin, {
  backgroundColor: { to: '#eff4f7' }
 }, 1, YAHOO.util.Easing.easeOut);
 colorAnim.duration = 0.25;
 colorAnim.animate ();

 if (detailHeightAnim && detailHeightAnim.isAnimated ()) {
  detailHeightAnim.stop();
 }
 detailHeightAnim = new YAHOO.util.Anim ("details", {
  height: { to: newHeight }
 }, 1, YAHOO.util.Easing.easeOut);
 if (newHeight < document.getElementById ("details").clientHeight) {
  detailHeightAnim.duration = 1.7;
 } else {
  detailHeightAnim.duration = 0.5;
 }
 detailHeightAnim.animate ();

 for (i = 1; i <= 31; i++) {
  var el = document.getElementById ("smalld" + i);
  if ((el != origin) && (document.getElementById ("detaild" + i).style.opacity > 0)) {
   hideDay (el);
  }
/*  var el = document.getElementById ("smalls" + i);
  if ((el != origin) && (document.getElementById ("details" + i).style.opacity > 0)) {
   hideDay (el);
  } */

  if (detailsOpacityState == 0) {
   if (navigator.appName == "Microsoft Internet Explorer") {
    elDetails.style.display = "block";
    elDetailsTop.style.display = "block";
    elDetailsBottom.style.display = "block";
   } else {
    if (detailsOpacityAnim && detailsOpacityAnim.isAnimated ()) {
     detailsOpacityAnim.stop();
    }
    detailsOpacityAnim = new YAHOO.util.Anim (elDetails, {
     opacity: { to: 1 }
    }, 1, YAHOO.util.Easing.easeOut);
    detailsOpacityAnim.duration = 0.7;
    detailsOpacityAnim.animate ();
    if (detailsTopOpacityAnim && detailsTopOpacityAnim.isAnimated ()) {
     detailsTopOpacityAnim.stop();
    }
    detailsTopOpacityAnim = new YAHOO.util.Anim (elDetailsTop, {
     opacity: { to: 1 }
    }, 1, YAHOO.util.Easing.easeOut);
    detailsTopOpacityAnim.duration = 0.7;
    detailsTopOpacityAnim.animate ();
    if (detailsBottomOpacityAnim && detailsBottomOpacityAnim.isAnimated ()) {
     detailsBottomOpacityAnim.stop();
    }
    detailsBottomOpacityAnim = new YAHOO.util.Anim (elDetailsBottom, {
     opacity: { to: 1 }
    }, 1, YAHOO.util.Easing.easeOut);
    detailsBottomOpacityAnim.duration = 0.7;
    detailsBottomOpacityAnim.animate ();
   }
   detailsOpacityState = 1;
  }
 }

 if (detailDaemon == null) {
  detailDaemon = window.setInterval ("hideDetails ();", 1000);
 }
}

function hideDetails () {
 if (displayedDayID == "") {
  if (detailHeightAnim && detailHeightAnim.isAnimated ()) {
   detailHeightAnim.stop();
  }
  var detailHeightAnim = new YAHOO.util.Anim ("details", {
   height: { to: '29' }
  }, 1, YAHOO.util.Easing.easeOut);
  detailHeightAnim.duration = 1.7;
  detailHeightAnim.animate ();
  window.clearInterval (detailDaemon);
  detailDaemon = null;

  for (i = 1; i <= 31; i++) {
   var el = document.getElementById ("smalld" + i);
   if (document.getElementById ("detaild" + i).style.opacity > 0) {
    hideDay (el);
   }
/*   var el = document.getElementById ("smalls" + i);
   if (document.getElementById ("details" + i).style.opacity > 0) {
    hideDay (el);
   } */
  }

  if (detailsOpacityState == 1) {
   if (navigator.appName == "Microsoft Internet Explorer") {
    elDetails.style.display = "none";
    elDetailsTop.style.display = "none";
    elDetailsBottom.style.display = "none";
   } else {
    if (detailsOpacityAnim && detailsOpacityAnim.isAnimated ()) {
     detailsOpacityAnim.stop();
    }
    detailsOpacityAnim = new YAHOO.util.Anim (elDetails, {
     opacity: { to: 0 }
    }, 1, YAHOO.util.Easing.easeOut);
    detailsOpacityAnim.duration = 3;
    detailsOpacityAnim.animate ();

    if (detailsTopOpacityAnim && detailsTopOpacityAnim.isAnimated ()) {
     detailsTopOpacityAnim.stop();
    }
    detailsTopOpacityAnim = new YAHOO.util.Anim (elDetailsTop, {
     opacity: { to: 0 }
    }, 1, YAHOO.util.Easing.easeOut);
    detailsTopOpacityAnim.duration = 3;
    detailsTopOpacityAnim.animate ();

    if (detailsBottomOpacityAnim && detailsBottomOpacityAnim.isAnimated ()) {
     detailsBottomOpacityAnim.stop();
    }
    detailsBottomOpacityAnim = new YAHOO.util.Anim (elDetailsBottom, {
     opacity: { to: 0 }
    }, 1, YAHOO.util.Easing.easeOut);
    detailsBottomOpacityAnim.duration = 3;
    detailsBottomOpacityAnim.animate ();
   }
   detailsOpacityState = 0;
  }
 }
}

function hideDay (origin) {
 var detailID = "detail" + origin.id.substr (5);
 var opacityAnim = new YAHOO.util.Anim (detailID, {
  opacity: { to: 0 }
 }, 1, YAHOO.util.Easing.easeOut);
 opacityAnim.duration = 0.25;
 opacityAnim.animate ();
 var colorAnim = new YAHOO.util.ColorAnim (origin, {
  backgroundColor: { to: '#ccd8e4' }
 }, 1, YAHOO.util.Easing.easeOut);
 colorAnim.duration = 0.25;
 colorAnim.animate ();
 if (displayedDayID == detailID) {
  displayedDayID = "";
 }
}

function doInitializeCalendar (rows) {
 for (var i = 0; i < rows.length; i++) {
  if (rows[i].tagName == "TR") {
   var columns = rows[i].childNodes;
   for (var j = 0; j < columns.length; j++) {
    var detailID = columns[j].id;
    if ((detailID) && (detailID.substr (0, 5) == "small")) {
     YAHOO.util.Event.addListener (columns[j], "mouseover", function (evt) {displayDay (this);});
     YAHOO.util.Event.addListener (columns[j], "mouseout", function () {hideDay (this);});
    }
   }
  }
 }
}

function initializeCalendar () {
 doInitializeCalendar (document.getElementById ("calendard").childNodes);
 doInitializeCalendar (document.getElementById ("calendars").childNodes);
 calendarAnimationInProgress = false;
 elDetails = document.getElementById ("details");
 elDetailsTop = document.getElementById ("detailsTop");
 elDetailsBottom = document.getElementById ("detailsBottom");
 if (navigator.appName == "Microsoft Internet Explorer") {
  elDetails.style.display = "none";
  elDetailsTop.style.display = "none";
  elDetailsBottom.style.display = "none";
 }
}

function hideBox () {
 elLightBoxBackground.style.display = "none";
 elLightBox.style.display = "none";
}

function disappearBox () {
 var opacityAnim = new YAHOO.util.Anim ("lightBoxBackground", {
  opacity: { to: 0 }
 }, 1, YAHOO.util.Easing.easeOut);
 opacityAnim.onComplete.subscribe (hideBox);
 opacityAnim.duration = 1.7;
 opacityAnim.animate ();

 if (navigator.appName == "Microsoft Internet Explorer") {
  elLightBox.style.display = "none";
 } else {
  var opacityAnim = new YAHOO.util.Anim ("lightBox", {
   opacity: { to: 0 }
  }, 1, YAHOO.util.Easing.easeOut);
  opacityAnim.onComplete.subscribe (hideBox);
  opacityAnim.duration = 0.7;
  opacityAnim.animate ();
 }
}

function dimBox () {
 var opacityAnim = new YAHOO.util.Anim ("lightBoxBackground", {
  opacity: { to: 0.9 }
 }, 1, YAHOO.util.Easing.easeOut);
 opacityAnim.duration = 2.7;
 opacityAnim.animate ();

 if (navigator.appName != "Microsoft Internet Explorer") {
  var lightBoxAnim = new YAHOO.util.Anim ("lightBox", {
   opacity: { to: 1 }
  }, 1, YAHOO.util.Easing.easeOut);
  lightBoxAnim.duration = 1.7;
  lightBoxAnim.animate ();
 }
}

function lightBox () {
 if (elLightBoxBackground.style.display != "block") {
  elLightBoxBackground.style.display = "block";
  elLightBox.style.display = "block";
  var opacityAnim = new YAHOO.util.Anim ("lightBoxBackground", {
   opacity: { to: 1 }
  }, 1, YAHOO.util.Easing.easeOut);
  opacityAnim.onComplete.subscribe (dimBox);
  opacityAnim.duration = 1.7;
  opacityAnim.animate ();
 } else {
  disappearBox ();
 }
}

function fixSpotLightBackground () {
 var colorAnim = new YAHOO.util.ColorAnim ("spotLightContent", {
  backgroundColor: { to: '#ccd8e4' }
 }, 1, YAHOO.util.Easing.easeOut);
 colorAnim.duration = 2.1;
 colorAnim.animate ();
}

function showSpotLightText () {
 var colorAnim = new YAHOO.util.ColorAnim ("spotLightContent", {
  color: { to: '#000090' }
 }, 1, YAHOO.util.Easing.easeBoth);
 colorAnim.duration = 1.7;
 colorAnim.onComplete.subscribe (fixSpotLightBackground);
 colorAnim.animate ();
}

function initializeSpotLight () {
 var colorAnim = new YAHOO.util.ColorAnim ("spotLightContent", {
  backgroundColor: { to: '#ffffff' }
 }, 1, YAHOO.util.Easing.easeIn);
 colorAnim.duration = 2.1;
 colorAnim.onComplete.subscribe (showSpotLightText);
 colorAnim.animate ();
}

function init () {
 elSelectedMainMenuItem = document.getElementById ("mmi_welcome");
 elAnimIFrame = document.getElementById ("animIFrame");
 elLightBoxBackground = document.getElementById ("lightBoxBackground");
 elLightBox = document.getElementById ("lightBox");
 YAHOO.util.Event.addListener ("spotLight", "click", lightBox);
 YAHOO.util.Event.addListener ("lightBoxBackground", "click", disappearBox);
 YAHOO.util.Event.addListener ("lightBox", "click", disappearBox);
 initializeBookmarkManager ();
// initializeCalendar ();
 animationInProgress = false;
}

YAHOO.util.Event.onDOMReady (init);

