var current_photo = 0;
	function slideshow() {
		if (jQuery('div.asset-image-multiple').length !== 0) {
			if (window.location.href.indexOf('.html')|| window.location.href.indexOf('/preview/')!== -1) {
				var i=0;
	
				jQuery('div.asset-image-large').find('img').attr('id', 'big_photo');
				var big_photo = document.getElementById('big_photo');
	
				var photos = [];
				jQuery('ul.asset-thumbnails li').each(function(){
					var photo = [];
					photo["thumb"] = jQuery(this).attr('tp:largeuri');
					photo["caption"] = jQuery(this).find('img').attr('alt') || '';
					photo["index"] = i + 1;
					photos.push(photo);
					jQuery(this).attr('id', i);
					i++;
				});
	
				var array_length = photos.length - 1;
				var photo_index = 1
				
				jQuery('ul.asset-thumbnails').before('<div class="caption"><p id="caption">' + photos[0]['caption'] + '</p></div>')
					.after('<div class="photo-count"><p><span id="current">' + photos[0]['index'] + '</span> / <span id="total">' + photos.length + '</span><img class="prev-button" src="http://www.latimes.com/includes/blogs_images/photo_gallery_prev_button.png" /><img class="next-button" src="http://www.latimes.com/includes/blogs_images/photo_gallery_next_button.png" /><span class="show-captions">Captions On</span><span class="show-captions" style="display:none;">Captions Off</span></p></div>');
				jQuery('div.asset-image-large').insertBefore(jQuery('ul.asset-thumbnails'));
				var caption = document.getElementById('caption');
				var current = document.getElementById('current');
				jQuery('ul.asset-thumbnails').css('display','block');	
				jQuery('div.asset-image-multiple').prepend('<div class="prevButton photoNav"><img src="http://www.latimes.com/includes/blogs_images/photo_gallery_prev_button.png" /><div class="button" style="display:none;"><div class="prev-button-text">PREV</div></div></div><div class="nextButton photoNav"><img src="http://www.latimes.com/includes/blogs_images/photo_gallery_next_button.png" /><div class="button" style="display:none;"><div class="next-button-text">NEXT</div></div></div>');
				jQuery('#big_photo').unwrap('a');
	
				function reloadOmniture(){
					if (omniture_blog_entrytitle) {
						s.prop31 = omniture_blog_entrytitle + ' - gal' + current_photo;
					}
					void(s.t());
				}
				
			
				function updateHash(){
					window.location.hash = '/' + current_photo;
				}
				
				function nextPhoto(){
					if (current_photo !== array_length) {
						current_photo = current_photo + 1;
						big_photo.src = photos[current_photo]['thumb'];
						caption.innerHTML = photos[current_photo]['caption'];
						current.innerHTML = photos[current_photo]['index'];
						ad_swapper.swap();
						updateHash();
						reloadOmniture();
					} else {
						current_photo = current_photo - array_length;
						big_photo.src = photos[current_photo]['thumb'];
						caption.innerHTML = photos[current_photo]['caption'];
						current.innerHTML = photos[current_photo]['index'];
						ad_swapper.swap();
						updateHash();
						reloadOmniture();
					}
				}
				
				function prevPhoto(){
						if (current_photo !== 0) {
						current_photo = current_photo - 1;
						big_photo.src = photos[current_photo]['thumb'];
						caption.innerHTML = photos[current_photo]['caption'];
						current.innerHTML = photos[current_photo]['index'];
						ad_swapper.swap();
						updateHash();
						reloadOmniture();
					} else {
						current_photo = array_length;
						big_photo.src = photos[current_photo]['thumb'];
						caption.innerHTML = photos[current_photo]['caption'];
						current.innerHTML = photos[current_photo]['index'];
						ad_swapper.swap();
						updateHash();
						reloadOmniture();
					}
				}
				
				jQuery('div.nextButton, img.next-button').click(function(){
					nextPhoto();
				});
				
				jQuery('div.prevButton, img.prev-button').click(function(){
					prevPhoto();
				});
				
				
				jQuery('div.asset-image-multiple').mouseenter(function(){
					jQuery('div.photoNav').fadeTo(250, 0.8);
					jQuery('div.photoNav').children('img').fadeTo(250, 0.8);
				});
				
				jQuery('div.asset-image-multiple').mouseleave(function(){
					jQuery('div.photoNav').fadeTo(250, 0);
					jQuery('div.photoNav').children('img').fadeTo(250, 0);
				});
				
				jQuery('div.photoNav').hover(
					function(){
						jQuery(this).children('.button').fadeTo(250, 0.8);
					},
					function(){
						jQuery(this).children('.button').fadeTo(250, 0);
					}
				);
				
				jQuery('span.show-captions').click(function(){
					jQuery('div.caption, span.show-captions').toggle();
				});
				
				
				if (window.location.hash.indexOf('#/') !== -1){
					var loadPhoto = window.location.hash.replace('#/', '');
					current_photo = parseInt(loadPhoto, 10);
					big_photo.src = photos[current_photo]['thumb'];
					caption.innerHTML = photos[current_photo]['caption'];
					current.innerHTML = photos[current_photo]['index'];
					//highlightThumb();
				}
			} else {
				jQuery('div.asset-image-large').each(function(){
					var parentURL = jQuery(this).parents('div.entry').find('h1.entry-header > a').attr('href') || '';
					jQuery(this).find('a').attr('href', parentURL);
				});
			}
		}
	}
	jQuery(document).ready(function(){
		slideshow();
	});
<!-- ph=1 -->

