function initAccordion() {
  $('#accordion div').hide();
  $('#accordion h2:first').addClass('selected');
  $('#accordion div:first').show();
  $('#accordion h2').click(
	function() {
	// for the h3 in #accordian that has been clicked do this:
	  var checkElement = $(this).next(); //create a new variable called checkElement which is equal to the element after this h3
	  
	  if((checkElement.is('div')) && (checkElement.is(':visible'))) { // if checkElement is a div AND checkElement is visible then do:
		return false; 
		}
	  if((checkElement.is('div')) && (!checkElement.is(':visible'))) { // if checkElement is a div AND checkElement is not visible then do:
		$('#accordion h2').removeClass('selected'); //find all h2s in #accordian and remove the class 'selected'
		$('#accordion div:visible').slideUp('normal'); //find all visible divs in accordian and slide up
		$(this).addClass('selected'); //add the class 'selected' to this h2
		checkElement.slideDown('normal'); // slidedown checkElement
		return false;
		}
	  }
	);
  }
  
function initMenu() {
  $('#accordionWide div').hide();
  $('#accordionWide h2:first').addClass('selected');
  $('#accordionWide div:first').show();
  $('#accordionWide h2').click(
	function() {
	// for the h3 in #accordian that has been clicked do this:
	  var checkElement = $(this).next(); //create a new variable called checkElement which is equal to the element after this h3
	  
	  if((checkElement.is('div')) && (checkElement.is(':visible'))) { // if checkElement is a div AND checkElement is visible then do:
		return false; 
		}
	  if((checkElement.is('div')) && (!checkElement.is(':visible'))) { // if checkElement is a div AND checkElement is not visible then do:
		$('#accordionWide h2').removeClass('selected'); //find all h2s in #accordian and remove the class 'selected'
		$('#accordionWide div:visible').slideUp('normal'); //find all visible divs in accordian and slide up
		$(this).addClass('selected'); //add the class 'selected' to this h2
		checkElement.slideDown('normal'); // slidedown checkElement
		return false;
		}
	  }
	);
  }


function initMetaDisplay() {
	var title = $("title").text();
	var keywords = $("meta[name=keywords]").attr("content");
	var description = $("meta[name=description]").attr("content");
	$("#header").prepend("<ul id='meta'><li><strong>Title: </strong>"+title+"</li><li><strong>Keywords: </strong>"+keywords+"</li><li><strong>Description: </strong>"+description+"</li></ul>");
}

$(document).ready(function() {
initAccordion();						
initMenu();
//initMetaDisplay();
});



