// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
function doSwf() {
  if ($('flash-banner')) {
	  swfobject.embedSWF('/flash/' + banner, 'flash-banner', 960, 144, '8.0.0')
  }
  
	if ($('player')) {
		swfobject.embedSWF('/flash/player.swf', 'player', '512', '371', '8.0.0', null, {file: 'reel.flv', skinpath: '/flash/fenian_skin.swf'}, {wmode: "transparent"})
	}
}

function doSifr() {
	if(typeof sIFR == "function"){
		// This is the preferred "named argument" syntax
		sIFR.replaceElement(named({sSelector:"p#title", sFlashSrc:"/flash/rwell.swf", sWmode:"transparent", sColor:"#000000", sLinkColor:"#00b3d8", sBgColor:"#deddcd", nPaddingTop:0, nPaddingBottom:0}));
		sIFR.replaceElement(named({sSelector:"p#about-us", sFlashSrc:"/flash/rwell.swf", sWmode:"transparent", sColor:"#000000", sLinkColor:"#00b3d8", sBgColor:"#deddcd", nPaddingTop:0, nPaddingBottom:0}));
	};
}

function showEvent() {
	id = this.rel;
	new Effect.Appear('event_' + id, {duration: 0.3});
}

function hideEvent() {
	id = this.rel
	new Effect.Fade('event_' + id, {duration: 0.3});
}

function loadCalendar() {
	var links = $$('.calendar a');
	for (i = 0; i < links.length; i++) {
		Event.observe(links[i], 'mouseover', showEvent);
		Event.observe(links[i], 'mouseout', hideEvent);
	}
}

function setupMenu() {
	submenus = $$('#left-nav ul li ul');
	for (var i=0; i < submenus.length; i++) {
		Event.observe(Element.childElements(submenus[i].parentNode)[0], 'click', function() { new Effect.toggle(Element.next(this), 'blind', {duration: 0.3}) });
		Element.childElements(submenus[i].parentNode)[0].onclick = function() { return false; }
	};
}

function init() {
	doSwf();
	doSifr();
	loadCalendar();
	setupMenu();
}

Event.observe(window, 'load', init);