/*
 * Copyright 2008 Cormac Kernan
 * License: http://www.opensource.org/licenses/mit-license.php
 * Author:  Cormac Kernan <cormac at kernan dot eu>
 * Version: 0.1 6/3/2008
 * Derived from articles by Dean Edwards & Simon Willison:
 *   http://simonwillison.net/2004/May/26/addLoadEvent/
 *   http://dean.edwards.name/weblog/2005/09/busted
 */
init = function() {}

function addInit(func)
{
  var currentInit = init
  init = function() {
    currentInit()
    if (typeof func == 'function') {
      func()
    } else {
      eval('try { ' + func + ' } catch(e) {}')
    }
  }
}
// start function can only be called once allowing use of methods below to call init() with different browsers
onloads = function() {
  if (arguments.callee.done) return
  // flag this function so we don't do the same thing twice
  arguments.callee.done = true
  init()
}
// call start() on DOM load for Mozilla
if (document.addEventListener) {
  document.addEventListener('DOMContentLoaded', onloads, false)
}
// call start() on DOM load for IE
/* for Internet Explorer */
/*@cc_on @*/
/*@if (@_win32)
   document.write('<script defer src="/javascript/onloads.js"><' + '/script>')
/*@end @*/

// for other browsers call start()
window.onload = onloads

/*
  Events can be added in a number of ways:
  1. addInit(functionName)
  2. addInit('functionName(10, true)') - useful when passing parameters or to only call if function exists
  3. addInit(function() { alert('test') })
*/
// add onload events below

/*
Shadowbox.loadSkin('classic', '/javascript/shadowbox/skin')
Shadowbox.loadLanguage('en', '/javascript/shadowbox/lang')
Shadowbox.loadPlayer(['img', 'swf'], '/javascript/shadowbox/player')
addInit('Shadowbox.init()')
*/

addInit(externalLinks)
addInit(accessibleForms)
addInit(firefoxForms)
addInit(pngFix)
addInit(menuFix)
addInit(populateForm)
//addInit(loadMap)
if (typeof google != 'undefined') {
  google.setOnLoadCallback(loadMap)
}
if (typeof window.onDomReady != 'undefined') {
  window.onDomReady(startSlideshow)
}
if (typeof Shadowbox != 'undefined') {
  Shadowbox.init({ animSequence: 'wh' })
}
if (typeof jQuery != 'undefined') {
  $(function() {
  	$('#accordion').accordion({ header: 'h2', collapsible: true, active: false });
  });
}