function updateImageSize() {//serves small pictures to small screens and updates every 10 seconds
	var viewportHeight = window.innerHeight ? window.innerHeight : $(window).height();
	if (viewportHeight < 500) {
			$('.imagecolumn a').each(function(){
				this.href = this.href.replace('_lg', '_md');  
			});
	} else {
			$('.imagecolumn a').each(function(){
				this.href = this.href.replace('_md', '_lg');  
			});
	};  
	setTimeout("updateImageSize()", 10000);
}



$(document).ready(function() { 

	updateImageSize();

	$('.imagecolumn img').mousedown(
		function() { // click on
			$(this).stop().fadeTo(0, 1);
		},
		function() { // click off
			$(this).stop().fadeTo(30, 0);
	});


	$('.imagecolumn a img').hover(
		function() { // Hover on
			$(this).stop().fadeTo(0, 0);
			},
		function() { // Hover off
			$(this).stop().fadeTo(400, 1);
			}
	);


	$('.cboxSlideshow_on #cboxSlideshow').live('click', $.fn.colorbox.next); //advances slideshow to next image on start
	$('a.photo').colorbox({rel:'photo', slideshow:true, slideshowAuto:false});	//rel is needed for the colorbox slideshow to work
	$("a.individualphoto").colorbox({slideshow:false});
	$(".weblink").colorbox({width:"94%", height:"90%", iframe:true});
	$('.hidden_text').colorbox({width:"500", inline:true});

if(navigator.userAgent.match(/Mobile/i) &&
navigator.userAgent.match(/Safari/i)){
        $(document).bind('cbox_open, cbox_complete', function(){
                $('#cboxOverlay').css({width:$(document).width(),
height:$(document).height(), position:'absolute'});
        }); //This makes the overlay cover the entire page on the iPad

// remove colorbox on weblinks for iTem users (until the scrolling issue inside iframes is resolved)
if (navigator.userAgent.match(/(iPod|iPhone|iPad)/)) { 
  $('.weblink').removeClass('cboxElement'); 
//  $('#navcolumn').show(); //attempt to make menu appear reliably on iPad
} 



}


});

