/*
 * 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
addInit(externalLinks)
addInit(accessibleForms)
addInit(firefoxForms)
addInit(activeXFix)
addInit(pngFix)
addInit('calendarInit()')
addInit(function() {
  if (document.getElementById('countdown-movie')) {
    swfobject.embedSWF('../images/countdown.swf', 'countdown-movie', '210', '150', '9.0.0')
  }
})