function slideShow() {

	//Set the opacity of all images to 0
	$('#portfolio li').css({opacity: 0.0});
	
	//Get the first image and display it (set it to full opacity)
	$('#portfolio li:first').css({opacity: 1.0});
	
	//Set the caption background to semi-transparent
	$('#portfoliobar .caption').css({opacity: 1.0});

	
	//Get the caption of the first image from REL attribute and display it
	$('#portfoliobar .content').html($('#portfolio a:first').find('img').attr('rel'));
	
	$('#portfoliobar .nav-next').click(function(){
		//if no IMGs have the show class, grab the first image
		var current = ($('#portfolio li.show')?  $('#portfolio li.show') : $('#portfolio li:first'));

		//Get next image, if it reached the end of the slideshow, rotate it back to the first image
		var next = ((current.next().length) ? ((current.next().hasClass('caption'))? $('#portfolio li:first') :current.next()) : $('#portfolio li:first'));	
		
		//Get next image caption
		var caption = next.find('img').attr('rel');	
		
		//Set the fade in effect for the next image, show class has higher z-index
		next.css({opacity: 0.0})
		.addClass('show')
		.animate({opacity: 1.0}, 1000);
	
		//Hide the current image
		current.animate({opacity: 0.0}, 1000)
		.removeClass('show');
		
		//Set the opacity to 0 and height to 1px
		$('#portfoliobar .content').html('');
		$('#portfoliobar .caption').animate({opacity: 0.0}, { queue:false, duration:0 }).animate({height: '1px'}, { queue:true, duration:300 });	
		
		//Animate the caption, opacity to 0.7 and heigth to 100px, a slide up effect
		$('#portfoliobar .caption').animate({opacity: 1.0},100 ).animate({height: '100px'},500, function(){
			$('#portfoliobar .content').html(caption);
		} );
		
	
	
	
		return false;
	})
	
	$('#portfoliobar .nav-prev').click(function(){
	
		//if no IMGs have the show class, grab the first image
		var current = ($('#portfolio li.show')?  $('#portfolio li.show') : $('#portfolio li:last'));


		//Get previous image, if it reached the beginning of the slideshow, rotate it to the last image
		var prev = ((current.prev().length) ? ((current.prev().hasClass('caption'))? $('#portfolio li:last') :current.prev()) : $('#portfolio li:last'));	
		

	
		//Get prev image caption
		var caption = prev.find('img').attr('rel');	
		
		//Set the fade in effect for the prev image, show class has higher z-index
		prev.css({opacity: 0.0})
		.addClass('show')
		.animate({opacity: 1.0}, 1000);
	
		//Hide the current image
		current.animate({opacity: 0.0}, 1000)
		.removeClass('show');
		
		//Set the opacity to 0 and height to 1px
		$('#portfoliobar .content').html('');
		$('#portfoliobar .caption').animate({opacity: 0.0}, { queue:false, duration:0 }).animate({height: '1px'}, { queue:true, duration:300 });	
		
		//Animate the caption, opacity to 0.7 and heigth to 100px, a slide up effect
		$('#portfoliobar .caption').animate({opacity: 1.0},100 ).animate({height: '100px'},500, function(){
			$('#portfoliobar .content').html(caption);
		} );
		
	
	
	
		return false;
	})	
	
	//Call the portfolio function to run the slideshow, 6000 = change to next image after 6 seconds
	//setInterval('portfolio()',6000);
	
}

function portfolio() {
	
	//if no IMGs have the show class, grab the first image
	var current = ($('#portfolio a.show')?  $('#portfolio a.show') : $('#portfolio a:first'));

	//Get next image, if it reached the end of the slideshow, rotate it back to the first image
	var next = ((current.next().length) ? ((current.next().hasClass('caption'))? $('#portfolio a:first') :current.next()) : $('#portfolio a:first'));	
	
	//Get next image caption
	var caption = next.find('img').attr('rel');	
	
	//Set the fade in effect for the next image, show class has higher z-index
	next.css({opacity: 0.0})
	.addClass('show')
	.animate({opacity: 1.0}, 1000);

	//Hide the current image
	current.animate({opacity: 0.0}, 1000)
	.removeClass('show');
	
	//Set the opacity to 0 and height to 1px
	$('#portfolio .caption').animate({opacity: 0.0}, { queue:false, duration:0 }).animate({height: '1px'}, { queue:true, duration:300 });	
	
	//Animate the caption, opacity to 0.7 and heigth to 100px, a slide up effect
	$('#portfolio .caption').animate({opacity: 1.0},100 ).animate({height: '100px'},500 );
	
	//Display the content
	$('#portfolio .content').html(caption);
	
	
}
	
jQuery(document).ready(function() {
 	$.reject({  
 		imagePath: '/img/browsers/',
        header: cmnlang['unsupported_browser'], 
        paragraph1: cmnlang['install_browser'],
        paragraph2: cmnlang['download_browser'],
        closeCookie: true,
        closeLink: cmnlang['close'],
        closeMessage: cmnlang['close_warning']
    });
	slideShow();		
		
});