function slideShow(){
	var dur = 200; 
	var oldpage = $('.nav_pages').children('.active');
	var newpage = $('.nav_pages').children('.active').next();
	if(newpage.length == 0){
		var newimg_id = '#img_1';
		var newtext_id = '#text_1';
		var newpage = $('.nav_pages').children().first();
	}
	else{
		var newimg_id = '#img_'+newpage.html();
		var newtext_id = '#text_'+newpage.html();
	}
	
		
	if(newpage.parent().prev().children('.slideshow_text:visible').length == 0){
		$(newtext_id).fadeIn(dur);
	}
	else{
		newpage.parent().prev().children('.slideshow_text:visible').fadeOut(dur, function(){
			$(newtext_id).fadeIn(dur);
		});
	}
	
	
	newpage.parent().parent().next().find('.image:visible').fadeOut(dur, function(){
		$(newimg_id).fadeIn(dur);
		oldpage.removeClass('active');
		newpage.addClass('active');
	});
	
	setTimeout("slideShow();", imageSlideshowInterval);
}

$(document).ready(function(){
	var dur = 200;

	setTimeout("slideShow();", imageSlideshowInterval);
	
	var click_p;
	$('.image_slideshow_right').find('img:first').show();
	$('.slideshow_text:first').show();
	$('.nav_pages').children('a:first').addClass('active');
	$('.nav_pages').children('a').click(function(e){
		e.preventDefault();
		if($(this).attr('class')=='active'){
			return false;
		}
		if (click_p != 1) {
			click_p = 1;
			var oldpage = $(this).parent().children('.active');
			var newpage = $(this);
			var newimg_id = '#img_'+$(this).html();
			var newtext_id = '#text_'+$(this).html();
			
			if($(this).parent().prev().children('.slideshow_text:visible').length == 0){
				$(this).parent().prev().children(newtext_id).fadeIn(dur);
			}
			else{
				$(this).parent().prev().children('.slideshow_text:visible').fadeOut(dur, function(){
					$(this).parent().children(newtext_id).fadeIn(dur);
				});
			}
			
			
			$(this).parent().parent().next().find('.image:visible').fadeOut(dur, function(){
				$(newimg_id).fadeIn(dur);
				oldpage.removeClass('active');
				newpage.addClass('active');
			});
			click_p = 0;
		}
	});
	

});
