function click_logo() {
	self.parent.tb_remove();return false
}

current_photo = 1;

function go_left() {
	p = current_photo-1;
	if (p>0) {
		$('#slide'+current_photo).fadeOut('slow');
		current_photo--;
		$('.gallery_pos').removeClass('active');
		$('#gallery'+current_photo).addClass('active');
	}
}

function go_image(p) {
//alert('ping');
		$('.slide').fadeOut('slow');

		$('.gallery_pos').removeClass('active');
		$('#gallery'+current_photo).addClass('active');

		if ($('#slide'+p).get(0)) {
			$('#slide'+p).fadeIn('slow', function() {
				
			});	

			current_photo = p;

			$('.gallery_pos').removeClass('active');
			$('#gallery'+current_photo).addClass('active');
		} else {
			var im = new Image();
						
			$('#loader_right').show();
	
			$('body').append('<div id="slide'+p+'" class="slide" style="z-index: '+(p+10)+'; display: none;"><img src="images/past/'+p+'.jpg" width="800" height="480" alt="" title="" /></div>');

			im.onload = function() {
			// always called

			$('.gallery_pos').removeClass('active');
			$('#gallery'+current_photo).addClass('active');

			$('#loader_right').hide();
			$('#slide'+p).fadeIn('slow');
			};		
	
			im.src = 'images/past/'+p+'.jpg';

			current_photo = p;

			$('.gallery_pos').removeClass('active');
			$('#gallery'+current_photo).addClass('active');
			
		}
		
		for(i=p; i>0; i--) {
			if (!$('#slide'+i).get(0)) {
				//slide not found
				$('body').append('<div id="slide'+i+'" class="slide" style="z-index: '+(i+10)+'; display: none;"><img src="images/past/'+i+'.jpg" width="800" height="480" alt="" title="" /></div>');
			}
		}

	return false;

}
var p;

function go_right() {
	p = current_photo+1;
	if (p<10) {
		if ($('#slide'+p).get(0)) {
			$('#slide'+p).fadeIn('slow', function() {
				
			});	

			current_photo++;
			$('.gallery_pos').removeClass('active');
			$('#gallery'+current_photo).addClass('active');
		} else {
			var im = new Image();
						
			$('#loader_right').show();
	
			$('body').append('<div id="slide'+p+'" class="slide" style="z-index: '+(p+10)+'; display: none;"><img src="images/past/'+p+'.jpg" width="800" height="480" alt="" title="" /></div>');

			im.onload = function() {
			// always called

			$('.gallery_pos').removeClass('active');
			$('#gallery'+current_photo).addClass('active');

			$('#loader_right').hide();
			$('#slide'+p).fadeIn('slow');
			};		
	
			im.src = 'images/past/'+p+'.jpg';

		
			current_photo++;
			$('.gallery_pos').removeClass('active');
			$('#gallery'+current_photo).addClass('active');
		}
	}
}

function startHome() {
	setTimeout('go_home();', 6000);	
}

function go_home() {
	p = current_photo+1;
	if (p<10) {
		if ($('#slide'+p).get(0)) {
			$('#slide'+p).fadeIn('slow', function() {
				
			});	
			current_photo++;
		} else {
			var im = new Image();
						
			$('#loader_right').show();
	
			$('body').append('<div id="slide'+p+'" class="slide" style="z-index: '+(p+10)+'; display: none;"><img src="images/past/'+p+'.jpg" width="800" height="480" alt="" title="" /></div>');

			im.onload = function() {
			// always called

			$('.gallery_pos').removeClass('active');
			$('#gallery'+current_photo).addClass('active');

			$('#loader_right').hide();
			$('#slide'+p).fadeIn('slow');
			};		
	
			im.src = 'images/past/'+p+'.jpg';

		
			current_photo++;
		}
	} else {
	$('.slide').hide();
	$('#slide1').fadeIn('slow');
	current_photo = 1;
	}
	setTimeout('go_home();', 6000);	
}
