$(document).ready(function(){ 
	$('body').append('<div id="ajax-holder" style="display:none"></div>');
	$('.thumbs-holder').jScrollPane({topCapHeight: 26, bottomCapHeight: 32, scrollbarWidth: 32, dragMaxHeight: 31, dragMinHeight: 32});
	
	if ( $.browser.msie ) {
		$(document).pngFix(); 
	}
	
	

	
	
	$('.apps a').click(function(){
		var url = $(this).attr('href');
		
		$('#ajax-holder').load(url, function(){
			var summary = $('#info-summary').html();
			var description = $('#info-description').html();
			var notes = $('#info-notes').html();
			var screenshots = $('#info-screenshots').html();
			
			$('.summary').hide().html( summary ).fadeIn();
			$('.info-description').hide().html( description ).fadeIn();
			$('.info-notes').hide().html( notes ).fadeIn();
			$('.screenshots').html( screenshots );
			
			$('#ajax-holder').html('');
			
			_slide();
		});
		return false;
	});
	
	_slide();
	
}); 
var interval;
function _slide(){
	window.clearInterval(interval);
	
	var count = 0;
	$(".screenshots img").eq(0).show();
	var num_images = $(".screenshots img").length;
	
	interval = window.setInterval(function(){
		count++;
				
		if( count == num_images )
			count = 0;
			
		var last_count = count-1 != -1 ? count-1 : num_images- 1;
		
		$(".screenshots img").eq(last_count).fadeOut(1000, function(){
			$(".screenshots img").eq(count).fadeIn();
		});
		
	}, 4000);
}
