﻿$(document).ready(function(){
  $('.pressInfo').hide();
  $('#pressMedia').show(); // Show media on page load
  $('#mediaLink').addClass('selected');
  $('.expandableDiv').hide();


	$('#pressDescriptionNav ul li a').click(function(){
	  var infoDiv = "press"+$(this).attr('href').substring(1);
	  $('.pressInfo').hide();
	  $('#'+infoDiv).show();
	  $('#pressDescriptionNav ul li a').removeClass('selected');
	  $(this).addClass('selected');
	  $(this).blur();
	  return false;
	});

	$('.pressInfo ul li a').click(function(){
		var strID = $(this).attr('id');
	if(strID !=undefined){
	strID = strID+"Div";
		if ($(this).hasClass('selected')) {
		  $(this).removeClass('selected').blur();
		  $('#'+strID).hide();
		}else{
		  $('.expandableLink').each(function(){    ///  This really doesn't need the 'each' selector yet, but it will once the collapsable divs are added
			if ($(this).hasClass('selected')) {
			  var tmpID = $(this).attr('id')+"Div";
			  $('#'+tmpID).hide();
			  $('#'+strID).show();
			  $(this).removeClass('selected');
			}else{$('#'+strID).show();}
		  });
		  $(this).addClass('selected').blur();
		}
		return false;
	   } 
	  });
	
});
