var imagePaths = new Array();

$(function() {	
			
	// Image Preloading
	$.preloadImages = function(){
		var img_list = ($.isArray(arguments[0]))?arguments[0]:arguments;
		
		for(var i = 0; i<img_list.length; i++){
			$("<img>").attr("src", img_list[i]);
		}
	}
			
	// set image swap events for all rollovers
	$('.rollover').hover(
		function() {
			this.src = this.src.replace( '-up', '-over' );
		},
		function() {
			this.src = this.src.replace( '-over', '-up' );
		}
	);
	
	
	$('.photo_link').overlay({
		mask: {
			color: '#000',
			loadSpeed: 100,
			opacity: '0.85',
			
		},	
		onBeforeLoad: function(){
			var curOver = this.getOverlay().attr('id');
			$('#'+curOver+' > .scrollable').data("scrollable").seekTo(0,0);		
		},
		fixed: false
	});
	
	if($("div#animate").length>0){
		$('html,body').animate({scrollTop: $("#main").offset().top},'slow');
	}
	
	$("div#nav a, div.subnav a").each(function(){
		//$(this).attr('href', $(this).attr('href')+'?a=1');
	});
});

$(window).load(function(){
	// load all slideshow images now that page has loaded
	$('.scrollable').find('div.photo').each(function(){
		var curP = $(this).find('p');
		
		if(curP.length>0){
			var img = new Image();
			var imgSRC = curP.text();
			curP.replaceWith($(img).attr('src',imgSRC));
		}
	});	

	$("div.simple_overlay .scrollable").scrollable().autoscroll({ interval: 5000 }).navigator();
	
	$("div#gallery .scrollable").scrollable({
		circular: true										
	}).autoscroll({ interval: 5000 }).navigator();

});



