/* 
*******************************************************
*                                                     *    
*      UNITED WAY                                     *
*                                                     *
* --------------------------------------------------- *
*                                                     *
*      REQUIRED LIBRARIES                             *
*                                                     *
*      All are Open Source MIT Licensed               *
*      www.opensource.org/licenses/mit-license.php    *
*                                                     *
*      Prototype JavaScript framework, v1.4.0         *
*      (c)2005 Sam Stephenson -> prototype.conio.net  *
*                                                     *
* --------------------------------------------------- *
*                                                     *
*      squarehead design studio                       *
*      845.331.1953                                   *
*      www.squarehead.com                             *
*      sbliss@squarehead.com                          *
*                                                     *
*                                                     *
*******************************************************
*/


///////////////////////////////////////////////////////
//
// Ajax Load Content
//
///////////////////////////////////////////////////////

// ---------------- keep track of previous nav location

var oldNav = "";

// ---------------- get the page and load into div

function getPage(page,currentNav)
{
    new Ajax.Updater('main-column',page, {asynchronous:true, evalScripts:true});
	selectNav(currentNav);
}


// ---------------- Set class for selected navigation - remove class from previous location

function selectNav(currentNav){
	if (oldNav) {
		Element.removeClassName($(oldNav), 'selected');
	}
	$(currentNav).className = 'selected';
	oldNav = currentNav;
}


///////////////////////////////////////////////////////
//
// initialize site
//
///////////////////////////////////////////////////////


function initPage() {
	getPage('home_page.php','0');
}


///////////////////////////////////////////////////////
//
// window.onload function manager
//
///////////////////////////////////////////////////////

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

///////////////////////////////////////////////////////
//
// Load the functions
//
///////////////////////////////////////////////////////


addLoadEvent(initPage);

