var $j = jQuery.noConflict();
$j(document).ready(function($){			
	$j('#preloadsummary').fadeIn('slow');
	
	/**
	 * All the functions below, are used to update the summary div
	 * That is not the objective of the plugin, the really important part 
	 * is the one right below. The option placeholder, and threshold.
	 */
	$.preload('#slideshow img', {//the first argument is a selector to the images
		onRequest:request,
		onComplete:complete,
		onFinish:finish,
		//placeholder:'../img/placeholder.jpg',//this is the really important option
		//notFound:'../img/notfound.jpg',//optional image if an image wasn't found
		threshold: 1 //'2' is the default, how many at a time, to load.
	});
	
	function update( data ){
		$j('#done').html(''+data.done );
		$j('#total').html(''+data.total );
		$j('#loaded').html(''+data.loaded );
		$j('#failed').html(''+data.failed );
	};
	function complete( data ){
		update( data );
		$j('#image-next').html( 'none' );//reset the "loading: xxxx"
		$j('#image-loaded').html( data.image );
	};
	function request( data ){
		update( data );
		$j('#image-next').html( data.image );//set the "loading: xxxx"
	};
	function finish(){//hide the summary
	if ($j('#slideshowNav') != null){
		$j('#preloadsummary').fadeOut('slow');
		if ($j('#slideshow') != null){
		$j(function() {
		$j('#slideshow').cycle({
		fx: 'fade',
		speed: 2500,
		timeout: 10000,
		pause: 1,
		random: false,
		pager: '#slideshowNav',
		delay: -4000,
		pauseOnPagerHover: true 
		});
		});
}
}
	};
});
if ($j('#imageHolder') != null){
$j(document).ready(function(){
  $j('#imageHolder').flash({
  swf: 'catFlash09.swf',
  width: 806,
  height: 382
  });
});
}

if ($j('#soundHolder') != null){
$j(document).ready(function(){
  $j('#soundHolder').flash({
  swf: 'catAudio2.swf',
  width: 45,
  height: 45
  });
});
}
/*
$j(document).ready(function() {
if ($j('#slideshow') != null){
$j(function() {
$j('#slideshow').cycle({
 fx: 'fade',
 speed: 2500,
 timeout: 10000,
 pause: 1,
 random: 0,
 pager: '#slideshowNav',
 delay: -4000,
 pauseOnPagerHover: true 
 });
});
}
});*/

if ($j('#gallery') != null){
$j(function() {
	$j('#gallery a').lightBox({fixedNavigation:true});
});
}

