/*
  script.js
  
  DOM ready for the main landing page.
*/
$(function() {
	// click event on the main navigation buttons
	$('.mainNavClick').click(function() {
		$(this).parent().parent().find('li.current_page_item').removeClass('current_page_item');
		//$(this).parent().addClass('current_page_item');
		$(this).addClass('current_page_item');
		
		// figure out which element was clicked handle display accordingly
		switch($('.mainNavClick').index(this)) {
			case 0:
				displayItemClicked(this, 0);
				break;
			case 1:
				displayItemClicked(this, 1);
				break;
			case 2:
				displayItemClicked(this, 2);
				break;
			case 3:
				displayItemClicked(this, 3);
				break;
			default:
			  //no-op
		}
	});
});
/*
	@function displayItemClicked
	@param div : this
	@param index : span # that was clicked.
	@return none
	
	This function takes 'this' and the index of 
	the item that was clicked and displays the
	inner content to whichever one it needs. 
	
	It will hide all other elements before displaying
	the element the user has clicked on.
*/
function displayItemClicked(div, indexId) {

	var item = $(div).parent().parent().parent().parent();
	$(item).find('.mainNav-inner-content').css('display','none');

	var displayedItem = $(item).find('.mainNav-inner-content')[indexId];
	$(displayedItem).css('display', 'block');
	
}












