// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
function my_toggle(id_closed, id_opened)
{
  $(id_opened).hide();
  $(id_closed).show();
  // $('calendar_name').value = 'Clermont-Ferrand'
  $('calendar_name').activate();
  return false;
}

function close_popup()
{
  $('preview').remove()
}

function open_popup_print(path)
{
  window.open(path, 'New', 'width=700,height=590')
}

function get_calendar_page(element_id)
{
  var element = $(element_id)
  $$('#my-calendars ul').each(function(s) { s.hide(); });
  element.show();
}

function show_login_form()
{
  $('links-disconnected').hide();
  $('quick-connect').show();
  $('connect-btn').show();
}

function close_login_form()
{
  $('quick-connect').hide();
  $('connect-btn').hide();
  $('links-disconnected').show();
}

function show_lost_password_form()
{
  $('links-disconnected').hide();
  $('quick-connect').show();
  $('forgot-btn').show();
}

function close_lost_password_form()
{
  $('quick-connect').hide();
  $('forgot-btn').hide();
  $('links-disconnected').show();
}

function loadAccordions()
{
  var bottomAccordion = new accordion('accordion');
  
  // Now lets open the first slide
  bottomAccordion.activate($$('#accordion .accordion_toggle')[0]);
  // el = $$('#accordion .accordion_content')[0];
  // el.show();
  // el.previous(0).addClassName('accordion_toggle_active');
  // el.setStyle({height : 'auto', display : 'block'});
}

var player = null;
function playerReady(thePlayer) {
	player = window.document[thePlayer.id];
}

function createPlayer() {
	var flashvars = {
		file:"/player/adhan.mp3", 
		autostart:"false"
	}

	var params = {
		allowfullscreen:"true", 
		allowscriptaccess:"always"
	}

	var attributes = {
		id:"player",  
		name:"player"
	}

  if (swfobject.hasFlashPlayerVersion("9")) {
	  swfobject.embedSWF("/player/player.swf", "player_container", "0", "0", "9", false, flashvars, params, attributes);
  } else {
    $('flash-required').show();
  }
}