function popoverLinks(popoverLinks) {
	var allLinks = $(popoverLinks);

	allLinks.each ( function() {
			// Get class of the link
			var thisClass = $(this).attr('class');
				switch (thisClass) {
				
					case "largerImage":
					case "largerImageLink":
	
						var title = $('#bodyText h1').html();
						var smallSource = $('#mainImage').attr('src');
						var largeImagePath = smallSource.replace('/w220/','/w445h600/');
					
						var popover = 	'<div id="largeImagePopOver">' +
							'	<a class="closePopover" href="#"><img src="../site/pages/images/layout/close_popover.gif" alt="close"></a>' +
							'   <p><strong>'+title+'</strong></p>'+
							'	<img id="largeImage" src="'+largeImagePath+'" />'+
							'	<div id="imageData"></div>'+
							'</div>';
						prependPopover(popover, "div#largeImagePopOver");

						$('#imageData').html($('#collectionData').html());

						$(this).click(function() {
							// Hide site and show pop over when clicking on an external link
							$('div#largeImagePopOver').fadeIn('normal');
							//get height of the pop over box and extend the objectContainer height to display it all
							var height = $('#largeImagePopOver').height();
							if(height > $('#objectContainer').height())
								$('#objectContainer').height(height+20);
							return false;
						});
					break;

					case "threeDObject":
						var title = $('#bodyText h1').html();
					
						var popover = 	'<div id="threeDPopOver">' +
							'	<a class="closePopover" href="#"><img src="../site/pages/images/layout/close_popover.gif" alt="close"></a>' +
							'   <p><strong>'+title+'</strong></p>'+
							'	<div id="threeDcontent"></div>'+
							'	<div id="threeDData"></div>'+
							'</div>';

						prependPopover(popover, "div#threeDPopOver");
						
						$('#threeDData').html($('#collectionData').html());
						
						$(this).click(function() {
							// Hide site and show pop over when clicking on an external link
							$('div#threeDPopOver').fadeIn('normal');
							//get height of the pop over box and extend the objectContainer height to display it all
							var height = $('#threeDPopOver').height();
							
							//if(height > $('#objectContainer').height())
								$('#objectContainer').height(750);
							return false;
						});
					break;
							
					case "blogImage":

						prependPopover('',"div#blogPopOver");
					
						$(this).click(function() {
							// Hide site and show pop over when clicking on an external link
							$('div#blogPopOver').fadeIn('normal');
							return false;
						});
					break;
					default:
						
				}
				var thisId = $(this).attr('id');
				
				switch (thisId) {
					case "zoomLink":
					var title = $('#bodyText h1').html();
						var popover = 	'<div id="zoomifyPopOver">' +
										'	<a class="closePopover" href="#"><img src="../site/pages/images/layout/close_popover.gif" alt="close"></a>' +
										'   <p><strong>'+title+'</strong></p>'+
										'	<div id="zoomifyContent"></div>'+
										'	<div id="zoomifyData"></div>'+
										'</div>';
						prependPopover(popover, "div#zoomifyPopOver");
					
						$('#zoomifyData').html($('#collectionData').html());
						$(this).click(function() {
							// Hide site and show pop over when clicking on an external link
							$('div#zoomifyPopOver').fadeIn('normal');
							//get height of the pop over box and extend the objectContainer height to display it all
							var height = $('#zoomifyPopOver').height();
							if($('#objectContainer').height() < 700)
								$('#objectContainer').height(700);
							return false;
						});
					break;

					
					case "audioDescription":
					var popover = 	'<div id="audioPopOver">' +
									'	<a class="closePopover" href="#"><img src="../site/pages/images/layout/close_popover.gif" alt="close"></a>' +
									'   <p><strong>Listen</strong></p>'+
									'	<div id="audioContent"></div>'+
									'	<div id="audioData"></div>'+
									'</div>';
					
					
						prependPopover(popover, "div#audioPopOver");
						$('#audioData').html($('#collectionData').html());
					
						$(this).click(function() {
							// Hide site and show pop over when clicking on an external link
							$('div#audioPopOver').fadeIn('normal');
							return false;
						});
					break;
				
					case "video":
					
						var popover = 	'<div id="videoPopOver">' +
									'	<a class="closePopover" href="#"><img src="../site/pages/images/layout/close_popover.gif" alt="close"></a>' +
									'   <p><strong>Video</strong></p>'+
									'	<div id="videoContent"></div>'+
									'	<div id="videoData"></div>'+
									'</div>';
					
					
						prependPopover(popover, "div#videoPopOver");
						$('#videoData').html($('#collectionData').html());
					
						$(this).click(function() {
							// Hide site and show pop over when clicking on an external link
							$('div#videoPopOver').fadeIn('normal');
							//get height of the pop over box and extend the objectContainer height to display it all
							var height = $('#videoPopOver').height();
							if(height > $('#objectContainer').height())
								$('#objectContainer').height(height+20);
							return false;
						});
					default:
						
				}
		});
}

