function menuOn( elid ) {
  var el = document.getElementById( elid + '_bar' );
  el.className += ' ' + elid + '_bar';
}

function menuOff( elid ) {
  var el = document.getElementById( elid + '_bar' );
  el.className = el.className.replace( ' ' + elid + '_bar', '' );
}

var xhr;

function show_month( month ) {
  // Prepare for AJAX
  xhr = getXmlHttpObject();
  if( xhr == null ) { return; }

  // Prepare parameters
  var url = 'workshopseminars_ajax.php?month=' + month;

  // Execute AJAX
  xhr.open( 'GET', url, true );
  xhr.onreadystatechange = onAjaxComplete;
  xhr.send( null );
}


function onAjaxComplete() {
  if( xhr.readyState == 4 && xhr.status == 200 ) {
    document.getElementById( 'workshop_listing' ).innerHTML = xhr.responseText;
    xhr = null;
  }
}

function getXmlHttpObject() {
  var xmlHttp = null;

  try {
    // Firefox, Opera 8.0+, Safari
    xmlHttp = new XMLHttpRequest();

  } catch (e) {
    // Internet Explorer
    try {
      xmlHttp = new ActiveXObject( 'Msxml2.XMLHTTP' );
    } catch (e) {
      xmlHttp = new ActiveXObject( 'Microsoft.XMLHTTP' );
    }
  }
  return( xmlHttp );
}

function show_content( page, name ) {
  document.getElementById( page + '_content' ).innerHTML = document.getElementById( page + '_' + name ).innerHTML;
}

function activate_link( month ) {
  var mlist = [
    'january',
    'february',
    'march',
    'april',
    'may',
    'june',
    'july',
    'august',
    'september',
    'october',
    'november',
    'december'
  ];
  for( var i = 0; i < mlist.length; i++ ) {
    var el = document.getElementById( 'workshopSeminars_' + mlist[i] );
    // Disable it
    if( el.className.indexOf( ' active' ) >= 0 ) {
      el.className = el.className.replace( ' active', '' );
    }
  }
  var el = document.getElementById( 'workshopSeminars_' + month );
  el.className = el.className + ' active';
}