function popOverContentEducation(popoverLinks) {
	var allLinks = $(popoverLinks);
	allLinks.each ( function() {
			// Get class of the link
			var thisId = $(this).attr('id');
				switch (thisId) {
				case "zoomLink":
					
					$(this).click(function() {
					
						$(this).parent().parent().parent().parent().children('#zoomifyPopOver').children('#zoomifyData').html($(this).parent().parent().parent().parent().children('#collectionData').html());
						// Hide site and show pop over when clicking on an external link
						$(this).parent().parent().parent().parent().children('#zoomifyPopOver').fadeIn('normal');
						//get height of the pop over box and extend the objectContainer height to display it all
					//	var height = $(this).parent().parent().parent().parent().children('#zoomifyPopOver').height();
						if($(this).parent().parent().parent().parent().parent().height() < 750)
							$(this).parent().parent().parent().parent().parent().height(750);
						return false;
					});
					
					$(this).parent().parent().parent().parent().children('#zoomifyPopOver').children('a').click( function() {
						$(this).parent().fadeOut('normal');
						$(this).parent().parent().parent().height('auto');
						return false;
					});
					
				break;
				
				case "threeDObject" :

					$(this).parent().parent().parent().parent().children('#threeDPopOver').children('a').click( function() {
						$(this).parent().fadeOut('normal');
						$(this).parent().parent().parent().height('auto');
						return false;
					});
					
				break;
				
				case "largerImage":
								
					//prependPopover('',"div#largeImagePopOver");

					$(this).click(function() {
						
						$(this).parent().parent().parent().parent().children('#largeImagePopOver').children('#imageData').html($(this).parent().parent().parent().parent().children('#collectionData').html());
						
						// Hide site and show pop over when clicking on an external link
						$(this).parent().parent().parent().parent().children('#largeImagePopOver').fadeIn('normal');
						//get height of the pop over box and extend the objectContainer height to display it all
						var height = $(this).parent().parent().parent().parent().children('#largeImagePopOver').height();
						if(height > $(this).parent().parent().parent().parent().parent().height())
							$(this).parent().parent().parent().parent().parent().height(height+50);
						return false;
					});
					
					$(this).parent().parent().parent().parent().children('#largeImagePopOver').children('a').click( function() {
						$(this).parent().fadeOut('normal');
						$(this).parent().parent().parent().height('auto');
						return false;
					});
					
				break;
				case "audioEducation":

					$(this).parent().parent().parent().parent().children('#audioPopOver').children('#audioData').html($(this).parent().parent().parent().parent().children('#collectionData').html());
				
					$(this).click(function() {
						// Hide site and show pop over when clicking on an external link
						$(this).parent().parent().parent().parent().children('#audioPopOver').fadeIn('normal');
						return false;
					});
					
					$(this).parent().parent().parent().parent().children('#audioPopOver').children('a').click( function() {
						$(this).parent().fadeOut('normal');
						return false;
					});
					
				break;
				case "blogImage":
					prependPopover('',"div#blogPopOver");
				
					$(this).click(function() {
						// Hide site and show pop over when clicking on an external link
						$(this).parent().parent().parent().parent().children('#blogPopOver').fadeIn('normal');
						return false;
					});
					
					$(this).parent().parent().parent().parent().children('#blogPopOver').children('a').click( function() {
						$(this).parent().fadeOut('normal');
						return false;
					});
					
				break;
				case "videoEducation":

					$(this).parent().parent().parent().parent().children('#videoPopOver').children('#videoData').html($(this).parent().parent().parent().parent().children('#collectionData').html());
				
					$(this).click(function() {
						// Hide site and show pop over when clicking on an external link
						$(this).parent().parent().parent().parent().children('#videoPopOver').fadeIn('normal');
						//get height of the pop over box and extend the objectContainer height to display it all
						var height = $(this).parent().parent().parent().parent().children('#videoPopOver').height();
						if(height > $(this).parent().parent().parent().parent().parent().height())
							$(this).parent().parent().parent().parent().parent().height(height+20);
						return false;
					});
					
					$(this).parent().parent().parent().parent().children('#videoPopOver').children('a').click( function() {
						$(this).parent().fadeOut('normal');
						$(this).parent().parent().parent().parent().parent().height('auto');
						return false;
					});
					
				default:
					
			}
	});
}


function prependPopover(popover, popoverType){
		// Write out a pop over and place it at top of page.

		$('#objectContainer').prepend(popover);

		// Hide pop over and show site when clicking on the pop over
		$('a.closePopover').click( function() {
			$(popoverType).fadeOut('normal');
			$('#objectContainer').height('auto');
			return false;
		});
}